ivprog.bundle.js 2.0 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./grammar/en/ivprog.g4":
  99. /*!******************************!*\
  100. !*** ./grammar/en/ivprog.g4 ***!
  101. \******************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. module.exports =
  105. /******/ (function(modules) { // webpackBootstrap
  106. /******/ // The module cache
  107. /******/ var installedModules = {};
  108. /******/
  109. /******/ // The require function
  110. /******/ function __webpack_require__(moduleId) {
  111. /******/
  112. /******/ // Check if module is in cache
  113. /******/ if(installedModules[moduleId]) {
  114. /******/ return installedModules[moduleId].exports;
  115. /******/ }
  116. /******/ // Create a new module (and put it into the cache)
  117. /******/ var module = installedModules[moduleId] = {
  118. /******/ i: moduleId,
  119. /******/ l: false,
  120. /******/ exports: {}
  121. /******/ };
  122. /******/
  123. /******/ // Execute the module function
  124. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  125. /******/
  126. /******/ // Flag the module as loaded
  127. /******/ module.l = true;
  128. /******/
  129. /******/ // Return the exports of the module
  130. /******/ return module.exports;
  131. /******/ }
  132. /******/
  133. /******/
  134. /******/ // expose the modules object (__webpack_modules__)
  135. /******/ __webpack_require__.m = modules;
  136. /******/
  137. /******/ // expose the module cache
  138. /******/ __webpack_require__.c = installedModules;
  139. /******/
  140. /******/ // identity function for calling harmony imports with the correct context
  141. /******/ __webpack_require__.i = function(value) { return value; };
  142. /******/
  143. /******/ // define getter function for harmony exports
  144. /******/ __webpack_require__.d = function(exports, name, getter) {
  145. /******/ if(!__webpack_require__.o(exports, name)) {
  146. /******/ Object.defineProperty(exports, name, {
  147. /******/ configurable: false,
  148. /******/ enumerable: true,
  149. /******/ get: getter
  150. /******/ });
  151. /******/ }
  152. /******/ };
  153. /******/
  154. /******/ // getDefaultExport function for compatibility with non-harmony modules
  155. /******/ __webpack_require__.n = function(module) {
  156. /******/ var getter = module && module.__esModule ?
  157. /******/ function getDefault() { return module['default']; } :
  158. /******/ function getModuleExports() { return module; };
  159. /******/ __webpack_require__.d(getter, 'a', getter);
  160. /******/ return getter;
  161. /******/ };
  162. /******/
  163. /******/ // Object.prototype.hasOwnProperty.call
  164. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  165. /******/
  166. /******/ // __webpack_public_path__
  167. /******/ __webpack_require__.p = "";
  168. /******/
  169. /******/ // Load entry module and return exports
  170. /******/ return __webpack_require__(__webpack_require__.s = 1);
  171. /******/ })
  172. /************************************************************************/
  173. /******/ ([
  174. /* 0 */
  175. /***/ (function(module, exports, __webpack_require__) {
  176. // Generated from /tmp/tmp-90353dyHOqtX84hE/ivprog.g4 by ANTLR 4.7
  177. // jshint ignore: start
  178. var antlr4 = __webpack_require__(2);
  179. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  180. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  181. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  182. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  183. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  184. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  185. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  186. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  187. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  188. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  189. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  190. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  191. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  192. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  193. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  194. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  195. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  196. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  197. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  198. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  199. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  200. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  201. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  202. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  203. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  204. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  205. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  206. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  207. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  208. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  209. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  210. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  211. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  212. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  213. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  214. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  215. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  216. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  217. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  218. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  219. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  220. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  221. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  222. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  223. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  224. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  225. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  226. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  227. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  228. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  229. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  230. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  231. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  232. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  233. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  234. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  235. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  236. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  237. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  238. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  239. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  240. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  241. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  242. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  243. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  244. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  245. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  246. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  247. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  248. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  249. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  250. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  251. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  252. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  253. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  254. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  255. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  256. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  257. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  258. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  259. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  260. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  261. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  262. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  263. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  264. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  265. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  266. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  267. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  268. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  269. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  270. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  271. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  272. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  273. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  274. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  275. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  276. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  277. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  278. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  279. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  280. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  281. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  282. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  283. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  284. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  285. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  286. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  287. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  288. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  289. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  290. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  291. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  292. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  293. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  294. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  295. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  296. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  297. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  298. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  299. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  300. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  301. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  302. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  303. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  304. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  305. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  306. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  307. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  308. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  309. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  310. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  311. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  312. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  313. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  314. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  315. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  316. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  317. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  318. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  319. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  320. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  321. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  322. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  323. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  324. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  325. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  326. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  327. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  328. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  329. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  330. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  331. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  332. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  333. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  334. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  335. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  336. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  337. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  338. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  339. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  340. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  341. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  342. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  343. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  344. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  345. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  346. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  347. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  348. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  349. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  350. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  351. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  352. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  353. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  354. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  355. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  356. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  357. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  358. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  359. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  360. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  361. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  362. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  363. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  364. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  365. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  366. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  367. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  368. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  369. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  370. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  371. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  372. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  373. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  374. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  375. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  376. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  377. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  378. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  379. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  380. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  381. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  382. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  383. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  384. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  385. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  386. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  387. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  388. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  389. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  390. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  391. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  392. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  393. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  394. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  395. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  396. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  397. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  398. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  399. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  400. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  401. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  402. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  403. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  404. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  405. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  406. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  407. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  408. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  409. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  410. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  411. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  412. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  413. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  414. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  415. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  416. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  417. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  418. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  419. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  420. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  421. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  422. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  423. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  424. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  425. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  426. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  427. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  428. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  429. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  430. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  431. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  432. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  433. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  434. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  435. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  436. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  437. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  438. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  439. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  440. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  441. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  442. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  443. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  444. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  445. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  446. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  447. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  448. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  449. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  450. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  451. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  452. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  453. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  454. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  455. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  456. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  457. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  458. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  459. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  460. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  461. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  462. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  463. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  464. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  465. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  466. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  467. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  468. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  469. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  470. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  471. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  472. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  473. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  474. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  475. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  476. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  477. function ivprog(input) {
  478. antlr4.Lexer.call(this, input);
  479. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  480. return this;
  481. }
  482. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  483. ivprog.prototype.constructor = ivprog;
  484. ivprog.EOF = antlr4.Token.EOF;
  485. ivprog.RK_PROGRAM = 1;
  486. ivprog.RK_REAL = 2;
  487. ivprog.RK_VOID = 3;
  488. ivprog.RK_BOOLEAN = 4;
  489. ivprog.RK_STRING = 5;
  490. ivprog.RK_INTEGER = 6;
  491. ivprog.RK_CHARACTER = 7;
  492. ivprog.RK_SWITCH = 8;
  493. ivprog.RK_CASE = 9;
  494. ivprog.RK_DEFAULT = 10;
  495. ivprog.RK_CONST = 11;
  496. ivprog.RK_FUNCTION = 12;
  497. ivprog.RK_RETURN = 13;
  498. ivprog.RK_FOR = 14;
  499. ivprog.RK_BREAK = 15;
  500. ivprog.RK_DO = 16;
  501. ivprog.RK_WHILE = 17;
  502. ivprog.RK_IF = 18;
  503. ivprog.RK_ELSE = 19;
  504. ivprog.RK_FALSE = 20;
  505. ivprog.RK_TRUE = 21;
  506. ivprog.OPEN_PARENTHESIS = 22;
  507. ivprog.CLOSE_PARENTHESIS = 23;
  508. ivprog.OPEN_BRACE = 24;
  509. ivprog.CLOSE_BRACE = 25;
  510. ivprog.OPEN_CURLY = 26;
  511. ivprog.CLOSE_CURLY = 27;
  512. ivprog.COMMA = 28;
  513. ivprog.EQUAL = 29;
  514. ivprog.SUM_OP = 30;
  515. ivprog.MULTI_OP = 31;
  516. ivprog.AND_OPERATOR = 32;
  517. ivprog.OR_OPERATOR = 33;
  518. ivprog.RELATIONAL_OPERATOR = 34;
  519. ivprog.COLON = 35;
  520. ivprog.NOT_OPERATOR = 36;
  521. ivprog.ID = 37;
  522. ivprog.LIB_ID = 38;
  523. ivprog.INTEGER = 39;
  524. ivprog.REAL = 40;
  525. ivprog.STRING = 41;
  526. ivprog.CHARACTER = 42;
  527. ivprog.WHITESPACE = 43;
  528. ivprog.EOS = 44;
  529. ivprog.COMMENTS = 45;
  530. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  531. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  532. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  533. "'boolean'", "'string'", "'integer'",
  534. "'character'", "'switch'", "'case'", "'otherwise'",
  535. "'const'", "'function'", "'return'", "'for'",
  536. "'break'", "'do'", "'while'", "'if'",
  537. "'else'", "'false'", "'true'", "'('",
  538. "')'", "'['", "']'", "'{'", "'}'", "','",
  539. "'='", null, null, null, null, null, "':'" ];
  540. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  541. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  542. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  543. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  544. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  545. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  546. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  547. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  548. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  549. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  550. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  551. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  552. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  553. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  554. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  555. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  556. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  557. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  558. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  559. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  560. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  561. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  562. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  563. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  564. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  565. "STRING", "STRING_CHARACTER", "CHARACTER",
  566. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  567. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  568. "COMMENTS" ];
  569. ivprog.prototype.grammarFileName = "ivprog.g4";
  570. exports.ivprog = ivprog;
  571. /***/ }),
  572. /* 1 */
  573. /***/ (function(module, exports, __webpack_require__) {
  574. module.exports = {
  575. ivprog: __webpack_require__(0).ivprog
  576. };
  577. /***/ }),
  578. /* 2 */
  579. /***/ (function(module, exports) {
  580. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  581. /***/ })
  582. /******/ ]);
  583. /***/ }),
  584. /***/ "./grammar/en/langFunctions.js":
  585. /*!*************************************!*\
  586. !*** ./grammar/en/langFunctions.js ***!
  587. \*************************************/
  588. /*! no static exports found */
  589. /***/ (function(module, exports, __webpack_require__) {
  590. "use strict";
  591. Object.defineProperty(exports, "__esModule", {
  592. value: true
  593. });
  594. /* This is a dictionary of the language defined functions
  595. **/
  596. exports.default = {
  597. main_function: "start",
  598. $read: "read",
  599. $write: "write",
  600. $numElements: "total_of_elements",
  601. $matrixLines: "total_of_lines",
  602. $matrixColumns: "total_of_columns",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "is_real",
  609. $isInt: "is_integer",
  610. $isBool: "is_logic",
  611. $castReal: "to_real",
  612. $castInt: "to_integer",
  613. $castBool: "to_logic",
  614. $castString: "to_string",
  615. $sin: "sin",
  616. $cos: "cos",
  617. $tan: "tan",
  618. $sqrt: "sqrt",
  619. $pow: "pow",
  620. $log: "log",
  621. $abs: "abs",
  622. $negate: "negate",
  623. $invert: "invert",
  624. $max: "maximum",
  625. $min: "minimum"
  626. };
  627. /***/ }),
  628. /***/ "./grammar/en/langLibs.js":
  629. /*!********************************!*\
  630. !*** ./grammar/en/langLibs.js ***!
  631. \********************************/
  632. /*! no static exports found */
  633. /***/ (function(module, exports, __webpack_require__) {
  634. "use strict";
  635. Object.defineProperty(exports, "__esModule", {
  636. value: true
  637. });
  638. /**
  639. * This is the dictionary of the language defined libraries
  640. */
  641. exports.default = {
  642. $mathLib: "Mathematic",
  643. $ioLib: "ES",
  644. $strLib: "Texto",
  645. $arrayLib: "Arranjo",
  646. $langLib: "Conversion"
  647. };
  648. /***/ }),
  649. /***/ "./grammar/es/ivprog.g4":
  650. /*!******************************!*\
  651. !*** ./grammar/es/ivprog.g4 ***!
  652. \******************************/
  653. /*! no static exports found */
  654. /***/ (function(module, exports, __webpack_require__) {
  655. module.exports =
  656. /******/ (function(modules) { // webpackBootstrap
  657. /******/ // The module cache
  658. /******/ var installedModules = {};
  659. /******/
  660. /******/ // The require function
  661. /******/ function __webpack_require__(moduleId) {
  662. /******/
  663. /******/ // Check if module is in cache
  664. /******/ if(installedModules[moduleId]) {
  665. /******/ return installedModules[moduleId].exports;
  666. /******/ }
  667. /******/ // Create a new module (and put it into the cache)
  668. /******/ var module = installedModules[moduleId] = {
  669. /******/ i: moduleId,
  670. /******/ l: false,
  671. /******/ exports: {}
  672. /******/ };
  673. /******/
  674. /******/ // Execute the module function
  675. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  676. /******/
  677. /******/ // Flag the module as loaded
  678. /******/ module.l = true;
  679. /******/
  680. /******/ // Return the exports of the module
  681. /******/ return module.exports;
  682. /******/ }
  683. /******/
  684. /******/
  685. /******/ // expose the modules object (__webpack_modules__)
  686. /******/ __webpack_require__.m = modules;
  687. /******/
  688. /******/ // expose the module cache
  689. /******/ __webpack_require__.c = installedModules;
  690. /******/
  691. /******/ // identity function for calling harmony imports with the correct context
  692. /******/ __webpack_require__.i = function(value) { return value; };
  693. /******/
  694. /******/ // define getter function for harmony exports
  695. /******/ __webpack_require__.d = function(exports, name, getter) {
  696. /******/ if(!__webpack_require__.o(exports, name)) {
  697. /******/ Object.defineProperty(exports, name, {
  698. /******/ configurable: false,
  699. /******/ enumerable: true,
  700. /******/ get: getter
  701. /******/ });
  702. /******/ }
  703. /******/ };
  704. /******/
  705. /******/ // getDefaultExport function for compatibility with non-harmony modules
  706. /******/ __webpack_require__.n = function(module) {
  707. /******/ var getter = module && module.__esModule ?
  708. /******/ function getDefault() { return module['default']; } :
  709. /******/ function getModuleExports() { return module; };
  710. /******/ __webpack_require__.d(getter, 'a', getter);
  711. /******/ return getter;
  712. /******/ };
  713. /******/
  714. /******/ // Object.prototype.hasOwnProperty.call
  715. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  716. /******/
  717. /******/ // __webpack_public_path__
  718. /******/ __webpack_require__.p = "";
  719. /******/
  720. /******/ // Load entry module and return exports
  721. /******/ return __webpack_require__(__webpack_require__.s = 1);
  722. /******/ })
  723. /************************************************************************/
  724. /******/ ([
  725. /* 0 */
  726. /***/ (function(module, exports, __webpack_require__) {
  727. // Generated from /tmp/tmp-9035d8Lmv08pWHQo/ivprog.g4 by ANTLR 4.7
  728. // jshint ignore: start
  729. var antlr4 = __webpack_require__(2);
  730. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  731. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  732. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  733. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  734. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  735. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  736. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  737. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  738. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  739. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  740. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  741. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  742. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  743. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  744. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  745. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  746. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  747. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  748. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  749. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  750. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  751. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  752. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  753. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  754. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  755. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  756. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  757. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  758. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  759. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  760. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  761. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  762. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  763. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  764. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  765. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  766. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  767. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  768. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  769. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  770. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  771. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  772. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  773. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  774. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  775. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  776. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  777. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  778. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  779. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  780. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  781. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  782. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  783. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  784. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  785. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  786. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  787. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  788. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  789. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  790. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  791. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  792. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  793. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  794. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  795. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  796. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  797. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  798. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  799. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  800. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  801. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  802. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  803. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  804. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  805. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  806. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  807. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  808. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  809. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  810. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  811. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  812. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  813. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  814. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  815. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  816. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  817. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  818. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  819. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  820. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  821. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  822. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  823. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  824. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  825. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  826. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  827. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  828. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  829. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  830. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  831. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  832. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  833. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  834. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  835. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  836. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  837. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  838. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  839. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  840. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  841. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  842. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  843. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  844. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  845. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  846. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  847. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  848. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  849. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  850. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  851. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  852. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  853. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  854. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  855. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  856. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  857. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  858. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  859. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  860. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  861. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  862. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  863. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  864. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  865. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  866. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  867. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  868. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  869. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  870. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  871. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  872. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  873. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  874. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  875. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  876. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  877. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  878. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  879. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  880. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  881. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  882. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  883. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  884. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  885. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  886. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  887. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  888. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  889. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  890. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  891. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  892. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  893. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  894. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  895. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  896. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  897. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  898. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  899. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  900. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  901. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  902. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  903. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  904. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  905. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  906. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  907. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  908. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  909. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  910. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  911. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  912. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  913. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  914. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  915. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  916. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  917. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  918. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  919. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  920. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  921. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  922. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  923. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  924. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  925. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  926. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  927. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  928. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  929. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  930. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  931. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  932. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  933. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  934. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  935. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  936. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  937. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  938. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  939. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  940. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  941. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  942. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  943. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  944. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  945. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  946. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  947. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  948. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  949. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  950. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  951. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  952. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  953. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  954. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  955. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  956. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  957. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  958. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  959. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  960. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  961. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  962. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  963. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  964. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  965. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  966. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  967. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  968. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  969. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  970. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  971. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  972. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  973. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  974. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  975. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  976. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  977. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  978. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  979. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  980. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  981. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  982. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  983. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  984. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  985. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  986. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  987. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  988. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  989. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  990. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  991. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  992. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  993. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  994. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  995. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  996. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  997. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  998. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  999. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1000. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1001. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1002. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1003. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1004. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1005. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1006. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1007. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1008. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1009. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1010. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1011. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1012. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1013. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1014. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1015. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1016. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1017. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1018. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1019. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1020. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1021. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1022. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1023. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1024. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1025. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1026. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1027. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1028. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1029. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1030. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1031. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1032. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1033. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1034. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1035. function ivprog(input) {
  1036. antlr4.Lexer.call(this, input);
  1037. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1038. return this;
  1039. }
  1040. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1041. ivprog.prototype.constructor = ivprog;
  1042. ivprog.EOF = antlr4.Token.EOF;
  1043. ivprog.RK_PROGRAM = 1;
  1044. ivprog.RK_REAL = 2;
  1045. ivprog.RK_VOID = 3;
  1046. ivprog.RK_BOOLEAN = 4;
  1047. ivprog.RK_STRING = 5;
  1048. ivprog.RK_INTEGER = 6;
  1049. ivprog.RK_CHARACTER = 7;
  1050. ivprog.RK_SWITCH = 8;
  1051. ivprog.RK_CASE = 9;
  1052. ivprog.RK_DEFAULT = 10;
  1053. ivprog.RK_CONST = 11;
  1054. ivprog.RK_FUNCTION = 12;
  1055. ivprog.RK_RETURN = 13;
  1056. ivprog.RK_FOR = 14;
  1057. ivprog.RK_BREAK = 15;
  1058. ivprog.RK_DO = 16;
  1059. ivprog.RK_WHILE = 17;
  1060. ivprog.RK_IF = 18;
  1061. ivprog.RK_ELSE = 19;
  1062. ivprog.RK_FALSE = 20;
  1063. ivprog.RK_TRUE = 21;
  1064. ivprog.OPEN_PARENTHESIS = 22;
  1065. ivprog.CLOSE_PARENTHESIS = 23;
  1066. ivprog.OPEN_BRACE = 24;
  1067. ivprog.CLOSE_BRACE = 25;
  1068. ivprog.OPEN_CURLY = 26;
  1069. ivprog.CLOSE_CURLY = 27;
  1070. ivprog.COMMA = 28;
  1071. ivprog.EQUAL = 29;
  1072. ivprog.SUM_OP = 30;
  1073. ivprog.MULTI_OP = 31;
  1074. ivprog.AND_OPERATOR = 32;
  1075. ivprog.OR_OPERATOR = 33;
  1076. ivprog.RELATIONAL_OPERATOR = 34;
  1077. ivprog.COLON = 35;
  1078. ivprog.NOT_OPERATOR = 36;
  1079. ivprog.ID = 37;
  1080. ivprog.LIB_ID = 38;
  1081. ivprog.INTEGER = 39;
  1082. ivprog.REAL = 40;
  1083. ivprog.STRING = 41;
  1084. ivprog.CHARACTER = 42;
  1085. ivprog.WHITESPACE = 43;
  1086. ivprog.EOS = 44;
  1087. ivprog.COMMENTS = 45;
  1088. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1089. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1090. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1091. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1092. "'escolha'", "'caso'", "'contrario'",
  1093. "'const'", "'funcao'", "'retorne'", "'para'",
  1094. "'pare'", "'faca'", "'enquanto'", "'se'",
  1095. "'senao'", "'falso'", "'verdadeiro'",
  1096. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1097. "','", "'='", null, null, null, null,
  1098. null, "':'" ];
  1099. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1100. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1101. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1102. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1103. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1104. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1105. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1106. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1107. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1108. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1109. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1110. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1111. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1112. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1113. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1114. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1115. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1116. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1117. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1118. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1119. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1120. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1121. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1122. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1123. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1124. "STRING", "STRING_CHARACTER", "CHARACTER",
  1125. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1126. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1127. "COMMENTS" ];
  1128. ivprog.prototype.grammarFileName = "ivprog.g4";
  1129. exports.ivprog = ivprog;
  1130. /***/ }),
  1131. /* 1 */
  1132. /***/ (function(module, exports, __webpack_require__) {
  1133. module.exports = {
  1134. ivprog: __webpack_require__(0).ivprog
  1135. };
  1136. /***/ }),
  1137. /* 2 */
  1138. /***/ (function(module, exports) {
  1139. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1140. /***/ })
  1141. /******/ ]);
  1142. /***/ }),
  1143. /***/ "./grammar/es/langFunctions.js":
  1144. /*!*************************************!*\
  1145. !*** ./grammar/es/langFunctions.js ***!
  1146. \*************************************/
  1147. /*! no static exports found */
  1148. /***/ (function(module, exports, __webpack_require__) {
  1149. "use strict";
  1150. Object.defineProperty(exports, "__esModule", {
  1151. value: true
  1152. });
  1153. /* This is a dictionary of the language defined functions
  1154. **/
  1155. exports.default = {
  1156. main_function: "inicio",
  1157. $read: "leia",
  1158. $write: "escreva",
  1159. $numElements: "total_of_elements",
  1160. $matrixLines: "total_of_lines",
  1161. $matrixColumns: "total_of_columns",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "is_real",
  1168. $isInt: "is_integer",
  1169. $isBool: "is_logic",
  1170. $castReal: "to_real",
  1171. $castInt: "to_integer",
  1172. $castBool: "to_logic",
  1173. $castString: "to_string",
  1174. $sin: "sin",
  1175. $cos: "cos",
  1176. $tan: "tan",
  1177. $sqrt: "sqrt",
  1178. $pow: "pow",
  1179. $log: "log",
  1180. $abs: "abs",
  1181. $negate: "negate",
  1182. $invert: "invert",
  1183. $max: "maximum",
  1184. $min: "minimum"
  1185. };
  1186. /***/ }),
  1187. /***/ "./grammar/es/langLibs.js":
  1188. /*!********************************!*\
  1189. !*** ./grammar/es/langLibs.js ***!
  1190. \********************************/
  1191. /*! no static exports found */
  1192. /***/ (function(module, exports, __webpack_require__) {
  1193. "use strict";
  1194. Object.defineProperty(exports, "__esModule", {
  1195. value: true
  1196. });
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. exports.default = {
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. };
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! no static exports found */
  1213. /***/ (function(module, exports, __webpack_require__) {
  1214. "use strict";
  1215. var _ivprog = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1216. var PT = _interopRequireWildcard(_ivprog);
  1217. var _langFunctions = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1218. var _langFunctions2 = _interopRequireDefault(_langFunctions);
  1219. var _langLibs = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. var _langLibs2 = _interopRequireDefault(_langLibs);
  1221. var _ivprog2 = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1222. var EN = _interopRequireWildcard(_ivprog2);
  1223. var _langFunctions3 = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1224. var _langFunctions4 = _interopRequireDefault(_langFunctions3);
  1225. var _langLibs3 = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1226. var _langLibs4 = _interopRequireDefault(_langLibs3);
  1227. var _ivprog3 = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1228. var ES = _interopRequireWildcard(_ivprog3);
  1229. var _langFunctions5 = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1230. var _langFunctions6 = _interopRequireDefault(_langFunctions5);
  1231. var _langLibs5 = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1232. var _langLibs6 = _interopRequireDefault(_langLibs5);
  1233. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1234. 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; } }
  1235. exports.pt = { lexer: PT.ivprog, langFuncs: _langFunctions2.default, langLibs: _langLibs2.default };
  1236. exports.en = { lexer: EN.ivprog, langFuncs: _langFunctions4.default, langLibs: _langLibs4.default };
  1237. exports.es = { lexer: ES.ivprog, langFuncs: _langFunctions6.default, langLibs: _langLibs6.default };
  1238. /***/ }),
  1239. /***/ "./grammar/pt/ivprog.g4":
  1240. /*!******************************!*\
  1241. !*** ./grammar/pt/ivprog.g4 ***!
  1242. \******************************/
  1243. /*! no static exports found */
  1244. /***/ (function(module, exports, __webpack_require__) {
  1245. module.exports =
  1246. /******/ (function(modules) { // webpackBootstrap
  1247. /******/ // The module cache
  1248. /******/ var installedModules = {};
  1249. /******/
  1250. /******/ // The require function
  1251. /******/ function __webpack_require__(moduleId) {
  1252. /******/
  1253. /******/ // Check if module is in cache
  1254. /******/ if(installedModules[moduleId]) {
  1255. /******/ return installedModules[moduleId].exports;
  1256. /******/ }
  1257. /******/ // Create a new module (and put it into the cache)
  1258. /******/ var module = installedModules[moduleId] = {
  1259. /******/ i: moduleId,
  1260. /******/ l: false,
  1261. /******/ exports: {}
  1262. /******/ };
  1263. /******/
  1264. /******/ // Execute the module function
  1265. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1266. /******/
  1267. /******/ // Flag the module as loaded
  1268. /******/ module.l = true;
  1269. /******/
  1270. /******/ // Return the exports of the module
  1271. /******/ return module.exports;
  1272. /******/ }
  1273. /******/
  1274. /******/
  1275. /******/ // expose the modules object (__webpack_modules__)
  1276. /******/ __webpack_require__.m = modules;
  1277. /******/
  1278. /******/ // expose the module cache
  1279. /******/ __webpack_require__.c = installedModules;
  1280. /******/
  1281. /******/ // identity function for calling harmony imports with the correct context
  1282. /******/ __webpack_require__.i = function(value) { return value; };
  1283. /******/
  1284. /******/ // define getter function for harmony exports
  1285. /******/ __webpack_require__.d = function(exports, name, getter) {
  1286. /******/ if(!__webpack_require__.o(exports, name)) {
  1287. /******/ Object.defineProperty(exports, name, {
  1288. /******/ configurable: false,
  1289. /******/ enumerable: true,
  1290. /******/ get: getter
  1291. /******/ });
  1292. /******/ }
  1293. /******/ };
  1294. /******/
  1295. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1296. /******/ __webpack_require__.n = function(module) {
  1297. /******/ var getter = module && module.__esModule ?
  1298. /******/ function getDefault() { return module['default']; } :
  1299. /******/ function getModuleExports() { return module; };
  1300. /******/ __webpack_require__.d(getter, 'a', getter);
  1301. /******/ return getter;
  1302. /******/ };
  1303. /******/
  1304. /******/ // Object.prototype.hasOwnProperty.call
  1305. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1306. /******/
  1307. /******/ // __webpack_public_path__
  1308. /******/ __webpack_require__.p = "";
  1309. /******/
  1310. /******/ // Load entry module and return exports
  1311. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1312. /******/ })
  1313. /************************************************************************/
  1314. /******/ ([
  1315. /* 0 */
  1316. /***/ (function(module, exports, __webpack_require__) {
  1317. // Generated from /tmp/tmp-9035JxTubjaWiG7T/ivprog.g4 by ANTLR 4.7
  1318. // jshint ignore: start
  1319. var antlr4 = __webpack_require__(2);
  1320. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1321. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1322. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1323. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1324. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1325. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1326. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1327. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1328. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1329. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1330. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1331. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1332. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1333. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1334. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1335. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1336. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1337. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1338. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1339. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1340. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1341. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1342. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1343. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1344. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1345. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1346. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1347. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1348. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1349. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1350. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1351. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1352. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1353. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1354. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1355. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1356. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1357. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1358. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1359. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1360. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1361. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1362. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1363. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1364. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1365. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1366. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1367. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1368. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1369. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1370. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1371. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1372. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1373. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1374. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1375. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1376. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1377. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1378. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1379. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1380. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1381. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1382. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1383. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1384. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1385. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1386. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1387. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1388. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1389. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1390. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1391. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1392. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1393. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1394. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1395. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1396. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1397. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1398. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1399. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1400. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1401. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1402. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1403. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1404. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1405. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1406. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1407. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1408. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1409. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1410. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1411. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1412. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1413. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1414. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1415. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1416. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1417. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1418. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1419. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1420. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1421. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1422. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1423. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1424. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1425. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1426. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1427. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1428. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1429. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1430. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1431. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1432. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1433. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1434. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1435. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1436. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1437. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1438. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1439. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1440. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1441. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1442. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1443. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1444. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1445. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1446. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1447. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1448. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1449. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1450. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1451. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1452. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1453. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1454. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1455. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1456. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1457. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1458. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1459. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1460. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1461. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1462. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1463. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1464. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1465. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1466. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1467. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1468. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1469. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1470. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1471. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1472. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1473. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1474. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1475. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1476. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1477. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1478. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1479. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1480. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1481. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1482. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1483. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1484. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1485. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1486. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1487. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1488. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1489. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1490. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1491. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1492. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1493. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1494. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1495. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1496. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1497. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1498. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1499. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1500. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1501. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1502. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1503. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1504. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1505. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1506. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1507. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1508. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1509. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1510. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1511. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1512. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1513. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1514. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1515. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1516. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1517. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1518. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1519. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1520. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1521. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1522. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1523. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1524. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1525. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1526. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1527. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1528. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1529. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1530. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1531. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1532. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1533. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1534. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1535. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1536. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1537. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1538. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1539. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1540. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1541. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1542. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1543. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1544. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1545. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1546. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1547. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1548. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1549. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1550. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1551. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1552. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1553. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1554. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1555. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1556. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1557. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1558. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1559. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1560. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1561. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1562. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1563. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1564. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1565. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1566. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1567. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1568. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1569. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1570. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1571. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1572. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1573. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1574. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1575. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1576. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1577. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1578. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1579. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1580. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1581. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1582. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1583. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1584. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1585. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1586. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1587. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1588. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1589. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1590. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1591. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1592. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1593. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1594. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1595. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1596. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1597. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1598. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1599. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1600. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1601. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1602. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1603. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1604. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1605. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1606. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1607. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1608. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1609. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1610. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1611. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1612. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1613. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1614. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1615. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1616. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1617. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1618. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1619. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1620. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1621. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1622. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1623. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1624. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1625. function ivprog(input) {
  1626. antlr4.Lexer.call(this, input);
  1627. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1628. return this;
  1629. }
  1630. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1631. ivprog.prototype.constructor = ivprog;
  1632. ivprog.EOF = antlr4.Token.EOF;
  1633. ivprog.RK_PROGRAM = 1;
  1634. ivprog.RK_REAL = 2;
  1635. ivprog.RK_VOID = 3;
  1636. ivprog.RK_BOOLEAN = 4;
  1637. ivprog.RK_STRING = 5;
  1638. ivprog.RK_INTEGER = 6;
  1639. ivprog.RK_CHARACTER = 7;
  1640. ivprog.RK_SWITCH = 8;
  1641. ivprog.RK_CASE = 9;
  1642. ivprog.RK_DEFAULT = 10;
  1643. ivprog.RK_CONST = 11;
  1644. ivprog.RK_FUNCTION = 12;
  1645. ivprog.RK_RETURN = 13;
  1646. ivprog.RK_FOR = 14;
  1647. ivprog.RK_BREAK = 15;
  1648. ivprog.RK_DO = 16;
  1649. ivprog.RK_WHILE = 17;
  1650. ivprog.RK_IF = 18;
  1651. ivprog.RK_ELSE = 19;
  1652. ivprog.RK_FALSE = 20;
  1653. ivprog.RK_TRUE = 21;
  1654. ivprog.OPEN_PARENTHESIS = 22;
  1655. ivprog.CLOSE_PARENTHESIS = 23;
  1656. ivprog.OPEN_BRACE = 24;
  1657. ivprog.CLOSE_BRACE = 25;
  1658. ivprog.OPEN_CURLY = 26;
  1659. ivprog.CLOSE_CURLY = 27;
  1660. ivprog.COMMA = 28;
  1661. ivprog.EQUAL = 29;
  1662. ivprog.SUM_OP = 30;
  1663. ivprog.MULTI_OP = 31;
  1664. ivprog.AND_OPERATOR = 32;
  1665. ivprog.OR_OPERATOR = 33;
  1666. ivprog.RELATIONAL_OPERATOR = 34;
  1667. ivprog.COLON = 35;
  1668. ivprog.NOT_OPERATOR = 36;
  1669. ivprog.ID = 37;
  1670. ivprog.LIB_ID = 38;
  1671. ivprog.INTEGER = 39;
  1672. ivprog.REAL = 40;
  1673. ivprog.STRING = 41;
  1674. ivprog.CHARACTER = 42;
  1675. ivprog.WHITESPACE = 43;
  1676. ivprog.EOS = 44;
  1677. ivprog.COMMENTS = 45;
  1678. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1679. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1680. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1681. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1682. "'escolha'", "'caso'", "'contrario'",
  1683. "'const'", "'funcao'", "'retorne'", "'para'",
  1684. "'pare'", "'faca'", "'enquanto'", "'se'",
  1685. "'senao'", "'falso'", "'verdadeiro'",
  1686. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1687. "','", "'='", null, null, null, null,
  1688. null, "':'" ];
  1689. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1690. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1691. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1692. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1693. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1694. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1695. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1696. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1697. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1698. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1699. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1700. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1701. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1702. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1703. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1704. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1705. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1706. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1707. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1708. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1709. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1710. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1711. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1712. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1713. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1714. "STRING", "STRING_CHARACTER", "CHARACTER",
  1715. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1716. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1717. "COMMENTS" ];
  1718. ivprog.prototype.grammarFileName = "ivprog.g4";
  1719. exports.ivprog = ivprog;
  1720. /***/ }),
  1721. /* 1 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. module.exports = {
  1724. ivprog: __webpack_require__(0).ivprog
  1725. };
  1726. /***/ }),
  1727. /* 2 */
  1728. /***/ (function(module, exports) {
  1729. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1730. /***/ })
  1731. /******/ ]);
  1732. /***/ }),
  1733. /***/ "./grammar/pt/langFunctions.js":
  1734. /*!*************************************!*\
  1735. !*** ./grammar/pt/langFunctions.js ***!
  1736. \*************************************/
  1737. /*! no static exports found */
  1738. /***/ (function(module, exports, __webpack_require__) {
  1739. "use strict";
  1740. Object.defineProperty(exports, "__esModule", {
  1741. value: true
  1742. });
  1743. /* This is a dictionary of the language defined functions
  1744. **/
  1745. exports.default = {
  1746. main_function: "inicio",
  1747. $read: "leia",
  1748. $write: "escreva",
  1749. $numElements: "total_de_elementos",
  1750. $matrixLines: "total_de_linhas",
  1751. $matrixColumns: "total_de_colunas",
  1752. $substring: "subcadeia",
  1753. $length: "comprimento",
  1754. $uppercase: "caixa_alta",
  1755. $lowercase: "caixa_baixa",
  1756. $charAt: "char_at",
  1757. $isReal: "e_real",
  1758. $isInt: "e_inteiro",
  1759. $isBool: "e_logico",
  1760. $castReal: "como_real",
  1761. $castInt: "como_inteiro",
  1762. $castBool: "como_logico",
  1763. $castString: "como_cadeia",
  1764. $sin: "seno",
  1765. $cos: "cosseno",
  1766. $tan: "tangente",
  1767. $sqrt: "raiz_quadrada",
  1768. $pow: "potencia",
  1769. $log: "logaritmo",
  1770. $abs: "modulo",
  1771. $negate: "trocar_sinal",
  1772. $invert: "inverter_valor",
  1773. $max: "maximo",
  1774. $min: "minimo"
  1775. };
  1776. /***/ }),
  1777. /***/ "./grammar/pt/langLibs.js":
  1778. /*!********************************!*\
  1779. !*** ./grammar/pt/langLibs.js ***!
  1780. \********************************/
  1781. /*! no static exports found */
  1782. /***/ (function(module, exports, __webpack_require__) {
  1783. "use strict";
  1784. Object.defineProperty(exports, "__esModule", {
  1785. value: true
  1786. });
  1787. /**
  1788. * This is the dictionary of the language defined libraries
  1789. */
  1790. exports.default = {
  1791. $mathLib: "Matematica",
  1792. $ioLib: "ES",
  1793. $strLib: "Texto",
  1794. $arrayLib: "Arranjo",
  1795. $langLib: "Conversao"
  1796. };
  1797. /***/ }),
  1798. /***/ "./i18n/en/error.json":
  1799. /*!****************************!*\
  1800. !*** ./i18n/en/error.json ***!
  1801. \****************************/
  1802. /*! 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 */
  1803. /***/ (function(module) {
  1804. 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"};
  1805. /***/ }),
  1806. /***/ "./i18n/en/index.js":
  1807. /*!**************************!*\
  1808. !*** ./i18n/en/index.js ***!
  1809. \**************************/
  1810. /*! no static exports found */
  1811. /***/ (function(module, exports, __webpack_require__) {
  1812. "use strict";
  1813. Object.defineProperty(exports, "__esModule", {
  1814. value: true
  1815. });
  1816. var _error = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1817. var _error2 = _interopRequireDefault(_error);
  1818. var _message = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1819. var _message2 = _interopRequireDefault(_message);
  1820. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1821. var _ui2 = _interopRequireDefault(_ui);
  1822. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1823. exports.default = {
  1824. 'message': _message2.default,
  1825. 'error': _error2.default,
  1826. 'ui': _ui2.default
  1827. };
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: default */
  1834. /***/ (function(module) {
  1835. module.exports = {};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, 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, 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, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Arithmetic 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","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":"Select an expression","math":"Mathematic","text_t":"Text","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"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: default */
  1850. /***/ (function(module) {
  1851. module.exports = {};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! no static exports found */
  1858. /***/ (function(module, exports, __webpack_require__) {
  1859. "use strict";
  1860. Object.defineProperty(exports, "__esModule", {
  1861. value: true
  1862. });
  1863. var _error = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1864. var _error2 = _interopRequireDefault(_error);
  1865. var _message = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1866. var _message2 = _interopRequireDefault(_message);
  1867. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1868. var _ui2 = _interopRequireDefault(_ui);
  1869. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1870. exports.default = {
  1871. 'message': _message2.default,
  1872. 'error': _error2.default,
  1873. 'ui': _ui2.default
  1874. };
  1875. /***/ }),
  1876. /***/ "./i18n/es/message.json":
  1877. /*!******************************!*\
  1878. !*** ./i18n/es/message.json ***!
  1879. \******************************/
  1880. /*! exports provided: default */
  1881. /***/ (function(module) {
  1882. module.exports = {};
  1883. /***/ }),
  1884. /***/ "./i18n/es/ui.json":
  1885. /*!*************************!*\
  1886. !*** ./i18n/es/ui.json ***!
  1887. \*************************/
  1888. /*! 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, 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, 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, default */
  1889. /***/ (function(module) {
  1890. 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":"Arithmetic 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","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":"Select an expression","$sin":"sin","math":"Mathematic","arrangement":"Arrangement","conversion":"Conversion","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"};
  1891. /***/ }),
  1892. /***/ "./i18n/index.js":
  1893. /*!***********************!*\
  1894. !*** ./i18n/index.js ***!
  1895. \***********************/
  1896. /*! no static exports found */
  1897. /***/ (function(module, exports, __webpack_require__) {
  1898. "use strict";
  1899. Object.defineProperty(exports, "__esModule", {
  1900. value: true
  1901. });
  1902. var _en = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1903. var _en2 = _interopRequireDefault(_en);
  1904. var _pt = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1905. var _pt2 = _interopRequireDefault(_pt);
  1906. var _es = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1907. var _es2 = _interopRequireDefault(_es);
  1908. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1909. exports.default = {
  1910. 'en': _en2.default,
  1911. 'pt': _pt2.default,
  1912. 'es': _es2.default
  1913. };
  1914. /***/ }),
  1915. /***/ "./i18n/pt/error.json":
  1916. /*!****************************!*\
  1917. !*** ./i18n/pt/error.json ***!
  1918. \****************************/
  1919. /*! 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 */
  1920. /***/ (function(module) {
  1921. 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."};
  1922. /***/ }),
  1923. /***/ "./i18n/pt/index.js":
  1924. /*!**************************!*\
  1925. !*** ./i18n/pt/index.js ***!
  1926. \**************************/
  1927. /*! no static exports found */
  1928. /***/ (function(module, exports, __webpack_require__) {
  1929. "use strict";
  1930. Object.defineProperty(exports, "__esModule", {
  1931. value: true
  1932. });
  1933. var _error = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1934. var _error2 = _interopRequireDefault(_error);
  1935. var _message = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1936. var _message2 = _interopRequireDefault(_message);
  1937. var _ui = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1938. var _ui2 = _interopRequireDefault(_ui);
  1939. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1940. exports.default = {
  1941. 'message': _message2.default,
  1942. 'error': _error2.default,
  1943. 'ui': _ui2.default
  1944. };
  1945. /***/ }),
  1946. /***/ "./i18n/pt/message.json":
  1947. /*!******************************!*\
  1948. !*** ./i18n/pt/message.json ***!
  1949. \******************************/
  1950. /*! exports provided: default */
  1951. /***/ (function(module) {
  1952. module.exports = {};
  1953. /***/ }),
  1954. /***/ "./i18n/pt/ui.json":
  1955. /*!*************************!*\
  1956. !*** ./i18n/pt/ui.json ***!
  1957. \*************************/
  1958. /*! 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, 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, 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, default */
  1959. /***/ (function(module) {
  1960. 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 Aritmética","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","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":"Selecione uma expressão","$sin":"seno","math":"Matematica","text_t":"Texto","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"};
  1961. /***/ }),
  1962. /***/ "./js/Sortable.js":
  1963. /*!************************!*\
  1964. !*** ./js/Sortable.js ***!
  1965. \************************/
  1966. /*! no static exports found */
  1967. /***/ (function(module, exports, __webpack_require__) {
  1968. "use strict";
  1969. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;
  1970. 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; };
  1971. /**!
  1972. * Sortable
  1973. * @author RubaXa <trash@rubaxa.org>
  1974. * @license MIT
  1975. */
  1976. (function sortableModule(factory) {
  1977. "use strict";
  1978. if (true) {
  1979. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1980. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1981. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1982. __WEBPACK_AMD_DEFINE_FACTORY__),
  1983. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1984. } else {}
  1985. })(function sortableFactory() {
  1986. "use strict";
  1987. if (typeof window == "undefined" || !window.document) {
  1988. return function sortableError() {
  1989. throw new Error("Sortable.js requires a window with a document");
  1990. };
  1991. }
  1992. var dragEl,
  1993. parentEl,
  1994. ghostEl,
  1995. cloneEl,
  1996. rootEl,
  1997. nextEl,
  1998. lastDownEl,
  1999. scrollEl,
  2000. scrollParentEl,
  2001. scrollCustomFn,
  2002. lastEl,
  2003. lastCSS,
  2004. lastParentCSS,
  2005. oldIndex,
  2006. newIndex,
  2007. activeGroup,
  2008. putSortable,
  2009. autoScroll = {},
  2010. tapEvt,
  2011. touchEvt,
  2012. moved,
  2013. /** @const */
  2014. R_SPACE = /\s+/g,
  2015. R_FLOAT = /left|right|inline/,
  2016. expando = 'Sortable' + new Date().getTime(),
  2017. win = window,
  2018. document = win.document,
  2019. parseInt = win.parseInt,
  2020. $ = win.jQuery || win.Zepto,
  2021. Polymer = win.Polymer,
  2022. captureMode = false,
  2023. supportDraggable = !!('draggable' in document.createElement('div')),
  2024. supportCssPointerEvents = function (el) {
  2025. // false when IE11
  2026. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2027. return false;
  2028. }
  2029. el = document.createElement('x');
  2030. el.style.cssText = 'pointer-events:auto';
  2031. return el.style.pointerEvents === 'auto';
  2032. }(),
  2033. _silent = false,
  2034. abs = Math.abs,
  2035. min = Math.min,
  2036. savedInputChecked = [],
  2037. touchDragOverListeners = [],
  2038. _autoScroll = _throttle(function ( /**Event*/evt, /**Object*/options, /**HTMLElement*/rootEl) {
  2039. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2040. if (rootEl && options.scroll) {
  2041. var _this = rootEl[expando],
  2042. el,
  2043. rect,
  2044. sens = options.scrollSensitivity,
  2045. speed = options.scrollSpeed,
  2046. x = evt.clientX,
  2047. y = evt.clientY,
  2048. winWidth = window.innerWidth,
  2049. winHeight = window.innerHeight,
  2050. vx,
  2051. vy,
  2052. scrollOffsetX,
  2053. scrollOffsetY;
  2054. // Delect scrollEl
  2055. if (scrollParentEl !== rootEl) {
  2056. scrollEl = options.scroll;
  2057. scrollParentEl = rootEl;
  2058. scrollCustomFn = options.scrollFn;
  2059. if (scrollEl === true) {
  2060. scrollEl = rootEl;
  2061. do {
  2062. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2063. break;
  2064. }
  2065. /* jshint boss:true */
  2066. } while (scrollEl = scrollEl.parentNode);
  2067. }
  2068. }
  2069. if (scrollEl) {
  2070. el = scrollEl;
  2071. rect = scrollEl.getBoundingClientRect();
  2072. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2073. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2074. }
  2075. if (!(vx || vy)) {
  2076. vx = (winWidth - x <= sens) - (x <= sens);
  2077. vy = (winHeight - y <= sens) - (y <= sens);
  2078. /* jshint expr:true */
  2079. (vx || vy) && (el = win);
  2080. }
  2081. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2082. autoScroll.el = el;
  2083. autoScroll.vx = vx;
  2084. autoScroll.vy = vy;
  2085. clearInterval(autoScroll.pid);
  2086. if (el) {
  2087. autoScroll.pid = setInterval(function () {
  2088. scrollOffsetY = vy ? vy * speed : 0;
  2089. scrollOffsetX = vx ? vx * speed : 0;
  2090. if ('function' === typeof scrollCustomFn) {
  2091. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2092. }
  2093. if (el === win) {
  2094. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2095. } else {
  2096. el.scrollTop += scrollOffsetY;
  2097. el.scrollLeft += scrollOffsetX;
  2098. }
  2099. }, 24);
  2100. }
  2101. }
  2102. }
  2103. }, 30),
  2104. _prepareGroup = function _prepareGroup(options) {
  2105. function toFn(value, pull) {
  2106. if (value === void 0 || value === true) {
  2107. value = group.name;
  2108. }
  2109. if (typeof value === 'function') {
  2110. return value;
  2111. } else {
  2112. return function (to, from) {
  2113. var fromGroup = from.options.group.name;
  2114. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2115. };
  2116. }
  2117. }
  2118. var group = {};
  2119. var originalGroup = options.group;
  2120. if (!originalGroup || (typeof originalGroup === "undefined" ? "undefined" : _typeof(originalGroup)) != 'object') {
  2121. originalGroup = { name: originalGroup };
  2122. }
  2123. group.name = originalGroup.name;
  2124. group.checkPull = toFn(originalGroup.pull, true);
  2125. group.checkPut = toFn(originalGroup.put);
  2126. group.revertClone = originalGroup.revertClone;
  2127. options.group = group;
  2128. };
  2129. /**
  2130. * @class Sortable
  2131. * @param {HTMLElement} el
  2132. * @param {Object} [options]
  2133. */
  2134. function Sortable(el, options) {
  2135. if (!(el && el.nodeType && el.nodeType === 1)) {
  2136. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2137. }
  2138. this.el = el; // root element
  2139. this.options = options = _extend({}, options);
  2140. // Export instance
  2141. el[expando] = this;
  2142. // Default options
  2143. var defaults = {
  2144. group: Math.random(),
  2145. sort: true,
  2146. disabled: false,
  2147. store: null,
  2148. handle: null,
  2149. scroll: true,
  2150. scrollSensitivity: 30,
  2151. scrollSpeed: 10,
  2152. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2153. ghostClass: 'sortable-ghost',
  2154. chosenClass: 'sortable-chosen',
  2155. dragClass: 'sortable-drag',
  2156. ignore: 'a, img',
  2157. filter: null,
  2158. preventOnFilter: true,
  2159. animation: 0,
  2160. setData: function setData(dataTransfer, dragEl) {
  2161. dataTransfer.setData('Text', dragEl.textContent);
  2162. },
  2163. dropBubble: false,
  2164. dragoverBubble: false,
  2165. dataIdAttr: 'data-id',
  2166. delay: 0,
  2167. forceFallback: false,
  2168. fallbackClass: 'sortable-fallback',
  2169. fallbackOnBody: false,
  2170. fallbackTolerance: 0,
  2171. fallbackOffset: { x: 0, y: 0 }
  2172. };
  2173. // Set default options
  2174. for (var name in defaults) {
  2175. !(name in options) && (options[name] = defaults[name]);
  2176. }
  2177. _prepareGroup(options);
  2178. // Bind all private methods
  2179. for (var fn in this) {
  2180. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2181. this[fn] = this[fn].bind(this);
  2182. }
  2183. }
  2184. // Setup drag mode
  2185. this.nativeDraggable = options.forceFallback ? false : supportDraggable;
  2186. // Bind events
  2187. _on(el, 'mousedown', this._onTapStart);
  2188. _on(el, 'touchstart', this._onTapStart);
  2189. _on(el, 'pointerdown', this._onTapStart);
  2190. if (this.nativeDraggable) {
  2191. _on(el, 'dragover', this);
  2192. _on(el, 'dragenter', this);
  2193. }
  2194. touchDragOverListeners.push(this._onDragOver);
  2195. // Restore sorting
  2196. options.store && this.sort(options.store.get(this));
  2197. }
  2198. Sortable.prototype = /** @lends Sortable.prototype */{
  2199. constructor: Sortable,
  2200. _onTapStart: function _onTapStart( /** Event|TouchEvent */evt) {
  2201. var _this = this,
  2202. el = this.el,
  2203. options = this.options,
  2204. preventOnFilter = options.preventOnFilter,
  2205. type = evt.type,
  2206. touch = evt.touches && evt.touches[0],
  2207. target = (touch || evt).target,
  2208. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2209. filter = options.filter,
  2210. startIndex;
  2211. _saveInputCheckedState(el);
  2212. // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2213. if (dragEl) {
  2214. return;
  2215. }
  2216. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2217. return; // only left button or enabled
  2218. }
  2219. target = _closest(target, options.draggable, el);
  2220. if (!target) {
  2221. return;
  2222. }
  2223. if (lastDownEl === target) {
  2224. // Ignoring duplicate `down`
  2225. return;
  2226. }
  2227. // Get the index of the dragged element within its parent
  2228. startIndex = _index(target, options.draggable);
  2229. // Check filter
  2230. if (typeof filter === 'function') {
  2231. if (filter.call(this, evt, target, this)) {
  2232. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2233. preventOnFilter && evt.preventDefault();
  2234. return; // cancel dnd
  2235. }
  2236. } else if (filter) {
  2237. filter = filter.split(',').some(function (criteria) {
  2238. criteria = _closest(originalTarget, criteria.trim(), el);
  2239. if (criteria) {
  2240. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2241. return true;
  2242. }
  2243. });
  2244. if (filter) {
  2245. preventOnFilter && evt.preventDefault();
  2246. return; // cancel dnd
  2247. }
  2248. }
  2249. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2250. return;
  2251. }
  2252. // Prepare `dragstart`
  2253. this._prepareDragStart(evt, touch, target, startIndex);
  2254. },
  2255. _prepareDragStart: function _prepareDragStart( /** Event */evt, /** Touch */touch, /** HTMLElement */target, /** Number */startIndex) {
  2256. var _this = this,
  2257. el = _this.el,
  2258. options = _this.options,
  2259. ownerDocument = el.ownerDocument,
  2260. dragStartFn;
  2261. if (target && !dragEl && target.parentNode === el) {
  2262. tapEvt = evt;
  2263. rootEl = el;
  2264. dragEl = target;
  2265. parentEl = dragEl.parentNode;
  2266. nextEl = dragEl.nextSibling;
  2267. lastDownEl = target;
  2268. activeGroup = options.group;
  2269. oldIndex = startIndex;
  2270. this._lastX = (touch || evt).clientX;
  2271. this._lastY = (touch || evt).clientY;
  2272. dragEl.style['will-change'] = 'transform';
  2273. dragStartFn = function dragStartFn() {
  2274. // Delayed drag has been triggered
  2275. // we can re-enable the events: touchmove/mousemove
  2276. _this._disableDelayedDrag();
  2277. // Make the element draggable
  2278. dragEl.draggable = _this.nativeDraggable;
  2279. // Chosen item
  2280. _toggleClass(dragEl, options.chosenClass, true);
  2281. // Bind the events: dragstart/dragend
  2282. _this._triggerDragStart(evt, touch);
  2283. // Drag start event
  2284. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2285. };
  2286. // Disable "draggable"
  2287. options.ignore.split(',').forEach(function (criteria) {
  2288. _find(dragEl, criteria.trim(), _disableDraggable);
  2289. });
  2290. _on(ownerDocument, 'mouseup', _this._onDrop);
  2291. _on(ownerDocument, 'touchend', _this._onDrop);
  2292. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2293. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2294. _on(ownerDocument, 'selectstart', _this);
  2295. if (options.delay) {
  2296. // If the user moves the pointer or let go the click or touch
  2297. // before the delay has been reached:
  2298. // disable the delayed drag
  2299. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2300. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2301. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2302. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2303. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2304. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2305. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2306. } else {
  2307. dragStartFn();
  2308. }
  2309. }
  2310. },
  2311. _disableDelayedDrag: function _disableDelayedDrag() {
  2312. var ownerDocument = this.el.ownerDocument;
  2313. clearTimeout(this._dragStartTimer);
  2314. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2315. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2316. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2317. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2318. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2319. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2320. },
  2321. _triggerDragStart: function _triggerDragStart( /** Event */evt, /** Touch */touch) {
  2322. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2323. if (touch) {
  2324. // Touch device support
  2325. tapEvt = {
  2326. target: dragEl,
  2327. clientX: touch.clientX,
  2328. clientY: touch.clientY
  2329. };
  2330. this._onDragStart(tapEvt, 'touch');
  2331. } else if (!this.nativeDraggable) {
  2332. this._onDragStart(tapEvt, true);
  2333. } else {
  2334. _on(dragEl, 'dragend', this);
  2335. _on(rootEl, 'dragstart', this._onDragStart);
  2336. }
  2337. try {
  2338. if (document.selection) {
  2339. // Timeout neccessary for IE9
  2340. setTimeout(function () {
  2341. document.selection.empty();
  2342. });
  2343. } else {
  2344. window.getSelection().removeAllRanges();
  2345. }
  2346. } catch (err) {}
  2347. },
  2348. _dragStarted: function _dragStarted() {
  2349. if (rootEl && dragEl) {
  2350. var options = this.options;
  2351. // Apply effect
  2352. _toggleClass(dragEl, options.ghostClass, true);
  2353. _toggleClass(dragEl, options.dragClass, false);
  2354. Sortable.active = this;
  2355. // Drag start event
  2356. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2357. } else {
  2358. this._nulling();
  2359. }
  2360. },
  2361. _emulateDragOver: function _emulateDragOver() {
  2362. if (touchEvt) {
  2363. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2364. return;
  2365. }
  2366. this._lastX = touchEvt.clientX;
  2367. this._lastY = touchEvt.clientY;
  2368. if (!supportCssPointerEvents) {
  2369. _css(ghostEl, 'display', 'none');
  2370. }
  2371. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2372. parent = target,
  2373. i = touchDragOverListeners.length;
  2374. if (parent) {
  2375. do {
  2376. if (parent[expando]) {
  2377. while (i--) {
  2378. touchDragOverListeners[i]({
  2379. clientX: touchEvt.clientX,
  2380. clientY: touchEvt.clientY,
  2381. target: target,
  2382. rootEl: parent
  2383. });
  2384. }
  2385. break;
  2386. }
  2387. target = parent; // store last element
  2388. }
  2389. /* jshint boss:true */
  2390. while (parent = parent.parentNode);
  2391. }
  2392. if (!supportCssPointerEvents) {
  2393. _css(ghostEl, 'display', '');
  2394. }
  2395. }
  2396. },
  2397. _onTouchMove: function _onTouchMove( /**TouchEvent*/evt) {
  2398. if (tapEvt) {
  2399. var options = this.options,
  2400. fallbackTolerance = options.fallbackTolerance,
  2401. fallbackOffset = options.fallbackOffset,
  2402. touch = evt.touches ? evt.touches[0] : evt,
  2403. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2404. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2405. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)';
  2406. // only set the status to dragging, when we are actually dragging
  2407. if (!Sortable.active) {
  2408. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2409. return;
  2410. }
  2411. this._dragStarted();
  2412. }
  2413. // as well as creating the ghost element on the document body
  2414. this._appendGhost();
  2415. moved = true;
  2416. touchEvt = touch;
  2417. _css(ghostEl, 'webkitTransform', translate3d);
  2418. _css(ghostEl, 'mozTransform', translate3d);
  2419. _css(ghostEl, 'msTransform', translate3d);
  2420. _css(ghostEl, 'transform', translate3d);
  2421. evt.preventDefault();
  2422. }
  2423. },
  2424. _appendGhost: function _appendGhost() {
  2425. if (!ghostEl) {
  2426. var rect = dragEl.getBoundingClientRect(),
  2427. css = _css(dragEl),
  2428. options = this.options,
  2429. ghostRect;
  2430. ghostEl = dragEl.cloneNode(true);
  2431. _toggleClass(ghostEl, options.ghostClass, false);
  2432. _toggleClass(ghostEl, options.fallbackClass, true);
  2433. _toggleClass(ghostEl, options.dragClass, true);
  2434. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2435. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2436. _css(ghostEl, 'width', rect.width);
  2437. _css(ghostEl, 'height', rect.height);
  2438. _css(ghostEl, 'opacity', '0.8');
  2439. _css(ghostEl, 'position', 'fixed');
  2440. _css(ghostEl, 'zIndex', '100000');
  2441. _css(ghostEl, 'pointerEvents', 'none');
  2442. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl);
  2443. // Fixing dimensions.
  2444. ghostRect = ghostEl.getBoundingClientRect();
  2445. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2446. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2447. }
  2448. },
  2449. _onDragStart: function _onDragStart( /**Event*/evt, /**boolean*/useFallback) {
  2450. var dataTransfer = evt.dataTransfer,
  2451. options = this.options;
  2452. this._offUpEvents();
  2453. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2454. cloneEl = _clone(dragEl);
  2455. cloneEl.draggable = false;
  2456. cloneEl.style['will-change'] = '';
  2457. _css(cloneEl, 'display', 'none');
  2458. _toggleClass(cloneEl, this.options.chosenClass, false);
  2459. rootEl.insertBefore(cloneEl, dragEl);
  2460. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2461. }
  2462. _toggleClass(dragEl, options.dragClass, true);
  2463. if (useFallback) {
  2464. if (useFallback === 'touch') {
  2465. // Bind touch events
  2466. _on(document, 'touchmove', this._onTouchMove);
  2467. _on(document, 'touchend', this._onDrop);
  2468. _on(document, 'touchcancel', this._onDrop);
  2469. _on(document, 'pointermove', this._onTouchMove);
  2470. _on(document, 'pointerup', this._onDrop);
  2471. } else {
  2472. // Old brwoser
  2473. _on(document, 'mousemove', this._onTouchMove);
  2474. _on(document, 'mouseup', this._onDrop);
  2475. }
  2476. this._loopId = setInterval(this._emulateDragOver, 50);
  2477. } else {
  2478. if (dataTransfer) {
  2479. dataTransfer.effectAllowed = 'move';
  2480. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2481. }
  2482. _on(document, 'drop', this);
  2483. setTimeout(this._dragStarted, 0);
  2484. }
  2485. },
  2486. _onDragOver: function _onDragOver( /**Event*/evt) {
  2487. var el = this.el,
  2488. target,
  2489. dragRect,
  2490. targetRect,
  2491. revert,
  2492. options = this.options,
  2493. group = options.group,
  2494. activeSortable = Sortable.active,
  2495. isOwner = activeGroup === group,
  2496. isMovingBetweenSortable = false,
  2497. canSort = options.sort;
  2498. if (evt.preventDefault !== void 0) {
  2499. evt.preventDefault();
  2500. !options.dragoverBubble && evt.stopPropagation();
  2501. }
  2502. if (dragEl.animated) {
  2503. return;
  2504. }
  2505. moved = true;
  2506. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2507. : 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
  2508. ) {
  2509. // Smart auto-scrolling
  2510. _autoScroll(evt, options, this.el);
  2511. if (_silent) {
  2512. return;
  2513. }
  2514. target = _closest(evt.target, options.draggable, el);
  2515. dragRect = dragEl.getBoundingClientRect();
  2516. if (putSortable !== this) {
  2517. putSortable = this;
  2518. isMovingBetweenSortable = true;
  2519. }
  2520. if (revert) {
  2521. _cloneHide(activeSortable, true);
  2522. parentEl = rootEl; // actualization
  2523. if (cloneEl || nextEl) {
  2524. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2525. } else if (!canSort) {
  2526. rootEl.appendChild(dragEl);
  2527. }
  2528. return;
  2529. }
  2530. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2531. //assign target only if condition is true
  2532. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2533. target = el.lastElementChild;
  2534. }
  2535. if (target) {
  2536. if (target.animated) {
  2537. return;
  2538. }
  2539. targetRect = target.getBoundingClientRect();
  2540. }
  2541. _cloneHide(activeSortable, isOwner);
  2542. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2543. if (!dragEl.contains(el)) {
  2544. el.appendChild(dragEl);
  2545. parentEl = el; // actualization
  2546. }
  2547. this._animate(dragRect, dragEl);
  2548. target && this._animate(targetRect, target);
  2549. }
  2550. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2551. if (lastEl !== target) {
  2552. lastEl = target;
  2553. lastCSS = _css(target);
  2554. lastParentCSS = _css(target.parentNode);
  2555. }
  2556. targetRect = target.getBoundingClientRect();
  2557. var width = targetRect.right - targetRect.left,
  2558. height = targetRect.bottom - targetRect.top,
  2559. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2560. isWide = target.offsetWidth > dragEl.offsetWidth,
  2561. isLong = target.offsetHeight > dragEl.offsetHeight,
  2562. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2563. nextSibling = target.nextElementSibling,
  2564. after = false;
  2565. if (floating) {
  2566. var elTop = dragEl.offsetTop,
  2567. tgTop = target.offsetTop;
  2568. if (elTop === tgTop) {
  2569. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2570. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2571. after = (evt.clientY - targetRect.top) / height > 0.5;
  2572. } else {
  2573. after = tgTop > elTop;
  2574. }
  2575. } else if (!isMovingBetweenSortable) {
  2576. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2577. }
  2578. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2579. if (moveVector !== false) {
  2580. if (moveVector === 1 || moveVector === -1) {
  2581. after = moveVector === 1;
  2582. }
  2583. _silent = true;
  2584. setTimeout(_unsilent, 30);
  2585. _cloneHide(activeSortable, isOwner);
  2586. if (!dragEl.contains(el)) {
  2587. if (after && !nextSibling) {
  2588. el.appendChild(dragEl);
  2589. } else {
  2590. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2591. }
  2592. }
  2593. parentEl = dragEl.parentNode; // actualization
  2594. this._animate(dragRect, dragEl);
  2595. this._animate(targetRect, target);
  2596. }
  2597. }
  2598. }
  2599. },
  2600. _animate: function _animate(prevRect, target) {
  2601. var ms = this.options.animation;
  2602. if (ms) {
  2603. var currentRect = target.getBoundingClientRect();
  2604. if (prevRect.nodeType === 1) {
  2605. prevRect = prevRect.getBoundingClientRect();
  2606. }
  2607. _css(target, 'transition', 'none');
  2608. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2609. target.offsetWidth; // repaint
  2610. _css(target, 'transition', 'all ' + ms + 'ms');
  2611. _css(target, 'transform', 'translate3d(0,0,0)');
  2612. clearTimeout(target.animated);
  2613. target.animated = setTimeout(function () {
  2614. _css(target, 'transition', '');
  2615. _css(target, 'transform', '');
  2616. target.animated = false;
  2617. }, ms);
  2618. }
  2619. },
  2620. _offUpEvents: function _offUpEvents() {
  2621. var ownerDocument = this.el.ownerDocument;
  2622. _off(document, 'touchmove', this._onTouchMove);
  2623. _off(document, 'pointermove', this._onTouchMove);
  2624. _off(ownerDocument, 'mouseup', this._onDrop);
  2625. _off(ownerDocument, 'touchend', this._onDrop);
  2626. _off(ownerDocument, 'pointerup', this._onDrop);
  2627. _off(ownerDocument, 'touchcancel', this._onDrop);
  2628. _off(ownerDocument, 'pointercancel', this._onDrop);
  2629. _off(ownerDocument, 'selectstart', this);
  2630. },
  2631. _onDrop: function _onDrop( /**Event*/evt) {
  2632. var el = this.el,
  2633. options = this.options;
  2634. clearInterval(this._loopId);
  2635. clearInterval(autoScroll.pid);
  2636. clearTimeout(this._dragStartTimer);
  2637. // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = '';
  2660. // Remove class's
  2661. _toggleClass(dragEl, this.options.ghostClass, false);
  2662. _toggleClass(dragEl, this.options.chosenClass, false);
  2663. // Drag stop event
  2664. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2665. if (rootEl !== parentEl) {
  2666. newIndex = _index(dragEl, options.draggable);
  2667. if (newIndex >= 0) {
  2668. // Add event
  2669. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex);
  2670. // Remove event
  2671. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex);
  2672. // drag from one list and drop into another
  2673. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2674. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2675. }
  2676. } else {
  2677. if (dragEl.nextSibling !== nextEl) {
  2678. // Get the index of the dragged element within its parent
  2679. newIndex = _index(dragEl, options.draggable);
  2680. if (newIndex >= 0) {
  2681. // drag & drop within the same list
  2682. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2683. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2684. }
  2685. }
  2686. }
  2687. if (Sortable.active) {
  2688. /* jshint eqnull:true */
  2689. if (newIndex == null || newIndex === -1) {
  2690. newIndex = oldIndex;
  2691. }
  2692. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex);
  2693. // Save sorting
  2694. this.save();
  2695. }
  2696. }
  2697. }
  2698. this._nulling();
  2699. },
  2700. _nulling: function _nulling() {
  2701. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2702. savedInputChecked.forEach(function (el) {
  2703. el.checked = true;
  2704. });
  2705. savedInputChecked.length = 0;
  2706. },
  2707. handleEvent: function handleEvent( /**Event*/evt) {
  2708. switch (evt.type) {
  2709. case 'drop':
  2710. case 'dragend':
  2711. this._onDrop(evt);
  2712. break;
  2713. case 'dragover':
  2714. case 'dragenter':
  2715. if (dragEl) {
  2716. this._onDragOver(evt);
  2717. _globalDragOver(evt);
  2718. }
  2719. break;
  2720. case 'selectstart':
  2721. evt.preventDefault();
  2722. break;
  2723. }
  2724. },
  2725. /**
  2726. * Serializes the item into an array of string.
  2727. * @returns {String[]}
  2728. */
  2729. toArray: function toArray() {
  2730. var order = [],
  2731. el,
  2732. children = this.el.children,
  2733. i = 0,
  2734. n = children.length,
  2735. options = this.options;
  2736. for (; i < n; i++) {
  2737. el = children[i];
  2738. if (_closest(el, options.draggable, this.el)) {
  2739. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2740. }
  2741. }
  2742. return order;
  2743. },
  2744. /**
  2745. * Sorts the elements according to the array.
  2746. * @param {String[]} order order of the items
  2747. */
  2748. sort: function sort(order) {
  2749. var items = {},
  2750. rootEl = this.el;
  2751. this.toArray().forEach(function (id, i) {
  2752. var el = rootEl.children[i];
  2753. if (_closest(el, this.options.draggable, rootEl)) {
  2754. items[id] = el;
  2755. }
  2756. }, this);
  2757. order.forEach(function (id) {
  2758. if (items[id]) {
  2759. rootEl.removeChild(items[id]);
  2760. rootEl.appendChild(items[id]);
  2761. }
  2762. });
  2763. },
  2764. /**
  2765. * Save the current sorting
  2766. */
  2767. save: function save() {
  2768. var store = this.options.store;
  2769. store && store.set(this);
  2770. },
  2771. /**
  2772. * 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.
  2773. * @param {HTMLElement} el
  2774. * @param {String} [selector] default: `options.draggable`
  2775. * @returns {HTMLElement|null}
  2776. */
  2777. closest: function closest(el, selector) {
  2778. return _closest(el, selector || this.options.draggable, this.el);
  2779. },
  2780. /**
  2781. * Set/get option
  2782. * @param {string} name
  2783. * @param {*} [value]
  2784. * @returns {*}
  2785. */
  2786. option: function option(name, value) {
  2787. var options = this.options;
  2788. if (value === void 0) {
  2789. return options[name];
  2790. } else {
  2791. options[name] = value;
  2792. if (name === 'group') {
  2793. _prepareGroup(options);
  2794. }
  2795. }
  2796. },
  2797. /**
  2798. * Destroy
  2799. */
  2800. destroy: function destroy() {
  2801. var el = this.el;
  2802. el[expando] = null;
  2803. _off(el, 'mousedown', this._onTapStart);
  2804. _off(el, 'touchstart', this._onTapStart);
  2805. _off(el, 'pointerdown', this._onTapStart);
  2806. if (this.nativeDraggable) {
  2807. _off(el, 'dragover', this);
  2808. _off(el, 'dragenter', this);
  2809. }
  2810. // Remove draggable attributes
  2811. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2812. el.removeAttribute('draggable');
  2813. });
  2814. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2815. this._onDrop();
  2816. this.el = el = null;
  2817. }
  2818. };
  2819. function _cloneHide(sortable, state) {
  2820. if (sortable.lastPullMode !== 'clone') {
  2821. state = true;
  2822. }
  2823. if (cloneEl && cloneEl.state !== state) {
  2824. _css(cloneEl, 'display', state ? 'none' : '');
  2825. if (!state) {
  2826. if (cloneEl.state) {
  2827. if (sortable.options.group.revertClone) {
  2828. rootEl.insertBefore(cloneEl, nextEl);
  2829. sortable._animate(dragEl, cloneEl);
  2830. } else {
  2831. rootEl.insertBefore(cloneEl, dragEl);
  2832. }
  2833. }
  2834. }
  2835. cloneEl.state = state;
  2836. }
  2837. }
  2838. function _closest( /**HTMLElement*/el, /**String*/selector, /**HTMLElement*/ctx) {
  2839. if (el) {
  2840. ctx = ctx || document;
  2841. do {
  2842. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2843. return el;
  2844. }
  2845. /* jshint boss:true */
  2846. } while (el = _getParentOrHost(el));
  2847. }
  2848. return null;
  2849. }
  2850. function _getParentOrHost(el) {
  2851. var parent = el.host;
  2852. return parent && parent.nodeType ? parent : el.parentNode;
  2853. }
  2854. function _globalDragOver( /**Event*/evt) {
  2855. if (evt.dataTransfer) {
  2856. evt.dataTransfer.dropEffect = 'move';
  2857. }
  2858. evt.preventDefault();
  2859. }
  2860. function _on(el, event, fn) {
  2861. el.addEventListener(event, fn, captureMode);
  2862. }
  2863. function _off(el, event, fn) {
  2864. el.removeEventListener(event, fn, captureMode);
  2865. }
  2866. function _toggleClass(el, name, state) {
  2867. if (el) {
  2868. if (el.classList) {
  2869. el.classList[state ? 'add' : 'remove'](name);
  2870. } else {
  2871. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2872. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2873. }
  2874. }
  2875. }
  2876. function _css(el, prop, val) {
  2877. var style = el && el.style;
  2878. if (style) {
  2879. if (val === void 0) {
  2880. if (document.defaultView && document.defaultView.getComputedStyle) {
  2881. val = document.defaultView.getComputedStyle(el, '');
  2882. } else if (el.currentStyle) {
  2883. val = el.currentStyle;
  2884. }
  2885. return prop === void 0 ? val : val[prop];
  2886. } else {
  2887. if (!(prop in style)) {
  2888. prop = '-webkit-' + prop;
  2889. }
  2890. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2891. }
  2892. }
  2893. }
  2894. function _find(ctx, tagName, iterator) {
  2895. if (ctx) {
  2896. var list = ctx.getElementsByTagName(tagName),
  2897. i = 0,
  2898. n = list.length;
  2899. if (iterator) {
  2900. for (; i < n; i++) {
  2901. iterator(list[i], i);
  2902. }
  2903. }
  2904. return list;
  2905. }
  2906. return [];
  2907. }
  2908. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2909. sortable = sortable || rootEl[expando];
  2910. var evt = document.createEvent('Event'),
  2911. options = sortable.options,
  2912. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2913. evt.initEvent(name, true, true);
  2914. evt.to = rootEl;
  2915. evt.from = fromEl || rootEl;
  2916. evt.item = targetEl || rootEl;
  2917. evt.clone = cloneEl;
  2918. evt.oldIndex = startIndex;
  2919. evt.newIndex = newIndex;
  2920. rootEl.dispatchEvent(evt);
  2921. if (options[onName]) {
  2922. options[onName].call(sortable, evt);
  2923. }
  2924. }
  2925. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2926. var evt,
  2927. sortable = fromEl[expando],
  2928. onMoveFn = sortable.options.onMove,
  2929. retVal;
  2930. evt = document.createEvent('Event');
  2931. evt.initEvent('move', true, true);
  2932. evt.to = toEl;
  2933. evt.from = fromEl;
  2934. evt.dragged = dragEl;
  2935. evt.draggedRect = dragRect;
  2936. evt.related = targetEl || toEl;
  2937. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2938. evt.willInsertAfter = willInsertAfter;
  2939. fromEl.dispatchEvent(evt);
  2940. if (onMoveFn) {
  2941. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2942. }
  2943. return retVal;
  2944. }
  2945. function _disableDraggable(el) {
  2946. el.draggable = false;
  2947. }
  2948. function _unsilent() {
  2949. _silent = false;
  2950. }
  2951. /** @returns {HTMLElement|false} */
  2952. function _ghostIsLast(el, evt) {
  2953. var lastEl = el.lastElementChild,
  2954. rect = lastEl.getBoundingClientRect();
  2955. // 5 — min delta
  2956. // abs — нельзя добавлять, а то глюки при наведении сверху
  2957. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2958. }
  2959. /**
  2960. * Generate id
  2961. * @param {HTMLElement} el
  2962. * @returns {String}
  2963. * @private
  2964. */
  2965. function _generateId(el) {
  2966. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2967. i = str.length,
  2968. sum = 0;
  2969. while (i--) {
  2970. sum += str.charCodeAt(i);
  2971. }
  2972. return sum.toString(36);
  2973. }
  2974. /**
  2975. * Returns the index of an element within its parent for a selected set of
  2976. * elements
  2977. * @param {HTMLElement} el
  2978. * @param {selector} selector
  2979. * @return {number}
  2980. */
  2981. function _index(el, selector) {
  2982. var index = 0;
  2983. if (!el || !el.parentNode) {
  2984. return -1;
  2985. }
  2986. while (el && (el = el.previousElementSibling)) {
  2987. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2988. index++;
  2989. }
  2990. }
  2991. return index;
  2992. }
  2993. function _matches( /**HTMLElement*/el, /**String*/selector) {
  2994. if (el) {
  2995. selector = selector.split('.');
  2996. var tag = selector.shift().toUpperCase(),
  2997. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  2998. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  2999. }
  3000. return false;
  3001. }
  3002. function _throttle(callback, ms) {
  3003. var args, _this;
  3004. return function () {
  3005. if (args === void 0) {
  3006. args = arguments;
  3007. _this = this;
  3008. setTimeout(function () {
  3009. if (args.length === 1) {
  3010. callback.call(_this, args[0]);
  3011. } else {
  3012. callback.apply(_this, args);
  3013. }
  3014. args = void 0;
  3015. }, ms);
  3016. }
  3017. };
  3018. }
  3019. function _extend(dst, src) {
  3020. if (dst && src) {
  3021. for (var key in src) {
  3022. if (src.hasOwnProperty(key)) {
  3023. dst[key] = src[key];
  3024. }
  3025. }
  3026. }
  3027. return dst;
  3028. }
  3029. function _clone(el) {
  3030. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3031. }
  3032. function _saveInputCheckedState(root) {
  3033. var inputs = root.getElementsByTagName('input');
  3034. var idx = inputs.length;
  3035. while (idx--) {
  3036. var el = inputs[idx];
  3037. el.checked && savedInputChecked.push(el);
  3038. }
  3039. }
  3040. // Fixed #973:
  3041. _on(document, 'touchmove', function (evt) {
  3042. if (Sortable.active) {
  3043. evt.preventDefault();
  3044. }
  3045. });
  3046. try {
  3047. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3048. get: function get() {
  3049. captureMode = {
  3050. capture: false,
  3051. passive: false
  3052. };
  3053. }
  3054. }));
  3055. } catch (err) {}
  3056. // Export utils
  3057. Sortable.utils = {
  3058. on: _on,
  3059. off: _off,
  3060. css: _css,
  3061. find: _find,
  3062. is: function is(el, selector) {
  3063. return !!_closest(el, selector, el);
  3064. },
  3065. extend: _extend,
  3066. throttle: _throttle,
  3067. closest: _closest,
  3068. toggleClass: _toggleClass,
  3069. clone: _clone,
  3070. index: _index
  3071. };
  3072. /**
  3073. * Create sortable instance
  3074. * @param {HTMLElement} el
  3075. * @param {Object} [options]
  3076. */
  3077. Sortable.create = function (el, options) {
  3078. return new Sortable(el, options);
  3079. };
  3080. // Export
  3081. Sortable.version = '1.6.1';
  3082. return Sortable;
  3083. });
  3084. /***/ }),
  3085. /***/ "./js/assessment/ivprogAssessment.js":
  3086. /*!*******************************************!*\
  3087. !*** ./js/assessment/ivprogAssessment.js ***!
  3088. \*******************************************/
  3089. /*! no static exports found */
  3090. /***/ (function(module, exports, __webpack_require__) {
  3091. "use strict";
  3092. Object.defineProperty(exports, "__esModule", {
  3093. value: true
  3094. });
  3095. exports.IVProgAssessment = undefined;
  3096. 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; }; }();
  3097. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3098. var _semanticAnalyser = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3099. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3100. var _inputTest = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3101. var _outputTest = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3103. var IVProgAssessment = exports.IVProgAssessment = function () {
  3104. function IVProgAssessment(textCode, testCases, domConsole) {
  3105. _classCallCheck(this, IVProgAssessment);
  3106. this.textCode = textCode;
  3107. this.testCases = testCases;
  3108. this.domConsole = domConsole;
  3109. }
  3110. _createClass(IVProgAssessment, [{
  3111. key: "runTest",
  3112. value: function runTest() {
  3113. var _this = this;
  3114. try {
  3115. // try and show error messages through domconsole
  3116. var parser = _ivprogParser.IVProgParser.createParser(this.textCode);
  3117. var semantic = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  3118. var validTree = semantic.analyseTree();
  3119. // loop test cases and show messages through domconsole
  3120. var partialTests = this.testCases.map(function (t, name) {
  3121. return _this.partialEvaluateTestCase(new _ivprogProcessor.IVProgProcessor(validTree), t.input, t.output, name);
  3122. });
  3123. var testResult = partialTests.reduce(function (acc, curr) {
  3124. return acc.then(function (v) {
  3125. return curr(v);
  3126. });
  3127. }, Promise.resolve(0));
  3128. return testResult.then(function (total) {
  3129. return Promise.resolve(total / _this.testCases.length);
  3130. }).catch(function (err) {
  3131. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3132. _this.domConsole.err(err.message);
  3133. return Promise.resolve(0);
  3134. });
  3135. } catch (error) {
  3136. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3137. this.domConsole.err(error.message);
  3138. return Promise.resolve(0);
  3139. }
  3140. }
  3141. }, {
  3142. key: "evaluateTestCase",
  3143. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3144. var outerThis = this;
  3145. var input = new _inputTest.InputTest(inputList);
  3146. var output = new _outputTest.OutputTest();
  3147. prog.registerInput(input);
  3148. prog.registerOutput(output);
  3149. var startTime = Date.now();
  3150. return prog.interpretAST().then(function (_) {
  3151. var millis = Date.now() - startTime;
  3152. if (input.inputList.length !== input.index) {
  3153. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou, ainda restam entradas!");
  3154. outerThis.domConsole.info("Levou " + millis + "ms");
  3155. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3156. } else if (output.list.length < outputList.length) {
  3157. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3158. outerThis.domConsole.info("Levou " + millis + "ms");
  3159. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3160. } else if (output.list.length > outputList.length) {
  3161. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3162. outerThis.domConsole.info("Levou " + millis + "ms");
  3163. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3164. } else {
  3165. var isOk = outerThis.checkOutput(output.list, outputList);
  3166. if (!isOk) {
  3167. outerThis.domConsole.err("Caso de teste " + (name + 1) + ": Falhou <" + inputList.join(", ") + ";" + outputList.join(", ") + ";" + output.list.join(", ") + ">");
  3168. outerThis.domConsole.info("Levou " + millis + "ms");
  3169. return Promise.resolve(accumulator);
  3170. } else {
  3171. outerThis.domConsole.info("Caso de teste " + (name + 1) + ": OK!");
  3172. outerThis.domConsole.info("Levou " + millis + "ms");
  3173. return Promise.resolve(accumulator + 1);
  3174. }
  3175. }
  3176. }).catch(function (_) {
  3177. return Promise.resolve(accumulator);
  3178. });
  3179. }
  3180. }, {
  3181. key: "partialEvaluateTestCase",
  3182. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3183. var _this2 = this;
  3184. var partial = function partial(accumulator) {
  3185. return _this2.evaluateTestCase(prog, inputList, outputList, name, accumulator);
  3186. };
  3187. partial = partial.bind(this);
  3188. return partial;
  3189. }
  3190. }, {
  3191. key: "checkOutput",
  3192. value: function checkOutput(aList, bList) {
  3193. for (var i = 0; i < aList.length; i++) {
  3194. var outValue = aList[i];
  3195. if (outValue != bList[i]) {
  3196. return false;
  3197. }
  3198. }
  3199. return true;
  3200. }
  3201. }]);
  3202. return IVProgAssessment;
  3203. }();
  3204. /***/ }),
  3205. /***/ "./js/ast/commands/arrayAssign.js":
  3206. /*!****************************************!*\
  3207. !*** ./js/ast/commands/arrayAssign.js ***!
  3208. \****************************************/
  3209. /*! no static exports found */
  3210. /***/ (function(module, exports, __webpack_require__) {
  3211. "use strict";
  3212. Object.defineProperty(exports, "__esModule", {
  3213. value: true
  3214. });
  3215. exports.ArrayIndexAssign = undefined;
  3216. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3218. 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; }
  3219. 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; }
  3220. var ArrayIndexAssign = exports.ArrayIndexAssign = function (_Assign) {
  3221. _inherits(ArrayIndexAssign, _Assign);
  3222. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3223. _classCallCheck(this, ArrayIndexAssign);
  3224. var _this = _possibleConstructorReturn(this, (ArrayIndexAssign.__proto__ || Object.getPrototypeOf(ArrayIndexAssign)).call(this, id, expression));
  3225. _this.line = lineExpression;
  3226. _this.column = columnExpression;
  3227. return _this;
  3228. }
  3229. return ArrayIndexAssign;
  3230. }(_assign.Assign);
  3231. /***/ }),
  3232. /***/ "./js/ast/commands/arrayDeclaration.js":
  3233. /*!*********************************************!*\
  3234. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3235. \*********************************************/
  3236. /*! no static exports found */
  3237. /***/ (function(module, exports, __webpack_require__) {
  3238. "use strict";
  3239. Object.defineProperty(exports, "__esModule", {
  3240. value: true
  3241. });
  3242. exports.ArrayDeclaration = undefined;
  3243. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3244. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3245. 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; }
  3246. 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; }
  3247. var ArrayDeclaration = exports.ArrayDeclaration = function (_Declaration) {
  3248. _inherits(ArrayDeclaration, _Declaration);
  3249. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3250. _classCallCheck(this, ArrayDeclaration);
  3251. var _this = _possibleConstructorReturn(this, (ArrayDeclaration.__proto__ || Object.getPrototypeOf(ArrayDeclaration)).call(this, id, type, initial, isConst));
  3252. _this.lines = lines;
  3253. _this.columns = columns;
  3254. return _this;
  3255. }
  3256. return ArrayDeclaration;
  3257. }(_declaration.Declaration);
  3258. /***/ }),
  3259. /***/ "./js/ast/commands/assign.js":
  3260. /*!***********************************!*\
  3261. !*** ./js/ast/commands/assign.js ***!
  3262. \***********************************/
  3263. /*! no static exports found */
  3264. /***/ (function(module, exports, __webpack_require__) {
  3265. "use strict";
  3266. Object.defineProperty(exports, "__esModule", {
  3267. value: true
  3268. });
  3269. exports.Assign = undefined;
  3270. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3271. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3272. 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; }
  3273. 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; }
  3274. var Assign = exports.Assign = function (_Command) {
  3275. _inherits(Assign, _Command);
  3276. function Assign(id, expression) {
  3277. _classCallCheck(this, Assign);
  3278. var _this = _possibleConstructorReturn(this, (Assign.__proto__ || Object.getPrototypeOf(Assign)).call(this));
  3279. _this.id = id;
  3280. _this.expression = expression;
  3281. return _this;
  3282. }
  3283. return Assign;
  3284. }(_command.Command);
  3285. /***/ }),
  3286. /***/ "./js/ast/commands/break.js":
  3287. /*!**********************************!*\
  3288. !*** ./js/ast/commands/break.js ***!
  3289. \**********************************/
  3290. /*! no static exports found */
  3291. /***/ (function(module, exports, __webpack_require__) {
  3292. "use strict";
  3293. Object.defineProperty(exports, "__esModule", {
  3294. value: true
  3295. });
  3296. exports.Break = undefined;
  3297. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3298. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3299. 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; }
  3300. 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; }
  3301. var Break = exports.Break = function (_Command) {
  3302. _inherits(Break, _Command);
  3303. function Break() {
  3304. _classCallCheck(this, Break);
  3305. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).call(this));
  3306. }
  3307. return Break;
  3308. }(_command.Command);
  3309. /***/ }),
  3310. /***/ "./js/ast/commands/case.js":
  3311. /*!*********************************!*\
  3312. !*** ./js/ast/commands/case.js ***!
  3313. \*********************************/
  3314. /*! no static exports found */
  3315. /***/ (function(module, exports, __webpack_require__) {
  3316. "use strict";
  3317. Object.defineProperty(exports, "__esModule", {
  3318. value: true
  3319. });
  3320. exports.Case = undefined;
  3321. 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; }; }();
  3322. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3323. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3324. 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; }
  3325. 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; }
  3326. var Case = exports.Case = function (_Command) {
  3327. _inherits(Case, _Command);
  3328. function Case(expression) {
  3329. _classCallCheck(this, Case);
  3330. var _this = _possibleConstructorReturn(this, (Case.__proto__ || Object.getPrototypeOf(Case)).call(this));
  3331. _this.expression = expression;
  3332. _this.commands = [];
  3333. return _this;
  3334. }
  3335. _createClass(Case, [{
  3336. key: 'setCommands',
  3337. value: function setCommands(commands) {
  3338. this.commands = commands;
  3339. }
  3340. }, {
  3341. key: 'isDefault',
  3342. get: function get() {
  3343. return this.expression === null;
  3344. }
  3345. }]);
  3346. return Case;
  3347. }(_command.Command);
  3348. /***/ }),
  3349. /***/ "./js/ast/commands/command.js":
  3350. /*!************************************!*\
  3351. !*** ./js/ast/commands/command.js ***!
  3352. \************************************/
  3353. /*! no static exports found */
  3354. /***/ (function(module, exports, __webpack_require__) {
  3355. "use strict";
  3356. Object.defineProperty(exports, "__esModule", {
  3357. value: true
  3358. });
  3359. 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; }; }();
  3360. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3361. var Command = exports.Command = function () {
  3362. function Command() {
  3363. _classCallCheck(this, Command);
  3364. this._sourceInfo = null;
  3365. }
  3366. _createClass(Command, [{
  3367. key: "sourceInfo",
  3368. set: function set(sourceInfo) {
  3369. this._sourceInfo = sourceInfo;
  3370. },
  3371. get: function get() {
  3372. return this._sourceInfo;
  3373. }
  3374. }]);
  3375. return Command;
  3376. }();
  3377. /***/ }),
  3378. /***/ "./js/ast/commands/commandBlock.js":
  3379. /*!*****************************************!*\
  3380. !*** ./js/ast/commands/commandBlock.js ***!
  3381. \*****************************************/
  3382. /*! no static exports found */
  3383. /***/ (function(module, exports, __webpack_require__) {
  3384. "use strict";
  3385. Object.defineProperty(exports, "__esModule", {
  3386. value: true
  3387. });
  3388. 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; }; }();
  3389. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3390. var CommandBlock = exports.CommandBlock = function () {
  3391. function CommandBlock(variables, commands) {
  3392. _classCallCheck(this, CommandBlock);
  3393. this.variables = variables;
  3394. this.commands = commands;
  3395. this._sourceInfo = null;
  3396. }
  3397. _createClass(CommandBlock, [{
  3398. key: "sourceInfo",
  3399. set: function set(sourceInfo) {
  3400. this._sourceInfo = sourceInfo;
  3401. },
  3402. get: function get() {
  3403. return this._sourceInfo;
  3404. }
  3405. }]);
  3406. return CommandBlock;
  3407. }();
  3408. /***/ }),
  3409. /***/ "./js/ast/commands/declaration.js":
  3410. /*!****************************************!*\
  3411. !*** ./js/ast/commands/declaration.js ***!
  3412. \****************************************/
  3413. /*! no static exports found */
  3414. /***/ (function(module, exports, __webpack_require__) {
  3415. "use strict";
  3416. Object.defineProperty(exports, "__esModule", {
  3417. value: true
  3418. });
  3419. exports.Declaration = undefined;
  3420. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3422. 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; }
  3423. 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; }
  3424. var Declaration = exports.Declaration = function (_Command) {
  3425. _inherits(Declaration, _Command);
  3426. function Declaration(id, type, initial, isConst) {
  3427. _classCallCheck(this, Declaration);
  3428. var _this = _possibleConstructorReturn(this, (Declaration.__proto__ || Object.getPrototypeOf(Declaration)).call(this));
  3429. _this.id = id;
  3430. _this.type = type;
  3431. _this.initial = initial;
  3432. _this.isConst = isConst;
  3433. return _this;
  3434. }
  3435. return Declaration;
  3436. }(_command.Command);
  3437. /***/ }),
  3438. /***/ "./js/ast/commands/doWhile.js":
  3439. /*!************************************!*\
  3440. !*** ./js/ast/commands/doWhile.js ***!
  3441. \************************************/
  3442. /*! no static exports found */
  3443. /***/ (function(module, exports, __webpack_require__) {
  3444. "use strict";
  3445. Object.defineProperty(exports, "__esModule", {
  3446. value: true
  3447. });
  3448. exports.DoWhile = undefined;
  3449. 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; }; }();
  3450. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3451. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3452. 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; }
  3453. 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; }
  3454. var DoWhile = exports.DoWhile = function (_While) {
  3455. _inherits(DoWhile, _While);
  3456. function DoWhile(condition, commandBlock) {
  3457. _classCallCheck(this, DoWhile);
  3458. return _possibleConstructorReturn(this, (DoWhile.__proto__ || Object.getPrototypeOf(DoWhile)).call(this, condition, commandBlock));
  3459. }
  3460. _createClass(DoWhile, [{
  3461. key: 'testFirst',
  3462. get: function get() {
  3463. return false;
  3464. }
  3465. }]);
  3466. return DoWhile;
  3467. }(_while.While);
  3468. /***/ }),
  3469. /***/ "./js/ast/commands/for.js":
  3470. /*!********************************!*\
  3471. !*** ./js/ast/commands/for.js ***!
  3472. \********************************/
  3473. /*! no static exports found */
  3474. /***/ (function(module, exports, __webpack_require__) {
  3475. "use strict";
  3476. Object.defineProperty(exports, "__esModule", {
  3477. value: true
  3478. });
  3479. exports.For = undefined;
  3480. 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; }; }();
  3481. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3482. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3483. 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; }
  3484. 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; }
  3485. var For = exports.For = function (_Command) {
  3486. _inherits(For, _Command);
  3487. function For(assignment, condition, increment, commandBlock) {
  3488. _classCallCheck(this, For);
  3489. var _this = _possibleConstructorReturn(this, (For.__proto__ || Object.getPrototypeOf(For)).call(this));
  3490. _this.assignment = assignment;
  3491. _this.condition = condition;
  3492. _this.increment = increment;
  3493. _this.commandBlock = commandBlock;
  3494. return _this;
  3495. }
  3496. _createClass(For, [{
  3497. key: 'commands',
  3498. get: function get() {
  3499. return this.commandBlock.commands;
  3500. }
  3501. }]);
  3502. return For;
  3503. }(_command.Command);
  3504. /***/ }),
  3505. /***/ "./js/ast/commands/formalParameter.js":
  3506. /*!********************************************!*\
  3507. !*** ./js/ast/commands/formalParameter.js ***!
  3508. \********************************************/
  3509. /*! no static exports found */
  3510. /***/ (function(module, exports, __webpack_require__) {
  3511. "use strict";
  3512. Object.defineProperty(exports, "__esModule", {
  3513. value: true
  3514. });
  3515. 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; }; }();
  3516. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3517. var FormalParameter = exports.FormalParameter = function () {
  3518. function FormalParameter(type, id) {
  3519. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3520. _classCallCheck(this, FormalParameter);
  3521. this.type = type;
  3522. this.id = id;
  3523. this.byRef = byRef;
  3524. this._sourceInfo = null;
  3525. }
  3526. _createClass(FormalParameter, [{
  3527. key: "sourceInfo",
  3528. set: function set(sourceInfo) {
  3529. this._sourceInfo = sourceInfo;
  3530. },
  3531. get: function get() {
  3532. return this._sourceInfo;
  3533. }
  3534. }]);
  3535. return FormalParameter;
  3536. }();
  3537. /***/ }),
  3538. /***/ "./js/ast/commands/function.js":
  3539. /*!*************************************!*\
  3540. !*** ./js/ast/commands/function.js ***!
  3541. \*************************************/
  3542. /*! no static exports found */
  3543. /***/ (function(module, exports, __webpack_require__) {
  3544. "use strict";
  3545. Object.defineProperty(exports, "__esModule", {
  3546. value: true
  3547. });
  3548. exports.Function = undefined;
  3549. 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; }; }();
  3550. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3552. var Function = exports.Function = function () {
  3553. function Function(name, returnType, formalParameters, commandBlock) {
  3554. _classCallCheck(this, Function);
  3555. this.name = name;
  3556. this.returnType = returnType;
  3557. this.formalParameters = formalParameters;
  3558. this.commandBlock = commandBlock;
  3559. this._sourceInfo = null;
  3560. }
  3561. _createClass(Function, [{
  3562. key: 'isMain',
  3563. get: function get() {
  3564. return this.name === null && this.returnType.isCompatible(_types.Types.VOID);
  3565. }
  3566. }, {
  3567. key: 'commands',
  3568. get: function get() {
  3569. return this.commandBlock.commands;
  3570. }
  3571. }, {
  3572. key: 'variablesDeclarations',
  3573. get: function get() {
  3574. return this.commandBlock.variables;
  3575. }
  3576. }, {
  3577. key: 'sourceInfo',
  3578. set: function set(sourceInfo) {
  3579. this._sourceInfo = sourceInfo;
  3580. },
  3581. get: function get() {
  3582. return this._sourceInfo;
  3583. }
  3584. }]);
  3585. return Function;
  3586. }();
  3587. /***/ }),
  3588. /***/ "./js/ast/commands/ifThenElse.js":
  3589. /*!***************************************!*\
  3590. !*** ./js/ast/commands/ifThenElse.js ***!
  3591. \***************************************/
  3592. /*! no static exports found */
  3593. /***/ (function(module, exports, __webpack_require__) {
  3594. "use strict";
  3595. Object.defineProperty(exports, "__esModule", {
  3596. value: true
  3597. });
  3598. exports.IfThenElse = undefined;
  3599. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3600. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3601. 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; }
  3602. 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; }
  3603. var IfThenElse = exports.IfThenElse = function (_Command) {
  3604. _inherits(IfThenElse, _Command);
  3605. function IfThenElse(condition, ifTrue, ifFalse) {
  3606. _classCallCheck(this, IfThenElse);
  3607. var _this = _possibleConstructorReturn(this, (IfThenElse.__proto__ || Object.getPrototypeOf(IfThenElse)).call(this));
  3608. _this.condition = condition;
  3609. _this.ifTrue = ifTrue;
  3610. _this.ifFalse = ifFalse;
  3611. return _this;
  3612. }
  3613. return IfThenElse;
  3614. }(_command.Command);
  3615. /***/ }),
  3616. /***/ "./js/ast/commands/index.js":
  3617. /*!**********************************!*\
  3618. !*** ./js/ast/commands/index.js ***!
  3619. \**********************************/
  3620. /*! no static exports found */
  3621. /***/ (function(module, exports, __webpack_require__) {
  3622. "use strict";
  3623. Object.defineProperty(exports, "__esModule", {
  3624. value: true
  3625. });
  3626. 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;
  3627. var _break = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3628. var _return = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3629. var _assign = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3630. var _arrayAssign = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3631. var _declaration = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3632. var _arrayDeclaration = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3633. var _while = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3634. var _for = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3635. var _function = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3636. var _ifThenElse = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3637. var _commandBlock = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3638. var _doWhile = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3639. var _switch = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3640. var _case = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3641. var _sysCall = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3642. var _formalParameter = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3643. var _functionCall = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3644. //Proxy to expression since they do exatcly the same thing
  3645. exports.Break = _break.Break;
  3646. exports.Return = _return.Return;
  3647. exports.Assign = _assign.Assign;
  3648. exports.ArrayIndexAssign = _arrayAssign.ArrayIndexAssign;
  3649. exports.Declaration = _declaration.Declaration;
  3650. exports.ArrayDeclaration = _arrayDeclaration.ArrayDeclaration;
  3651. exports.While = _while.While;
  3652. exports.For = _for.For;
  3653. exports.Function = _function.Function;
  3654. exports.IfThenElse = _ifThenElse.IfThenElse;
  3655. exports.CommandBlock = _commandBlock.CommandBlock;
  3656. exports.DoWhile = _doWhile.DoWhile;
  3657. exports.Switch = _switch.Switch;
  3658. exports.Case = _case.Case;
  3659. exports.SysCall = _sysCall.SysCall;
  3660. exports.FormalParameter = _formalParameter.FormalParameter;
  3661. exports.FunctionCall = _functionCall.FunctionCall;
  3662. /***/ }),
  3663. /***/ "./js/ast/commands/return.js":
  3664. /*!***********************************!*\
  3665. !*** ./js/ast/commands/return.js ***!
  3666. \***********************************/
  3667. /*! no static exports found */
  3668. /***/ (function(module, exports, __webpack_require__) {
  3669. "use strict";
  3670. Object.defineProperty(exports, "__esModule", {
  3671. value: true
  3672. });
  3673. exports.Return = undefined;
  3674. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3675. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3676. 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; }
  3677. 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; }
  3678. var Return = exports.Return = function (_Command) {
  3679. _inherits(Return, _Command);
  3680. function Return(expression) {
  3681. _classCallCheck(this, Return);
  3682. var _this = _possibleConstructorReturn(this, (Return.__proto__ || Object.getPrototypeOf(Return)).call(this));
  3683. _this.expression = expression;
  3684. return _this;
  3685. }
  3686. return Return;
  3687. }(_command.Command);
  3688. /***/ }),
  3689. /***/ "./js/ast/commands/switch.js":
  3690. /*!***********************************!*\
  3691. !*** ./js/ast/commands/switch.js ***!
  3692. \***********************************/
  3693. /*! no static exports found */
  3694. /***/ (function(module, exports, __webpack_require__) {
  3695. "use strict";
  3696. Object.defineProperty(exports, "__esModule", {
  3697. value: true
  3698. });
  3699. exports.Switch = undefined;
  3700. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3701. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3702. 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; }
  3703. 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; }
  3704. var Switch = exports.Switch = function (_Command) {
  3705. _inherits(Switch, _Command);
  3706. function Switch(expression, cases) {
  3707. _classCallCheck(this, Switch);
  3708. var _this = _possibleConstructorReturn(this, (Switch.__proto__ || Object.getPrototypeOf(Switch)).call(this));
  3709. _this.expression = expression;
  3710. _this.cases = cases;
  3711. return _this;
  3712. }
  3713. return Switch;
  3714. }(_command.Command);
  3715. /***/ }),
  3716. /***/ "./js/ast/commands/sysCall.js":
  3717. /*!************************************!*\
  3718. !*** ./js/ast/commands/sysCall.js ***!
  3719. \************************************/
  3720. /*! no static exports found */
  3721. /***/ (function(module, exports, __webpack_require__) {
  3722. "use strict";
  3723. Object.defineProperty(exports, "__esModule", {
  3724. value: true
  3725. });
  3726. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3727. /**
  3728. * This class represents all the language defined functions.
  3729. * The language processor uses the id provided here to properly execute the desired function.
  3730. * The function is actually implemented inside the language processor.
  3731. * All the functions can be found at: js/processor/definedFunctions.js
  3732. */
  3733. var SysCall = exports.SysCall = function SysCall(langFunc) {
  3734. _classCallCheck(this, SysCall);
  3735. this.langFunc = langFunc;
  3736. };
  3737. /***/ }),
  3738. /***/ "./js/ast/commands/while.js":
  3739. /*!**********************************!*\
  3740. !*** ./js/ast/commands/while.js ***!
  3741. \**********************************/
  3742. /*! no static exports found */
  3743. /***/ (function(module, exports, __webpack_require__) {
  3744. "use strict";
  3745. Object.defineProperty(exports, "__esModule", {
  3746. value: true
  3747. });
  3748. exports.While = undefined;
  3749. 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; }; }();
  3750. var _command = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3751. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3752. 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; }
  3753. 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; }
  3754. var While = exports.While = function (_Command) {
  3755. _inherits(While, _Command);
  3756. function While(expression, commandBlock) {
  3757. _classCallCheck(this, While);
  3758. var _this = _possibleConstructorReturn(this, (While.__proto__ || Object.getPrototypeOf(While)).call(this));
  3759. _this.expression = expression;
  3760. _this.commandBlock = commandBlock;
  3761. return _this;
  3762. }
  3763. _createClass(While, [{
  3764. key: 'commands',
  3765. get: function get() {
  3766. return this.commandBlock.commands;
  3767. }
  3768. }, {
  3769. key: 'testFirst',
  3770. get: function get() {
  3771. return true;
  3772. }
  3773. }]);
  3774. return While;
  3775. }(_command.Command);
  3776. /***/ }),
  3777. /***/ "./js/ast/error/syntaxError.js":
  3778. /*!*************************************!*\
  3779. !*** ./js/ast/error/syntaxError.js ***!
  3780. \*************************************/
  3781. /*! no static exports found */
  3782. /***/ (function(module, exports, __webpack_require__) {
  3783. "use strict";
  3784. Object.defineProperty(exports, "__esModule", {
  3785. value: true
  3786. });
  3787. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3788. 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; }
  3789. 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; }
  3790. var SyntaxError = exports.SyntaxError = function (_Error) {
  3791. _inherits(SyntaxError, _Error);
  3792. function SyntaxError() {
  3793. var _ref;
  3794. _classCallCheck(this, SyntaxError);
  3795. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  3796. msg[_key] = arguments[_key];
  3797. }
  3798. var _this = _possibleConstructorReturn(this, (_ref = SyntaxError.__proto__ || Object.getPrototypeOf(SyntaxError)).call.apply(_ref, [this].concat(msg)));
  3799. if (Error.captureStackTrace) Error.captureStackTrace(_this, SyntaxError);
  3800. return _this;
  3801. }
  3802. return SyntaxError;
  3803. }(Error);
  3804. /***/ }),
  3805. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3806. /*!********************************************!*\
  3807. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3808. \********************************************/
  3809. /*! no static exports found */
  3810. /***/ (function(module, exports, __webpack_require__) {
  3811. "use strict";
  3812. Object.defineProperty(exports, "__esModule", {
  3813. value: true
  3814. });
  3815. exports.SyntaxErrorFactory = undefined;
  3816. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3817. var _syntaxError = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3818. var SyntaxErrorFactory = exports.SyntaxErrorFactory = Object.freeze({
  3819. extra_lines: function extra_lines() {
  3820. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("extra_lines"));
  3821. },
  3822. token_missing_one: function token_missing_one(expected, token) {
  3823. var context = [expected, token.text, token.line, token.column];
  3824. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("token_missing_one", context));
  3825. },
  3826. token_missing_list: function token_missing_list(expectedList, token) {
  3827. var line = expectedList.join(_localizedStringsService.LocalizedStrings.getOR());
  3828. return SyntaxErrorFactory.token_missing_one(line, token);
  3829. },
  3830. id_missing: function id_missing(token) {
  3831. var context = [token.text, token.line, token.column];
  3832. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("id_missing", context));
  3833. },
  3834. eos_missing: function eos_missing(token) {
  3835. var context = [token.line, token.column];
  3836. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("eos_missing", context));
  3837. },
  3838. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3839. var context = [token.line, token.column, typeName];
  3840. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_dimension", context));
  3841. },
  3842. invalid_array_size: function invalid_array_size(token) {
  3843. var context = [token.line];
  3844. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_array_size", context));
  3845. },
  3846. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3847. var context = [name, typeName, token.line];
  3848. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_main_return", context));
  3849. },
  3850. invalid_var_declaration: function invalid_var_declaration(token) {
  3851. var context = [token.line];
  3852. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_var_declaration", context));
  3853. },
  3854. invalid_break_command: function invalid_break_command(cmdName, token) {
  3855. var context = [token.line, cmdName];
  3856. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_break_command", context));
  3857. },
  3858. invalid_terminal: function invalid_terminal(token) {
  3859. var context = [token.text, token.line, token.column];
  3860. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError('invalid_terminal', context));
  3861. },
  3862. invalid_type: function invalid_type(list, token) {
  3863. var line = list.join(_localizedStringsService.LocalizedStrings.getOR());
  3864. var context = [token.text, token.line, token.column, line];
  3865. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_type", context));
  3866. },
  3867. const_not_init: function const_not_init(token) {
  3868. var context = [token.line, token.column];
  3869. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("const_not_init", context));
  3870. },
  3871. invalid_id_format: function invalid_id_format(token) {
  3872. var context = [token.text, token.line, token.column];
  3873. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("invalid_id_format", context));
  3874. },
  3875. duplicate_function: function duplicate_function(token) {
  3876. var context = [token.text, token.line, token.column];
  3877. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_function", context));
  3878. },
  3879. main_parameters: function main_parameters() {
  3880. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("main_parameters"));
  3881. },
  3882. duplicate_variable: function duplicate_variable(token) {
  3883. var context = [token.text, token.line, token.column];
  3884. return new _syntaxError.SyntaxError(_localizedStringsService.LocalizedStrings.getError("duplicate_variable", context));
  3885. }
  3886. });
  3887. /***/ }),
  3888. /***/ "./js/ast/expressions/arrayAccess.js":
  3889. /*!*******************************************!*\
  3890. !*** ./js/ast/expressions/arrayAccess.js ***!
  3891. \*******************************************/
  3892. /*! no static exports found */
  3893. /***/ (function(module, exports, __webpack_require__) {
  3894. "use strict";
  3895. Object.defineProperty(exports, "__esModule", {
  3896. value: true
  3897. });
  3898. exports.ArrayAccess = undefined;
  3899. 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; }; }();
  3900. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  3901. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3902. 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; }
  3903. 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; }
  3904. var ArrayAccess = exports.ArrayAccess = function (_Expression) {
  3905. _inherits(ArrayAccess, _Expression);
  3906. function ArrayAccess(id, line, column) {
  3907. _classCallCheck(this, ArrayAccess);
  3908. var _this = _possibleConstructorReturn(this, (ArrayAccess.__proto__ || Object.getPrototypeOf(ArrayAccess)).call(this));
  3909. _this.id = id;
  3910. _this.line = line;
  3911. _this.column = column;
  3912. return _this;
  3913. }
  3914. _createClass(ArrayAccess, [{
  3915. key: 'toString',
  3916. value: function toString() {
  3917. var strLine = this.line.toString();
  3918. var strColumn = null;
  3919. if (this.column) {
  3920. strColumn = this.column.toString();
  3921. }
  3922. if (strColumn) {
  3923. return this.id + '[' + strLine + '][' + strColumn + ']';
  3924. } else {
  3925. return this.id + '[' + strLine + ']';
  3926. }
  3927. }
  3928. }]);
  3929. return ArrayAccess;
  3930. }(_expression.Expression);
  3931. /***/ }),
  3932. /***/ "./js/ast/expressions/arrayLiteral.js":
  3933. /*!********************************************!*\
  3934. !*** ./js/ast/expressions/arrayLiteral.js ***!
  3935. \********************************************/
  3936. /*! no static exports found */
  3937. /***/ (function(module, exports, __webpack_require__) {
  3938. "use strict";
  3939. Object.defineProperty(exports, "__esModule", {
  3940. value: true
  3941. });
  3942. exports.ArrayLiteral = undefined;
  3943. 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; }; }();
  3944. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  3945. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3946. 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; }
  3947. 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; }
  3948. var ArrayLiteral = exports.ArrayLiteral = function (_Literal) {
  3949. _inherits(ArrayLiteral, _Literal);
  3950. function ArrayLiteral(type, value) {
  3951. _classCallCheck(this, ArrayLiteral);
  3952. var _this = _possibleConstructorReturn(this, (ArrayLiteral.__proto__ || Object.getPrototypeOf(ArrayLiteral)).call(this, type));
  3953. _this.value = value;
  3954. return _this;
  3955. }
  3956. _createClass(ArrayLiteral, [{
  3957. key: 'validateType',
  3958. value: function validateType() {
  3959. // let valid = true;
  3960. // if(this.columns !== null) {
  3961. // const len = this.columns;
  3962. // const len2 = this.lines;
  3963. // for (let i = len - 1; i >= 0; i--) {
  3964. // for (let j = len2 - 1; j >= 0; j--) {
  3965. // if(this.value[i].value[j].type !== this.subtype) {
  3966. // valid = false;
  3967. // break;
  3968. // }
  3969. // }
  3970. // }
  3971. // } else {
  3972. // const len = this.lines;
  3973. // for (var i = len - 1; i >= 0; i--) {
  3974. // if(this.value[i].type !== this.subtype) {
  3975. // valid = false;
  3976. // break;
  3977. // }
  3978. // }
  3979. // }
  3980. return true; //valid;
  3981. }
  3982. }, {
  3983. key: 'validateSize',
  3984. value: function validateSize() {
  3985. var valid = true;
  3986. if (this.columns !== null) {
  3987. var equalityTest = data.value.map(function (v) {
  3988. return v.length;
  3989. }).reduce(function (old, next) {
  3990. if (old === null) {
  3991. return next;
  3992. } else if (old === next) {
  3993. return old;
  3994. } else {
  3995. return -1;
  3996. }
  3997. }, null);
  3998. valid = equalityTest !== -1;
  3999. }
  4000. return valid;
  4001. }
  4002. }, {
  4003. key: 'toString',
  4004. value: function toString() {
  4005. var strList = this.value.map(function (arrayLiteral) {
  4006. return arrayLiteral.toString();
  4007. });
  4008. return "{" + strList.join(',') + "}";
  4009. }
  4010. }, {
  4011. key: 'subtype',
  4012. get: function get() {
  4013. var element = this.value[0];
  4014. if (element instanceof ArrayLiteral) {
  4015. return element.value[0].type;
  4016. } else {
  4017. return element.type;
  4018. }
  4019. }
  4020. }, {
  4021. key: 'lines',
  4022. get: function get() {
  4023. return this.value.length;
  4024. }
  4025. }, {
  4026. key: 'columns',
  4027. get: function get() {
  4028. var element = this.value[0];
  4029. if (!(element instanceof ArrayLiteral)) {
  4030. return null;
  4031. } else {
  4032. return element.value[0].value.length;
  4033. }
  4034. }
  4035. }, {
  4036. key: 'isVector',
  4037. get: function get() {
  4038. return this.columns === null;
  4039. }
  4040. }, {
  4041. key: 'isValid',
  4042. get: function get() {
  4043. return true; //this.validateType() && this.validateSize();
  4044. }
  4045. }]);
  4046. return ArrayLiteral;
  4047. }(_literal.Literal);
  4048. /***/ }),
  4049. /***/ "./js/ast/expressions/boolLiteral.js":
  4050. /*!*******************************************!*\
  4051. !*** ./js/ast/expressions/boolLiteral.js ***!
  4052. \*******************************************/
  4053. /*! no static exports found */
  4054. /***/ (function(module, exports, __webpack_require__) {
  4055. "use strict";
  4056. Object.defineProperty(exports, "__esModule", {
  4057. value: true
  4058. });
  4059. exports.BoolLiteral = undefined;
  4060. 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; }; }();
  4061. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4063. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4064. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4065. 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; }
  4066. 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; }
  4067. var BoolLiteral = exports.BoolLiteral = function (_Literal) {
  4068. _inherits(BoolLiteral, _Literal);
  4069. function BoolLiteral(value) {
  4070. _classCallCheck(this, BoolLiteral);
  4071. var _this = _possibleConstructorReturn(this, (BoolLiteral.__proto__ || Object.getPrototypeOf(BoolLiteral)).call(this, _types.Types.BOOLEAN));
  4072. _this.value = value;
  4073. return _this;
  4074. }
  4075. _createClass(BoolLiteral, [{
  4076. key: 'toString',
  4077. value: function toString() {
  4078. return (0, _parsers.convertBoolToString)(this.value);
  4079. }
  4080. }]);
  4081. return BoolLiteral;
  4082. }(_literal.Literal);
  4083. /***/ }),
  4084. /***/ "./js/ast/expressions/expression.js":
  4085. /*!******************************************!*\
  4086. !*** ./js/ast/expressions/expression.js ***!
  4087. \******************************************/
  4088. /*! no static exports found */
  4089. /***/ (function(module, exports, __webpack_require__) {
  4090. "use strict";
  4091. Object.defineProperty(exports, "__esModule", {
  4092. value: true
  4093. });
  4094. 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; }; }();
  4095. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4096. var Expression = exports.Expression = function () {
  4097. function Expression() {
  4098. _classCallCheck(this, Expression);
  4099. this._sourceInfo = null;
  4100. }
  4101. _createClass(Expression, [{
  4102. key: "sourceInfo",
  4103. set: function set(sourceInfo) {
  4104. this._sourceInfo = sourceInfo;
  4105. },
  4106. get: function get() {
  4107. return this._sourceInfo;
  4108. }
  4109. }]);
  4110. return Expression;
  4111. }();
  4112. /***/ }),
  4113. /***/ "./js/ast/expressions/functionCall.js":
  4114. /*!********************************************!*\
  4115. !*** ./js/ast/expressions/functionCall.js ***!
  4116. \********************************************/
  4117. /*! no static exports found */
  4118. /***/ (function(module, exports, __webpack_require__) {
  4119. "use strict";
  4120. Object.defineProperty(exports, "__esModule", {
  4121. value: true
  4122. });
  4123. exports.FunctionCall = undefined;
  4124. 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; }; }();
  4125. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4126. var _definedFunctions = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4127. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4128. 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; }
  4129. 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; }
  4130. var FunctionCall = exports.FunctionCall = function (_Expression) {
  4131. _inherits(FunctionCall, _Expression);
  4132. function FunctionCall(id, actualParameters) {
  4133. _classCallCheck(this, FunctionCall);
  4134. var _this = _possibleConstructorReturn(this, (FunctionCall.__proto__ || Object.getPrototypeOf(FunctionCall)).call(this));
  4135. _this.id = id;
  4136. _this.actualParameters = actualParameters;
  4137. return _this;
  4138. }
  4139. _createClass(FunctionCall, [{
  4140. key: 'toString',
  4141. value: function toString() {
  4142. var name = null;
  4143. if (this.isMainCall) {
  4144. name = _definedFunctions.LanguageDefinedFunction.getMainFunctionName();
  4145. } else {
  4146. name = _definedFunctions.LanguageDefinedFunction.getLocalName(this.id);
  4147. }
  4148. var params = null;
  4149. if (this.actualParameters.length == 0) {
  4150. params = "()";
  4151. } else {
  4152. var strParams = this.actualParameters.map(function (v) {
  4153. return v.toString();
  4154. });
  4155. params = "(" + strParams.join(",") + ")";
  4156. }
  4157. return name + params;
  4158. }
  4159. }, {
  4160. key: 'isMainCall',
  4161. get: function get() {
  4162. return this.id === null;
  4163. }
  4164. }, {
  4165. key: 'parametersSize',
  4166. get: function get() {
  4167. return this.actualParameters.length;
  4168. }
  4169. }]);
  4170. return FunctionCall;
  4171. }(_expression.Expression);
  4172. /***/ }),
  4173. /***/ "./js/ast/expressions/index.js":
  4174. /*!*************************************!*\
  4175. !*** ./js/ast/expressions/index.js ***!
  4176. \*************************************/
  4177. /*! no static exports found */
  4178. /***/ (function(module, exports, __webpack_require__) {
  4179. "use strict";
  4180. Object.defineProperty(exports, "__esModule", {
  4181. value: true
  4182. });
  4183. exports.UnaryApp = exports.InfixApp = exports.VariableLiteral = exports.ArrayLiteral = exports.StringLiteral = exports.BoolLiteral = exports.RealLiteral = exports.IntLiteral = exports.FunctionCall = exports.ArrayAccess = undefined;
  4184. var _arrayAccess = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4185. var _functionCall = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4186. var _intLiteral = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4187. var _realLiteral = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4188. var _boolLiteral = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4189. var _stringLiteral = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4190. var _arrayLiteral = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4191. var _variableLiteral = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4192. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4193. var _unaryApp = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4194. exports.ArrayAccess = _arrayAccess.ArrayAccess;
  4195. exports.FunctionCall = _functionCall.FunctionCall;
  4196. exports.IntLiteral = _intLiteral.IntLiteral;
  4197. exports.RealLiteral = _realLiteral.RealLiteral;
  4198. exports.BoolLiteral = _boolLiteral.BoolLiteral;
  4199. exports.StringLiteral = _stringLiteral.StringLiteral;
  4200. exports.ArrayLiteral = _arrayLiteral.ArrayLiteral;
  4201. exports.VariableLiteral = _variableLiteral.VariableLiteral;
  4202. exports.InfixApp = _infixApp.InfixApp;
  4203. exports.UnaryApp = _unaryApp.UnaryApp;
  4204. /***/ }),
  4205. /***/ "./js/ast/expressions/infixApp.js":
  4206. /*!****************************************!*\
  4207. !*** ./js/ast/expressions/infixApp.js ***!
  4208. \****************************************/
  4209. /*! no static exports found */
  4210. /***/ (function(module, exports, __webpack_require__) {
  4211. "use strict";
  4212. Object.defineProperty(exports, "__esModule", {
  4213. value: true
  4214. });
  4215. exports.InfixApp = undefined;
  4216. 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; }; }();
  4217. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4218. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4219. 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; }
  4220. 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; }
  4221. var InfixApp = exports.InfixApp = function (_Expression) {
  4222. _inherits(InfixApp, _Expression);
  4223. function InfixApp(op, left, right) {
  4224. _classCallCheck(this, InfixApp);
  4225. var _this = _possibleConstructorReturn(this, (InfixApp.__proto__ || Object.getPrototypeOf(InfixApp)).call(this));
  4226. _this.op = op;
  4227. _this.left = left;
  4228. _this.right = right;
  4229. return _this;
  4230. }
  4231. _createClass(InfixApp, [{
  4232. key: 'toString',
  4233. value: function toString() {
  4234. var l = this.left.toString();
  4235. var op = this.op.value;
  4236. var r = this.right.toString();
  4237. return l + op + r;
  4238. }
  4239. }]);
  4240. return InfixApp;
  4241. }(_expression.Expression);
  4242. /***/ }),
  4243. /***/ "./js/ast/expressions/intLiteral.js":
  4244. /*!******************************************!*\
  4245. !*** ./js/ast/expressions/intLiteral.js ***!
  4246. \******************************************/
  4247. /*! no static exports found */
  4248. /***/ (function(module, exports, __webpack_require__) {
  4249. "use strict";
  4250. Object.defineProperty(exports, "__esModule", {
  4251. value: true
  4252. });
  4253. exports.IntLiteral = undefined;
  4254. 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; }; }();
  4255. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4256. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4257. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4258. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4259. 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; }
  4260. 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; }
  4261. var IntLiteral = exports.IntLiteral = function (_Literal) {
  4262. _inherits(IntLiteral, _Literal);
  4263. function IntLiteral(value) {
  4264. _classCallCheck(this, IntLiteral);
  4265. var _this = _possibleConstructorReturn(this, (IntLiteral.__proto__ || Object.getPrototypeOf(IntLiteral)).call(this, _types.Types.INTEGER));
  4266. _this.value = value;
  4267. return _this;
  4268. }
  4269. _createClass(IntLiteral, [{
  4270. key: 'toString',
  4271. value: function toString() {
  4272. return (0, _parsers.convertToString)(this.value, this.type);
  4273. }
  4274. }]);
  4275. return IntLiteral;
  4276. }(_literal.Literal);
  4277. /***/ }),
  4278. /***/ "./js/ast/expressions/literal.js":
  4279. /*!***************************************!*\
  4280. !*** ./js/ast/expressions/literal.js ***!
  4281. \***************************************/
  4282. /*! no static exports found */
  4283. /***/ (function(module, exports, __webpack_require__) {
  4284. "use strict";
  4285. Object.defineProperty(exports, "__esModule", {
  4286. value: true
  4287. });
  4288. exports.Literal = undefined;
  4289. var _expression = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4290. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4291. 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; }
  4292. 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; }
  4293. var Literal = exports.Literal = function (_Expression) {
  4294. _inherits(Literal, _Expression);
  4295. function Literal(type) {
  4296. _classCallCheck(this, Literal);
  4297. var _this = _possibleConstructorReturn(this, (Literal.__proto__ || Object.getPrototypeOf(Literal)).call(this));
  4298. _this.type = type;
  4299. return _this;
  4300. }
  4301. return Literal;
  4302. }(_expression.Expression);
  4303. /***/ }),
  4304. /***/ "./js/ast/expressions/realLiteral.js":
  4305. /*!*******************************************!*\
  4306. !*** ./js/ast/expressions/realLiteral.js ***!
  4307. \*******************************************/
  4308. /*! no static exports found */
  4309. /***/ (function(module, exports, __webpack_require__) {
  4310. "use strict";
  4311. Object.defineProperty(exports, "__esModule", {
  4312. value: true
  4313. });
  4314. exports.RealLiteral = undefined;
  4315. 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; }; }();
  4316. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4317. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4318. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4319. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4320. 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; }
  4321. 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; }
  4322. var RealLiteral = exports.RealLiteral = function (_Literal) {
  4323. _inherits(RealLiteral, _Literal);
  4324. function RealLiteral(value) {
  4325. _classCallCheck(this, RealLiteral);
  4326. var _this = _possibleConstructorReturn(this, (RealLiteral.__proto__ || Object.getPrototypeOf(RealLiteral)).call(this, _types.Types.REAL));
  4327. _this.value = value;
  4328. return _this;
  4329. }
  4330. _createClass(RealLiteral, [{
  4331. key: 'toString',
  4332. value: function toString() {
  4333. return (0, _parsers.convertToString)(this.value, this.type);
  4334. }
  4335. }]);
  4336. return RealLiteral;
  4337. }(_literal.Literal);
  4338. /***/ }),
  4339. /***/ "./js/ast/expressions/stringLiteral.js":
  4340. /*!*********************************************!*\
  4341. !*** ./js/ast/expressions/stringLiteral.js ***!
  4342. \*********************************************/
  4343. /*! no static exports found */
  4344. /***/ (function(module, exports, __webpack_require__) {
  4345. "use strict";
  4346. Object.defineProperty(exports, "__esModule", {
  4347. value: true
  4348. });
  4349. exports.StringLiteral = undefined;
  4350. 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; }; }();
  4351. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4352. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. 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; }
  4355. 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; }
  4356. var StringLiteral = exports.StringLiteral = function (_Literal) {
  4357. _inherits(StringLiteral, _Literal);
  4358. function StringLiteral(value) {
  4359. _classCallCheck(this, StringLiteral);
  4360. var _this = _possibleConstructorReturn(this, (StringLiteral.__proto__ || Object.getPrototypeOf(StringLiteral)).call(this, _types.Types.STRING));
  4361. _this.value = value;
  4362. return _this;
  4363. }
  4364. _createClass(StringLiteral, [{
  4365. key: 'toString',
  4366. value: function toString() {
  4367. return this.value;
  4368. }
  4369. }]);
  4370. return StringLiteral;
  4371. }(_literal.Literal);
  4372. /***/ }),
  4373. /***/ "./js/ast/expressions/unaryApp.js":
  4374. /*!****************************************!*\
  4375. !*** ./js/ast/expressions/unaryApp.js ***!
  4376. \****************************************/
  4377. /*! no static exports found */
  4378. /***/ (function(module, exports, __webpack_require__) {
  4379. "use strict";
  4380. Object.defineProperty(exports, "__esModule", {
  4381. value: true
  4382. });
  4383. exports.UnaryApp = undefined;
  4384. 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; }; }();
  4385. var _infixApp = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4386. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4387. 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; }
  4388. 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; }
  4389. var UnaryApp = exports.UnaryApp = function (_InfixApp) {
  4390. _inherits(UnaryApp, _InfixApp);
  4391. function UnaryApp(op, left) {
  4392. _classCallCheck(this, UnaryApp);
  4393. return _possibleConstructorReturn(this, (UnaryApp.__proto__ || Object.getPrototypeOf(UnaryApp)).call(this, op, left, null));
  4394. }
  4395. _createClass(UnaryApp, [{
  4396. key: 'toString',
  4397. value: function toString() {
  4398. var l = this.left.toString();
  4399. var op = this.op.value;
  4400. return op + l;
  4401. }
  4402. }]);
  4403. return UnaryApp;
  4404. }(_infixApp.InfixApp);
  4405. /***/ }),
  4406. /***/ "./js/ast/expressions/variableLiteral.js":
  4407. /*!***********************************************!*\
  4408. !*** ./js/ast/expressions/variableLiteral.js ***!
  4409. \***********************************************/
  4410. /*! no static exports found */
  4411. /***/ (function(module, exports, __webpack_require__) {
  4412. "use strict";
  4413. Object.defineProperty(exports, "__esModule", {
  4414. value: true
  4415. });
  4416. exports.VariableLiteral = undefined;
  4417. 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; }; }();
  4418. var _literal = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4419. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4420. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4421. 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; }
  4422. 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; }
  4423. var VariableLiteral = exports.VariableLiteral = function (_Literal) {
  4424. _inherits(VariableLiteral, _Literal);
  4425. function VariableLiteral(id) {
  4426. _classCallCheck(this, VariableLiteral);
  4427. var _this = _possibleConstructorReturn(this, (VariableLiteral.__proto__ || Object.getPrototypeOf(VariableLiteral)).call(this, _types.Types.UNDEFINED));
  4428. _this.id = id;
  4429. return _this;
  4430. }
  4431. _createClass(VariableLiteral, [{
  4432. key: 'toString',
  4433. value: function toString() {
  4434. return this.id;
  4435. }
  4436. }]);
  4437. return VariableLiteral;
  4438. }(_literal.Literal);
  4439. /***/ }),
  4440. /***/ "./js/ast/ivprogParser.js":
  4441. /*!********************************!*\
  4442. !*** ./js/ast/ivprogParser.js ***!
  4443. \********************************/
  4444. /*! no static exports found */
  4445. /***/ (function(module, exports, __webpack_require__) {
  4446. "use strict";
  4447. Object.defineProperty(exports, "__esModule", {
  4448. value: true
  4449. });
  4450. exports.IVProgParser = undefined;
  4451. 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; }; }();
  4452. var _index = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4453. var _expressions = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4454. var Expressions = _interopRequireWildcard(_expressions);
  4455. var _commands = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4456. var Commands = _interopRequireWildcard(_commands);
  4457. var _parsers = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4458. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4459. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4460. var _sourceInfo2 = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4461. var _operators = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4462. var _syntaxErrorFactory = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4463. var _definedFunctions = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4464. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4465. 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; } }
  4466. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4467. var IVProgParser = exports.IVProgParser = function () {
  4468. _createClass(IVProgParser, null, [{
  4469. key: 'createParser',
  4470. value: function createParser(input) {
  4471. var lexerClass = _languageService.LanguageService.getCurrentLexer();
  4472. return new IVProgParser(input, lexerClass);
  4473. }
  4474. // <BEGIN scope consts>
  4475. }, {
  4476. key: 'BASE',
  4477. get: function get() {
  4478. return 0;
  4479. }
  4480. }, {
  4481. key: 'FUNCTION',
  4482. get: function get() {
  4483. return 1;
  4484. }
  4485. }, {
  4486. key: 'COMMAND',
  4487. get: function get() {
  4488. return 2;
  4489. }
  4490. }, {
  4491. key: 'BREAKABLE',
  4492. get: function get() {
  4493. return 4;
  4494. }
  4495. // </ END scope consts>
  4496. }]);
  4497. function IVProgParser(input, lexerClass) {
  4498. _classCallCheck(this, IVProgParser);
  4499. this.lexerClass = lexerClass;
  4500. this.lexer = new lexerClass(new _index.InputStream(input));
  4501. this.tokenStream = new _index.CommonTokenStream(this.lexer);
  4502. this.tokenStream.fill();
  4503. this.pos = 1;
  4504. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4505. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4506. this.parsingArrayDimension = 0;
  4507. this.scope = [];
  4508. this.langFuncs = _languageService.LanguageService.getCurrentLangFuncs();
  4509. this.definedFuncsNameList = [];
  4510. this.definedVariablesStack = [];
  4511. }
  4512. _createClass(IVProgParser, [{
  4513. key: 'parseTree',
  4514. value: function parseTree() {
  4515. return this.parseProgram();
  4516. }
  4517. }, {
  4518. key: 'getToken',
  4519. value: function getToken() {
  4520. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4521. // if(index === null)
  4522. // index = this.pos;
  4523. return this.tokenStream.LT(index);
  4524. }
  4525. }, {
  4526. key: 'insideScope',
  4527. value: function insideScope(scope) {
  4528. if (this.scope.length <= 0) {
  4529. return IVProgParser.BASE === scope;
  4530. } else {
  4531. return this.scope[this.scope.length - 1] === scope;
  4532. }
  4533. }
  4534. }, {
  4535. key: 'pushScope',
  4536. value: function pushScope(scope) {
  4537. this.scope.push(scope);
  4538. }
  4539. }, {
  4540. key: 'pushVariableStack',
  4541. value: function pushVariableStack() {
  4542. this.definedVariablesStack.push([]);
  4543. }
  4544. }, {
  4545. key: 'popScope',
  4546. value: function popScope() {
  4547. return this.scope.pop();
  4548. }
  4549. }, {
  4550. key: 'popVariableStack',
  4551. value: function popVariableStack() {
  4552. return this.definedVariablesStack.pop();
  4553. }
  4554. }, {
  4555. key: 'getCurrentVariableStack',
  4556. value: function getCurrentVariableStack() {
  4557. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4558. }
  4559. }, {
  4560. key: 'isEOF',
  4561. value: function isEOF() {
  4562. this.getToken(this.pos);
  4563. return this.tokenStream.fetchedEOF;
  4564. }
  4565. }, {
  4566. key: 'parseProgram',
  4567. value: function parseProgram() {
  4568. var token = this.getToken();
  4569. var globalVars = [];
  4570. var functions = [];
  4571. if (this.lexerClass.RK_PROGRAM === token.type) {
  4572. this.pos++;
  4573. this.consumeNewLines();
  4574. this.checkOpenCurly();
  4575. this.pos++;
  4576. this.pushVariableStack();
  4577. while (true) {
  4578. this.consumeNewLines();
  4579. var _token = this.getToken();
  4580. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4581. globalVars = globalVars.concat(this.parseGlobalVariables());
  4582. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4583. this.pushVariableStack();
  4584. functions = functions.concat(this.parseFunction());
  4585. this.popVariableStack();
  4586. } else {
  4587. break;
  4588. }
  4589. }
  4590. this.consumeNewLines();
  4591. this.checkCloseCurly();
  4592. this.pos++;
  4593. this.consumeNewLines();
  4594. if (!this.isEOF()) {
  4595. throw _syntaxErrorFactory.SyntaxErrorFactory.extra_lines();
  4596. }
  4597. this.popVariableStack();
  4598. return { global: globalVars, functions: functions };
  4599. } else {
  4600. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4601. }
  4602. }
  4603. }, {
  4604. key: 'checkOpenCurly',
  4605. value: function checkOpenCurly() {
  4606. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4607. var token = this.getToken();
  4608. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4609. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('{', token);else return false;
  4610. }
  4611. return true;
  4612. }
  4613. }, {
  4614. key: 'checkCloseCurly',
  4615. value: function checkCloseCurly() {
  4616. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4617. var token = this.getToken();
  4618. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4619. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('}', token);else return false;
  4620. }
  4621. return true;
  4622. }
  4623. /* It checks if the current token at position pos is a ']'.
  4624. * As a check function it doesn't increment pos.
  4625. *
  4626. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4627. *
  4628. * @returns true if the attempt is true and current token is '[',
  4629. * false is attempt is true and current token is not '['
  4630. **/
  4631. }, {
  4632. key: 'checkOpenBrace',
  4633. value: function checkOpenBrace() {
  4634. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4635. var token = this.getToken();
  4636. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4637. if (!attempt) {
  4638. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('[', token);
  4639. } else {
  4640. return false;
  4641. }
  4642. }
  4643. return true;
  4644. }
  4645. }, {
  4646. key: 'checkCloseBrace',
  4647. value: function checkCloseBrace() {
  4648. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4649. var token = this.getToken();
  4650. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4651. if (!attempt) {
  4652. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(']', token);
  4653. } else {
  4654. return false;
  4655. }
  4656. }
  4657. return true;
  4658. }
  4659. }, {
  4660. key: 'checkOpenParenthesis',
  4661. value: function checkOpenParenthesis() {
  4662. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4663. var token = this.getToken();
  4664. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4665. if (!attempt) {
  4666. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('(', token);
  4667. } else {
  4668. return false;
  4669. }
  4670. }
  4671. return true;
  4672. }
  4673. }, {
  4674. key: 'checkCloseParenthesis',
  4675. value: function checkCloseParenthesis() {
  4676. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4677. var token = this.getToken();
  4678. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4679. if (!attempt) {
  4680. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(')', token);
  4681. } else {
  4682. return false;
  4683. }
  4684. }
  4685. return true;
  4686. }
  4687. }, {
  4688. key: 'checkEOS',
  4689. value: function checkEOS() {
  4690. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4691. var eosToken = this.getToken();
  4692. if (eosToken.type !== this.lexerClass.EOS) {
  4693. if (!attempt) throw _syntaxErrorFactory.SyntaxErrorFactory.eos_missing(eosToken);else return false;
  4694. }
  4695. return true;
  4696. }
  4697. }, {
  4698. key: 'checkFunctionDuplicate',
  4699. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4700. var id = functionID === null ? "$main" : functionID;
  4701. var index = this.definedFuncsNameList.indexOf(id);
  4702. if (index !== -1) {
  4703. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_function(funcIDToken);
  4704. }
  4705. this.definedFuncsNameList.push(id);
  4706. }
  4707. }, {
  4708. key: 'checkVariableDuplicate',
  4709. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4710. var index = this.getCurrentVariableStack().indexOf(variableID);
  4711. if (index !== -1) {
  4712. throw _syntaxErrorFactory.SyntaxErrorFactory.duplicate_variable(variableIDToken);
  4713. }
  4714. this.getCurrentVariableStack().push(variableID);
  4715. }
  4716. }, {
  4717. key: 'consumeForSemiColon',
  4718. value: function consumeForSemiColon() {
  4719. var eosToken = this.getToken();
  4720. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4721. this.pos++;
  4722. return;
  4723. }
  4724. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(';', eosToken);
  4725. }
  4726. }, {
  4727. key: 'parseGlobalVariables',
  4728. value: function parseGlobalVariables() {
  4729. var decl = this.parseMaybeConst();
  4730. this.checkEOS();
  4731. this.pos++;
  4732. return decl;
  4733. }
  4734. /*
  4735. * Checks if the next token is PR_CONST. It's only available
  4736. * at global variables declaration level
  4737. * @returns Declararion(const, type, id, initVal?)
  4738. **/
  4739. }, {
  4740. key: 'parseMaybeConst',
  4741. value: function parseMaybeConst() {
  4742. var constToken = this.getToken();
  4743. if (constToken.type === this.lexerClass.RK_CONST) {
  4744. this.pos++;
  4745. var typeString = this.parseType();
  4746. return this.parseDeclaration(typeString, true);
  4747. } else if (this.isVariableType(constToken)) {
  4748. var _typeString = this.parseType();
  4749. return this.parseDeclaration(_typeString);
  4750. } else {
  4751. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4752. }
  4753. }
  4754. /*
  4755. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4756. * @returns a list of Declararion(const, type, id, initVal?)
  4757. **/
  4758. }, {
  4759. key: 'parseDeclaration',
  4760. value: function parseDeclaration(typeString) {
  4761. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4762. var initial = null;
  4763. var dim1 = null;
  4764. var dim2 = null;
  4765. var idToken = this.getToken();
  4766. var idString = this.parseID();
  4767. this.checkVariableDuplicate(idString, idToken);
  4768. // Check for array or vector
  4769. // ID[int/IDi][int/IDj]
  4770. if (this.checkOpenBrace(true)) {
  4771. this.pos++;
  4772. this.consumeNewLines();
  4773. dim1 = this.parseArrayDimension();
  4774. this.consumeNewLines();
  4775. this.checkCloseBrace();
  4776. this.pos++;
  4777. if (this.checkOpenBrace(true)) {
  4778. this.pos++;
  4779. this.consumeNewLines();
  4780. dim2 = this.parseArrayDimension();
  4781. this.consumeNewLines();
  4782. this.checkCloseBrace();
  4783. this.pos++;
  4784. }
  4785. }
  4786. var equalsToken = this.getToken();
  4787. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4788. throw _syntaxErrorFactory.SyntaxErrorFactory.const_not_init(idToken);
  4789. }
  4790. if (equalsToken.type === this.lexerClass.EQUAL) {
  4791. this.pos++;
  4792. initial = this.parseExpressionOR();
  4793. }
  4794. var declaration = null;
  4795. var dimensions = 0;
  4796. if (dim1 !== null) {
  4797. dimensions++;
  4798. if (dim2 !== null) {
  4799. dimensions++;
  4800. }
  4801. declaration = new Commands.ArrayDeclaration(idString, new _compoundType.CompoundType(typeString, dimensions), dim1, dim2, initial, isConst);
  4802. } else {
  4803. declaration = new Commands.Declaration(idString, typeString, initial, isConst);
  4804. }
  4805. declaration.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(idToken);
  4806. var commaToken = this.getToken();
  4807. if (commaToken.type === this.lexerClass.COMMA) {
  4808. this.pos++;
  4809. this.consumeNewLines();
  4810. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4811. } else {
  4812. return [declaration];
  4813. }
  4814. }
  4815. }, {
  4816. key: 'consumeNewLines',
  4817. value: function consumeNewLines() {
  4818. var token = this.getToken();
  4819. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4820. this.pos++;
  4821. token = this.getToken();
  4822. }
  4823. }
  4824. }, {
  4825. key: 'isVariableType',
  4826. value: function isVariableType(token) {
  4827. return this.variableTypes.find(function (v) {
  4828. return v === token.type;
  4829. });
  4830. }
  4831. /*
  4832. * Reads the next token of the stream to check if it is a Integer or an ID.
  4833. * @returns Integer | ID
  4834. **/
  4835. }, {
  4836. key: 'parseArrayDimension',
  4837. value: function parseArrayDimension() {
  4838. var dimToken = this.getToken();
  4839. if (dimToken.type === this.lexerClass.INTEGER) {
  4840. //parse as int literal
  4841. this.pos++;
  4842. return this.getIntLiteral(dimToken);
  4843. } else if (dimToken.type === this.lexerClass.ID) {
  4844. //parse as variable
  4845. this.pos++;
  4846. return this.parseVariable(dimToken);
  4847. } else {
  4848. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  4849. }
  4850. }
  4851. /*
  4852. * Returns an object {type: 'int', value: value}.
  4853. * It checks for binary and hexadecimal integers.
  4854. * @returns object with fields type and value
  4855. **/
  4856. }, {
  4857. key: 'getIntLiteral',
  4858. value: function getIntLiteral(token) {
  4859. var text = token.text;
  4860. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4861. var exp = new Expressions.IntLiteral((0, _parsers.toInt)(text));
  4862. exp.sourceInfo = sourceInfo;
  4863. return exp;
  4864. }
  4865. }, {
  4866. key: 'getRealLiteral',
  4867. value: function getRealLiteral(token) {
  4868. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4869. var exp = new Expressions.RealLiteral((0, _parsers.toReal)(token.text));
  4870. exp.sourceInfo = sourceInfo;
  4871. return exp;
  4872. }
  4873. }, {
  4874. key: 'getStringLiteral',
  4875. value: function getStringLiteral(token) {
  4876. var text = token.text;
  4877. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4878. var exp = new Expressions.StringLiteral((0, _parsers.toString)(text));
  4879. exp.sourceInfo = sourceInfo;
  4880. return exp;
  4881. }
  4882. }, {
  4883. key: 'getBoolLiteral',
  4884. value: function getBoolLiteral(token) {
  4885. var val = (0, _parsers.toBool)(token.text);
  4886. var exp = new Expressions.BoolLiteral(val);
  4887. exp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);;
  4888. return exp;
  4889. }
  4890. }, {
  4891. key: 'parseArrayLiteral',
  4892. value: function parseArrayLiteral() {
  4893. this.checkOpenCurly();
  4894. var beginArray = this.getToken();
  4895. if (this.parsingArrayDimension >= 2) {
  4896. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list('Array dimensions exceed maximum size of 2 at line ' + beginArray.line);
  4897. }
  4898. this.pos++;
  4899. this.parsingArrayDimension++;
  4900. this.consumeNewLines();
  4901. var data = this.parseExpressionList();
  4902. this.consumeNewLines();
  4903. this.checkCloseCurly();
  4904. var endArray = this.getToken();
  4905. this.pos++;
  4906. this.parsingArrayDimension--;
  4907. if (this.parsingArrayDimension === 0) {
  4908. // if (!data.isValid) {
  4909. // // TODO: better error message
  4910. // console.log('invalid array');
  4911. // throw new Error(`Invalid array at line ${beginArray.line}`);
  4912. // }
  4913. }
  4914. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(beginArray, endArray);
  4915. var dataDim = 1;
  4916. if (data[0] instanceof Expressions.ArrayLiteral) {
  4917. dataDim++;
  4918. }
  4919. var type = new _compoundType.CompoundType(_types.Types.UNDEFINED, dataDim);
  4920. var exp = new Expressions.ArrayLiteral(type, data);
  4921. exp.sourceInfo = sourceInfo;
  4922. return exp;
  4923. }
  4924. /*
  4925. * Returns an object {type: 'variable', value: value}.
  4926. * @returns object with fields type and value
  4927. **/
  4928. }, {
  4929. key: 'parseVariable',
  4930. value: function parseVariable(token) {
  4931. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  4932. var exp = new Expressions.VariableLiteral(token.text);
  4933. exp.sourceInfo = sourceInfo;
  4934. return exp;
  4935. }
  4936. /*
  4937. * Returns an object representing a function. It has
  4938. * four attributes: returnType, id, formalParams and block.
  4939. * The block object has two attributes: declarations and commands
  4940. **/
  4941. }, {
  4942. key: 'parseFunction',
  4943. value: function parseFunction() {
  4944. this.pushScope(IVProgParser.FUNCTION);
  4945. var formalParams = [];
  4946. var token = this.getToken();
  4947. if (token.type !== this.lexerClass.RK_FUNCTION) {
  4948. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  4949. return null;
  4950. }
  4951. this.pos++;
  4952. var funType = this.parseType();
  4953. var dimensions = 0;
  4954. if (this.checkOpenBrace(true)) {
  4955. this.pos++;
  4956. this.checkCloseBrace();
  4957. this.pos++;
  4958. dimensions++;
  4959. if (this.checkOpenBrace(true)) {
  4960. this.pos++;
  4961. this.checkCloseBrace();
  4962. this.pos++;
  4963. dimensions++;
  4964. }
  4965. }
  4966. var funcIDToken = this.getToken();
  4967. var functionID = this.parseID();
  4968. this.checkFunctionDuplicate(functionID, funcIDToken);
  4969. this.checkOpenParenthesis();
  4970. this.pos++;
  4971. this.consumeNewLines();
  4972. if (!this.checkCloseParenthesis(true)) {
  4973. formalParams = this.parseFormalParameters(); // formal parameters
  4974. this.consumeNewLines();
  4975. this.checkCloseParenthesis();
  4976. this.pos++;
  4977. } else {
  4978. this.pos++;
  4979. }
  4980. this.consumeNewLines();
  4981. var commandsBlock = this.parseCommandBlock();
  4982. var returnType = funType;
  4983. if (dimensions > 0) {
  4984. returnType = new _compoundType.CompoundType(funType, dimensions);
  4985. }
  4986. var func = new Commands.Function(functionID, returnType, formalParams, commandsBlock);
  4987. if (functionID === null && !func.isMain) {
  4988. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_main_return(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  4989. } else if (func.isMain && formalParams.length !== 0) {
  4990. throw _syntaxErrorFactory.SyntaxErrorFactory.main_parameters();
  4991. }
  4992. this.popScope();
  4993. return func;
  4994. }
  4995. /*
  4996. * Parse the formal parameters of a function.
  4997. * @returns a list of objects with the following attributes: type, id and dimensions.
  4998. **/
  4999. }, {
  5000. key: 'parseFormalParameters',
  5001. value: function parseFormalParameters() {
  5002. var list = [];
  5003. while (true) {
  5004. var dimensions = 0;
  5005. var typeString = this.parseType();
  5006. var idToken = this.getToken();
  5007. var idString = this.parseID();
  5008. this.checkVariableDuplicate(idString, idToken);
  5009. if (this.checkOpenBrace(true)) {
  5010. this.pos++;
  5011. dimensions++;
  5012. this.checkCloseBrace();
  5013. this.pos++;
  5014. if (this.checkOpenBrace(true)) {
  5015. this.pos++;
  5016. dimensions++;
  5017. this.checkCloseBrace();
  5018. this.pos++;
  5019. }
  5020. }
  5021. var type = null;
  5022. if (dimensions > 0) {
  5023. type = new _compoundType.CompoundType(typeString, dimensions);
  5024. } else {
  5025. type = typeString;
  5026. }
  5027. list.push(new Commands.FormalParameter(type, idString));
  5028. var commaToken = this.getToken();
  5029. if (commaToken.type !== this.lexerClass.COMMA) break;
  5030. this.pos++;
  5031. this.consumeNewLines();
  5032. }
  5033. return list;
  5034. }
  5035. }, {
  5036. key: 'parseID',
  5037. value: function parseID() {
  5038. var token = this.getToken();
  5039. if (token.type !== this.lexerClass.ID) {
  5040. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5041. }
  5042. this.pos++;
  5043. if (this.insideScope(IVProgParser.FUNCTION)) {
  5044. if (token.text === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5045. return null;
  5046. }
  5047. }
  5048. return token.text;
  5049. }
  5050. }, {
  5051. key: 'parseMaybeLibID',
  5052. value: function parseMaybeLibID() {
  5053. var token = this.getToken();
  5054. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5055. throw _syntaxErrorFactory.SyntaxErrorFactory.id_missing(token);
  5056. }
  5057. this.pos++;
  5058. return token.text;
  5059. }
  5060. }, {
  5061. key: 'parseType',
  5062. value: function parseType() {
  5063. var token = this.getToken();
  5064. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5065. return _types.Types.VOID;
  5066. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5067. this.pos++;
  5068. return _types.Types.VOID;
  5069. } else if (this.isVariableType(token)) {
  5070. this.pos++;
  5071. switch (token.type) {
  5072. case this.lexerClass.RK_INTEGER:
  5073. return _types.Types.INTEGER;
  5074. case this.lexerClass.RK_BOOLEAN:
  5075. return _types.Types.BOOLEAN;
  5076. case this.lexerClass.RK_REAL:
  5077. return _types.Types.REAL;
  5078. case this.lexerClass.RK_STRING:
  5079. return _types.Types.STRING;
  5080. default:
  5081. break;
  5082. }
  5083. }
  5084. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_type(this.getTypeArray(), token);
  5085. }
  5086. }, {
  5087. key: 'parseCommandBlock',
  5088. value: function parseCommandBlock() {
  5089. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5090. var variablesDecl = [];
  5091. var commands = [];
  5092. var hasOpen = false;
  5093. if (this.checkOpenCurly(optionalCurly)) {
  5094. this.pos++;
  5095. hasOpen = true;
  5096. }
  5097. this.consumeNewLines();
  5098. while (true) {
  5099. var cmd = this.parseCommand();
  5100. if (cmd === null) break;
  5101. if (cmd !== -1) {
  5102. if (cmd instanceof Array) {
  5103. variablesDecl = variablesDecl.concat(cmd);
  5104. } else {
  5105. commands.push(cmd);
  5106. }
  5107. }
  5108. }
  5109. this.consumeNewLines();
  5110. if (hasOpen) {
  5111. this.checkCloseCurly();
  5112. this.pos++;
  5113. this.consumeNewLines();
  5114. }
  5115. return new Commands.CommandBlock(variablesDecl, commands);
  5116. }
  5117. }, {
  5118. key: 'parseCommand',
  5119. value: function parseCommand() {
  5120. var token = this.getToken();
  5121. if (this.isVariableType(token)) {
  5122. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5123. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_var_declaration(token.line);
  5124. }
  5125. this.pushScope(IVProgParser.BASE);
  5126. var varType = this.parseType();
  5127. this.popScope();
  5128. var cmd = this.parseDeclaration(varType);
  5129. this.checkEOS();
  5130. this.pos++;
  5131. return cmd;
  5132. } else if (token.type === this.lexerClass.ID) {
  5133. return this.parseIDCommand();
  5134. } else if (token.type === this.lexerClass.LIB_ID) {
  5135. return this.parseIDCommand();
  5136. } else if (token.type === this.lexerClass.RK_RETURN) {
  5137. return this.parseReturn();
  5138. } else if (token.type === this.lexerClass.RK_WHILE) {
  5139. return this.parseWhile();
  5140. } else if (token.type === this.lexerClass.RK_FOR) {
  5141. return this.parseFor();
  5142. } else if (token.type === this.lexerClass.RK_BREAK) {
  5143. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5144. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5145. }
  5146. return this.parseBreak();
  5147. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5148. return this.parseSwitchCase();
  5149. } else if (token.type === this.lexerClass.RK_DO) {
  5150. return this.parseDoWhile();
  5151. } else if (token.type === this.lexerClass.RK_IF) {
  5152. return this.parseIfThenElse();
  5153. } else if (this.checkEOS(true)) {
  5154. this.pos++;
  5155. return -1;
  5156. } else {
  5157. return null;
  5158. }
  5159. }
  5160. }, {
  5161. key: 'parseSwitchCase',
  5162. value: function parseSwitchCase() {
  5163. this.pushScope(IVProgParser.BREAKABLE);
  5164. this.pos++;
  5165. this.checkOpenParenthesis();
  5166. this.pos++;
  5167. this.consumeNewLines();
  5168. var exp = this.parseExpressionOR();
  5169. this.consumeNewLines();
  5170. this.checkCloseParenthesis();
  5171. this.pos++;
  5172. this.consumeNewLines();
  5173. this.checkOpenCurly();
  5174. this.pos++;
  5175. this.consumeNewLines();
  5176. var casesList = this.parseCases();
  5177. this.consumeNewLines();
  5178. this.checkCloseCurly();
  5179. this.pos++;
  5180. this.consumeNewLines();
  5181. this.popScope();
  5182. return new Commands.Switch(exp, casesList);
  5183. }
  5184. }, {
  5185. key: 'parseDoWhile',
  5186. value: function parseDoWhile() {
  5187. this.pos++;
  5188. this.consumeNewLines();
  5189. this.pushScope(IVProgParser.BREAKABLE);
  5190. var commandsBlock = this.parseCommandBlock();
  5191. this.consumeNewLines(); //Maybe not...
  5192. var whileToken = this.getToken();
  5193. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5194. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5195. }
  5196. this.pos++;
  5197. this.checkOpenParenthesis();
  5198. this.pos++;
  5199. this.consumeNewLines();
  5200. var condition = this.parseExpressionOR();
  5201. this.consumeNewLines();
  5202. this.checkCloseParenthesis();
  5203. this.pos++;
  5204. this.checkEOS();
  5205. this.popScope();
  5206. return new Commands.DoWhile(condition, commandsBlock);
  5207. }
  5208. }, {
  5209. key: 'parseIfThenElse',
  5210. value: function parseIfThenElse() {
  5211. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5212. this.pushScope(IVProgParser.BREAKABLE);
  5213. } else {
  5214. this.pushScope(IVProgParser.COMMAND);
  5215. }
  5216. this.pos++;
  5217. this.checkOpenParenthesis();
  5218. this.pos++;
  5219. this.consumeNewLines();
  5220. var logicalExpression = this.parseExpressionOR();
  5221. this.consumeNewLines();
  5222. this.checkCloseParenthesis();
  5223. this.pos++;
  5224. this.consumeNewLines();
  5225. var cmdBlocks = this.parseCommandBlock();
  5226. var maybeElse = this.getToken();
  5227. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5228. this.pos++;
  5229. this.consumeNewLines();
  5230. var maybeIf = this.getToken();
  5231. var elseBlock = null;
  5232. if (this.checkOpenCurly(true)) {
  5233. elseBlock = this.parseCommandBlock();
  5234. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5235. elseBlock = this.parseIfThenElse();
  5236. } else {
  5237. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5238. }
  5239. return new Commands.IfThenElse(logicalExpression, cmdBlocks, elseBlock);
  5240. }
  5241. this.popScope();
  5242. return new Commands.IfThenElse(logicalExpression, cmdBlocks, null);
  5243. }
  5244. }, {
  5245. key: 'parseFor',
  5246. value: function parseFor() {
  5247. this.pushScope(IVProgParser.BREAKABLE);
  5248. this.pos++;
  5249. this.checkOpenParenthesis();
  5250. this.pos++;
  5251. this.consumeNewLines();
  5252. var attribution = this.parseForAssign();
  5253. this.consumeNewLines();
  5254. var condition = this.parseExpressionOR();
  5255. this.consumeForSemiColon();
  5256. var increment = this.parseForAssign(true);
  5257. this.checkCloseParenthesis();
  5258. this.pos++;
  5259. this.consumeNewLines();
  5260. var commandsBlock = this.parseCommandBlock();
  5261. this.popScope();
  5262. return new Commands.For(attribution, condition, increment, commandsBlock);
  5263. }
  5264. }, {
  5265. key: 'parseWhile',
  5266. value: function parseWhile() {
  5267. this.pushScope(IVProgParser.BREAKABLE);
  5268. this.pos++;
  5269. this.checkOpenParenthesis();
  5270. this.pos++;
  5271. this.consumeNewLines();
  5272. var logicalExpression = this.parseExpressionOR();
  5273. this.consumeNewLines();
  5274. this.checkCloseParenthesis();
  5275. this.pos++;
  5276. this.consumeNewLines();
  5277. var cmdBlocks = this.parseCommandBlock();
  5278. this.popScope();
  5279. return new Commands.While(logicalExpression, cmdBlocks);
  5280. }
  5281. }, {
  5282. key: 'parseBreak',
  5283. value: function parseBreak() {
  5284. this.pos++;
  5285. this.checkEOS();
  5286. this.pos++;
  5287. return new Commands.Break();
  5288. }
  5289. }, {
  5290. key: 'parseReturn',
  5291. value: function parseReturn() {
  5292. this.pos++;
  5293. var exp = null;
  5294. if (!this.checkEOS(true)) {
  5295. exp = this.parseExpressionOR();
  5296. this.checkEOS();
  5297. }
  5298. this.pos++;
  5299. return new Commands.Return(exp);
  5300. }
  5301. }, {
  5302. key: 'parseIDCommand',
  5303. value: function parseIDCommand() {
  5304. var refToken = this.getToken();
  5305. var isID = refToken.type === this.lexerClass.ID;
  5306. var id = this.parseMaybeLibID();
  5307. if (this.checkOpenBrace(true)) {
  5308. this.pos++;
  5309. var lineExpression = null;
  5310. var columnExpression = null;
  5311. this.consumeNewLines();
  5312. lineExpression = this.parseExpression();
  5313. this.consumeNewLines();
  5314. this.checkCloseBrace();
  5315. this.pos++;
  5316. if (this.checkOpenBrace(true)) {
  5317. this.pos++;
  5318. this.consumeNewLines();
  5319. columnExpression = this.parseExpression();
  5320. this.consumeNewLines();
  5321. this.checkCloseBrace();
  5322. this.pos++;
  5323. }
  5324. var equalToken = this.getToken();
  5325. if (equalToken.type !== this.lexerClass.EQUAL) {
  5326. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equalToken);
  5327. }
  5328. this.pos++;
  5329. var exp = this.parseExpressionOR();
  5330. this.checkEOS();
  5331. this.pos++;
  5332. var cmd = new Commands.ArrayIndexAssign(id, lineExpression, columnExpression, exp);
  5333. cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalToken);
  5334. return cmd;
  5335. }
  5336. var equalOrParenthesis = this.getToken();
  5337. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5338. this.pos++;
  5339. var _exp = this.parseExpressionOR();
  5340. this.checkEOS();
  5341. this.pos++;
  5342. var _cmd = new Commands.Assign(id, _exp);
  5343. _cmd.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equalOrParenthesis);
  5344. return _cmd;
  5345. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5346. var funcCall = this.parseFunctionCallCommand(id);
  5347. this.checkEOS();
  5348. this.pos++;
  5349. return funcCall;
  5350. } else if (isID) {
  5351. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_list(['=', '('], equalOrParenthesis);
  5352. } else {
  5353. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(refToken);
  5354. }
  5355. }
  5356. }, {
  5357. key: 'parseForAssign',
  5358. value: function parseForAssign() {
  5359. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5360. if (!isLast) this.consumeNewLines();
  5361. if (this.checkEOS(true)) {
  5362. return null;
  5363. }
  5364. var id = this.parseID();
  5365. var equal = this.getToken();
  5366. if (equal.type !== this.lexerClass.EQUAL) {
  5367. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one('=', equal);
  5368. }
  5369. this.pos++;
  5370. var exp = this.parseExpressionOR();
  5371. if (!isLast) {
  5372. this.consumeForSemiColon();
  5373. }
  5374. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(equal);
  5375. var cmd = new Commands.Assign(id, exp);
  5376. cmd.sourceInfo = sourceInfo;
  5377. return cmd;
  5378. }
  5379. }, {
  5380. key: 'parseCases',
  5381. value: function parseCases() {
  5382. var token = this.getToken();
  5383. if (token.type !== this.lexerClass.RK_CASE) {
  5384. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5385. }
  5386. this.pos++;
  5387. var nextToken = this.getToken();
  5388. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5389. this.pos++;
  5390. var colonToken = this.getToken();
  5391. if (colonToken.type !== this.lexerClass.COLON) {
  5392. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', colonToken);
  5393. }
  5394. this.pos++;
  5395. this.consumeNewLines();
  5396. var block = this.parseCommandBlock(true);
  5397. var defaultCase = new Commands.Case(null);
  5398. defaultCase.setCommands(block.commands);
  5399. return [defaultCase];
  5400. } else {
  5401. var exp = this.parseExpressionOR();
  5402. var _colonToken = this.getToken();
  5403. if (_colonToken.type !== this.lexerClass.COLON) {
  5404. throw _syntaxErrorFactory.SyntaxErrorFactory.token_missing_one(':', _colonToken);
  5405. }
  5406. this.pos++;
  5407. this.consumeNewLines();
  5408. var _block = this.parseCommandBlock(true);
  5409. var aCase = new Commands.Case(exp);
  5410. aCase.setCommands(_block.commands);
  5411. var caseToken = this.getToken();
  5412. if (caseToken.type === this.lexerClass.RK_CASE) {
  5413. return [aCase].concat(this.parseCases());
  5414. } else {
  5415. return [aCase];
  5416. }
  5417. }
  5418. }
  5419. /*
  5420. * Parses an Expression following the structure:
  5421. *
  5422. * EOR => EAnd ( 'or' EOR)? #expression and
  5423. *
  5424. * EOR => ENot ('and' EOR)? #expression or
  5425. *
  5426. * ENot => 'not'? ER #expression not
  5427. *
  5428. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5429. *
  5430. * E => factor ((+, -) E)? #expression
  5431. *
  5432. * factor=> term ((*, /, %) factor)?
  5433. *
  5434. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5435. **/
  5436. }, {
  5437. key: 'parseExpressionOR',
  5438. value: function parseExpressionOR() {
  5439. var exp1 = this.parseExpressionAND();
  5440. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5441. var opToken = this.getToken();
  5442. this.pos++;
  5443. var or = (0, _operators.convertFromString)('or');
  5444. this.consumeNewLines();
  5445. var exp2 = this.parseExpressionAND();
  5446. var _finalExp = new Expressions.InfixApp(or, exp1, exp2);
  5447. _finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5448. exp1 = _finalExp;
  5449. }
  5450. return exp1;
  5451. }
  5452. }, {
  5453. key: 'parseExpressionAND',
  5454. value: function parseExpressionAND() {
  5455. var exp1 = this.parseExpressionNot();
  5456. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5457. var opToken = this.getToken();
  5458. this.pos++;
  5459. var and = (0, _operators.convertFromString)('and');
  5460. this.consumeNewLines();
  5461. var exp2 = this.parseExpressionNot();
  5462. var _finalExp2 = new Expressions.InfixApp(and, exp1, exp2);
  5463. _finalExp2.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5464. exp1 = _finalExp2;
  5465. }
  5466. return exp1;
  5467. }
  5468. }, {
  5469. key: 'parseExpressionNot',
  5470. value: function parseExpressionNot() {
  5471. var maybeNotToken = this.getToken();
  5472. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5473. var opToken = this.getToken();
  5474. this.pos++;
  5475. var not = (0, _operators.convertFromString)('not');
  5476. var exp1 = this.parseExpressionRel();
  5477. finalExp = new Expressions.UnaryApp(not, exp1);
  5478. finalExp.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(opToken);
  5479. return finalExp;
  5480. } else {
  5481. return this.parseExpressionRel();
  5482. }
  5483. }
  5484. }, {
  5485. key: 'parseExpressionRel',
  5486. value: function parseExpressionRel() {
  5487. var exp1 = this.parseExpression();
  5488. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5489. var relToken = this.getToken();
  5490. this.pos++;
  5491. var rel = (0, _operators.convertFromString)(relToken.text);
  5492. var exp2 = this.parseExpression();
  5493. var _finalExp3 = new Expressions.InfixApp(rel, exp1, exp2);
  5494. _finalExp3.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(relToken);
  5495. exp1 = _finalExp3;
  5496. }
  5497. return exp1;
  5498. }
  5499. }, {
  5500. key: 'parseExpression',
  5501. value: function parseExpression() {
  5502. var factor = this.parseFactor();
  5503. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5504. var sumOpToken = this.getToken();
  5505. this.pos++;
  5506. var op = (0, _operators.convertFromString)(sumOpToken.text);
  5507. var factor2 = this.parseFactor();
  5508. var _finalExp4 = new Expressions.InfixApp(op, factor, factor2);
  5509. _finalExp4.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(sumOpToken);
  5510. factor = _finalExp4;
  5511. }
  5512. return factor;
  5513. }
  5514. }, {
  5515. key: 'parseFactor',
  5516. value: function parseFactor() {
  5517. var term = this.parseTerm();
  5518. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5519. var multOpToken = this.getToken();
  5520. this.pos++;
  5521. var op = (0, _operators.convertFromString)(multOpToken.text);
  5522. var term2 = this.parseTerm();
  5523. var _finalExp5 = new Expressions.InfixApp(op, term, term2);
  5524. _finalExp5.sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(multOpToken);
  5525. term = _finalExp5;
  5526. }
  5527. return term;
  5528. }
  5529. }, {
  5530. key: 'parseTerm',
  5531. value: function parseTerm() {
  5532. var token = this.getToken();
  5533. var sourceInfo = null;
  5534. switch (token.type) {
  5535. case this.lexerClass.SUM_OP:
  5536. this.pos++;
  5537. sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(token);
  5538. var exp = new Expressions.UnaryApp((0, _operators.convertFromString)(token.text), this.parseTerm());
  5539. exp.sourceInfo = sourceInfo;
  5540. return exp;
  5541. case this.lexerClass.INTEGER:
  5542. this.pos++;
  5543. return this.getIntLiteral(token);
  5544. case this.lexerClass.REAL:
  5545. this.pos++;
  5546. return this.getRealLiteral(token);
  5547. case this.lexerClass.STRING:
  5548. this.pos++;
  5549. return this.getStringLiteral(token);
  5550. case this.lexerClass.RK_TRUE:
  5551. case this.lexerClass.RK_FALSE:
  5552. this.pos++;
  5553. return this.getBoolLiteral(token);
  5554. case this.lexerClass.OPEN_CURLY:
  5555. return this.parseArrayLiteral();
  5556. case this.lexerClass.ID:
  5557. case this.lexerClass.LIB_ID:
  5558. return this.parseIDTerm();
  5559. case this.lexerClass.OPEN_PARENTHESIS:
  5560. return this.parseParenthesisExp();
  5561. default:
  5562. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_terminal(token);
  5563. }
  5564. }
  5565. }, {
  5566. key: 'parseIDTerm',
  5567. value: function parseIDTerm() {
  5568. var tokenA = this.getToken();
  5569. var id = this.parseMaybeLibID();
  5570. var isID = tokenA.type === this.lexerClass.ID;
  5571. if (isID && this.checkOpenBrace(true)) {
  5572. var tokenB = null;
  5573. this.pos++;
  5574. var firstIndex = this.parseExpression();
  5575. var secondIndex = null;
  5576. this.consumeNewLines();
  5577. this.checkCloseBrace();
  5578. tokenB = this.getToken();
  5579. this.pos++;
  5580. if (this.checkOpenBrace(true)) {
  5581. this.pos++;
  5582. secondIndex = this.parseExpression();
  5583. this.consumeNewLines();
  5584. this.checkCloseBrace();
  5585. tokenB = this.getToken();
  5586. this.pos++;
  5587. }
  5588. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5589. var exp = new Expressions.ArrayAccess(id, firstIndex, secondIndex);
  5590. exp.sourceInfo = sourceInfo;
  5591. return exp;
  5592. } else if (this.checkOpenParenthesis(true)) {
  5593. return this.parseFunctionCallExpression(id);
  5594. } else if (isID) {
  5595. var _sourceInfo = _sourceInfo2.SourceInfo.createSourceInfo(tokenA);
  5596. var _exp2 = new Expressions.VariableLiteral(id);
  5597. _exp2.sourceInfo = _sourceInfo;
  5598. return _exp2;
  5599. } else {
  5600. throw _syntaxErrorFactory.SyntaxErrorFactory.invalid_id_format(tokenA);
  5601. }
  5602. }
  5603. }, {
  5604. key: 'getFunctionName',
  5605. value: function getFunctionName(id) {
  5606. var name = _definedFunctions.LanguageDefinedFunction.getInternalName(id);
  5607. if (name === null) {
  5608. if (id === _definedFunctions.LanguageDefinedFunction.getMainFunctionName()) {
  5609. return null;
  5610. }
  5611. return id;
  5612. } else {
  5613. return name;
  5614. }
  5615. }
  5616. }, {
  5617. key: 'parseFunctionCallExpression',
  5618. value: function parseFunctionCallExpression(id) {
  5619. var tokenA = this.getToken(this.pos - 1);
  5620. var actualParameters = this.parseActualParameters();
  5621. var tokenB = this.getToken(this.pos - 1);
  5622. var funcName = this.getFunctionName(id);
  5623. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5624. var cmd = new Expressions.FunctionCall(funcName, actualParameters);
  5625. cmd.sourceInfo = sourceInfo;
  5626. return cmd;
  5627. }
  5628. }, {
  5629. key: 'parseFunctionCallCommand',
  5630. value: function parseFunctionCallCommand(id) {
  5631. return this.parseFunctionCallExpression(id);
  5632. }
  5633. }, {
  5634. key: 'parseParenthesisExp',
  5635. value: function parseParenthesisExp() {
  5636. this.checkOpenParenthesis();
  5637. var tokenA = this.getToken();
  5638. this.pos++;
  5639. this.consumeNewLines();
  5640. var exp = this.parseExpressionOR();
  5641. this.consumeNewLines();
  5642. this.checkCloseParenthesis();
  5643. var tokenB = this.getToken();
  5644. var sourceInfo = _sourceInfo2.SourceInfo.createSourceInfoFromList(tokenA, tokenB);
  5645. this.pos++;
  5646. exp.sourceInfo = sourceInfo;
  5647. return exp;
  5648. }
  5649. }, {
  5650. key: 'parseActualParameters',
  5651. value: function parseActualParameters() {
  5652. this.checkOpenParenthesis();
  5653. this.pos++;
  5654. if (this.checkCloseParenthesis(true)) {
  5655. this.pos++;
  5656. return [];
  5657. }
  5658. this.consumeNewLines();
  5659. var list = this.parseExpressionList();
  5660. this.consumeNewLines();
  5661. this.checkCloseParenthesis();
  5662. this.pos++;
  5663. return list;
  5664. }
  5665. }, {
  5666. key: 'parseExpressionList',
  5667. value: function parseExpressionList() {
  5668. var list = [];
  5669. while (true) {
  5670. var exp = this.parseExpressionOR();
  5671. list.push(exp);
  5672. var maybeToken = this.getToken();
  5673. if (maybeToken.type !== this.lexerClass.COMMA) {
  5674. break;
  5675. } else {
  5676. this.pos++;
  5677. this.consumeNewLines();
  5678. }
  5679. }
  5680. return list;
  5681. }
  5682. }, {
  5683. key: 'getTypeArray',
  5684. value: function getTypeArray() {
  5685. var _this = this;
  5686. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5687. return types.map(function (x) {
  5688. return _this.lexer.literalNames[x];
  5689. });
  5690. }
  5691. }]);
  5692. return IVProgParser;
  5693. }();
  5694. /***/ }),
  5695. /***/ "./js/ast/operators.js":
  5696. /*!*****************************!*\
  5697. !*** ./js/ast/operators.js ***!
  5698. \*****************************/
  5699. /*! no static exports found */
  5700. /***/ (function(module, exports, __webpack_require__) {
  5701. "use strict";
  5702. Object.defineProperty(exports, "__esModule", {
  5703. value: true
  5704. });
  5705. exports.convertFromString = convertFromString;
  5706. var Operators = exports.Operators = Object.freeze({
  5707. ADD: { ord: 0, value: "+" },
  5708. SUB: { ord: 1, value: "-" },
  5709. MULT: { ord: 2, value: '*' },
  5710. DIV: { ord: 3, value: '/' },
  5711. MOD: { ord: 4, value: '%' },
  5712. GT: { ord: 5, value: '>' },
  5713. GE: { ord: 6, value: '>=' },
  5714. LT: { ord: 7, value: '<' },
  5715. LE: { ord: 8, value: '<=' },
  5716. EQ: { ord: 9, value: '==' },
  5717. NEQ: { ord: 10, value: '!=' },
  5718. AND: { ord: 11, value: 'and' },
  5719. OR: { ord: 12, value: 'or' },
  5720. NOT: { ord: 13, value: 'not' }
  5721. });
  5722. function convertFromString(op) {
  5723. switch (op) {
  5724. case '+':
  5725. return Operators.ADD;
  5726. case '-':
  5727. return Operators.SUB;
  5728. case '*':
  5729. return Operators.MULT;
  5730. case '/':
  5731. return Operators.DIV;
  5732. case '%':
  5733. return Operators.MOD;
  5734. case '>':
  5735. return Operators.GT;
  5736. case '>=':
  5737. return Operators.GE;
  5738. case '<':
  5739. return Operators.LT;
  5740. case '<=':
  5741. return Operators.LE;
  5742. case '==':
  5743. return Operators.EQ;
  5744. case '!=':
  5745. return Operators.NEQ;
  5746. case 'and':
  5747. return Operators.AND;
  5748. case 'or':
  5749. return Operators.OR;
  5750. case 'not':
  5751. return Operators.NOT;
  5752. }
  5753. }
  5754. /***/ }),
  5755. /***/ "./js/ast/sourceInfo.js":
  5756. /*!******************************!*\
  5757. !*** ./js/ast/sourceInfo.js ***!
  5758. \******************************/
  5759. /*! no static exports found */
  5760. /***/ (function(module, exports, __webpack_require__) {
  5761. "use strict";
  5762. Object.defineProperty(exports, "__esModule", {
  5763. value: true
  5764. });
  5765. 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; }; }();
  5766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5767. var SourceInfo = exports.SourceInfo = function () {
  5768. _createClass(SourceInfo, null, [{
  5769. key: "createSourceInfo",
  5770. value: function createSourceInfo(token) {
  5771. return new SourceInfo(token.line, token.column, token.text.length);
  5772. }
  5773. }, {
  5774. key: "createSourceInfoFromList",
  5775. value: function createSourceInfoFromList(tokenA, tokenB) {
  5776. var line = tokenA.line;
  5777. var column = tokenA.column;
  5778. // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  5779. // No idea why...
  5780. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  5781. return new SourceInfo(line, column, size);
  5782. }
  5783. }]);
  5784. function SourceInfo(line, column, size) {
  5785. _classCallCheck(this, SourceInfo);
  5786. this.line = line;
  5787. this.column = column;
  5788. this.size = size;
  5789. }
  5790. return SourceInfo;
  5791. }();
  5792. /***/ }),
  5793. /***/ "./js/io/domConsole.js":
  5794. /*!*****************************!*\
  5795. !*** ./js/io/domConsole.js ***!
  5796. \*****************************/
  5797. /*! no static exports found */
  5798. /***/ (function(module, exports, __webpack_require__) {
  5799. "use strict";
  5800. Object.defineProperty(exports, "__esModule", {
  5801. value: true
  5802. });
  5803. exports.DOMConsole = undefined;
  5804. 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; }; }();
  5805. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  5806. var _jquery2 = _interopRequireDefault(_jquery);
  5807. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5808. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5809. var DOMConsole = exports.DOMConsole = function () {
  5810. _createClass(DOMConsole, null, [{
  5811. key: 'USER',
  5812. get: function get() {
  5813. return 0;
  5814. }
  5815. }, {
  5816. key: 'INFO',
  5817. get: function get() {
  5818. return 1;
  5819. }
  5820. }, {
  5821. key: 'ERR',
  5822. get: function get() {
  5823. return 2;
  5824. }
  5825. }]);
  5826. function DOMConsole(elementID) {
  5827. _classCallCheck(this, DOMConsole);
  5828. this.input = null;
  5829. this.needInput = false;
  5830. this.termDiv = null;
  5831. this.anyKey = false;
  5832. this.parent = (0, _jquery2.default)(elementID);
  5833. this.setup();
  5834. this.inputListeners = [];
  5835. }
  5836. _createClass(DOMConsole, [{
  5837. key: 'setup',
  5838. value: function setup() {
  5839. this._setupDom();
  5840. this._setupEvents();
  5841. }
  5842. }, {
  5843. key: '_setupEvents',
  5844. value: function _setupEvents() {
  5845. var _this = this;
  5846. this.input.on("keydown", function (event) {
  5847. if (!_this.needInput) {
  5848. event.preventDefault();
  5849. return;
  5850. }
  5851. var keyCode = event.which;
  5852. if (keyCode === 13 || _this.anyKey) {
  5853. var text = _this.input.val();
  5854. text = text.replace('[\n\r]+', '');
  5855. _this.notifyListeners(text);
  5856. _this.write(text);
  5857. _this.input.val("");
  5858. }
  5859. });
  5860. }
  5861. }, {
  5862. key: '_setupDom',
  5863. value: function _setupDom() {
  5864. this.termDiv = (0, _jquery2.default)("<div></div>");
  5865. this.termDiv.addClass("ivprog-term-div");
  5866. this.input = (0, _jquery2.default)('<input text="type">');
  5867. this.input.addClass("ivprog-term-input");
  5868. this.termDiv.append(this.input);
  5869. this.parent.append(this.termDiv);
  5870. }
  5871. }, {
  5872. key: 'notifyListeners',
  5873. value: function notifyListeners(text) {
  5874. this.inputListeners.forEach(function (resolve) {
  5875. return resolve(text);
  5876. });
  5877. this.inputListeners.splice(0, this.inputListeners.length);
  5878. this.hideInput();
  5879. this.anyKey = false;
  5880. }
  5881. }, {
  5882. key: 'write',
  5883. value: function write(text) {
  5884. this._appendText(text, DOMConsole.USER);
  5885. }
  5886. }, {
  5887. key: 'info',
  5888. value: function info(text) {
  5889. this._appendText(text, DOMConsole.INFO);
  5890. }
  5891. }, {
  5892. key: 'err',
  5893. value: function err(text) {
  5894. this._appendText(text, DOMConsole.ERR);
  5895. }
  5896. }, {
  5897. key: '_appendText',
  5898. value: function _appendText(text, type) {
  5899. var divClass = this.getClassForType(type);
  5900. var textDiv = (0, _jquery2.default)("<div></div>");
  5901. textDiv.addClass(divClass);
  5902. textDiv.append(text);
  5903. textDiv.insertBefore(this.input);
  5904. this.scrollTerm();
  5905. }
  5906. }, {
  5907. key: 'scrollTerm',
  5908. value: function scrollTerm() {
  5909. this.termDiv.animate({
  5910. scrollTop: this.termDiv.prop('scrollHeight')
  5911. }, 0);
  5912. }
  5913. }, {
  5914. key: 'getClassForType',
  5915. value: function getClassForType(type) {
  5916. switch (type) {
  5917. case DOMConsole.USER:
  5918. return "ivprog-term-userText";
  5919. case DOMConsole.INFO:
  5920. return "ivprog-term-info";
  5921. case DOMConsole.ERR:
  5922. return "ivprog-term-error";
  5923. }
  5924. }
  5925. }, {
  5926. key: 'dispose',
  5927. value: function dispose() {
  5928. this.parent.off();
  5929. this.input.off();
  5930. this.input = null;
  5931. this.parent.empty();
  5932. }
  5933. }, {
  5934. key: 'showInput',
  5935. value: function showInput() {
  5936. this.needInput = true;
  5937. this.input.show();
  5938. this.input.focus();
  5939. }
  5940. }, {
  5941. key: 'hideInput',
  5942. value: function hideInput() {
  5943. this.needInput = false;
  5944. this.input.hide();
  5945. }
  5946. }, {
  5947. key: 'requestInput',
  5948. value: function requestInput(callback) {
  5949. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  5950. this.inputListeners.push(callback);
  5951. this.anyKey = anyKey;
  5952. this.showInput();
  5953. }
  5954. }, {
  5955. key: 'sendOutput',
  5956. value: function sendOutput(text) {
  5957. var _this2 = this;
  5958. text.split("\n").forEach(function (t) {
  5959. t = t.replace(/\t/g, '&#9;');
  5960. _this2.write(t);
  5961. });
  5962. }
  5963. }, {
  5964. key: 'clear',
  5965. value: function clear() {
  5966. this.input.parent().children().not(this.input).remove();
  5967. this.input.val("");
  5968. }
  5969. }]);
  5970. return DOMConsole;
  5971. }();
  5972. /***/ }),
  5973. /***/ "./js/io/input.js":
  5974. /*!************************!*\
  5975. !*** ./js/io/input.js ***!
  5976. \************************/
  5977. /*! no static exports found */
  5978. /***/ (function(module, exports, __webpack_require__) {
  5979. "use strict";
  5980. Object.defineProperty(exports, "__esModule", {
  5981. value: true
  5982. });
  5983. 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; }; }();
  5984. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5985. var Input = exports.Input = function () {
  5986. function Input() {
  5987. _classCallCheck(this, Input);
  5988. }
  5989. _createClass(Input, [{
  5990. key: "requestInput",
  5991. value: function requestInput(callback) {
  5992. throw new Error("Must be implemented");
  5993. }
  5994. }]);
  5995. return Input;
  5996. }();
  5997. /***/ }),
  5998. /***/ "./js/io/output.js":
  5999. /*!*************************!*\
  6000. !*** ./js/io/output.js ***!
  6001. \*************************/
  6002. /*! no static exports found */
  6003. /***/ (function(module, exports, __webpack_require__) {
  6004. "use strict";
  6005. Object.defineProperty(exports, "__esModule", {
  6006. value: true
  6007. });
  6008. 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; }; }();
  6009. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6010. var Output = exports.Output = function () {
  6011. function Output() {
  6012. _classCallCheck(this, Output);
  6013. }
  6014. _createClass(Output, [{
  6015. key: "sendOutput",
  6016. value: function sendOutput(text) {
  6017. throw new Error("Must be implemented");
  6018. }
  6019. }]);
  6020. return Output;
  6021. }();
  6022. /***/ }),
  6023. /***/ "./js/main.js":
  6024. /*!********************!*\
  6025. !*** ./js/main.js ***!
  6026. \********************/
  6027. /*! no static exports found */
  6028. /***/ (function(module, exports, __webpack_require__) {
  6029. "use strict";
  6030. Object.defineProperty(exports, "__esModule", {
  6031. value: true
  6032. });
  6033. exports.i18n = exports.LocalizedStrings = exports.initVisualUI = exports.runner = undefined;
  6034. var _runner = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6035. var _functions = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6036. var _localizedStringsService = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6037. var _i18nHelper = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6038. var i18n = _i18nHelper.i18nHelper.i18n;
  6039. exports.runner = _runner.runner;
  6040. exports.initVisualUI = _functions.initVisualUI;
  6041. exports.LocalizedStrings = _localizedStringsService.LocalizedStrings;
  6042. exports.i18n = i18n;
  6043. /***/ }),
  6044. /***/ "./js/processor/compatibilityTable.js":
  6045. /*!********************************************!*\
  6046. !*** ./js/processor/compatibilityTable.js ***!
  6047. \********************************************/
  6048. /*! no static exports found */
  6049. /***/ (function(module, exports, __webpack_require__) {
  6050. "use strict";
  6051. Object.defineProperty(exports, "__esModule", {
  6052. value: true
  6053. });
  6054. exports.resultTypeAfterInfixOp = resultTypeAfterInfixOp;
  6055. exports.resultTypeAfterUnaryOp = resultTypeAfterUnaryOp;
  6056. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6057. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6058. var _multiType = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6059. function buildInfixAddTable() {
  6060. var table = [[], [], [], []];
  6061. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6062. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6063. table[_types.Types.INTEGER.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6064. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6065. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6066. table[_types.Types.REAL.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6067. table[_types.Types.STRING.ord][_types.Types.INTEGER.ord] = _types.Types.STRING;
  6068. table[_types.Types.STRING.ord][_types.Types.REAL.ord] = _types.Types.STRING;
  6069. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.STRING;
  6070. table[_types.Types.STRING.ord][_types.Types.BOOLEAN.ord] = _types.Types.STRING;
  6071. return table;
  6072. }
  6073. function buildInfixMultiDivSubTable() {
  6074. var table = [[], [], [], []];
  6075. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6076. table[_types.Types.INTEGER.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6077. table[_types.Types.REAL.ord][_types.Types.INTEGER.ord] = _types.Types.REAL;
  6078. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.REAL;
  6079. return table;
  6080. }
  6081. function buildInfixEqualityInequalityTable() {
  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.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6086. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6087. return table;
  6088. }
  6089. function buildInfixRelationalTable() {
  6090. var table = [[], [], [], []];
  6091. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.BOOLEAN;
  6092. table[_types.Types.REAL.ord][_types.Types.REAL.ord] = _types.Types.BOOLEAN;
  6093. table[_types.Types.STRING.ord][_types.Types.STRING.ord] = _types.Types.BOOLEAN;
  6094. return table;
  6095. }
  6096. function buildInfixAndOrTable() {
  6097. var table = [[], [], [], []];
  6098. table[_types.Types.BOOLEAN.ord][_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6099. return table;
  6100. }
  6101. function buildInfixModTable() {
  6102. var table = [[], [], [], []];
  6103. table[_types.Types.INTEGER.ord][_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6104. return table;
  6105. }
  6106. function buildUnarySumSubList() {
  6107. var list = [];
  6108. list[_types.Types.INTEGER.ord] = _types.Types.INTEGER;
  6109. list[_types.Types.REAL.ord] = _types.Types.REAL;
  6110. return list;
  6111. }
  6112. function buildUnaryNegList() {
  6113. var list = [];
  6114. list[_types.Types.BOOLEAN.ord] = _types.Types.BOOLEAN;
  6115. return list;
  6116. }
  6117. function buildInfixCompatibilityTable() {
  6118. var compatibilityMap = new WeakMap();
  6119. compatibilityMap.set(_operators.Operators.ADD, buildInfixAddTable());
  6120. compatibilityMap.set(_operators.Operators.SUB, buildInfixMultiDivSubTable());
  6121. compatibilityMap.set(_operators.Operators.MULT, buildInfixMultiDivSubTable());
  6122. compatibilityMap.set(_operators.Operators.DIV, buildInfixMultiDivSubTable());
  6123. compatibilityMap.set(_operators.Operators.EQ, buildInfixEqualityInequalityTable());
  6124. compatibilityMap.set(_operators.Operators.NEQ, buildInfixEqualityInequalityTable());
  6125. compatibilityMap.set(_operators.Operators.GE, buildInfixRelationalTable());
  6126. compatibilityMap.set(_operators.Operators.GT, buildInfixRelationalTable());
  6127. compatibilityMap.set(_operators.Operators.LE, buildInfixRelationalTable());
  6128. compatibilityMap.set(_operators.Operators.LT, buildInfixRelationalTable());
  6129. compatibilityMap.set(_operators.Operators.OR, buildInfixAndOrTable());
  6130. compatibilityMap.set(_operators.Operators.AND, buildInfixAndOrTable());
  6131. compatibilityMap.set(_operators.Operators.MOD, buildInfixModTable());
  6132. return compatibilityMap;
  6133. }
  6134. function buildUnaryCompatibilityTable() {
  6135. var compatibilityMap = new WeakMap();
  6136. compatibilityMap.set(_operators.Operators.ADD, buildUnarySumSubList());
  6137. compatibilityMap.set(_operators.Operators.SUB, buildUnarySumSubList());
  6138. compatibilityMap.set(_operators.Operators.NOT, buildUnaryNegList());
  6139. return compatibilityMap;
  6140. }
  6141. var infixMap = buildInfixCompatibilityTable();
  6142. var unaryMap = buildUnaryCompatibilityTable();
  6143. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6144. try {
  6145. if (leftExpressionType instanceof _multiType.MultiType && rightExpressionType instanceof _multiType.MultiType) {
  6146. var newMulti = [];
  6147. for (var i = 0; i < leftExpressionType.types.length; i++) {
  6148. var element = leftExpressionType.types[i];
  6149. if (rightExpressionType.types.indexOf(element) !== -1) {
  6150. newMulti.push(element);
  6151. }
  6152. }
  6153. if (newMulti.length <= 0) {
  6154. return _types.Types.UNDEFINED;
  6155. } else {
  6156. return new _multiType.MultiType(newMulti);
  6157. }
  6158. } else if (leftExpressionType instanceof _multiType.MultiType) {
  6159. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6160. return rightExpressionType;
  6161. } else {
  6162. return _types.Types.UNDEFINED;
  6163. }
  6164. } else if (rightExpressionType instanceof _multiType.MultiType) {
  6165. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6166. return leftExpressionType;
  6167. } else {
  6168. return _types.Types.UNDEFINED;
  6169. }
  6170. }
  6171. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6172. if (resultType === null || resultType === undefined) {
  6173. return _types.Types.UNDEFINED;
  6174. }
  6175. return resultType;
  6176. } catch (e) {
  6177. if (e instanceof TypeError) {
  6178. return _types.Types.UNDEFINED;
  6179. } else {
  6180. throw e;
  6181. }
  6182. }
  6183. }
  6184. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6185. try {
  6186. if (leftExpressionType instanceof _multiType.MultiType) {
  6187. return leftExpressionType;
  6188. }
  6189. return unaryMap.get(operator)[leftExpressionType.ord];
  6190. } catch (e) {
  6191. if (e instanceof TypeError) {
  6192. return _types.Types.UNDEFINED;
  6193. } else {
  6194. throw e;
  6195. }
  6196. }
  6197. }
  6198. /***/ }),
  6199. /***/ "./js/processor/context.js":
  6200. /*!*********************************!*\
  6201. !*** ./js/processor/context.js ***!
  6202. \*********************************/
  6203. /*! no static exports found */
  6204. /***/ (function(module, exports, __webpack_require__) {
  6205. "use strict";
  6206. Object.defineProperty(exports, "__esModule", {
  6207. value: true
  6208. });
  6209. var Context = exports.Context = Object.freeze({
  6210. BASE: Symbol('context:base'),
  6211. BREAKABLE: Symbol('context:breakable'),
  6212. FUNCTION: Symbol('context:function')
  6213. });
  6214. /***/ }),
  6215. /***/ "./js/processor/definedFunctions.js":
  6216. /*!******************************************!*\
  6217. !*** ./js/processor/definedFunctions.js ***!
  6218. \******************************************/
  6219. /*! no static exports found */
  6220. /***/ (function(module, exports, __webpack_require__) {
  6221. "use strict";
  6222. Object.defineProperty(exports, "__esModule", {
  6223. value: true
  6224. });
  6225. exports.LanguageDefinedFunction = undefined;
  6226. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6227. var _io = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6228. var _strings = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6229. var _arrays = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6230. var _lang = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6231. var _math = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6232. function valueToKey(value, object) {
  6233. for (var key in object) {
  6234. if (object.hasOwnProperty(key)) {
  6235. if (object[key] === value) {
  6236. return key;
  6237. }
  6238. }
  6239. }
  6240. return null;
  6241. }
  6242. function concatObjects() {
  6243. var result = {};
  6244. for (var _len = arguments.length, objs = Array(_len), _key = 0; _key < _len; _key++) {
  6245. objs[_key] = arguments[_key];
  6246. }
  6247. for (var i = 0; i < objs.length; i++) {
  6248. var obj = objs[i];
  6249. for (var key in obj) {
  6250. if (obj.hasOwnProperty(key)) {
  6251. result[key] = obj[key];
  6252. }
  6253. }
  6254. }
  6255. return result;
  6256. }
  6257. var libsObject = {
  6258. $mathLib: {
  6259. $sin: (0, _math.createSinFun)(),
  6260. $cos: (0, _math.createCosFun)(),
  6261. $tan: (0, _math.createTanFun)(),
  6262. $sqrt: (0, _math.createSqrtFun)(),
  6263. $pow: (0, _math.createPowFun)(),
  6264. $log: (0, _math.createLogFun)(),
  6265. $abs: (0, _math.createAbsFun)(),
  6266. $negate: (0, _math.createNegateFun)(),
  6267. $invert: (0, _math.createInvertFun)(),
  6268. $max: (0, _math.createMaxFun)(),
  6269. $min: (0, _math.createMinFun)()
  6270. },
  6271. $ioLib: {
  6272. $read: (0, _io.createInputFun)(),
  6273. $write: (0, _io.createOutputFun)()
  6274. },
  6275. $strLib: {
  6276. $substring: (0, _strings.createSubstringFun)(),
  6277. $length: (0, _strings.createLengthFun)(),
  6278. $uppercase: (0, _strings.createUppercaseFun)(),
  6279. $lowercase: (0, _strings.createLowercaseFun)(),
  6280. $charAt: (0, _strings.createrCharAtFun)()
  6281. },
  6282. $arrayLib: {
  6283. $numElements: (0, _arrays.createNumElementsFun)(),
  6284. $matrixLines: (0, _arrays.createMatrixLinesFun)(),
  6285. $matrixColumns: (0, _arrays.createMatrixColumnsFun)()
  6286. },
  6287. $langLib: {
  6288. $isReal: (0, _lang.createIsRealFun)(),
  6289. $isInt: (0, _lang.createIsIntFun)(),
  6290. $isBool: (0, _lang.createIsBoolFun)(),
  6291. $castReal: (0, _lang.createCastRealFun)(),
  6292. $castInt: (0, _lang.createCastIntFun)(),
  6293. $castBool: (0, _lang.createCastBoolFun)(),
  6294. $castString: (0, _lang.createCastStringFun)()
  6295. }
  6296. };
  6297. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6298. var LanguageDefinedFunction = exports.LanguageDefinedFunction = Object.freeze({
  6299. getMainFunctionName: function getMainFunctionName() {
  6300. return _languageService.LanguageService.getCurrentLangFuncs().main_function;
  6301. },
  6302. getInternalName: function getInternalName(localName) {
  6303. if (localName.indexOf(".") !== -1) {
  6304. var names = localName.split(".");
  6305. var lib = valueToKey(names[0], _languageService.LanguageService.getCurrentLangLibs());
  6306. var internalName = valueToKey(names[1], _languageService.LanguageService.getCurrentLangFuncs());
  6307. if (lib === null || internalName === null) {
  6308. return null;
  6309. }
  6310. return lib + "." + internalName;
  6311. }
  6312. var funcName = valueToKey(localName, _languageService.LanguageService.getCurrentLangFuncs());
  6313. if (funcName !== null) {
  6314. if (funcsObject[funcName]) {
  6315. return funcName;
  6316. }
  6317. }
  6318. return null;
  6319. },
  6320. getFunction: function getFunction(internalName) {
  6321. if (internalName.indexOf(".") !== -1) {
  6322. var names = internalName.split(".");
  6323. var libName = names[0];
  6324. var funName = names[1];
  6325. return libsObject[libName][funName];
  6326. }
  6327. return funcsObject[internalName];
  6328. },
  6329. getLocalName: function getLocalName(internalName) {
  6330. if (internalName.indexOf(".") !== -1) {
  6331. var names = internalName.split(".");
  6332. var libName = _languageService.LanguageService.getCurrentLangLibs()[names[0]];
  6333. var funName = _languageService.LanguageService.getCurrentLangFuncs()[names[1]];
  6334. return libName + '.' + funName;
  6335. } else if (_languageService.LanguageService.getCurrentLangFuncs()[internalName]) {
  6336. return _languageService.LanguageService.getCurrentLangFuncs()[internalName];
  6337. } else {
  6338. return internalName;
  6339. }
  6340. }
  6341. });
  6342. /***/ }),
  6343. /***/ "./js/processor/error/processorErrorFactory.js":
  6344. /*!*****************************************************!*\
  6345. !*** ./js/processor/error/processorErrorFactory.js ***!
  6346. \*****************************************************/
  6347. /*! no static exports found */
  6348. /***/ (function(module, exports, __webpack_require__) {
  6349. "use strict";
  6350. Object.defineProperty(exports, "__esModule", {
  6351. value: true
  6352. });
  6353. exports.ProcessorErrorFactory = undefined;
  6354. var _runtimeError = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6355. var _semanticError = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6356. var _localizedStringsService = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6357. var _operators = __webpack_require__(/*! ../../ast/operators */ "./js/ast/operators.js");
  6358. function translateType(type, dim) {
  6359. switch (dim) {
  6360. case 0:
  6361. return _localizedStringsService.LocalizedStrings.getUI(type);
  6362. default:
  6363. var transType = _localizedStringsService.LocalizedStrings.getUI(type);
  6364. if (dim === 1) return _localizedStringsService.LocalizedStrings.getUI("vector_string", [transType]);else return _localizedStringsService.LocalizedStrings.getUI("matrix_string", [transType]);
  6365. }
  6366. }
  6367. function translateOp(op) {
  6368. switch (op.ord) {
  6369. case _operators.Operators.AND.ord:
  6370. case _operators.Operators.OR.ord:
  6371. case _operators.Operators.NOT.ord:
  6372. return _localizedStringsService.LocalizedStrings.getUI(op.value);
  6373. default:
  6374. return op.value;
  6375. }
  6376. }
  6377. var ProcessorErrorFactory = exports.ProcessorErrorFactory = Object.freeze({
  6378. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6379. if (sourceInfo) {
  6380. var context = [id, sourceInfo.line, sourceInfo.column];
  6381. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found_full", context));
  6382. } else {
  6383. return ProcessorErrorFactory.symbol_not_found(id);
  6384. }
  6385. },
  6386. symbol_not_found: function symbol_not_found(id) {
  6387. var context = [id];
  6388. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("symbol_not_found", context));
  6389. },
  6390. function_missing_full: function function_missing_full(id, sourceInfo) {
  6391. if (sourceInfo) {
  6392. var context = [id, sourceInfo.line, sourceInfo.column];
  6393. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing_full", context));
  6394. } else {
  6395. return ProcessorErrorFactory.function_missing(id);
  6396. }
  6397. },
  6398. function_missing: function function_missing(id) {
  6399. var context = [id];
  6400. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_missing", context));
  6401. },
  6402. main_missing: function main_missing() {
  6403. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("main_missing"));
  6404. }, // TODO: better urgent error message
  6405. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6406. if (sourceInfo) {
  6407. var context = [sourceInfo.line];
  6408. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int_full", context));
  6409. } else {
  6410. return ProcessorErrorFactory.array_dimension_not_int();
  6411. }
  6412. },
  6413. array_dimension_not_int: function array_dimension_not_int() {
  6414. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_int"));
  6415. },
  6416. unknown_command_full: function unknown_command_full(sourceInfo) {
  6417. if (sourceInfo) {
  6418. var context = [sourceInfo.line];
  6419. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command_full", context));
  6420. } else {
  6421. return ProcessorErrorFactory.unknown_command();
  6422. }
  6423. },
  6424. unknown_command: function unknown_command() {
  6425. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unknown_command"));
  6426. },
  6427. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6428. if (sourceInfo) {
  6429. var context = [translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6430. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_full", context));
  6431. } else {
  6432. return ProcessorErrorFactory.incompatible_types(type, dim);
  6433. }
  6434. },
  6435. incompatible_types: function incompatible_types(type, dim) {
  6436. var context = [translateType(type, dim)];
  6437. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types", context));
  6438. },
  6439. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6440. if (sourceInfo) {
  6441. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6442. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array_full", context));
  6443. } else {
  6444. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6445. }
  6446. },
  6447. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6448. var context = [exp, translateType(type, dim)];
  6449. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("incompatible_types_array", context));
  6450. },
  6451. loop_condition_type_full: function loop_condition_type_full(sourceInfo) {
  6452. if (sourceInfo) {
  6453. var context = [sourceInfo.line, sourceInfo.column];
  6454. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type_full", context));
  6455. } else {
  6456. return ProcessorErrorFactory.loop_condition_type();
  6457. }
  6458. },
  6459. loop_condition_type: function loop_condition_type() {
  6460. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("loop_condition_type"));
  6461. },
  6462. endless_loop_full: function endless_loop_full(sourceInfo) {
  6463. if (sourceInfo) {
  6464. var context = [sourceInfo.line];
  6465. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop_full", context));
  6466. } else {
  6467. return ProcessorErrorFactory.endless_loop();
  6468. }
  6469. },
  6470. endless_loop: function endless_loop() {
  6471. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("endless_loop"));
  6472. },
  6473. for_condition_type_full: function for_condition_type_full(sourceInfo) {
  6474. if (sourceInfo) {
  6475. var context = [sourceInfo.line, sourceInfo.column];
  6476. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type_full", context));
  6477. } else {
  6478. return ProcessorErrorFactory.for_condition_type();
  6479. }
  6480. },
  6481. for_condition_type: function for_condition_type() {
  6482. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("for_condition_type"));
  6483. },
  6484. if_condition_type_full: function if_condition_type_full(sourceInfo) {
  6485. if (sourceInfo) {
  6486. var context = [sourceInfo.line, sourceInfo.column];
  6487. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type_full", context));
  6488. } else {
  6489. return ProcessorErrorFactory.if_condition_type();
  6490. }
  6491. },
  6492. if_condition_type: function if_condition_type() {
  6493. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("if_condition_type"));
  6494. },
  6495. invalid_global_var: function invalid_global_var() {
  6496. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_global_var"));
  6497. },
  6498. not_implemented: function not_implemented(id) {
  6499. var context = [id];
  6500. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("not_implemented", context));
  6501. },
  6502. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6503. if (sourceInfo) {
  6504. var context = [exp, translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6505. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type_full", context));
  6506. } else {
  6507. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6508. }
  6509. },
  6510. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6511. var context = [exp, translateType(type, dim)];
  6512. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_case_type", context));
  6513. },
  6514. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6515. if (sourceInfo) {
  6516. var context = [sourceInfo.line, sourceInfo.column, id];
  6517. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression_full", context));
  6518. } else {
  6519. return ProcessorErrorFactory.void_in_expression(id);
  6520. }
  6521. },
  6522. void_in_expression: function void_in_expression(id) {
  6523. var context = [id];
  6524. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("void_in_expression", context));
  6525. },
  6526. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6527. if (sourceInfo) {
  6528. var context = [id, sourceInfo.line, sourceInfo.column];
  6529. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access_full", context));
  6530. } else {
  6531. return ProcessorErrorFactory.invalid_array_access(id);
  6532. }
  6533. },
  6534. invalid_array_access: function invalid_array_access(id) {
  6535. var context = [id];
  6536. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_array_access", context));
  6537. },
  6538. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6539. if (sourceInfo) {
  6540. var context = [id, sourceInfo.line, sourceInfo.column];
  6541. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access_full", context));
  6542. } else {
  6543. return ProcessorErrorFactory.invalid_matrix_access(id);
  6544. }
  6545. },
  6546. invalid_matrix_access: function invalid_matrix_access(id) {
  6547. var context = [id];
  6548. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_matrix_access", context));
  6549. },
  6550. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6551. if (sourceInfo) {
  6552. var context = [sourceInfo.line, value, id, columns];
  6553. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6554. } else {
  6555. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6556. }
  6557. },
  6558. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6559. var context = [value, id, columns];
  6560. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_column_outbounds", context));
  6561. },
  6562. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6563. if (sourceInfo) {
  6564. var context = [sourceInfo.line, value, id, lines];
  6565. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6566. } else {
  6567. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6568. }
  6569. },
  6570. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6571. var context = [value, id, lines];
  6572. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("matrix_line_outbounds", context));
  6573. },
  6574. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6575. if (sourceInfo) {
  6576. var context = [sourceInfo.line, value, id, lines];
  6577. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds_full", context));
  6578. } else {
  6579. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6580. }
  6581. },
  6582. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6583. var context = [value, id, lines];
  6584. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_line_outbounds", context));
  6585. },
  6586. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6587. if (sourceInfo) {
  6588. var context = [sourceInfo.line, id];
  6589. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix_full", context));
  6590. } else {
  6591. return ProcessorErrorFactory.vector_not_matrix(id);
  6592. }
  6593. },
  6594. vector_not_matrix: function vector_not_matrix(id) {
  6595. var context = [id];
  6596. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("vector_not_matrix", context));
  6597. },
  6598. function_no_return: function function_no_return(id) {
  6599. var context = [id];
  6600. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("function_no_return", context));
  6601. },
  6602. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6603. if (sourceInfo) {
  6604. var context = [sourceInfo.line, id, translateType(type, dim)];
  6605. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6606. } else {
  6607. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6608. }
  6609. },
  6610. invalid_void_return: function invalid_void_return(id, type, dim) {
  6611. var context = [id, translateType(type, dim)];
  6612. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_void_return_full", context));
  6613. },
  6614. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6615. if (sourceInfo) {
  6616. var context = [sourceInfo.line, id, translateType(type, dim)];
  6617. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type_full", context));
  6618. } else {
  6619. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6620. }
  6621. },
  6622. invalid_return_type: function invalid_return_type(id, type, dim) {
  6623. var context = [id, translateType(type, dim)];
  6624. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_return_type", context));
  6625. },
  6626. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6627. if (sourceInfo) {
  6628. var context = [sourceInfo.line, id, expected, actual];
  6629. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size_full", context));
  6630. } else {
  6631. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6632. }
  6633. },
  6634. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6635. var context = [id, expected, actual];
  6636. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameters_size", context));
  6637. },
  6638. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6639. if (sourceInfo) {
  6640. var context = [exp, id, sourceInfo.line];
  6641. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6642. } else {
  6643. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6644. }
  6645. },
  6646. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6647. var context = [exp, id];
  6648. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_parameter_type_full", context));
  6649. },
  6650. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6651. if (sourceInfo) {
  6652. var context = [exp, id, sourceInfo.line];
  6653. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref_full", context));
  6654. } else {
  6655. return ProcessorErrorFactory.invalid_ref(id, exp);
  6656. }
  6657. },
  6658. invalid_ref: function invalid_ref(id, exp) {
  6659. var context = [exp, id];
  6660. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("invalid_ref", context));
  6661. },
  6662. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6663. if (sourceInfo) {
  6664. var context = [sourceInfo.line];
  6665. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command_full", context));
  6666. } else {
  6667. return ProcessorErrorFactory.unexpected_break_command();
  6668. }
  6669. },
  6670. unexpected_break_command: function unexpected_break_command() {
  6671. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("unexpected_break_command"));
  6672. },
  6673. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6674. if (sourceInfo) {
  6675. var context = [sourceInfo.line, exp];
  6676. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6677. } else {
  6678. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6679. }
  6680. },
  6681. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6682. var context = [exp];
  6683. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_type", context));
  6684. },
  6685. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6686. if (sourceInfo) {
  6687. var context = [sourceInfo.line, expected, actual];
  6688. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6689. } else {
  6690. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6691. }
  6692. },
  6693. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6694. var context = [expected, actual];
  6695. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_line", context));
  6696. },
  6697. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6698. if (sourceInfo) {
  6699. var context = [sourceInfo.line, expected, actual];
  6700. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6701. } else {
  6702. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6703. }
  6704. },
  6705. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6706. var context = [expected, actual];
  6707. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_array_literal_column", context));
  6708. },
  6709. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6710. if (sourceInfo) {
  6711. var context = [sourceInfo.line, translateOp(opName), translateType(type, dim)];
  6712. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op_full", context));
  6713. } else {
  6714. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6715. }
  6716. },
  6717. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6718. var context = [translateOp(opName), translateType(type, dim)];
  6719. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_unary_op", context));
  6720. },
  6721. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6722. if (sourceInfo) {
  6723. var context = [sourceInfo.line, translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6724. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op_full", context));
  6725. } else {
  6726. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6727. }
  6728. },
  6729. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6730. var context = [translateOp(opName), translateType(typeLeft, dimLeft), translateType(typeRight, dimRight)];
  6731. return new _runtimeError.RuntimeError(_localizedStringsService.LocalizedStrings.getError("invalid_infix_op", context));
  6732. },
  6733. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6734. if (sourceInfo) {
  6735. var context = [sourceInfo.line];
  6736. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6737. } else {
  6738. return ProcessorErrorFactory.array_dimension_not_positive();
  6739. }
  6740. },
  6741. array_dimension_not_positive: function array_dimension_not_positive() {
  6742. return new _semanticError.SemanticError(_localizedStringsService.LocalizedStrings.getError("array_dimension_not_positive"));
  6743. }
  6744. });
  6745. /***/ }),
  6746. /***/ "./js/processor/error/runtimeError.js":
  6747. /*!********************************************!*\
  6748. !*** ./js/processor/error/runtimeError.js ***!
  6749. \********************************************/
  6750. /*! no static exports found */
  6751. /***/ (function(module, exports, __webpack_require__) {
  6752. "use strict";
  6753. Object.defineProperty(exports, "__esModule", {
  6754. value: true
  6755. });
  6756. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6757. 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; }
  6758. 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; }
  6759. var RuntimeError = exports.RuntimeError = function (_Error) {
  6760. _inherits(RuntimeError, _Error);
  6761. function RuntimeError() {
  6762. var _ref;
  6763. _classCallCheck(this, RuntimeError);
  6764. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6765. msg[_key] = arguments[_key];
  6766. }
  6767. var _this = _possibleConstructorReturn(this, (_ref = RuntimeError.__proto__ || Object.getPrototypeOf(RuntimeError)).call.apply(_ref, [this].concat(msg)));
  6768. if (Error.captureStackTrace) Error.captureStackTrace(_this, RuntimeError);
  6769. return _this;
  6770. }
  6771. return RuntimeError;
  6772. }(Error);
  6773. /***/ }),
  6774. /***/ "./js/processor/error/semanticError.js":
  6775. /*!*********************************************!*\
  6776. !*** ./js/processor/error/semanticError.js ***!
  6777. \*********************************************/
  6778. /*! no static exports found */
  6779. /***/ (function(module, exports, __webpack_require__) {
  6780. "use strict";
  6781. Object.defineProperty(exports, "__esModule", {
  6782. value: true
  6783. });
  6784. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6785. 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; }
  6786. 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; }
  6787. var SemanticError = exports.SemanticError = function (_Error) {
  6788. _inherits(SemanticError, _Error);
  6789. function SemanticError() {
  6790. var _ref;
  6791. _classCallCheck(this, SemanticError);
  6792. for (var _len = arguments.length, msg = Array(_len), _key = 0; _key < _len; _key++) {
  6793. msg[_key] = arguments[_key];
  6794. }
  6795. var _this = _possibleConstructorReturn(this, (_ref = SemanticError.__proto__ || Object.getPrototypeOf(SemanticError)).call.apply(_ref, [this].concat(msg)));
  6796. if (Error.captureStackTrace) Error.captureStackTrace(_this, SemanticError);
  6797. return _this;
  6798. }
  6799. return SemanticError;
  6800. }(Error);
  6801. /***/ }),
  6802. /***/ "./js/processor/ivprogProcessor.js":
  6803. /*!*****************************************!*\
  6804. !*** ./js/processor/ivprogProcessor.js ***!
  6805. \*****************************************/
  6806. /*! no static exports found */
  6807. /***/ (function(module, exports, __webpack_require__) {
  6808. "use strict";
  6809. Object.defineProperty(exports, "__esModule", {
  6810. value: true
  6811. });
  6812. exports.IVProgProcessor = undefined;
  6813. 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; }; }();
  6814. var _store = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  6815. var _storeObject = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  6816. var _storeObjectArray = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  6817. var _storeObjectRef = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  6818. var _modes = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  6819. var _context = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  6820. var _types = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6821. var _operators = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6822. var _definedFunctions = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  6823. var _compatibilityTable = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  6824. var _commands = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  6825. var Commands = _interopRequireWildcard(_commands);
  6826. var _expressions = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  6827. var Expressions = _interopRequireWildcard(_expressions);
  6828. var _storeObjectArrayAddress = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  6829. var _storeObjectArrayAddressRef = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  6830. var _compoundType = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  6831. var _parsers = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  6832. var _config = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6833. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  6834. var _decimal2 = _interopRequireDefault(_decimal);
  6835. var _processorErrorFactory = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  6836. var _runtimeError = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  6837. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  6838. 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; } }
  6839. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6840. var IVProgProcessor = exports.IVProgProcessor = function () {
  6841. _createClass(IVProgProcessor, null, [{
  6842. key: 'LOOP_TIMEOUT',
  6843. get: function get() {
  6844. return _config.Config.loopTimeout;
  6845. },
  6846. set: function set(ms) {
  6847. _config.Config.setConfig({ loopTimeout: ms });
  6848. }
  6849. }, {
  6850. key: 'MAIN_INTERNAL_ID',
  6851. get: function get() {
  6852. return "$main";
  6853. }
  6854. }]);
  6855. function IVProgProcessor(ast) {
  6856. _classCallCheck(this, IVProgProcessor);
  6857. this.ast = ast;
  6858. this.globalStore = new _store.Store("$global");
  6859. this.stores = [this.globalStore];
  6860. this.context = [_context.Context.BASE];
  6861. this.input = null;
  6862. this.forceKill = false;
  6863. this.loopTimers = [];
  6864. this.output = null;
  6865. }
  6866. _createClass(IVProgProcessor, [{
  6867. key: 'registerInput',
  6868. value: function registerInput(input) {
  6869. if (this.input !== null) this.input = null;
  6870. this.input = input;
  6871. }
  6872. }, {
  6873. key: 'registerOutput',
  6874. value: function registerOutput(output) {
  6875. if (this.output !== null) this.output = null;
  6876. this.output = output;
  6877. }
  6878. }, {
  6879. key: 'checkContext',
  6880. value: function checkContext(context) {
  6881. return this.context[this.context.length - 1] === context;
  6882. }
  6883. }, {
  6884. key: 'ignoreSwitchCases',
  6885. value: function ignoreSwitchCases(store) {
  6886. if (store.mode === _modes.Modes.RETURN) {
  6887. return true;
  6888. } else if (store.mode === _modes.Modes.BREAK) {
  6889. return true;
  6890. } else {
  6891. return false;
  6892. }
  6893. }
  6894. }, {
  6895. key: 'prepareState',
  6896. value: function prepareState() {
  6897. if (this.stores !== null) {
  6898. for (var i = 0; i < this.stores.length; i++) {
  6899. delete this.stores[i];
  6900. }
  6901. this.stores = null;
  6902. }
  6903. if (this.globalStore !== null) this.globalStore = null;
  6904. this.globalStore = new _store.Store("$global");
  6905. this.stores = [this.globalStore];
  6906. this.context = [_context.Context.BASE];
  6907. }
  6908. }, {
  6909. key: 'interpretAST',
  6910. value: function interpretAST() {
  6911. this.prepareState();
  6912. this.initGlobal();
  6913. var mainFunc = this.findMainFunction();
  6914. if (mainFunc === null) {
  6915. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  6916. }
  6917. return this.runFunction(mainFunc, [], this.globalStore);
  6918. }
  6919. }, {
  6920. key: 'initGlobal',
  6921. value: function initGlobal() {
  6922. var _this = this;
  6923. if (!this.checkContext(_context.Context.BASE)) {
  6924. throw _processorErrorFactory.ProcessorErrorFactory.invalid_global_var();
  6925. }
  6926. this.ast.global.forEach(function (decl) {
  6927. _this.executeCommand(_this.globalStore, decl).then(function (sto) {
  6928. return _this.globalStore = sto;
  6929. });
  6930. });
  6931. }
  6932. }, {
  6933. key: 'findMainFunction',
  6934. value: function findMainFunction() {
  6935. return this.ast.functions.find(function (v) {
  6936. return v.isMain;
  6937. });
  6938. }
  6939. }, {
  6940. key: 'findFunction',
  6941. value: function findFunction(name) {
  6942. if (name.match(/^\$.+$/)) {
  6943. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  6944. if (!!!fun) {
  6945. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  6946. }
  6947. return fun;
  6948. } else {
  6949. var val = this.ast.functions.find(function (v) {
  6950. return v.name === name;
  6951. });
  6952. if (!!!val) {
  6953. // TODO: better error message;
  6954. throw _processorErrorFactory.ProcessorErrorFactory.function_missing(name);
  6955. }
  6956. return val;
  6957. }
  6958. }
  6959. }, {
  6960. key: 'runFunction',
  6961. value: function runFunction(func, actualParameters, store) {
  6962. var _this2 = this;
  6963. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  6964. var funcStore = new _store.Store(funcName);
  6965. funcStore.extendStore(this.globalStore);
  6966. var returnStoreObject = null;
  6967. if (func.returnType instanceof _compoundType.CompoundType) {
  6968. if (func.returnType.dimensions > 1) {
  6969. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, -1, [[]]);
  6970. } else {
  6971. returnStoreObject = new _storeObjectArray.StoreObjectArray(func.returnType, -1, null, []);
  6972. }
  6973. } else {
  6974. returnStoreObject = new _storeObject.StoreObject(func.returnType, null);
  6975. }
  6976. funcStore.insertStore('$', returnStoreObject);
  6977. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  6978. return newFuncStore$.then(function (sto) {
  6979. _this2.context.push(_context.Context.FUNCTION);
  6980. _this2.stores.push(sto);
  6981. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  6982. return _this2.executeCommands(stoWithVars, func.commands);
  6983. }).then(function (finalSto) {
  6984. _this2.stores.pop();
  6985. _this2.context.pop();
  6986. return finalSto;
  6987. });
  6988. });
  6989. }
  6990. }, {
  6991. key: 'associateParameters',
  6992. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  6993. var _this3 = this;
  6994. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : calleeStore.name;
  6995. if (formalList.length != actualList.length) {
  6996. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size(funcName, formalList.length, actualList.length);
  6997. }
  6998. var promises$ = actualList.map(function (actualParameter) {
  6999. return _this3.evaluateExpression(callerStore, actualParameter);
  7000. });
  7001. return Promise.all(promises$).then(function (values) {
  7002. for (var i = 0; i < values.length; i++) {
  7003. var stoObj = values[i];
  7004. var exp = actualList[i];
  7005. var formalParameter = formalList[i];
  7006. if (formalParameter.type.isCompatible(stoObj.type)) {
  7007. if (formalParameter.byRef && !stoObj.inStore) {
  7008. throw _processorErrorFactory.ProcessorErrorFactory.invalid_ref(funcName, exp.toString());
  7009. }
  7010. if (formalParameter.byRef) {
  7011. var ref = null;
  7012. if (stoObj instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7013. ref = new _storeObjectArrayAddressRef.StoreObjectArrayAddressRef(stoObj);
  7014. } else {
  7015. ref = new _storeObjectRef.StoreObjectRef(stoObj.id, callerStore);
  7016. }
  7017. calleeStore.insertStore(formalParameter.id, ref);
  7018. } else {
  7019. var realValue = _this3.parseStoreObjectValue(stoObj);
  7020. calleeStore.insertStore(formalParameter.id, realValue);
  7021. }
  7022. } else {
  7023. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type(funcName, exp.toString());
  7024. }
  7025. }
  7026. return calleeStore;
  7027. });
  7028. }
  7029. }, {
  7030. key: 'executeCommands',
  7031. value: function executeCommands(store, cmds) {
  7032. // helper to partially apply a function, in this case executeCommand
  7033. var outerRef = this;
  7034. var partial = function partial(fun, cmd) {
  7035. return function (sto) {
  7036. return fun(sto, cmd);
  7037. };
  7038. };
  7039. return cmds.reduce(function (lastCommand, next) {
  7040. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7041. return lastCommand.then(nextCommand);
  7042. }, Promise.resolve(store));
  7043. }
  7044. }, {
  7045. key: 'executeCommand',
  7046. value: function executeCommand(store, cmd) {
  7047. if (this.forceKill) {
  7048. return Promise.reject("FORCED_KILL!");
  7049. } else if (store.mode === _modes.Modes.PAUSE) {
  7050. return Promise.resolve(this.executeCommand(store, cmd));
  7051. } else if (store.mode === _modes.Modes.RETURN) {
  7052. return Promise.resolve(store);
  7053. } else if (this.checkContext(_context.Context.BREAKABLE) && store.mode === _modes.Modes.BREAK) {
  7054. return Promise.resolve(store);
  7055. }
  7056. if (cmd instanceof Commands.Declaration) {
  7057. return this.executeDeclaration(store, cmd);
  7058. } else if (cmd instanceof Commands.ArrayIndexAssign) {
  7059. return this.executeArrayIndexAssign(store, cmd);
  7060. } else if (cmd instanceof Commands.Assign) {
  7061. return this.executeAssign(store, cmd);
  7062. } else if (cmd instanceof Commands.Break) {
  7063. return this.executeBreak(store, cmd);
  7064. } else if (cmd instanceof Commands.Return) {
  7065. return this.executeReturn(store, cmd);
  7066. } else if (cmd instanceof Commands.IfThenElse) {
  7067. return this.executeIfThenElse(store, cmd);
  7068. } else if (cmd instanceof Commands.While) {
  7069. return this.executeWhile(store, cmd);
  7070. } else if (cmd instanceof Commands.DoWhile) {
  7071. return this.executeDoWhile(store, cmd);
  7072. } else if (cmd instanceof Commands.For) {
  7073. return this.executeFor(store, cmd);
  7074. } else if (cmd instanceof Commands.Switch) {
  7075. return this.executeSwitch(store, cmd);
  7076. } else if (cmd instanceof Expressions.FunctionCall) {
  7077. return this.executeFunctionCall(store, cmd);
  7078. } else if (cmd instanceof Commands.SysCall) {
  7079. return this.executeSysCall(store, cmd);
  7080. } else {
  7081. throw _processorErrorFactory.ProcessorErrorFactory.unknown_command(cmd.sourceInfo);
  7082. }
  7083. }
  7084. }, {
  7085. key: 'executeSysCall',
  7086. value: function executeSysCall(store, cmd) {
  7087. var func = cmd.langFunc.bind(this);
  7088. return func(store, cmd);
  7089. }
  7090. }, {
  7091. key: 'executeFunctionCall',
  7092. value: function executeFunctionCall(store, cmd) {
  7093. var func = null;
  7094. if (cmd.isMainCall) {
  7095. func = this.findMainFunction();
  7096. } else {
  7097. func = this.findFunction(cmd.id);
  7098. }
  7099. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7100. if (!_types.Types.VOID.isCompatible(func.returnType) && sto.mode !== _modes.Modes.RETURN) {
  7101. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : func.name;
  7102. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.function_no_return(funcName));
  7103. } else {
  7104. return store;
  7105. }
  7106. });
  7107. }
  7108. }, {
  7109. key: 'executeSwitch',
  7110. value: function executeSwitch(store, cmd) {
  7111. var _this4 = this;
  7112. this.context.push(_context.Context.BREAKABLE);
  7113. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7114. return promise.then(function (result) {
  7115. var sto = result.sto;
  7116. if (_this4.ignoreSwitchCases(sto)) {
  7117. return Promise.resolve(result);
  7118. } else if (result.wasTrue || aCase.isDefault) {
  7119. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7120. return $newSto.then(function (nSto) {
  7121. return Promise.resolve({ wasTrue: true, sto: nSto });
  7122. });
  7123. } else {
  7124. var $value = _this4.evaluateExpression(sto, new Expressions.InfixApp(_operators.Operators.EQ, switchExp, aCase.expression));
  7125. return $value.then(function (vl) {
  7126. if (vl.value) {
  7127. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7128. return _$newSto.then(function (nSto) {
  7129. return Promise.resolve({ wasTrue: true, sto: nSto });
  7130. });
  7131. } else {
  7132. return Promise.resolve({ wasTrue: false, sto: sto });
  7133. }
  7134. });
  7135. }
  7136. });
  7137. };
  7138. try {
  7139. var breakLoop = false;
  7140. var $result = Promise.resolve({ wasTrue: false, sto: store });
  7141. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7142. var aCase = cmd.cases[index];
  7143. $result = auxCaseFun($result, cmd.expression, aCase);
  7144. $result.then(function (r) {
  7145. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7146. });
  7147. }
  7148. return $result.then(function (r) {
  7149. _this4.context.pop();
  7150. if (r.sto.mode === _modes.Modes.BREAK) {
  7151. r.sto.mode = _modes.Modes.RUN;
  7152. }
  7153. return r.sto;
  7154. });
  7155. } catch (error) {
  7156. return Promise.reject(error);
  7157. }
  7158. }
  7159. }, {
  7160. key: 'executeFor',
  7161. value: function executeFor(store, cmd) {
  7162. try {
  7163. //BEGIN for -> while rewrite
  7164. var initCmd = cmd.assignment;
  7165. var condition = cmd.condition;
  7166. var increment = cmd.increment;
  7167. var whileBlock = new Commands.CommandBlock([], cmd.commands.concat(increment));
  7168. var forAsWhile = new Commands.While(condition, whileBlock);
  7169. //END for -> while rewrite
  7170. var newCmdList = [initCmd, forAsWhile];
  7171. return this.executeCommands(store, newCmdList);
  7172. } catch (error) {
  7173. return Promise.reject(error);
  7174. }
  7175. }
  7176. }, {
  7177. key: 'executeDoWhile',
  7178. value: function executeDoWhile(store, cmd) {
  7179. var outerRef = this;
  7180. try {
  7181. outerRef.loopTimers.push(Date.now());
  7182. outerRef.context.push(_context.Context.BREAKABLE);
  7183. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7184. return $newStore.then(function (sto) {
  7185. if (sto.mode === _modes.Modes.BREAK) {
  7186. outerRef.context.pop();
  7187. sto.mode = _modes.Modes.RUN;
  7188. outerRef.loopTimers.pop();
  7189. return sto;
  7190. }
  7191. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7192. return $value.then(function (vl) {
  7193. if (!vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7194. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7195. }
  7196. if (vl.value) {
  7197. outerRef.context.pop();
  7198. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7199. var time = outerRef.loopTimers[i];
  7200. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7201. outerRef.forceKill = true;
  7202. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7203. }
  7204. }
  7205. return outerRef.executeCommand(sto, cmd);
  7206. } else {
  7207. outerRef.context.pop();
  7208. outerRef.loopTimers.pop();
  7209. return sto;
  7210. }
  7211. });
  7212. });
  7213. } catch (error) {
  7214. return Promise.reject(error);
  7215. }
  7216. }
  7217. }, {
  7218. key: 'executeWhile',
  7219. value: function executeWhile(store, cmd) {
  7220. var outerRef = this;
  7221. try {
  7222. outerRef.loopTimers.push(Date.now());
  7223. outerRef.context.push(_context.Context.BREAKABLE);
  7224. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7225. return $value.then(function (vl) {
  7226. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7227. if (vl.value) {
  7228. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7229. return $newStore.then(function (sto) {
  7230. outerRef.context.pop();
  7231. if (sto.mode === _modes.Modes.BREAK) {
  7232. outerRef.loopTimers.pop();
  7233. sto.mode = _modes.Modes.RUN;
  7234. return sto;
  7235. }
  7236. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7237. var time = outerRef.loopTimers[i];
  7238. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7239. outerRef.forceKill = true;
  7240. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.endless_loop_full(cmd.sourceInfo));
  7241. }
  7242. }
  7243. return outerRef.executeCommand(sto, cmd);
  7244. });
  7245. } else {
  7246. outerRef.context.pop();
  7247. outerRef.loopTimers.pop();
  7248. return store;
  7249. }
  7250. } else {
  7251. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo));
  7252. }
  7253. });
  7254. } catch (error) {
  7255. return Promise.reject(error);
  7256. }
  7257. }
  7258. }, {
  7259. key: 'executeIfThenElse',
  7260. value: function executeIfThenElse(store, cmd) {
  7261. var _this5 = this;
  7262. try {
  7263. var $value = this.evaluateExpression(store, cmd.condition);
  7264. return $value.then(function (vl) {
  7265. if (vl.type.isCompatible(_types.Types.BOOLEAN)) {
  7266. if (vl.value) {
  7267. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7268. } else if (cmd.ifFalse !== null) {
  7269. if (cmd.ifFalse instanceof Commands.IfThenElse) {
  7270. return _this5.executeCommand(store, cmd.ifFalse);
  7271. } else {
  7272. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7273. }
  7274. } else {
  7275. return Promise.resolve(store);
  7276. }
  7277. } else {
  7278. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo));
  7279. }
  7280. });
  7281. } catch (error) {
  7282. return Promise.reject(error);
  7283. }
  7284. }
  7285. }, {
  7286. key: 'executeReturn',
  7287. value: function executeReturn(store, cmd) {
  7288. var _this6 = this;
  7289. try {
  7290. var funcType = store.applyStore('$').type;
  7291. var $value = this.evaluateExpression(store, cmd.expression);
  7292. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : store.name;
  7293. return $value.then(function (vl) {
  7294. if (vl === null && funcType.isCompatible(_types.Types.VOID)) {
  7295. return Promise.resolve(store);
  7296. }
  7297. if (vl === null || !funcType.isCompatible(vl.type)) {
  7298. var stringInfo = funcType.stringInfo();
  7299. var info = stringInfo[0];
  7300. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7301. } else {
  7302. var realValue = _this6.parseStoreObjectValue(vl);
  7303. store.updateStore('$', realValue);
  7304. store.mode = _modes.Modes.RETURN;
  7305. return Promise.resolve(store);
  7306. }
  7307. });
  7308. } catch (error) {
  7309. return Promise.reject(error);
  7310. }
  7311. }
  7312. }, {
  7313. key: 'executeBreak',
  7314. value: function executeBreak(store, cmd) {
  7315. if (this.checkContext(_context.Context.BREAKABLE)) {
  7316. store.mode = _modes.Modes.BREAK;
  7317. return Promise.resolve(store);
  7318. } else {
  7319. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.unexpected_break_command_full(cmd.sourceInfo));
  7320. }
  7321. }
  7322. }, {
  7323. key: 'executeAssign',
  7324. value: function executeAssign(store, cmd) {
  7325. var _this7 = this;
  7326. try {
  7327. var $value = this.evaluateExpression(store, cmd.expression);
  7328. return $value.then(function (vl) {
  7329. var realValue = _this7.parseStoreObjectValue(vl);
  7330. store.updateStore(cmd.id, realValue);
  7331. return store;
  7332. });
  7333. } catch (error) {
  7334. return Promise.reject(error);
  7335. }
  7336. }
  7337. }, {
  7338. key: 'executeArrayIndexAssign',
  7339. value: function executeArrayIndexAssign(store, cmd) {
  7340. var _this8 = this;
  7341. var mustBeArray = store.applyStore(cmd.id);
  7342. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7343. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7344. }
  7345. var line$ = this.evaluateExpression(store, cmd.line);
  7346. var column$ = this.evaluateExpression(store, cmd.column);
  7347. var value$ = this.evaluateExpression(store, cmd.expression);
  7348. return Promise.all([line$, column$, value$]).then(function (results) {
  7349. var lineSO = results[0];
  7350. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7351. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7352. }
  7353. var line = lineSO.number;
  7354. var columnSO = results[1];
  7355. var column = null;
  7356. if (columnSO !== null) {
  7357. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7358. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7359. }
  7360. column = columnSO.number;
  7361. }
  7362. var value = _this8.parseStoreObjectValue(results[2]);
  7363. if (line >= mustBeArray.lines) {
  7364. if (mustBeArray.isVector) {
  7365. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7366. } else {
  7367. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7368. }
  7369. } else if (line < 0) {
  7370. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7371. }
  7372. if (column !== null && mustBeArray.columns === null) {
  7373. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7374. }
  7375. if (column !== null) {
  7376. if (column >= mustBeArray.columns) {
  7377. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7378. } else if (column < 0) {
  7379. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7380. }
  7381. }
  7382. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), mustBeArray);
  7383. if (column !== null) {
  7384. if (value.type instanceof _compoundType.CompoundType) {
  7385. var type = mustBeArray.type.innerType;
  7386. var stringInfo = type.stringInfo();
  7387. var info = stringInfo[0];
  7388. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7389. }
  7390. newArray.value[line].value[column] = value;
  7391. store.updateStore(cmd.id, newArray);
  7392. } else {
  7393. if (mustBeArray.columns !== null && value.type instanceof _compoundType.CompoundType) {
  7394. var _type = mustBeArray.type;
  7395. var _stringInfo = _type.stringInfo();
  7396. var _info = _stringInfo[0];
  7397. var exp = cmd.expression.toString();
  7398. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7399. }
  7400. newArray.value[line] = value;
  7401. store.updateStore(cmd.id, newArray);
  7402. }
  7403. return store;
  7404. });
  7405. }
  7406. }, {
  7407. key: 'executeDeclaration',
  7408. value: function executeDeclaration(store, cmd) {
  7409. try {
  7410. var $value = this.evaluateExpression(store, cmd.initial);
  7411. if (cmd instanceof Commands.ArrayDeclaration) {
  7412. var $lines = this.evaluateExpression(store, cmd.lines);
  7413. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7414. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7415. var lineSO = values[0];
  7416. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7417. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7418. }
  7419. var line = lineSO.number;
  7420. if (line < 0) {
  7421. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7422. }
  7423. var columnSO = values[1];
  7424. var column = null;
  7425. if (columnSO !== null) {
  7426. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7427. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo));
  7428. }
  7429. column = columnSO.number;
  7430. if (column < 0) {
  7431. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(cmd.sourceInfo);
  7432. }
  7433. }
  7434. var value = values[2];
  7435. var temp = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, null);
  7436. store.insertStore(cmd.id, temp);
  7437. var realValue = value;
  7438. if (value !== null) {
  7439. if (value instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7440. if (value.type instanceof _compoundType.CompoundType) {
  7441. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), value.refValue);
  7442. } else {
  7443. realValue = Object.assign(new _storeObject.StoreObject(null, null), value.refValue);
  7444. }
  7445. }
  7446. } else {
  7447. realValue = new _storeObjectArray.StoreObjectArray(cmd.type, line, column, []);
  7448. if (column !== null) {
  7449. for (var i = 0; i < line; i++) {
  7450. realValue.value.push(new _storeObjectArray.StoreObjectArray(new _compoundType.CompoundType(cmd.type.innerType, 1), column, null, []));
  7451. }
  7452. }
  7453. }
  7454. realValue.readOnly = cmd.isConst;
  7455. store.updateStore(cmd.id, realValue);
  7456. return store;
  7457. });
  7458. } else {
  7459. var temp = new _storeObject.StoreObject(cmd.type, null);
  7460. store.insertStore(cmd.id, temp);
  7461. return $value.then(function (vl) {
  7462. var realValue = vl;
  7463. if (vl !== null) {
  7464. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7465. if (vl.type instanceof _compoundType.CompoundType) {
  7466. realValue = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), vl.refValue);
  7467. } else {
  7468. realValue = Object.assign(new _storeObject.StoreObject(null, null), vl.refValue);
  7469. }
  7470. }
  7471. } else {
  7472. realValue = new _storeObject.StoreObject(cmd.type, 0);
  7473. }
  7474. realValue.readOnly = cmd.isConst;
  7475. store.updateStore(cmd.id, realValue);
  7476. return store;
  7477. });
  7478. }
  7479. } catch (e) {
  7480. return Promise.reject(e);
  7481. }
  7482. }
  7483. }, {
  7484. key: 'evaluateExpression',
  7485. value: function evaluateExpression(store, exp) {
  7486. if (exp instanceof Expressions.UnaryApp) {
  7487. return this.evaluateUnaryApp(store, exp);
  7488. } else if (exp instanceof Expressions.InfixApp) {
  7489. return this.evaluateInfixApp(store, exp);
  7490. } else if (exp instanceof Expressions.ArrayAccess) {
  7491. return this.evaluateArrayAccess(store, exp);
  7492. } else if (exp instanceof Expressions.VariableLiteral) {
  7493. return this.evaluateVariableLiteral(store, exp);
  7494. } else if (exp instanceof Expressions.IntLiteral) {
  7495. return this.evaluateLiteral(store, exp);
  7496. } else if (exp instanceof Expressions.RealLiteral) {
  7497. return this.evaluateLiteral(store, exp);
  7498. } else if (exp instanceof Expressions.BoolLiteral) {
  7499. return this.evaluateLiteral(store, exp);
  7500. } else if (exp instanceof Expressions.StringLiteral) {
  7501. return this.evaluateLiteral(store, exp);
  7502. } else if (exp instanceof Expressions.ArrayLiteral) {
  7503. return this.evaluateArrayLiteral(store, exp);
  7504. } else if (exp instanceof Expressions.FunctionCall) {
  7505. return this.evaluateFunctionCall(store, exp);
  7506. }
  7507. return Promise.resolve(null);
  7508. }
  7509. }, {
  7510. key: 'evaluateFunctionCall',
  7511. value: function evaluateFunctionCall(store, exp) {
  7512. if (exp.isMainCall) {
  7513. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), exp.sourceInfo));
  7514. }
  7515. var func = this.findFunction(exp.id);
  7516. if (_types.Types.VOID.isCompatible(func.returnType)) {
  7517. // TODO: better error message
  7518. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(exp.id, exp.sourceInfo));
  7519. }
  7520. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7521. return $newStore.then(function (sto) {
  7522. if (sto.mode !== _modes.Modes.RETURN) {
  7523. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7524. }
  7525. var val = sto.applyStore('$');
  7526. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7527. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null, null), val));
  7528. } else {
  7529. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7530. }
  7531. });
  7532. }
  7533. }, {
  7534. key: 'evaluateArrayLiteral',
  7535. value: function evaluateArrayLiteral(store, exp) {
  7536. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7537. var errorCode = validationResult[0];
  7538. switch (errorCode) {
  7539. case _storeObjectArray.StoreObjectArray.WRONG_COLUMN_NUMBER:
  7540. {
  7541. var columnValue = validationResult[1];
  7542. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7543. }
  7544. case _storeObjectArray.StoreObjectArray.WRONG_LINE_NUMBER:
  7545. {
  7546. var lineValue = validationResult[1];
  7547. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7548. }
  7549. case _storeObjectArray.StoreObjectArray.WRONG_TYPE:
  7550. {
  7551. var line = null;
  7552. var strExp = null;
  7553. if (validationResult.length > 2) {
  7554. line = validationResult[1];
  7555. var column = validationResult[2];
  7556. strExp = exp.value[line].value[column].toString();
  7557. } else {
  7558. line = validationResult[1];
  7559. strExp = exp.value[line].toString();
  7560. }
  7561. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7562. }
  7563. }
  7564. };
  7565. if (!exp.isVector) {
  7566. var $matrix = this.evaluateMatrix(store, exp.value);
  7567. return $matrix.then(function (list) {
  7568. var type = new _compoundType.CompoundType(list[0].type.innerType, 2);
  7569. var arr = new _storeObjectArray.StoreObjectArray(type, list.length, list[0].lines, list);
  7570. var checkResult = arr.isValid;
  7571. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7572. return errorHelperFunction(checkResult, exp);
  7573. }
  7574. });
  7575. } else {
  7576. return this.evaluateVector(store, exp.value).then(function (list) {
  7577. var type = new _compoundType.CompoundType(list[0].type, 1);
  7578. var stoArray = new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7579. var checkResult = stoArray.isValid;
  7580. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7581. return errorHelperFunction(checkResult, exp);
  7582. }
  7583. });
  7584. }
  7585. }
  7586. }, {
  7587. key: 'evaluateVector',
  7588. value: function evaluateVector(store, exps) {
  7589. var _this9 = this;
  7590. return Promise.all(exps.map(function (exp) {
  7591. return _this9.evaluateExpression(store, exp);
  7592. }));
  7593. }
  7594. }, {
  7595. key: 'evaluateMatrix',
  7596. value: function evaluateMatrix(store, exps) {
  7597. var _this10 = this;
  7598. return Promise.all(exps.map(function (vector) {
  7599. var $vector = _this10.evaluateVector(store, vector.value);
  7600. return $vector.then(function (list) {
  7601. var type = new _compoundType.CompoundType(list[0].type, 1);
  7602. return new _storeObjectArray.StoreObjectArray(type, list.length, null, list);
  7603. });
  7604. }));
  7605. }
  7606. }, {
  7607. key: 'evaluateLiteral',
  7608. value: function evaluateLiteral(_, exp) {
  7609. return Promise.resolve(new _storeObject.StoreObject(exp.type, exp.value));
  7610. }
  7611. }, {
  7612. key: 'evaluateVariableLiteral',
  7613. value: function evaluateVariableLiteral(store, exp) {
  7614. try {
  7615. var val = store.applyStore(exp.id);
  7616. if (val instanceof _storeObjectArray.StoreObjectArray) {
  7617. return Promise.resolve(Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null, null), val));
  7618. } else {
  7619. return Promise.resolve(Object.assign(new _storeObject.StoreObject(null, null), val));
  7620. }
  7621. } catch (error) {
  7622. return Promise.reject(error);
  7623. }
  7624. }
  7625. }, {
  7626. key: 'evaluateArrayAccess',
  7627. value: function evaluateArrayAccess(store, exp) {
  7628. var mustBeArray = store.applyStore(exp.id);
  7629. if (!(mustBeArray.type instanceof _compoundType.CompoundType)) {
  7630. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(exp.id, exp.sourceInfo));
  7631. }
  7632. var $line = this.evaluateExpression(store, exp.line);
  7633. var $column = this.evaluateExpression(store, exp.column);
  7634. return Promise.all([$line, $column]).then(function (values) {
  7635. var lineSO = values[0];
  7636. var columnSO = values[1];
  7637. if (!_types.Types.INTEGER.isCompatible(lineSO.type)) {
  7638. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7639. }
  7640. var line = lineSO.number;
  7641. var column = null;
  7642. if (columnSO !== null) {
  7643. if (!_types.Types.INTEGER.isCompatible(columnSO.type)) {
  7644. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(exp.sourceInfo));
  7645. }
  7646. column = columnSO.number;
  7647. }
  7648. if (line >= mustBeArray.lines) {
  7649. if (mustBeArray.isVector) {
  7650. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7651. } else {
  7652. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7653. }
  7654. } else if (line < 0) {
  7655. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7656. }
  7657. if (column !== null && mustBeArray.columns === null) {
  7658. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.vector_not_matrix_full(exp.id, exp.sourceInfo));
  7659. }
  7660. if (column !== null) {
  7661. if (column >= mustBeArray.columns) {
  7662. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7663. } else if (column < 0) {
  7664. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(exp.sourceInfo);
  7665. }
  7666. }
  7667. return Promise.resolve(new _storeObjectArrayAddress.StoreObjectArrayAddress(mustBeArray.id, line, column, store));
  7668. });
  7669. }
  7670. }, {
  7671. key: 'evaluateUnaryApp',
  7672. value: function evaluateUnaryApp(store, unaryApp) {
  7673. var $left = this.evaluateExpression(store, unaryApp.left);
  7674. return $left.then(function (left) {
  7675. var resultType = (0, _compatibilityTable.resultTypeAfterUnaryOp)(unaryApp.op, left.type);
  7676. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7677. var stringInfo = left.type.stringInfo();
  7678. var info = stringInfo[0];
  7679. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7680. }
  7681. switch (unaryApp.op.ord) {
  7682. case _operators.Operators.ADD.ord:
  7683. return new _storeObject.StoreObject(resultType, left.value);
  7684. case _operators.Operators.SUB.ord:
  7685. return new _storeObject.StoreObject(resultType, left.value.negated());
  7686. case _operators.Operators.NOT.ord:
  7687. return new _storeObject.StoreObject(resultType, !left.value);
  7688. default:
  7689. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7690. }
  7691. });
  7692. }
  7693. }, {
  7694. key: 'evaluateInfixApp',
  7695. value: function evaluateInfixApp(store, infixApp) {
  7696. var $left = this.evaluateExpression(store, infixApp.left);
  7697. var $right = this.evaluateExpression(store, infixApp.right);
  7698. return Promise.all([$left, $right]).then(function (values) {
  7699. var left = values[0];
  7700. var right = values[1];
  7701. var resultType = (0, _compatibilityTable.resultTypeAfterInfixOp)(infixApp.op, left.type, right.type);
  7702. if (_types.Types.UNDEFINED.isCompatible(resultType)) {
  7703. var stringInfoLeft = left.type.stringInfo();
  7704. var infoLeft = stringInfoLeft[0];
  7705. var stringInfoRight = right.type.stringInfo();
  7706. var infoRight = stringInfoRight[0];
  7707. return Promise.reject(_processorErrorFactory.ProcessorErrorFactory.invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  7708. }
  7709. var result = null;
  7710. switch (infixApp.op.ord) {
  7711. case _operators.Operators.ADD.ord:
  7712. {
  7713. if (_types.Types.STRING.isCompatible(left.type)) {
  7714. var rightStr = (0, _parsers.convertToString)(right.value, right.type);
  7715. return new _storeObject.StoreObject(resultType, left.value + rightStr);
  7716. } else if (_types.Types.STRING.isCompatible(right.type)) {
  7717. var leftStr = (0, _parsers.convertToString)(left.value, left.type);
  7718. return new _storeObject.StoreObject(resultType, leftStr + right.value);
  7719. } else {
  7720. return new _storeObject.StoreObject(resultType, left.value.plus(right.value));
  7721. }
  7722. }
  7723. case _operators.Operators.SUB.ord:
  7724. return new _storeObject.StoreObject(resultType, left.value.minus(right.value));
  7725. case _operators.Operators.MULT.ord:
  7726. {
  7727. result = left.value.times(right.value);
  7728. if (result.dp() > _config.Config.decimalPlaces) {
  7729. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7730. }
  7731. return new _storeObject.StoreObject(resultType, result);
  7732. }
  7733. case _operators.Operators.DIV.ord:
  7734. {
  7735. if (_types.Types.INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  7736. if (result.dp() > _config.Config.decimalPlaces) {
  7737. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7738. }
  7739. return new _storeObject.StoreObject(resultType, result);
  7740. }
  7741. case _operators.Operators.MOD.ord:
  7742. {
  7743. result = left.value.modulo(right.value);
  7744. if (result.dp() > _config.Config.decimalPlaces) {
  7745. result = new _decimal2.default(result.toFixed(_config.Config.decimalPlaces));
  7746. }
  7747. return new _storeObject.StoreObject(resultType, result);
  7748. }
  7749. case _operators.Operators.GT.ord:
  7750. {
  7751. if (_types.Types.STRING.isCompatible(left.type)) {
  7752. result = left.value.length > right.value.length;
  7753. } else {
  7754. result = left.value.gt(right.value);
  7755. }
  7756. return new _storeObject.StoreObject(resultType, result);
  7757. }
  7758. case _operators.Operators.GE.ord:
  7759. {
  7760. if (_types.Types.STRING.isCompatible(left.type)) {
  7761. result = left.value.length >= right.value.length;
  7762. } else {
  7763. result = left.value.gte(right.value);
  7764. }
  7765. return new _storeObject.StoreObject(resultType, result);
  7766. }
  7767. case _operators.Operators.LT.ord:
  7768. {
  7769. if (_types.Types.STRING.isCompatible(left.type)) {
  7770. result = left.value.length < right.value.length;
  7771. } else {
  7772. result = left.value.lt(right.value);
  7773. }
  7774. return new _storeObject.StoreObject(resultType, result);
  7775. }
  7776. case _operators.Operators.LE.ord:
  7777. {
  7778. if (_types.Types.STRING.isCompatible(left.type)) {
  7779. result = left.value.length <= right.value.length;
  7780. } else {
  7781. result = left.value.lte(right.value);
  7782. }
  7783. return new _storeObject.StoreObject(resultType, result);
  7784. }
  7785. case _operators.Operators.EQ.ord:
  7786. {
  7787. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7788. result = left.value.eq(right.value);
  7789. } else {
  7790. result = left.value === right.value;
  7791. }
  7792. return new _storeObject.StoreObject(resultType, result);
  7793. }
  7794. case _operators.Operators.NEQ.ord:
  7795. {
  7796. if (_types.Types.INTEGER.isCompatible(left.type) || _types.Types.REAL.isCompatible(left.type)) {
  7797. result = !left.value.eq(right.value);
  7798. } else {
  7799. result = left.value !== right.value;
  7800. }
  7801. return new _storeObject.StoreObject(resultType, result);
  7802. }
  7803. case _operators.Operators.AND.ord:
  7804. return new _storeObject.StoreObject(resultType, left.value && right.value);
  7805. case _operators.Operators.OR.ord:
  7806. return new _storeObject.StoreObject(resultType, left.value || right.value);
  7807. default:
  7808. return Promise.reject(new _runtimeError.RuntimeError('!!!Critical Invalid InfixApp ' + infixApp.op));
  7809. }
  7810. });
  7811. }
  7812. }, {
  7813. key: 'parseStoreObjectValue',
  7814. value: function parseStoreObjectValue(vl) {
  7815. var realValue = vl;
  7816. if (vl instanceof _storeObjectArrayAddress.StoreObjectArrayAddress) {
  7817. if (vl.type instanceof _compoundType.CompoundType) {
  7818. switch (vl.type.dimensions) {
  7819. case 1:
  7820. {
  7821. realValue = new _storeObjectArray.StoreObjectArray(vl.type, vl.value);
  7822. break;
  7823. }
  7824. default:
  7825. {
  7826. throw new _runtimeError.RuntimeError("Three dimensional array address...");
  7827. }
  7828. }
  7829. } else {
  7830. realValue = new _storeObject.StoreObject(vl.type, vl.value);
  7831. }
  7832. }
  7833. return realValue;
  7834. }
  7835. }]);
  7836. return IVProgProcessor;
  7837. }();
  7838. /***/ }),
  7839. /***/ "./js/processor/lib/arrays.js":
  7840. /*!************************************!*\
  7841. !*** ./js/processor/lib/arrays.js ***!
  7842. \************************************/
  7843. /*! no static exports found */
  7844. /***/ (function(module, exports, __webpack_require__) {
  7845. "use strict";
  7846. Object.defineProperty(exports, "__esModule", {
  7847. value: true
  7848. });
  7849. exports.createNumElementsFun = createNumElementsFun;
  7850. exports.createMatrixLinesFun = createMatrixLinesFun;
  7851. exports.createMatrixColumnsFun = createMatrixColumnsFun;
  7852. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7853. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7854. var Commands = _interopRequireWildcard(_commands);
  7855. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7856. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7857. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7858. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7859. 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; } }
  7860. /**
  7861. * num_elements
  7862. * matrix_lines
  7863. * matrix_columns
  7864. */
  7865. function createNumElementsFun() {
  7866. var numElementsFun = function numElementsFun(sto, _) {
  7867. var vector = sto.applyStore("vector");
  7868. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(vector.lines));
  7869. sto.mode = _modes.Modes.RETURN;
  7870. return Promise.resolve(sto.updateStore("$", temp));
  7871. };
  7872. var block = new Commands.CommandBlock([], [new Commands.SysCall(numElementsFun)]);
  7873. var func = new Commands.Function('$numElements', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 1), 'vector', false)], block);
  7874. return func;
  7875. }
  7876. function createMatrixLinesFun() {
  7877. var matrixLinesFun = function matrixLinesFun(sto, _) {
  7878. var matrix = sto.applyStore("matrix");
  7879. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.lines));
  7880. sto.mode = _modes.Modes.RETURN;
  7881. return Promise.resolve(sto.updateStore("$", temp));
  7882. };
  7883. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixLinesFun)]);
  7884. var func = new Commands.Function('$matrixLines', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7885. return func;
  7886. }
  7887. function createMatrixColumnsFun() {
  7888. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  7889. var matrix = sto.applyStore("matrix");
  7890. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(matrix.columns));
  7891. sto.mode = _modes.Modes.RETURN;
  7892. return Promise.resolve(sto.updateStore("$", temp));
  7893. };
  7894. var block = new Commands.CommandBlock([], [new Commands.SysCall(matrixColumnsFun)]);
  7895. var func = new Commands.Function('$matrixColumns', _types.Types.INTEGER, [new Commands.FormalParameter(new _compoundType.CompoundType(_types.Types.ALL, 2), 'matrix', false)], block);
  7896. return func;
  7897. }
  7898. /***/ }),
  7899. /***/ "./js/processor/lib/io.js":
  7900. /*!********************************!*\
  7901. !*** ./js/processor/lib/io.js ***!
  7902. \********************************/
  7903. /*! no static exports found */
  7904. /***/ (function(module, exports, __webpack_require__) {
  7905. "use strict";
  7906. Object.defineProperty(exports, "__esModule", {
  7907. value: true
  7908. });
  7909. exports.createOutputFun = createOutputFun;
  7910. exports.createInputFun = createInputFun;
  7911. var _storeObject = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  7912. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7913. var Commands = _interopRequireWildcard(_commands);
  7914. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7915. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7916. 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; } }
  7917. function createOutputFun() {
  7918. var writeFunction = function writeFunction(store, _) {
  7919. var val = store.applyStore('p1');
  7920. if (val.type.isCompatible(_types.Types.INTEGER)) {
  7921. this.output.sendOutput(val.value.toString());
  7922. } else if (val.type.isCompatible(_types.Types.REAL)) {
  7923. if (val.value.dp() <= 0) {
  7924. this.output.sendOutput(val.value.toFixed(1));
  7925. } else {
  7926. this.output.sendOutput(val.value.toString());
  7927. }
  7928. } else {
  7929. this.output.sendOutput(val.value);
  7930. }
  7931. return Promise.resolve(store);
  7932. };
  7933. var block = new Commands.CommandBlock([], [new Commands.SysCall(writeFunction)]);
  7934. var func = new Commands.Function('$write', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', false)], block);
  7935. return func;
  7936. }
  7937. function createInputFun() {
  7938. var readFunction = function readFunction(store, _) {
  7939. var _this = this;
  7940. var request = new Promise(function (resolve, _) {
  7941. _this.input.requestInput(resolve);
  7942. });
  7943. return request.then(function (text) {
  7944. var typeToConvert = store.applyStore('p1').type;
  7945. var stoObj = null;
  7946. if (typeToConvert.isCompatible(_types.Types.INTEGER)) {
  7947. var val = (0, _parsers.toInt)(text);
  7948. stoObj = new _storeObject.StoreObject(_types.Types.INTEGER, val);
  7949. } else if (typeToConvert.isCompatible(_types.Types.REAL)) {
  7950. stoObj = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(text));
  7951. } else if (typeToConvert.isCompatible(_types.Types.BOOLEAN)) {
  7952. stoObj = new _storeObject.StoreObject(_types.Types.BOOLEAN, (0, _parsers.toBool)(text));
  7953. } else if (typeToConvert.isCompatible(_types.Types.STRING)) {
  7954. stoObj = new _storeObject.StoreObject(_types.Types.STRING, (0, _parsers.toString)(text));
  7955. }
  7956. _this.loopTimers.splice(0, _this.loopTimers.length);
  7957. store.updateStore('p1', stoObj);
  7958. return Promise.resolve(store);
  7959. });
  7960. };
  7961. var block = new Commands.CommandBlock([], [new Commands.SysCall(readFunction)]);
  7962. var func = new Commands.Function('$read', _types.Types.VOID, [new Commands.FormalParameter(_types.Types.ALL, 'p1', true)], block);
  7963. return func;
  7964. }
  7965. /***/ }),
  7966. /***/ "./js/processor/lib/lang.js":
  7967. /*!**********************************!*\
  7968. !*** ./js/processor/lib/lang.js ***!
  7969. \**********************************/
  7970. /*! no static exports found */
  7971. /***/ (function(module, exports, __webpack_require__) {
  7972. "use strict";
  7973. Object.defineProperty(exports, "__esModule", {
  7974. value: true
  7975. });
  7976. exports.createIsRealFun = createIsRealFun;
  7977. exports.createIsIntFun = createIsIntFun;
  7978. exports.createIsBoolFun = createIsBoolFun;
  7979. exports.createCastRealFun = createCastRealFun;
  7980. exports.createCastIntFun = createCastIntFun;
  7981. exports.createCastBoolFun = createCastBoolFun;
  7982. exports.createCastStringFun = createCastStringFun;
  7983. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  7984. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  7985. var Commands = _interopRequireWildcard(_commands);
  7986. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  7987. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7988. var _ivprogParser = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  7989. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  7990. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  7991. 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; } }
  7992. /**
  7993. *
  7994. * is_real
  7995. * is_int
  7996. * is_bool
  7997. * cast_real
  7998. * cast_int
  7999. * cast_bool
  8000. * cast_string
  8001. */
  8002. function createIsRealFun() {
  8003. var isRealFun = function isRealFun(sto, _) {
  8004. var str = sto.applyStore("str");
  8005. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8006. var result = false;
  8007. try {
  8008. var val = parser.parseTerm();
  8009. if (val instanceof _expressions.RealLiteral) {
  8010. result = true;
  8011. }
  8012. } catch (error) {}
  8013. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8014. sto.mode = _modes.Modes.RETURN;
  8015. return Promise.resolve(sto.updateStore("$", temp));
  8016. };
  8017. var block = new Commands.CommandBlock([], [new Commands.SysCall(isRealFun)]);
  8018. var func = new Commands.Function('$isReal', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8019. return func;
  8020. }
  8021. function createIsIntFun() {
  8022. var isIntFun = function isIntFun(sto, _) {
  8023. var str = sto.applyStore("str");
  8024. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8025. var result = false;
  8026. try {
  8027. var val = parser.parseTerm();
  8028. if (val instanceof _expressions.IntLiteral) {
  8029. result = true;
  8030. }
  8031. } catch (error) {}
  8032. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8033. sto.mode = _modes.Modes.RETURN;
  8034. return Promise.resolve(sto.updateStore("$", temp));
  8035. };
  8036. var block = new Commands.CommandBlock([], [new Commands.SysCall(isIntFun)]);
  8037. var func = new Commands.Function('$isInt', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8038. return func;
  8039. }
  8040. function createIsBoolFun() {
  8041. var isBoolFun = function isBoolFun(sto, _) {
  8042. var str = sto.applyStore("str");
  8043. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8044. var result = false;
  8045. try {
  8046. var val = parser.parseTerm();
  8047. if (val instanceof _expressions.BoolLiteral) {
  8048. result = true;
  8049. }
  8050. } catch (error) {}
  8051. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, result);
  8052. sto.mode = _modes.Modes.RETURN;
  8053. return Promise.resolve(sto.updateStore("$", temp));
  8054. };
  8055. var block = new Commands.CommandBlock([], [new Commands.SysCall(isBoolFun)]);
  8056. var func = new Commands.Function('$isBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8057. return func;
  8058. }
  8059. function createCastRealFun() {
  8060. var castRealFun = function castRealFun(sto, _) {
  8061. var val = sto.applyStore("val");
  8062. switch (val.type.ord) {
  8063. case _types.Types.INTEGER.ord:
  8064. {
  8065. var temp = new _storeObject.StoreObject(_types.Types.REAL, (0, _parsers.toReal)(val.number));
  8066. sto.mode = _modes.Modes.RETURN;
  8067. return Promise.resolve(sto.updateStore("$", temp));
  8068. }
  8069. case _types.Types.STRING.ord:
  8070. {
  8071. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8072. try {
  8073. var result = parser.parseTerm();
  8074. if (result instanceof _expressions.RealLiteral) {
  8075. var _temp = new _storeObject.StoreObject(_types.Types.REAL, result.value);
  8076. sto.mode = _modes.Modes.RETURN;
  8077. return Promise.resolve(sto.updateStore("$", _temp));
  8078. }
  8079. } catch (error) {
  8080. return Promise.reject("cannot convert string to real");
  8081. }
  8082. }
  8083. }
  8084. };
  8085. var block = new Commands.CommandBlock([], [new Commands.SysCall(castRealFun)]);
  8086. var func = new Commands.Function('$castReal', _types.Types.REAL, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8087. return func;
  8088. }
  8089. function createCastIntFun() {
  8090. var castIntFun = function castIntFun(sto, _) {
  8091. var val = sto.applyStore("val");
  8092. switch (val.type.ord) {
  8093. case _types.Types.REAL.ord:
  8094. {
  8095. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, Math.floor(val.number));
  8096. sto.mode = _modes.Modes.RETURN;
  8097. return Promise.resolve(sto.updateStore("$", temp));
  8098. }
  8099. case _types.Types.STRING.ord:
  8100. {
  8101. var parser = _ivprogParser.IVProgParser.createParser(val.value);
  8102. try {
  8103. var result = parser.parseTerm();
  8104. if (result instanceof _expressions.IntLiteral) {
  8105. var _temp2 = new _storeObject.StoreObject(_types.Types.INTEGER, result.value);
  8106. sto.mode = _modes.Modes.RETURN;
  8107. return Promise.resolve(sto.updateStore("$", _temp2));
  8108. }
  8109. } catch (error) {
  8110. return Promise.reject("cannot convert string to real");
  8111. }
  8112. }
  8113. }
  8114. };
  8115. var block = new Commands.CommandBlock([], [new Commands.SysCall(castIntFun)]);
  8116. var func = new Commands.Function('$castInt', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.ALL, 'val', false)], block);
  8117. return func;
  8118. }
  8119. function createCastBoolFun() {
  8120. var castBoolFun = function castBoolFun(sto, _) {
  8121. var str = sto.applyStore("str");
  8122. var parser = _ivprogParser.IVProgParser.createParser(str.value);
  8123. try {
  8124. var val = parser.parseTerm();
  8125. if (val instanceof _expressions.BoolLiteral) {
  8126. var temp = new _storeObject.StoreObject(_types.Types.BOOLEAN, val.value);
  8127. sto.mode = _modes.Modes.RETURN;
  8128. return Promise.resolve(sto.updateStore("$", temp));
  8129. }
  8130. } catch (error) {}
  8131. return Promise.reject("cannot convert " + str.value + " to boolean");
  8132. };
  8133. var block = new Commands.CommandBlock([], [new Commands.SysCall(castBoolFun)]);
  8134. var func = new Commands.Function('$castBool', _types.Types.BOOLEAN, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8135. return func;
  8136. }
  8137. function createCastStringFun() {
  8138. var castStringFun = function castStringFun(store, _) {
  8139. var val = store.applyStore('str');
  8140. var result = (0, _parsers.convertToString)(val);
  8141. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8142. sto.mode = _modes.Modes.RETURN;
  8143. return Promise.resolve(sto.updateStore("$", temp));
  8144. };
  8145. var block = new Commands.CommandBlock([], [new Commands.SysCall(castStringFun)]);
  8146. var func = new Commands.Function('$castString', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.ALL, 'str', false)], block);
  8147. return func;
  8148. }
  8149. /***/ }),
  8150. /***/ "./js/processor/lib/math.js":
  8151. /*!**********************************!*\
  8152. !*** ./js/processor/lib/math.js ***!
  8153. \**********************************/
  8154. /*! no static exports found */
  8155. /***/ (function(module, exports, __webpack_require__) {
  8156. "use strict";
  8157. Object.defineProperty(exports, "__esModule", {
  8158. value: true
  8159. });
  8160. exports.createSinFun = createSinFun;
  8161. exports.createCosFun = createCosFun;
  8162. exports.createTanFun = createTanFun;
  8163. exports.createSqrtFun = createSqrtFun;
  8164. exports.createPowFun = createPowFun;
  8165. exports.createLogFun = createLogFun;
  8166. exports.createAbsFun = createAbsFun;
  8167. exports.createNegateFun = createNegateFun;
  8168. exports.createInvertFun = createInvertFun;
  8169. exports.createMaxFun = createMaxFun;
  8170. exports.createMinFun = createMinFun;
  8171. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8172. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8173. var Commands = _interopRequireWildcard(_commands);
  8174. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8175. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8176. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8177. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8178. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8179. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8180. var _config = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8181. 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; } }
  8182. 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); } }
  8183. /**
  8184. * sin
  8185. * cos
  8186. * tan
  8187. * sqrt
  8188. * pow
  8189. * log
  8190. * abs
  8191. * negate
  8192. * invert
  8193. * max
  8194. * min
  8195. */
  8196. function convertToRadians(degrees) {
  8197. return degrees.times(_decimal.Decimal.acos(-1)).div(180);
  8198. }
  8199. function createSinFun() {
  8200. var sinFun = function sinFun(sto, _) {
  8201. var x = sto.applyStore('x');
  8202. var angle = x.value.mod(360);
  8203. var result = null;
  8204. if (angle.eq(90)) {
  8205. result = new _decimal.Decimal(1);
  8206. } else if (angle.eq(180)) {
  8207. result = new _decimal.Decimal(0);
  8208. } else if (angle.eq(270)) {
  8209. result = new _decimal.Decimal(-1);
  8210. } else {
  8211. result = _decimal.Decimal.sin(convertToRadians(angle));
  8212. }
  8213. if (result.dp() > _config.Config.decimalPlaces) {
  8214. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8215. }
  8216. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8217. sto.mode = _modes.Modes.RETURN;
  8218. return Promise.resolve(sto.updateStore('$', temp));
  8219. };
  8220. var block = new Commands.CommandBlock([], [new Commands.SysCall(sinFun)]);
  8221. var func = new Commands.Function('$sin', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8222. return func;
  8223. }
  8224. function createCosFun() {
  8225. var cosFun = function cosFun(sto, _) {
  8226. var x = sto.applyStore('x');
  8227. var angle = x.value.mod(360);
  8228. var result = null;
  8229. if (angle.eq(90)) {
  8230. result = new _decimal.Decimal(0);
  8231. } else if (angle.eq(180)) {
  8232. result = new _decimal.Decimal(-1);
  8233. } else if (angle.eq(270)) {
  8234. result = new _decimal.Decimal(0);
  8235. }
  8236. result = _decimal.Decimal.cos(convertToRadians(angle));
  8237. if (result.dp() > _config.Config.decimalPlaces) {
  8238. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8239. }
  8240. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8241. sto.mode = _modes.Modes.RETURN;
  8242. return Promise.resolve(sto.updateStore('$', temp));
  8243. };
  8244. var block = new Commands.CommandBlock([], [new Commands.SysCall(cosFun)]);
  8245. var func = new Commands.Function('$cos', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8246. return func;
  8247. }
  8248. function createTanFun() {
  8249. var tanFun = function tanFun(sto, _) {
  8250. var x = sto.applyStore('x');
  8251. var angle = x.value.mod(360);
  8252. if (angle.eq(90) || angle.eq(270)) {
  8253. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8254. }
  8255. var result = _decimal.Decimal.tan(convertToRadians(angle));
  8256. if (result.dp() > _config.Config.decimalPlaces) {
  8257. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8258. }
  8259. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8260. sto.mode = _modes.Modes.RETURN;
  8261. return Promise.resolve(sto.updateStore('$', temp));
  8262. };
  8263. var block = new Commands.CommandBlock([], [new Commands.SysCall(tanFun)]);
  8264. var func = new Commands.Function('$tan', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8265. return func;
  8266. }
  8267. function createSqrtFun() {
  8268. var sqrtFun = function sqrtFun(sto, _) {
  8269. var x = sto.applyStore('x');
  8270. var result = x.value.sqrt();
  8271. if (result.dp() > _config.Config.decimalPlaces) {
  8272. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8273. }
  8274. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8275. sto.mode = _modes.Modes.RETURN;
  8276. return Promise.resolve(sto.updateStore('$', temp));
  8277. };
  8278. var block = new Commands.CommandBlock([], [new Commands.SysCall(sqrtFun)]);
  8279. var func = new Commands.Function('$sqrt', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8280. return func;
  8281. }
  8282. function createPowFun() {
  8283. var powFun = function powFun(sto, _) {
  8284. var x = sto.applyStore('x');
  8285. var y = sto.applyStore('y');
  8286. var result = x.value.pow(y.value);
  8287. if (result.dp() > _config.Config.decimalPlaces) {
  8288. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8289. }
  8290. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8291. sto.mode = _modes.Modes.RETURN;
  8292. return Promise.resolve(sto.updateStore('$', temp));
  8293. };
  8294. var block = new Commands.CommandBlock([], [new Commands.SysCall(powFun)]);
  8295. 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);
  8296. return func;
  8297. }
  8298. function createLogFun() {
  8299. var logFun = function logFun(sto, _) {
  8300. var x = sto.applyStore('x');
  8301. if (x.value.isNegative()) {
  8302. return Promise.reject("the value passed to log function cannot be negative");
  8303. }
  8304. var result = _decimal.Decimal.log10(x.value);
  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(logFun)]);
  8313. var func = new Commands.Function('$log', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8314. return func;
  8315. }
  8316. function createAbsFun() {
  8317. var absFun = function absFun(sto, _) {
  8318. var x = sto.applyStore('x');
  8319. var result = x.value.abs();
  8320. var temp = new _storeObject.StoreObject(x.type, result);
  8321. sto.mode = _modes.Modes.RETURN;
  8322. return Promise.resolve(sto.updateStore('$', temp));
  8323. };
  8324. var block = new Commands.CommandBlock([], [new Commands.SysCall(absFun)]);
  8325. 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);
  8326. return func;
  8327. }
  8328. function createNegateFun() {
  8329. var negateFun = function negateFun(sto, _) {
  8330. var x = sto.applyStore('x');
  8331. var result = x.value.negated();
  8332. var temp = new _storeObject.StoreObject(x.type, result);
  8333. sto.mode = _modes.Modes.RETURN;
  8334. return Promise.resolve(sto.updateStore('$', temp));
  8335. };
  8336. var block = new Commands.CommandBlock([], [new Commands.SysCall(negateFun)]);
  8337. 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);
  8338. return func;
  8339. }
  8340. function createInvertFun() {
  8341. var invertFun = function invertFun(sto, _) {
  8342. var x = sto.applyStore('x');
  8343. var result = (0, _parsers.toReal)(1).dividedBy(x.value);
  8344. if (result.dp() > _config.Config.decimalPlaces) {
  8345. result = new _decimal.Decimal(result.toFixed(_config.Config.decimalPlaces));
  8346. }
  8347. var temp = new _storeObject.StoreObject(_types.Types.REAL, result);
  8348. sto.mode = _modes.Modes.RETURN;
  8349. return Promise.resolve(sto.updateStore('$', temp));
  8350. };
  8351. var block = new Commands.CommandBlock([], [new Commands.SysCall(invertFun)]);
  8352. var func = new Commands.Function('$invert', _types.Types.REAL, [new Commands.FormalParameter(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 'x', false)], block);
  8353. return func;
  8354. }
  8355. function createMaxFun() {
  8356. var maxFun = function maxFun(sto, _) {
  8357. var x = sto.applyStore('x');
  8358. var numbers = x.value.map(function (stoObj) {
  8359. return stoObj.value;
  8360. });
  8361. var result = _decimal.Decimal.max.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8362. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8363. sto.mode = _modes.Modes.RETURN;
  8364. return Promise.resolve(sto.updateStore('$', temp));
  8365. };
  8366. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8367. var block = new Commands.CommandBlock([], [new Commands.SysCall(maxFun)]);
  8368. var func = new Commands.Function('$max', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8369. return func;
  8370. }
  8371. function createMinFun() {
  8372. var minFun = function minFun(sto, _) {
  8373. var x = sto.applyStore('x');
  8374. var numbers = x.value.map(function (stoObj) {
  8375. return stoObj.value;
  8376. });
  8377. var result = _decimal.Decimal.min.apply(_decimal.Decimal, _toConsumableArray(numbers));
  8378. var temp = new _storeObject.StoreObject(x.type.innerType, result);
  8379. sto.mode = _modes.Modes.RETURN;
  8380. return Promise.resolve(sto.updateStore('$', temp));
  8381. };
  8382. var paramType = new _compoundType.CompoundType(new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), 1);
  8383. var block = new Commands.CommandBlock([], [new Commands.SysCall(minFun)]);
  8384. var func = new Commands.Function('$min', new _multiType.MultiType([_types.Types.INTEGER, _types.Types.REAL]), [new Commands.FormalParameter(paramType, 'x', false)], block);
  8385. return func;
  8386. }
  8387. /***/ }),
  8388. /***/ "./js/processor/lib/strings.js":
  8389. /*!*************************************!*\
  8390. !*** ./js/processor/lib/strings.js ***!
  8391. \*************************************/
  8392. /*! no static exports found */
  8393. /***/ (function(module, exports, __webpack_require__) {
  8394. "use strict";
  8395. Object.defineProperty(exports, "__esModule", {
  8396. value: true
  8397. });
  8398. exports.createSubstringFun = createSubstringFun;
  8399. exports.createLengthFun = createLengthFun;
  8400. exports.createUppercaseFun = createUppercaseFun;
  8401. exports.createLowercaseFun = createLowercaseFun;
  8402. exports.createrCharAtFun = createrCharAtFun;
  8403. var _storeObject = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8404. var _commands = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8405. var Commands = _interopRequireWildcard(_commands);
  8406. var _types = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8407. var _parsers = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8408. var _modes = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8409. 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; } }
  8410. /*
  8411. * substring
  8412. * length
  8413. * uppercase
  8414. * lowercase
  8415. * charAt
  8416. **/
  8417. function createSubstringFun() {
  8418. var substringFun = function substringFun(sto, _) {
  8419. var str = sto.applyStore("str");
  8420. var start = sto.applyStore("start");
  8421. var end = sto.applyStore("end");
  8422. var result = str.value.substring(start.value, end.value);
  8423. var temp = new _storeObject.StoreObject(_types.Types.STRING, result);
  8424. sto.mode = _modes.Modes.RETURN;
  8425. return Promise.resolve(sto.updateStore("$", temp));
  8426. };
  8427. var block = new Commands.CommandBlock([], [new Commands.SysCall(substringFun)]);
  8428. 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);
  8429. return func;
  8430. }
  8431. function createLengthFun() {
  8432. var lengthFun = function lengthFun(sto, _) {
  8433. var str = sto.applyStore("str");
  8434. var temp = new _storeObject.StoreObject(_types.Types.INTEGER, (0, _parsers.toInt)(str.value.length));
  8435. sto.mode = _modes.Modes.RETURN;
  8436. return Promise.resolve(sto.updateStore("$", temp));
  8437. };
  8438. var block = new Commands.CommandBlock([], [new Commands.SysCall(lengthFun)]);
  8439. var func = new Commands.Function('$length', _types.Types.INTEGER, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8440. return func;
  8441. }
  8442. function createUppercaseFun() {
  8443. var uppercaseFun = function uppercaseFun(sto, _) {
  8444. var str = sto.applyStore("str");
  8445. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toUpperCase());
  8446. sto.mode = _modes.Modes.RETURN;
  8447. return Promise.resolve(sto.updateStore("$", temp));
  8448. };
  8449. var block = new Commands.CommandBlock([], [new Commands.SysCall(uppercaseFun)]);
  8450. var func = new Commands.Function('$uppercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8451. return func;
  8452. }
  8453. function createLowercaseFun() {
  8454. var lowercaseFun = function lowercaseFun(sto, _) {
  8455. var str = sto.applyStore("str");
  8456. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.toLowerCase());
  8457. sto.mode = _modes.Modes.RETURN;
  8458. return Promise.resolve(sto.updateStore("$", temp));
  8459. };
  8460. var block = new Commands.CommandBlock([], [new Commands.SysCall(lowercaseFun)]);
  8461. var func = new Commands.Function('$lowercase', _types.Types.STRING, [new Commands.FormalParameter(_types.Types.STRING, 'str', false)], block);
  8462. return func;
  8463. }
  8464. function createrCharAtFun() {
  8465. var charAtFun = function charAtFun(sto, _) {
  8466. var str = sto.applyStore("str");
  8467. var idx = sto.applyStore("index");
  8468. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8469. return Promise.reject(new Error("invalid string position"));
  8470. }
  8471. var temp = new _storeObject.StoreObject(_types.Types.STRING, str.value.charAt(idx.value.toNumber()));
  8472. sto.mode = _modes.Modes.RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. };
  8475. var block = new Commands.CommandBlock([], [new Commands.SysCall(charAtFun)]);
  8476. 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);
  8477. return func;
  8478. }
  8479. /***/ }),
  8480. /***/ "./js/processor/modes.js":
  8481. /*!*******************************!*\
  8482. !*** ./js/processor/modes.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. var Modes = exports.Modes = Object.freeze({
  8491. RETURN: Symbol('mode:return'),
  8492. BREAK: Symbol('mode:break'),
  8493. PAUSE: Symbol('mode:pause'),
  8494. RUN: Symbol('mode:run')
  8495. });
  8496. /***/ }),
  8497. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8498. /*!***************************************************!*\
  8499. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8500. \***************************************************/
  8501. /*! no static exports found */
  8502. /***/ (function(module, exports, __webpack_require__) {
  8503. "use strict";
  8504. Object.defineProperty(exports, "__esModule", {
  8505. value: true
  8506. });
  8507. exports.SemanticAnalyser = undefined;
  8508. 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; }; }();
  8509. var _processorErrorFactory = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8510. var _definedFunctions = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8511. var _languageService = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8512. var _commands = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8513. var _expressions = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8514. var _literal = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8515. var _compatibilityTable = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8516. var _types = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8517. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8518. var _multiType = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8519. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8520. var SemanticAnalyser = exports.SemanticAnalyser = function () {
  8521. function SemanticAnalyser(ast) {
  8522. _classCallCheck(this, SemanticAnalyser);
  8523. this.ast = ast;
  8524. this.lexerClass = _languageService.LanguageService.getCurrentLexer();
  8525. var lexer = new this.lexerClass(null);
  8526. this.literalNames = lexer.literalNames;
  8527. this.symbolMap = null;
  8528. this.currentFunction = null;
  8529. }
  8530. _createClass(SemanticAnalyser, [{
  8531. key: 'pushMap',
  8532. value: function pushMap() {
  8533. if (this.symbolMap === null) {
  8534. this.symbolMap = { map: {}, next: null };
  8535. } else {
  8536. var n = { map: {}, next: this.symbolMap };
  8537. this.symbolMap = n;
  8538. }
  8539. }
  8540. }, {
  8541. key: 'popMap',
  8542. value: function popMap() {
  8543. if (this.symbolMap !== null) {
  8544. this.symbolMap = this.symbolMap.next;
  8545. }
  8546. }
  8547. }, {
  8548. key: 'insertSymbol',
  8549. value: function insertSymbol(id, typeInfo) {
  8550. this.symbolMap.map[id] = typeInfo;
  8551. }
  8552. }, {
  8553. key: 'findSymbol',
  8554. value: function findSymbol(id, symMap) {
  8555. if (!symMap.map[id]) {
  8556. if (symMap.next) {
  8557. return this.findSymbol(id, symMap.next);
  8558. }
  8559. return null;
  8560. } else {
  8561. return symMap.map[id];
  8562. }
  8563. }
  8564. }, {
  8565. key: 'getMainFunction',
  8566. value: function getMainFunction() {
  8567. return this.ast.functions.find(function (v) {
  8568. return v.isMain;
  8569. });
  8570. }
  8571. }, {
  8572. key: 'findFunction',
  8573. value: function findFunction(name) {
  8574. if (name.match(/^\$.+$/)) {
  8575. var fun = _definedFunctions.LanguageDefinedFunction.getFunction(name);
  8576. if (!!!fun) {
  8577. throw _processorErrorFactory.ProcessorErrorFactory.not_implemented(name);
  8578. }
  8579. return fun;
  8580. } else {
  8581. var val = this.ast.functions.find(function (v) {
  8582. return v.name === name;
  8583. });
  8584. if (!!!val) {
  8585. return null;
  8586. }
  8587. return val;
  8588. }
  8589. }
  8590. }, {
  8591. key: 'analyseTree',
  8592. value: function analyseTree() {
  8593. var globalVars = this.ast.global;
  8594. this.pushMap();
  8595. this.assertDeclarations(globalVars);
  8596. var functions = this.ast.functions;
  8597. var mainFunc = functions.filter(function (f) {
  8598. return f.name === null;
  8599. });
  8600. if (mainFunc.length <= 0) {
  8601. throw _processorErrorFactory.ProcessorErrorFactory.main_missing();
  8602. }
  8603. for (var i = 0; i < functions.length; i++) {
  8604. var fun = functions[i];
  8605. this.assertFunction(fun);
  8606. }
  8607. return this.ast;
  8608. }
  8609. }, {
  8610. key: 'assertDeclarations',
  8611. value: function assertDeclarations(list) {
  8612. for (var i = 0; i < list.length; i++) {
  8613. this.assertDeclaration(list[i]);
  8614. }
  8615. }
  8616. }, {
  8617. key: 'assertDeclaration',
  8618. value: function assertDeclaration(declaration) {
  8619. if (declaration instanceof _commands.ArrayDeclaration) {
  8620. if (declaration.initial === null) {
  8621. var lineType = this.evaluateExpressionType(declaration.lines);
  8622. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8623. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8624. }
  8625. if (declaration.columns !== null) {
  8626. var columnType = this.evaluateExpressionType(declaration.columns);
  8627. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8628. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(declaration.sourceInfo);
  8629. }
  8630. }
  8631. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8632. return;
  8633. }
  8634. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8635. this.insertSymbol(declaration.id, { id: declaration.id, lines: declaration.lines, columns: declaration.columns, type: declaration.type });
  8636. } else {
  8637. if (declaration.initial === null) {
  8638. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8639. return;
  8640. }
  8641. var resultType = this.evaluateExpressionType(declaration.initial);
  8642. if (resultType instanceof _multiType.MultiType) {
  8643. if (!resultType.isCompatible(declaration.type)) {
  8644. var stringInfo = declaration.type.stringInfo();
  8645. var info = stringInfo[0];
  8646. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  8647. }
  8648. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8649. } else if (!declaration.type.isCompatible(resultType)) {
  8650. var _stringInfo = declaration.type.stringInfo();
  8651. var _info = _stringInfo[0];
  8652. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  8653. } else {
  8654. this.insertSymbol(declaration.id, { id: declaration.id, type: declaration.type });
  8655. }
  8656. }
  8657. }
  8658. }, {
  8659. key: 'evaluateExpressionType',
  8660. value: function evaluateExpressionType(expression) {
  8661. if (expression instanceof _expressions.UnaryApp) {
  8662. var op = expression.op;
  8663. var resultType = this.evaluateExpressionType(expression.left);
  8664. return (0, _compatibilityTable.resultTypeAfterUnaryOp)(op, resultType);
  8665. } else if (expression instanceof _expressions.InfixApp) {
  8666. var _op = expression.op;
  8667. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  8668. var resultTypeRight = this.evaluateExpressionType(expression.right);
  8669. return (0, _compatibilityTable.resultTypeAfterInfixOp)(_op, resultTypeLeft, resultTypeRight);
  8670. } else if (expression instanceof _literal.Literal) {
  8671. return this.evaluateLiteralType(expression);
  8672. } else if (expression instanceof _expressions.FunctionCall) {
  8673. if (expression.isMainCall) {
  8674. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(_definedFunctions.LanguageDefinedFunction.getMainFunctionName(), expression.sourceInfo);
  8675. }
  8676. var fun = this.findFunction(expression.id);
  8677. if (fun === null) {
  8678. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(expression.id, expression.sourceInfo);
  8679. }
  8680. if (fun.returnType.isCompatible(_types.Types.VOID)) {
  8681. throw _processorErrorFactory.ProcessorErrorFactory.void_in_expression_full(expression.id, expression.sourceInfo);
  8682. }
  8683. this.assertParameters(fun, expression.actualParameters);
  8684. return fun.returnType;
  8685. } else if (expression instanceof _expressions.ArrayAccess) {
  8686. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  8687. if (arrayTypeInfo === null) {
  8688. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(expression.id, expression.sourceInfo);
  8689. }
  8690. if (!(arrayTypeInfo.type instanceof _compoundType.CompoundType)) {
  8691. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(expression.id, expression.sourceInfo);
  8692. }
  8693. var lineType = this.evaluateExpressionType(expression.line);
  8694. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8695. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8696. }
  8697. if (expression.column !== null) {
  8698. if (arrayTypeInfo.columns === null) {
  8699. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(expression.id, expression.sourceInfo);
  8700. }
  8701. var columnType = this.evaluateExpressionType(expression.column);
  8702. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8703. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(expression.sourceInfo);
  8704. }
  8705. }
  8706. var arrType = arrayTypeInfo.type;
  8707. if (expression.column !== null) {
  8708. // indexing matrix
  8709. return arrType.innerType;
  8710. } else {
  8711. if (arrayTypeInfo.columns === null) {
  8712. return arrType.innerType;
  8713. }
  8714. return new _compoundType.CompoundType(arrType.innerType, 1);
  8715. }
  8716. }
  8717. }
  8718. }, {
  8719. key: 'evaluateLiteralType',
  8720. value: function evaluateLiteralType(literal) {
  8721. if (literal instanceof _expressions.IntLiteral) {
  8722. return literal.type;
  8723. } else if (literal instanceof _expressions.RealLiteral) {
  8724. return literal.type;
  8725. } else if (literal instanceof _expressions.StringLiteral) {
  8726. return literal.type;
  8727. } else if (literal instanceof _expressions.BoolLiteral) {
  8728. return literal.type;
  8729. } else if (literal instanceof _expressions.VariableLiteral) {
  8730. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  8731. if (typeInfo === null) {
  8732. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(literal.id, literal.sourceInfo);
  8733. }
  8734. if (typeInfo.type instanceof _compoundType.CompoundType) {
  8735. return typeInfo.type;
  8736. }
  8737. return typeInfo.type;
  8738. } else {
  8739. console.warn("Evaluating type only for an array literal...");
  8740. var last = null;
  8741. if (literal.value.length === 1) {
  8742. last = this.evaluateExpressionType(literal.value[0]);
  8743. } else {
  8744. for (var i = 0; i < literal.value.length; i++) {
  8745. var e = this.evaluateExpressionType(literal.value[i]);
  8746. if (last === null) {
  8747. last = e;
  8748. } else if (!last.isCompatible(e)) {
  8749. var strInfo = last.stringInfo();
  8750. var info = strInfo[0];
  8751. var strExp = literal.toString();
  8752. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8753. }
  8754. }
  8755. }
  8756. if (last instanceof _compoundType.CompoundType) {
  8757. return new _compoundType.CompoundType(last.innerType, last.dimensions + 1);
  8758. }
  8759. return new _compoundType.CompoundType(last, 1);
  8760. }
  8761. }
  8762. }, {
  8763. key: 'evaluateArrayLiteral',
  8764. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  8765. var _this = this;
  8766. if (literal instanceof _expressions.ArrayLiteral) {
  8767. if (columns === null) {
  8768. // it's a vector...
  8769. var dimType = this.evaluateExpressionType(lines);
  8770. if (!dimType.isCompatible(_types.Types.INTEGER)) {
  8771. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8772. }
  8773. if (lines instanceof _expressions.IntLiteral) {
  8774. if (!lines.value.eq(literal.value.length)) {
  8775. if (type.dimensions > 1) {
  8776. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8777. } else {
  8778. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.values.toNumber(), literal.sourceInfo);
  8779. }
  8780. } else if (line.value.isNeg()) {
  8781. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8782. }
  8783. }
  8784. literal.value.reduce(function (last, next) {
  8785. var eType = _this.evaluateExpressionType(next);
  8786. if (!last.canAccept(eType)) {
  8787. var strInfo = last.stringInfo();invalid;
  8788. var info = strInfo[0];
  8789. var strExp = literal.toString();
  8790. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8791. }
  8792. return last;
  8793. }, type);
  8794. return true;
  8795. } else {
  8796. var _dimType = this.evaluateExpressionType(columns);
  8797. if (!_dimType.isCompatible(_types.Types.INTEGER)) {
  8798. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  8799. }
  8800. if (columns instanceof _expressions.IntLiteral) {
  8801. if (!columns.value.eq(literal.value.length)) {
  8802. if (type.dimensions > 1) {
  8803. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.values.toNumber(), literal.sourceInfo);
  8804. } else {
  8805. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  8806. }
  8807. } else if (columns.value.isNeg()) {
  8808. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  8809. }
  8810. }
  8811. for (var i = 0; i < columns; i++) {
  8812. var anotherArray = literal.value[i];
  8813. this.evaluateArrayLiteral(id, lines, null, type, anotherArray);
  8814. }
  8815. }
  8816. } else {
  8817. var resultType = this.evaluateExpressionType(literal);
  8818. if (!(resultType instanceof _compoundType.CompoundType)) {
  8819. var strInfo = type.stringInfo();
  8820. var info = strInfo[0];
  8821. var strExp = literal.toString();
  8822. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  8823. }
  8824. if (!type.isCompatible(resultType)) {
  8825. var _strInfo = type.stringInfo();
  8826. var _info2 = _strInfo[0];
  8827. var _strExp = literal.toString();
  8828. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_array_full(_strExp, _info2.type, _info2.dim, literal.sourceInfo);
  8829. }
  8830. return true;
  8831. }
  8832. }
  8833. }, {
  8834. key: 'assertFunction',
  8835. value: function assertFunction(fun) {
  8836. var _this2 = this;
  8837. this.pushMap();
  8838. this.currentFunction = fun;
  8839. fun.formalParameters.forEach(function (formalParam) {
  8840. if (formalParam.type instanceof _compoundType.CompoundType) {
  8841. if (formalParam.type.dimensions > 1) {
  8842. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: -1, type: formalParam.type });
  8843. } else {
  8844. _this2.insertSymbol(formalParam.id, { id: formalParam.id, lines: -1, columns: null, type: formalParam.type });
  8845. }
  8846. } else {
  8847. _this2.insertSymbol(formalParam.id, { id: formalParam.id, type: formalParam.type });
  8848. }
  8849. });
  8850. this.assertDeclarations(fun.variablesDeclarations);
  8851. var optional = fun.returnType.isCompatible(_types.Types.VOID);
  8852. var valid = this.assertReturn(fun, optional);
  8853. if (!valid) {
  8854. throw _processorErrorFactory.ProcessorErrorFactory.function_no_return(fun.name);
  8855. }
  8856. this.popMap();
  8857. }
  8858. }, {
  8859. key: 'assertReturn',
  8860. value: function assertReturn(fun, optional) {
  8861. var _this3 = this;
  8862. return fun.commands.reduce(function (last, next) {
  8863. return _this3.checkCommand(fun.returnType, next, optional) || last;
  8864. }, optional);
  8865. }
  8866. }, {
  8867. key: 'checkCommand',
  8868. value: function checkCommand(type, cmd, optional) {
  8869. if (cmd instanceof _commands.While) {
  8870. var resultType = this.evaluateExpressionType(cmd.expression);
  8871. if (!resultType.isCompatible(_types.Types.BOOLEAN)) {
  8872. throw _processorErrorFactory.ProcessorErrorFactory.loop_condition_type_full(cmd.sourceInfo);
  8873. }
  8874. this.checkCommands(type, cmd.commands, optional);
  8875. return false;
  8876. } else if (cmd instanceof _commands.For) {
  8877. this.checkCommand(type, cmd.assignment, optional);
  8878. var _resultType = this.evaluateExpressionType(cmd.condition);
  8879. if (!_resultType.isCompatible(_types.Types.BOOLEAN)) {
  8880. throw _processorErrorFactory.ProcessorErrorFactory.for_condition_type_full(cmd.sourceInfo);
  8881. }
  8882. this.checkCommand(type, cmd.increment, optional);
  8883. this.checkCommands(type, cmd.commands, optional);
  8884. return false;
  8885. } else if (cmd instanceof _commands.Switch) {
  8886. var sType = this.evaluateExpressionType(cmd.expression);
  8887. var result = optional;
  8888. var hasDefault = false;
  8889. for (var i = 0; i < cmd.cases.length; i++) {
  8890. var aCase = cmd.cases[i];
  8891. if (aCase.expression !== null) {
  8892. var caseType = this.evaluateExpressionType(aCase.expression);
  8893. if (!sType.isCompatible(caseType)) {
  8894. var strInfo = sType.stringInfo();
  8895. var info = strInfo[0];
  8896. var strExp = aCase.expression.toString();
  8897. throw _processorErrorFactory.ProcessorErrorFactory.invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  8898. }
  8899. } else {
  8900. hasDefault = true;
  8901. }
  8902. result = result && this.checkCommands(type, aCase.commands, result);
  8903. }
  8904. return result && hasDefault;
  8905. } else if (cmd instanceof _commands.ArrayIndexAssign) {
  8906. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8907. if (typeInfo === null) {
  8908. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8909. }
  8910. if (!(typeInfo.type instanceof _compoundType.CompoundType)) {
  8911. throw _processorErrorFactory.ProcessorErrorFactory.invalid_array_access_full(cmd.id, cmd.sourceInfo);
  8912. }
  8913. var exp = cmd.expression;
  8914. var lineExp = cmd.line;
  8915. var lineType = this.evaluateExpressionType(lineExp);
  8916. if (!lineType.isCompatible(_types.Types.INTEGER)) {
  8917. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8918. }
  8919. var columnExp = cmd.column;
  8920. if (typeInfo.columns === null && columnExp !== null) {
  8921. throw _processorErrorFactory.ProcessorErrorFactory.invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  8922. } else if (columnExp !== null) {
  8923. var columnType = this.evaluateExpressionType(columnExp);
  8924. if (!columnType.isCompatible(_types.Types.INTEGER)) {
  8925. throw _processorErrorFactory.ProcessorErrorFactory.array_dimension_not_int_full(cmd.sourceInfo);
  8926. }
  8927. }
  8928. // exp can be a arrayLiteral, a single value exp or an array access
  8929. if (exp instanceof _expressions.ArrayLiteral) {
  8930. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  8931. } else {
  8932. // cannot properly evaluate since type system is poorly constructed
  8933. }
  8934. return optional;
  8935. } else if (cmd instanceof _commands.Assign) {
  8936. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  8937. if (_typeInfo === null) {
  8938. throw _processorErrorFactory.ProcessorErrorFactory.symbol_not_found_full(cmd.id, cmd.sourceInfo);
  8939. }
  8940. var _exp = cmd.expression;
  8941. if (_exp instanceof _expressions.ArrayLiteral) {
  8942. if (!(_typeInfo.type instanceof _compoundType.CompoundType)) {
  8943. var stringInfo = _typeInfo.type.stringInfo();
  8944. var _info3 = stringInfo[0];
  8945. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  8946. }
  8947. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  8948. } else {
  8949. var _resultType2 = this.evaluateExpressionType(_exp);
  8950. if (!_resultType2.isCompatible(_typeInfo.type)) {
  8951. var _stringInfo2 = _typeInfo.type.stringInfo();
  8952. var _info4 = _stringInfo2[0];
  8953. throw _processorErrorFactory.ProcessorErrorFactory.incompatible_types_full(_info4.type, _info4.dim, cmd.sourceInfo);
  8954. }
  8955. }
  8956. return optional;
  8957. } else if (cmd instanceof _commands.Break) {
  8958. return optional;
  8959. } else if (cmd instanceof _commands.IfThenElse) {
  8960. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  8961. if (!_resultType3.isCompatible(_types.Types.BOOLEAN)) {
  8962. throw _processorErrorFactory.ProcessorErrorFactory.if_condition_type_full(cmd.sourceInfo);
  8963. }
  8964. if (cmd.ifFalse instanceof _commands.IfThenElse) {
  8965. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  8966. } else {
  8967. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  8968. }
  8969. } else if (cmd instanceof _expressions.FunctionCall) {
  8970. var fun = null;
  8971. if (cmd.isMainCall) {
  8972. fun = this.getMainFunction();
  8973. } else {
  8974. fun = this.findFunction(cmd.id);
  8975. }
  8976. if (fun === null) {
  8977. throw _processorErrorFactory.ProcessorErrorFactory.function_missing_full(cmd.id, cmd.sourceInfo);
  8978. }
  8979. this.assertParameters(fun, cmd.actualParameters);
  8980. return optional;
  8981. } else if (cmd instanceof _commands.Return) {
  8982. var funcName = this.currentFunction.isMain ? _definedFunctions.LanguageDefinedFunction.getMainFunctionName() : this.currentFunction.name;
  8983. if (cmd.expression === null && !type.isCompatible(_types.Types.VOID)) {
  8984. var _stringInfo3 = type.stringInfo();
  8985. var _info5 = _stringInfo3[0];
  8986. throw _processorErrorFactory.ProcessorErrorFactory.invalid_void_return_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  8987. } else if (cmd.expression !== null) {
  8988. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  8989. if (!type.isCompatible(_resultType4)) {
  8990. var _stringInfo4 = type.stringInfo();
  8991. var _info6 = _stringInfo4[0];
  8992. throw _processorErrorFactory.ProcessorErrorFactory.invalid_return_type_full(funcName, _info6.type, _info6.dim, cmd.sourceInfo);
  8993. } else {
  8994. return true;
  8995. }
  8996. } else {
  8997. return true;
  8998. }
  8999. }
  9000. }
  9001. }, {
  9002. key: 'checkCommands',
  9003. value: function checkCommands(type, cmds, optional) {
  9004. var _this4 = this;
  9005. return cmds.reduce(function (last, next) {
  9006. return _this4.checkCommand(type, next, optional) || last;
  9007. }, optional);
  9008. }
  9009. }, {
  9010. key: 'assertParameters',
  9011. value: function assertParameters(fun, actualParametersList) {
  9012. if (fun.formalParameters.length !== actualParametersList.length) {
  9013. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9014. }
  9015. for (var i = 0; i < actualParametersList.length; i++) {
  9016. var param = actualParametersList[i];
  9017. var formalParam = fun.formalParameters[i];
  9018. if (formalParam.byRef) {
  9019. if (!(param instanceof _expressions.VariableLiteral || param instanceof _expressions.ArrayAccess)) {
  9020. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9021. }
  9022. }
  9023. var resultType = this.evaluateExpressionType(param);
  9024. if (resultType instanceof _multiType.MultiType && formalParam.type instanceof _multiType.MultiType) {
  9025. var shared = 0;
  9026. for (var j = 0; j < resultType.types.length; j++) {
  9027. var element = resultType.types[j];
  9028. if (formalParam.type.types.indexOf(element) !== -1) {
  9029. shared++;
  9030. }
  9031. }
  9032. if (shared <= 0) {
  9033. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9034. }
  9035. } else if (resultType instanceof _multiType.MultiType) {
  9036. if (!resultType.isCompatible(formalParam.type)) {
  9037. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9038. }
  9039. } else if (!formalParam.type.isCompatible(resultType)) {
  9040. throw _processorErrorFactory.ProcessorErrorFactory.invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9041. }
  9042. }
  9043. }
  9044. }]);
  9045. return SemanticAnalyser;
  9046. }();
  9047. /***/ }),
  9048. /***/ "./js/processor/store/store.js":
  9049. /*!*************************************!*\
  9050. !*** ./js/processor/store/store.js ***!
  9051. \*************************************/
  9052. /*! no static exports found */
  9053. /***/ (function(module, exports, __webpack_require__) {
  9054. "use strict";
  9055. Object.defineProperty(exports, "__esModule", {
  9056. value: true
  9057. });
  9058. exports.Store = undefined;
  9059. 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; }; }();
  9060. var _modes = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9061. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9062. var Store = exports.Store = function () {
  9063. function Store(name) {
  9064. _classCallCheck(this, Store);
  9065. this.name = name;
  9066. this.store = {};
  9067. this.nextStore = null;
  9068. this.mode = _modes.Modes.RUN;
  9069. }
  9070. _createClass(Store, [{
  9071. key: "extendStore",
  9072. value: function extendStore(nextStore) {
  9073. this.nextStore = nextStore;
  9074. }
  9075. }, {
  9076. key: "applyStore",
  9077. value: function applyStore(id) {
  9078. if (!this.store[id]) {
  9079. if (this.nextStore !== null) {
  9080. return this.nextStore.applyStore(id);
  9081. } else {
  9082. // TODO: better error message
  9083. throw new Error("Variable " + id + " not found.");
  9084. }
  9085. }
  9086. var val = this.store[id];
  9087. if (val.isRef) {
  9088. return val.getRefObj();
  9089. }
  9090. return this.store[id];
  9091. }
  9092. }, {
  9093. key: "updateStore",
  9094. value: function updateStore(id, stoObj) {
  9095. if (!this.store[id]) {
  9096. if (this.nextStore !== null) {
  9097. this.nextStore.updateStore(id, stoObj);
  9098. return this;
  9099. } else {
  9100. // TODO: better error message
  9101. throw new Error("Variable " + id + " not found.");
  9102. }
  9103. } else {
  9104. var oldObj = this.store[id];
  9105. if (oldObj.readOnly) {
  9106. // TODO: better error message
  9107. throw new Error("Cannot change value of a read only variable: " + id);
  9108. }
  9109. if (oldObj.isRef) {
  9110. oldObj.updateRef(stoObj);
  9111. return this;
  9112. } else if (oldObj.isCompatible(stoObj)) {
  9113. stoObj.setID(id);
  9114. this.store[id] = Object.freeze(stoObj);
  9115. return this;
  9116. } else {
  9117. var oldType = oldObj.type;
  9118. var stoType = stoObj.type;
  9119. // TODO: better error message
  9120. throw new Error(oldType + " is not compatible with type " + stoType + " given");
  9121. }
  9122. }
  9123. }
  9124. //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9125. // and no the StoreObject refferenced by it
  9126. // updateStoreRef(id, stoObjAddress) {...}
  9127. }, {
  9128. key: "insertStore",
  9129. value: function insertStore(id, stoObj) {
  9130. if (this.store[id]) {
  9131. // TODO: better error message
  9132. throw new Error(id + " is already defined");
  9133. }
  9134. stoObj.setID(id);
  9135. this.store[id] = Object.freeze(stoObj);
  9136. return this;
  9137. }
  9138. }]);
  9139. return Store;
  9140. }();
  9141. /***/ }),
  9142. /***/ "./js/processor/store/storeObject.js":
  9143. /*!*******************************************!*\
  9144. !*** ./js/processor/store/storeObject.js ***!
  9145. \*******************************************/
  9146. /*! no static exports found */
  9147. /***/ (function(module, exports, __webpack_require__) {
  9148. "use strict";
  9149. Object.defineProperty(exports, "__esModule", {
  9150. value: true
  9151. });
  9152. exports.StoreObject = undefined;
  9153. 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; }; }();
  9154. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9155. var _decimal2 = _interopRequireDefault(_decimal);
  9156. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9157. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9158. var StoreObject = exports.StoreObject = function () {
  9159. function StoreObject(type, value) {
  9160. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9161. _classCallCheck(this, StoreObject);
  9162. this._type = type;
  9163. this._value = value;
  9164. this._readOnly = readOnly;
  9165. this._id = null;
  9166. }
  9167. _createClass(StoreObject, [{
  9168. key: 'setID',
  9169. value: function setID(id) {
  9170. this._id = id;
  9171. }
  9172. }, {
  9173. key: 'isCompatible',
  9174. value: function isCompatible(another) {
  9175. if (another instanceof StoreObject) {
  9176. return this.type.isCompatible(another.type);
  9177. }
  9178. return false;
  9179. }
  9180. }, {
  9181. key: 'id',
  9182. get: function get() {
  9183. return this._id;
  9184. }
  9185. }, {
  9186. key: 'inStore',
  9187. get: function get() {
  9188. return this.id !== null;
  9189. }
  9190. }, {
  9191. key: 'type',
  9192. get: function get() {
  9193. return this._type;
  9194. }
  9195. }, {
  9196. key: 'value',
  9197. get: function get() {
  9198. return this._value;
  9199. }
  9200. }, {
  9201. key: 'number',
  9202. get: function get() {
  9203. if (this._value instanceof _decimal2.default) {
  9204. return this._value.toNumber();
  9205. } else {
  9206. return null;
  9207. }
  9208. }
  9209. }, {
  9210. key: 'readOnly',
  9211. get: function get() {
  9212. return this._readOnly;
  9213. },
  9214. set: function set(value) {
  9215. this._readOnly = value;
  9216. }
  9217. }]);
  9218. return StoreObject;
  9219. }();
  9220. /***/ }),
  9221. /***/ "./js/processor/store/storeObjectArray.js":
  9222. /*!************************************************!*\
  9223. !*** ./js/processor/store/storeObjectArray.js ***!
  9224. \************************************************/
  9225. /*! no static exports found */
  9226. /***/ (function(module, exports, __webpack_require__) {
  9227. "use strict";
  9228. Object.defineProperty(exports, "__esModule", {
  9229. value: true
  9230. });
  9231. exports.StoreObjectArray = undefined;
  9232. 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); } };
  9233. 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; }; }();
  9234. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9235. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9236. 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; }
  9237. 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; }
  9238. var StoreObjectArray = exports.StoreObjectArray = function (_StoreObject) {
  9239. _inherits(StoreObjectArray, _StoreObject);
  9240. _createClass(StoreObjectArray, null, [{
  9241. key: 'WRONG_LINE_NUMBER',
  9242. get: function get() {
  9243. return 1;
  9244. }
  9245. }, {
  9246. key: 'WRONG_TYPE',
  9247. get: function get() {
  9248. return 2;
  9249. }
  9250. }, {
  9251. key: 'WRONG_COLUMN_NUMBER',
  9252. get: function get() {
  9253. return 3;
  9254. }
  9255. }]);
  9256. function StoreObjectArray(type, lines, columns) {
  9257. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9258. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9259. _classCallCheck(this, StoreObjectArray);
  9260. var _this = _possibleConstructorReturn(this, (StoreObjectArray.__proto__ || Object.getPrototypeOf(StoreObjectArray)).call(this, type, value, readOnly));
  9261. _this._lines = lines;
  9262. _this._columns = columns;
  9263. return _this;
  9264. }
  9265. _createClass(StoreObjectArray, [{
  9266. key: 'isCompatible',
  9267. value: function isCompatible(another) {
  9268. if (another instanceof _storeObject.StoreObject) {
  9269. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9270. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9271. return _get(StoreObjectArray.prototype.__proto__ || Object.getPrototypeOf(StoreObjectArray.prototype), 'isCompatible', this).call(this, another);
  9272. }
  9273. }
  9274. }
  9275. return false;
  9276. }
  9277. }, {
  9278. key: 'lines',
  9279. get: function get() {
  9280. return this._lines;
  9281. }
  9282. }, {
  9283. key: 'columns',
  9284. get: function get() {
  9285. return this._columns;
  9286. }
  9287. }, {
  9288. key: 'isVector',
  9289. get: function get() {
  9290. return this.type.dimensions === 1;
  9291. }
  9292. }, {
  9293. key: 'isValid',
  9294. get: function get() {
  9295. var _this2 = this;
  9296. if (this.value !== null) {
  9297. if (this.isVector) {
  9298. if (this.value.length !== this.lines) {
  9299. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];;
  9300. }
  9301. var mustBeNull = this.value.find(function (v) {
  9302. return !_this2.type.canAccept(v.type);
  9303. });
  9304. if (!!mustBeNull) {
  9305. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];;
  9306. }
  9307. }
  9308. return [];
  9309. } else {
  9310. if (this.lines !== this.value.length) {
  9311. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9312. }
  9313. for (var i = 0; i < this.lines; i++) {
  9314. for (var j = 0; j < this.columns; j++) {
  9315. var arr = this.value[i];
  9316. if (arr.length !== this.columns) {
  9317. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9318. }
  9319. var _mustBeNull = arr.find(function (v) {
  9320. return !_this2.type.canAccept(v.type);
  9321. });
  9322. if (!!_mustBeNull) {
  9323. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9324. }
  9325. }
  9326. }
  9327. return [];
  9328. }
  9329. }
  9330. }]);
  9331. return StoreObjectArray;
  9332. }(_storeObject.StoreObject);
  9333. /***/ }),
  9334. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9335. /*!*******************************************************!*\
  9336. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9337. \*******************************************************/
  9338. /*! no static exports found */
  9339. /***/ (function(module, exports, __webpack_require__) {
  9340. "use strict";
  9341. Object.defineProperty(exports, "__esModule", {
  9342. value: true
  9343. });
  9344. exports.StoreObjectArrayAddress = undefined;
  9345. 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; }; }();
  9346. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9347. var _storeObjectArray = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9348. var _compoundType = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9349. var _processorErrorFactory = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9350. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9351. 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; }
  9352. 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; }
  9353. var StoreObjectArrayAddress = exports.StoreObjectArrayAddress = function (_StoreObject) {
  9354. _inherits(StoreObjectArrayAddress, _StoreObject);
  9355. function StoreObjectArrayAddress(refID, line, column, store) {
  9356. _classCallCheck(this, StoreObjectArrayAddress);
  9357. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddress.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddress)).call(this, null, null, false));
  9358. _this.refID = refID;
  9359. _this.store = store;
  9360. _this.line = line;
  9361. _this.column = column;
  9362. return _this;
  9363. }
  9364. _createClass(StoreObjectArrayAddress, [{
  9365. key: 'getArrayObject',
  9366. value: function getArrayObject() {
  9367. return this.store.applyStore(this.refID);
  9368. }
  9369. }, {
  9370. key: 'updateArrayObject',
  9371. value: function updateArrayObject(stoObj) {
  9372. var anArray = this.getArrayObject();
  9373. var newArray = Object.assign(new _storeObjectArray.StoreObjectArray(null, null, null), anArray);
  9374. if (!stoObj.type.isCompatible(this.type)) {
  9375. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9376. } else if (this.type instanceof _compoundType.CompoundType && this.type.canAccept(stoObj.type)) {
  9377. throw new Error('Invalid operation: cannot assign the value given to ' + this.refID);
  9378. }
  9379. if (this.column !== null) {
  9380. newArray.value[this.line].value[this.column] = stoObj;
  9381. return newArray;
  9382. } else {
  9383. newArray.value[this.line] = stoObj;
  9384. return newArray;
  9385. }
  9386. }
  9387. }, {
  9388. key: 'isCompatible',
  9389. value: function isCompatible(another) {
  9390. if (this.type.isCompatible(another.type)) {
  9391. if (another.type instanceof _compoundType.CompoundType) {
  9392. return this.lines === another.lines && this.columns === another.columns;
  9393. } else {
  9394. this.refValue.isCompatible(another);
  9395. }
  9396. }
  9397. }
  9398. }, {
  9399. key: 'isRef',
  9400. get: function get() {
  9401. return false;
  9402. }
  9403. }, {
  9404. key: 'inStore',
  9405. get: function get() {
  9406. return true;
  9407. }
  9408. }, {
  9409. key: 'refValue',
  9410. get: function get() {
  9411. var refLine = this.store.applyStore(this.refID).value[this.line];
  9412. if (!refLine) {
  9413. if (this.getArrayObject().isVector) {
  9414. throw _processorErrorFactory.ProcessorErrorFactory.vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9415. } else {
  9416. throw _processorErrorFactory.ProcessorErrorFactory.matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9417. }
  9418. }
  9419. if (this.column !== null) {
  9420. var refColumn = refLine.value[this.column];
  9421. if (!refColumn) {
  9422. if (this.getArrayObject().isVector) {
  9423. throw _processorErrorFactory.ProcessorErrorFactory.vector_not_matrix(this.refID);
  9424. } else {
  9425. throw _processorErrorFactory.ProcessorErrorFactory.matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9426. }
  9427. }
  9428. return refColumn;
  9429. }
  9430. return refLine;
  9431. }
  9432. }, {
  9433. key: 'value',
  9434. get: function get() {
  9435. return this.refValue.value;
  9436. }
  9437. }, {
  9438. key: 'type',
  9439. get: function get() {
  9440. return this.refValue.type;
  9441. }
  9442. }, {
  9443. key: 'lines',
  9444. get: function get() {
  9445. if (!(this.type instanceof _compoundType.CompoundType)) {
  9446. return null;
  9447. }
  9448. return this.refValue.value.length;
  9449. }
  9450. }, {
  9451. key: 'columns',
  9452. get: function get() {
  9453. switch (this.type.dimensions) {
  9454. case 2:
  9455. return this.refValue.value[0].value.length;
  9456. default:
  9457. return null;
  9458. }
  9459. }
  9460. }]);
  9461. return StoreObjectArrayAddress;
  9462. }(_storeObject.StoreObject);
  9463. /***/ }),
  9464. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9465. /*!**********************************************************!*\
  9466. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9467. \**********************************************************/
  9468. /*! no static exports found */
  9469. /***/ (function(module, exports, __webpack_require__) {
  9470. "use strict";
  9471. Object.defineProperty(exports, "__esModule", {
  9472. value: true
  9473. });
  9474. exports.StoreObjectArrayAddressRef = undefined;
  9475. 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; }; }();
  9476. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9477. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9478. var _decimal2 = _interopRequireDefault(_decimal);
  9479. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9480. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9481. 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; }
  9482. 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; }
  9483. var StoreObjectArrayAddressRef = exports.StoreObjectArrayAddressRef = function (_StoreObject) {
  9484. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9485. function StoreObjectArrayAddressRef(address) {
  9486. _classCallCheck(this, StoreObjectArrayAddressRef);
  9487. var _this = _possibleConstructorReturn(this, (StoreObjectArrayAddressRef.__proto__ || Object.getPrototypeOf(StoreObjectArrayAddressRef)).call(this, null, null, false));
  9488. _this.address = address;
  9489. return _this;
  9490. }
  9491. _createClass(StoreObjectArrayAddressRef, [{
  9492. key: 'getRefObj',
  9493. value: function getRefObj() {
  9494. return this.address.refValue;
  9495. }
  9496. }, {
  9497. key: 'updateRef',
  9498. value: function updateRef(stoObj) {
  9499. var newArray = this.address.updateArrayObject(stoObj);
  9500. this.address.store.updateStore(this.address.refID, newArray);
  9501. }
  9502. }, {
  9503. key: 'isCompatible',
  9504. value: function isCompatible(another) {
  9505. return this.address.isCompatible(another);
  9506. }
  9507. }, {
  9508. key: 'isRef',
  9509. get: function get() {
  9510. return true;
  9511. }
  9512. }, {
  9513. key: 'type',
  9514. get: function get() {
  9515. return this.address.type;
  9516. }
  9517. }, {
  9518. key: 'value',
  9519. get: function get() {
  9520. return this.address.value;
  9521. }
  9522. }, {
  9523. key: 'number',
  9524. get: function get() {
  9525. if (this.value instanceof _decimal2.default) {
  9526. return this.value.toNumber();
  9527. } else {
  9528. return null;
  9529. }
  9530. }
  9531. }]);
  9532. return StoreObjectArrayAddressRef;
  9533. }(_storeObject.StoreObject);
  9534. /***/ }),
  9535. /***/ "./js/processor/store/storeObjectRef.js":
  9536. /*!**********************************************!*\
  9537. !*** ./js/processor/store/storeObjectRef.js ***!
  9538. \**********************************************/
  9539. /*! no static exports found */
  9540. /***/ (function(module, exports, __webpack_require__) {
  9541. "use strict";
  9542. Object.defineProperty(exports, "__esModule", {
  9543. value: true
  9544. });
  9545. exports.StoreObjectRef = undefined;
  9546. 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; }; }();
  9547. var _storeObject = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9548. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9549. var _decimal2 = _interopRequireDefault(_decimal);
  9550. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9551. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9552. 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; }
  9553. 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; }
  9554. var StoreObjectRef = exports.StoreObjectRef = function (_StoreObject) {
  9555. _inherits(StoreObjectRef, _StoreObject);
  9556. function StoreObjectRef(refID, store) {
  9557. _classCallCheck(this, StoreObjectRef);
  9558. var _this = _possibleConstructorReturn(this, (StoreObjectRef.__proto__ || Object.getPrototypeOf(StoreObjectRef)).call(this, null, null, false));
  9559. _this.refID = refID;
  9560. _this.store = store;
  9561. return _this;
  9562. }
  9563. _createClass(StoreObjectRef, [{
  9564. key: 'getRefObj',
  9565. value: function getRefObj() {
  9566. return this.store.applyStore(this.refID);
  9567. }
  9568. }, {
  9569. key: 'updateRef',
  9570. value: function updateRef(stoObj) {
  9571. this.store.updateStore(this.refID, stoObj);
  9572. }
  9573. }, {
  9574. key: 'isCompatible',
  9575. value: function isCompatible(another) {
  9576. return this.store.applyStore(this.refID).isCompatible(another);
  9577. }
  9578. }, {
  9579. key: 'isRef',
  9580. get: function get() {
  9581. return true;
  9582. }
  9583. }, {
  9584. key: 'type',
  9585. get: function get() {
  9586. return this.store.applyStore(this.refID).type;
  9587. }
  9588. }, {
  9589. key: 'value',
  9590. get: function get() {
  9591. return this.store.applyStore(this.refID).value;
  9592. }
  9593. }, {
  9594. key: 'number',
  9595. get: function get() {
  9596. if (this.value instanceof _decimal2.default) {
  9597. return this.value.toNumber();
  9598. } else {
  9599. return null;
  9600. }
  9601. }
  9602. }]);
  9603. return StoreObjectRef;
  9604. }(_storeObject.StoreObject);
  9605. /***/ }),
  9606. /***/ "./js/runner.js":
  9607. /*!**********************!*\
  9608. !*** ./js/runner.js ***!
  9609. \**********************/
  9610. /*! no static exports found */
  9611. /***/ (function(module, exports, __webpack_require__) {
  9612. "use strict";
  9613. Object.defineProperty(exports, "__esModule", {
  9614. value: true
  9615. });
  9616. exports.runner = runner;
  9617. var _ivprogParser = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  9618. var _ivprogProcessor = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  9619. var _domConsole = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  9620. var _languageService = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  9621. var _semanticAnalyser = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  9622. function runner() {
  9623. var ivprogLexer = _languageService.LanguageService.getCurrentLexer();
  9624. // const lexer = new ivprogLexer(new InputStream(input));
  9625. // const stream = new CommonTokenStream(lexer);
  9626. // stream.fill();
  9627. // let i = 1;
  9628. // let token = null;
  9629. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  9630. // console.log(`${token.type}-${token.text}`);
  9631. // console.log('\n')
  9632. // i++;
  9633. // }
  9634. // const anaSin = new IVProgParser(input, ivprogLexer);
  9635. var editor = new JsonEditor('#json-renderer', {});
  9636. var domConsole = new _domConsole.DOMConsole("#console");
  9637. // proc.interpretAST().then( sto => {
  9638. // console.log(sto.applyStore('a'));
  9639. // }).catch(e => console.log(e));
  9640. try {
  9641. $('#btn').click(function () {
  9642. var input = $('#input').val();
  9643. var analiser = new _ivprogParser.IVProgParser(input, ivprogLexer);
  9644. try {
  9645. var data = analiser.parseTree();
  9646. var semAna = new _semanticAnalyser.SemanticAnalyser(data);
  9647. var proc = new _ivprogProcessor.IVProgProcessor(semAna.analyseTree());
  9648. proc.registerInput(domConsole);
  9649. domConsole.clear();
  9650. proc.registerOutput(domConsole);
  9651. proc.interpretAST().then(function (sto) {
  9652. return editor.load(sto.store);
  9653. }).catch(function (e) {
  9654. alert(e);console.log(e);
  9655. });
  9656. } catch (error) {
  9657. alert(error);
  9658. console.log(error);
  9659. }
  9660. });
  9661. } catch (a) {
  9662. console.log(a);
  9663. }
  9664. }
  9665. /***/ }),
  9666. /***/ "./js/semantic/semantic.min.js":
  9667. /*!*************************************!*\
  9668. !*** ./js/semantic/semantic.min.js ***!
  9669. \*************************************/
  9670. /*! no static exports found */
  9671. /***/ (function(module, exports, __webpack_require__) {
  9672. "use strict";
  9673. 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; };
  9674. /*
  9675. * # Semantic UI - 2.3.3
  9676. * https://github.com/Semantic-Org/Semantic-UI
  9677. * http://www.semantic-ui.com/
  9678. *
  9679. * Copyright 2014 Contributors
  9680. * Released under the MIT license
  9681. * http://opensource.org/licenses/MIT
  9682. *
  9683. */
  9684. !function (e, t, n, i) {
  9685. e.site = e.fn.site = function (o) {
  9686. var a,
  9687. r,
  9688. s = new Date().getTime(),
  9689. l = [],
  9690. c = arguments[0],
  9691. u = "string" == typeof c,
  9692. d = [].slice.call(arguments, 1),
  9693. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  9694. m = f.namespace,
  9695. g = f.error,
  9696. p = "module-" + m,
  9697. h = e(n),
  9698. v = this,
  9699. b = h.data(p);return a = { initialize: function initialize() {
  9700. a.instantiate();
  9701. }, instantiate: function instantiate() {
  9702. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  9703. }, normalize: function normalize() {
  9704. a.fix.console(), a.fix.requestAnimationFrame();
  9705. }, fix: { console: function (_console) {
  9706. function console() {
  9707. return _console.apply(this, arguments);
  9708. }
  9709. console.toString = function () {
  9710. return _console.toString();
  9711. };
  9712. return console;
  9713. }(function () {
  9714. 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 () {});
  9715. }), consoleClear: function consoleClear() {
  9716. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  9717. }, requestAnimationFrame: function requestAnimationFrame() {
  9718. 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) {
  9719. setTimeout(e, 0);
  9720. });
  9721. } }, moduleExists: function moduleExists(t) {
  9722. return e.fn[t] !== i && e.fn[t].settings !== i;
  9723. }, enabled: { modules: function modules(t) {
  9724. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9725. a.moduleExists(t) && n.push(t);
  9726. }), n;
  9727. } }, disabled: { modules: function modules(t) {
  9728. var n = [];return t = t || f.modules, e.each(t, function (e, t) {
  9729. a.moduleExists(t) || n.push(t);
  9730. }), n;
  9731. } }, change: { setting: function setting(t, n, o, r) {
  9732. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  9733. var s,
  9734. 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)));
  9735. });
  9736. }, settings: function settings(t, n, o) {
  9737. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  9738. 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)));
  9739. });
  9740. } }, enable: { console: function console() {
  9741. a.console(!0);
  9742. }, debug: function debug(e, t) {
  9743. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  9744. }, verbose: function verbose(e, t) {
  9745. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  9746. } }, disable: { console: function console() {
  9747. a.console(!1);
  9748. }, debug: function debug(e, t) {
  9749. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  9750. }, verbose: function verbose(e, t) {
  9751. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  9752. } }, console: function console(e) {
  9753. if (e) {
  9754. if (b.cache.console === i) return void a.error(g.console);a.debug("Restoring console function"), t.console = b.cache.console;
  9755. } 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() {} };
  9756. }, destroy: function destroy() {
  9757. a.verbose("Destroying previous site for", h), h.removeData(p);
  9758. }, cache: {}, setting: function setting(t, n) {
  9759. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  9760. if (n === i) return f[t];f[t] = n;
  9761. }
  9762. }, internal: function internal(t, n) {
  9763. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  9764. if (n === i) return a[t];a[t] = n;
  9765. }
  9766. }, debug: function debug() {
  9767. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  9768. }, verbose: function verbose() {
  9769. 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)));
  9770. }, error: function error() {
  9771. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  9772. }, performance: { log: function log(e) {
  9773. 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);
  9774. }, display: function display() {
  9775. var t = f.name + ":",
  9776. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  9777. n += t["Execution Time"];
  9778. }), 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) {
  9779. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  9780. }), console.groupEnd()), l = [];
  9781. } }, invoke: function invoke(t, n, o) {
  9782. var s,
  9783. l,
  9784. c,
  9785. 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) {
  9786. 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 {
  9787. 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];
  9788. }
  9789. })), 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;
  9790. } }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  9791. }, 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) {
  9792. return function (n) {
  9793. return !!e.data(n, t);
  9794. };
  9795. }) : function (t, n, i) {
  9796. return !!e.data(t, i[3]);
  9797. } });
  9798. }(jQuery, window, document), function (e, t, n, i) {
  9799. "use strict";
  9800. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  9801. var o,
  9802. a = e(this),
  9803. r = a.selector || "",
  9804. s = new Date().getTime(),
  9805. l = [],
  9806. c = arguments[0],
  9807. u = arguments[1],
  9808. d = "string" == typeof c,
  9809. f = [].slice.call(arguments, 1);return a.each(function () {
  9810. var m,
  9811. g,
  9812. p,
  9813. h,
  9814. v,
  9815. b,
  9816. y,
  9817. x,
  9818. C,
  9819. w,
  9820. S,
  9821. k,
  9822. T,
  9823. A,
  9824. R,
  9825. P,
  9826. E = e(this),
  9827. F = this,
  9828. O = [],
  9829. D = !1;(P = { initialize: function initialize() {
  9830. 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());
  9831. }, instantiate: function instantiate() {
  9832. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  9833. }, destroy: function destroy() {
  9834. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  9835. }, refresh: function refresh() {
  9836. 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);
  9837. }, submit: function submit() {
  9838. P.verbose("Submitting form", E), E.submit();
  9839. }, attachEvents: function attachEvents(t, n) {
  9840. n = n || "submit", e(t).on("click" + A, function (e) {
  9841. P[n](), e.preventDefault();
  9842. });
  9843. }, bindEvents: function bindEvents() {
  9844. 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 () {
  9845. var t = e(this),
  9846. n = t.prop("type"),
  9847. i = P.get.changeEvent(n, t);e(this).on(i + A, P.event.field.change);
  9848. });
  9849. }, clear: function clear() {
  9850. m.each(function () {
  9851. var t = e(this),
  9852. n = t.parent(),
  9853. i = t.closest(g),
  9854. o = i.find(x.prompt),
  9855. a = t.data(y.defaultValue) || "",
  9856. r = n.is(x.uiCheckbox),
  9857. 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(""));
  9858. });
  9859. }, reset: function reset() {
  9860. m.each(function () {
  9861. var t = e(this),
  9862. n = t.parent(),
  9863. o = t.closest(g),
  9864. a = o.find(x.prompt),
  9865. r = t.data(y.defaultValue),
  9866. s = n.is(x.uiCheckbox),
  9867. l = n.is(x.uiDropdown),
  9868. 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)));
  9869. });
  9870. }, determine: { isValid: function isValid() {
  9871. var t = !0;return e.each(b, function (e, n) {
  9872. P.validate.field(n, e, !0) || (t = !1);
  9873. }), t;
  9874. } }, is: { bracketedRule: function bracketedRule(e) {
  9875. return e.type && e.type.match(v.regExp.bracket);
  9876. }, shorthandFields: function shorthandFields(e) {
  9877. var t = e[Object.keys(e)[0]];return P.is.shorthandRules(t);
  9878. }, shorthandRules: function shorthandRules(t) {
  9879. return "string" == typeof t || e.isArray(t);
  9880. }, empty: function empty(e) {
  9881. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  9882. }, blank: function blank(t) {
  9883. return "" === e.trim(t.val());
  9884. }, valid: function valid(t) {
  9885. 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) {
  9886. P.is.valid(e) || (n = !1);
  9887. }), n);
  9888. } }, removeEvents: function removeEvents() {
  9889. E.off(A), m.off(A), h.off(A), m.off(A);
  9890. }, event: { field: { keydown: function keydown(t) {
  9891. var n = e(this),
  9892. i = t.which,
  9893. o = n.is(x.input),
  9894. a = n.is(x.checkbox),
  9895. r = n.closest(x.uiDropdown).length > 0,
  9896. 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);
  9897. }, keyup: function keyup() {
  9898. D = !1;
  9899. }, blur: function blur(t) {
  9900. var n = e(this),
  9901. i = n.closest(g),
  9902. 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);
  9903. }, change: function change(t) {
  9904. var n = e(this),
  9905. i = n.closest(g),
  9906. o = P.get.validation(n);o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  9907. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  9908. }, v.delay));
  9909. } } }, get: { ancillaryValue: function ancillaryValue(e) {
  9910. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  9911. }, ruleName: function ruleName(e) {
  9912. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  9913. }, changeEvent: function changeEvent(e, t) {
  9914. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  9915. }, inputEvent: function inputEvent() {
  9916. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  9917. }, fieldsFromShorthand: function fieldsFromShorthand(t) {
  9918. var n = {};return e.each(t, function (t, i) {
  9919. "string" == typeof i && (i = [i]), n[t] = { rules: [] }, e.each(i, function (e, i) {
  9920. n[t].rules.push({ type: i });
  9921. });
  9922. }), n;
  9923. }, prompt: function prompt(t, n) {
  9924. var i,
  9925. o,
  9926. a = P.get.ruleName(t),
  9927. r = P.get.ancillaryValue(t),
  9928. s = P.get.field(n.identifier),
  9929. l = s.val(),
  9930. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  9931. u = -1 !== c.search("{value}"),
  9932. 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;
  9933. }, settings: function settings() {
  9934. if (e.isPlainObject(t)) {
  9935. 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));
  9936. } 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();
  9937. }, field: function field(t) {
  9938. 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/>");
  9939. }, fields: function fields(t) {
  9940. var n = e();return e.each(t, function (e, t) {
  9941. n = n.add(P.get.field(t));
  9942. }), n;
  9943. }, validation: function validation(t) {
  9944. var n, i;return !!b && (e.each(b, function (e, o) {
  9945. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  9946. }), n || !1);
  9947. }, value: function value(e) {
  9948. var t = [];return t.push(e), P.get.values.call(F, t)[e];
  9949. }, values: function values(t) {
  9950. var n = {};return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  9951. var a = e(o),
  9952. r = (a.prop("type"), a.prop("name")),
  9953. s = a.val(),
  9954. l = a.is(x.checkbox),
  9955. c = a.is(x.radio),
  9956. u = -1 !== r.indexOf("[]"),
  9957. 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);
  9958. }), n;
  9959. } }, has: { field: function field(e) {
  9960. 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;
  9961. } }, escape: { string: function string(e) {
  9962. return (e = String(e)).replace(w.escape, "\\$&");
  9963. } }, add: { rule: function rule(e, t) {
  9964. P.add.field(e, t);
  9965. }, field: function field(t, n) {
  9966. var i = {};P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = { rules: [] }, e.each(n, function (e, n) {
  9967. i[t].rules.push({ type: n });
  9968. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  9969. }, fields: function fields(t) {
  9970. var n;n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  9971. }, prompt: function prompt(t, n) {
  9972. var o = P.get.field(t).closest(g),
  9973. a = o.children(x.prompt),
  9974. 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)));
  9975. }, errors: function errors(e) {
  9976. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  9977. } }, remove: { rule: function rule(t, n) {
  9978. 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) {
  9979. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  9980. });
  9981. }, field: function field(t) {
  9982. var n = e.isArray(t) ? t : [t];e.each(n, function (e, t) {
  9983. P.remove.rule(t);
  9984. });
  9985. }, rules: function rules(t, n) {
  9986. e.isArray(t) ? e.each(fields, function (e, t) {
  9987. P.remove.rule(t, n);
  9988. }) : P.remove.rule(t, n);
  9989. }, fields: function fields(e) {
  9990. P.remove.field(e);
  9991. }, prompt: function prompt(t) {
  9992. var n = P.get.field(t).closest(g),
  9993. 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 () {
  9994. o.remove();
  9995. }) : o.fadeOut(v.duration, function () {
  9996. o.remove();
  9997. }));
  9998. } }, set: { success: function success() {
  9999. E.removeClass(C.error).addClass(C.success);
  10000. }, defaults: function defaults() {
  10001. m.each(function () {
  10002. var t = e(this),
  10003. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();t.data(y.defaultValue, n);
  10004. });
  10005. }, error: function error() {
  10006. E.removeClass(C.success).addClass(C.error);
  10007. }, value: function value(e, t) {
  10008. var n = {};return n[e] = t, P.set.values.call(F, n);
  10009. }, values: function values(t) {
  10010. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10011. var i,
  10012. o = P.get.field(t),
  10013. a = o.parent(),
  10014. r = e.isArray(n),
  10015. s = a.is(x.uiCheckbox),
  10016. l = a.is(x.uiDropdown),
  10017. 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) {
  10018. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10019. })) : 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)));
  10020. });
  10021. } }, validate: { form: function form(e, t) {
  10022. var n = P.get.values();if (D) return !1;if (O = [], P.determine.isValid()) {
  10023. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10024. } 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);
  10025. }, field: function field(t, n, o) {
  10026. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);var a = t.identifier || n,
  10027. r = P.get.field(a),
  10028. s = !!t.depends && P.get.field(t.depends),
  10029. l = !0,
  10030. 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) {
  10031. 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);
  10032. }), 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);
  10033. }, rule: function rule(t, n) {
  10034. var o = P.get.field(t.identifier),
  10035. a = (n.type, o.val()),
  10036. r = P.get.ancillaryValue(n),
  10037. s = P.get.ruleName(n),
  10038. 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);
  10039. } }, setting: function setting(t, n) {
  10040. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10041. if (n === i) return v[t];v[t] = n;
  10042. }
  10043. }, internal: function internal(t, n) {
  10044. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10045. if (n === i) return P[t];P[t] = n;
  10046. }
  10047. }, debug: function debug() {
  10048. !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)));
  10049. }, verbose: function verbose() {
  10050. !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)));
  10051. }, error: function error() {
  10052. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10053. }, performance: { log: function log(e) {
  10054. 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);
  10055. }, display: function display() {
  10056. var t = v.name + ":",
  10057. n = 0;s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10058. n += t["Execution Time"];
  10059. }), 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) {
  10060. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10061. }), console.groupEnd()), l = [];
  10062. } }, invoke: function invoke(t, n, a) {
  10063. var r,
  10064. s,
  10065. l,
  10066. 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) {
  10067. 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 {
  10068. 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];
  10069. }
  10070. })), 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;
  10071. } }).initialize();
  10072. }), o !== i ? o : this;
  10073. }, 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() {
  10074. return !0;
  10075. }, onFailure: function onFailure() {
  10076. return !1;
  10077. }, 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) {
  10078. var n = '<ul class="list">';return e.each(t, function (e, t) {
  10079. n += "<li>" + t + "</li>";
  10080. }), e(n += "</ul>");
  10081. }, prompt: function prompt(t) {
  10082. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10083. } }, rules: { empty: function empty(t) {
  10084. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10085. }, checked: function checked() {
  10086. return e(this).filter(":checked").length > 0;
  10087. }, email: function email(t) {
  10088. return e.fn.form.settings.regExp.email.test(t);
  10089. }, url: function url(t) {
  10090. return e.fn.form.settings.regExp.url.test(t);
  10091. }, regExp: function regExp(t, n) {
  10092. if (n instanceof RegExp) return t.match(n);var i,
  10093. 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));
  10094. }, integer: function integer(t, n) {
  10095. var o,
  10096. a,
  10097. r,
  10098. 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);
  10099. }, decimal: function decimal(t) {
  10100. return e.fn.form.settings.regExp.decimal.test(t);
  10101. }, number: function number(t) {
  10102. return e.fn.form.settings.regExp.number.test(t);
  10103. }, is: function is(e, t) {
  10104. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10105. }, isExactly: function isExactly(e, t) {
  10106. return e == t;
  10107. }, not: function not(e, t) {
  10108. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10109. }, notExactly: function notExactly(e, t) {
  10110. return e != t;
  10111. }, contains: function contains(t, n) {
  10112. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10113. }, containsExactly: function containsExactly(t, n) {
  10114. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10115. }, doesntContain: function doesntContain(t, n) {
  10116. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10117. }, doesntContainExactly: function doesntContainExactly(t, n) {
  10118. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10119. }, minLength: function minLength(e, t) {
  10120. return e !== i && e.length >= t;
  10121. }, length: function length(e, t) {
  10122. return e !== i && e.length >= t;
  10123. }, exactLength: function exactLength(e, t) {
  10124. return e !== i && e.length == t;
  10125. }, maxLength: function maxLength(e, t) {
  10126. return e !== i && e.length <= t;
  10127. }, match: function match(t, n) {
  10128. 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();
  10129. }, different: function different(t, n) {
  10130. 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();
  10131. }, creditCard: function creditCard(t, n) {
  10132. var i,
  10133. o,
  10134. 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] } },
  10135. r = {},
  10136. s = !1,
  10137. l = "string" == typeof n && n.split(",");if ("string" == typeof t && 0 !== t.length) {
  10138. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10139. (o = a[i]) && (r = { length: -1 !== e.inArray(t.length, o.length), pattern: -1 !== t.search(o.pattern) }).length && r.pattern && (s = !0);
  10140. }), !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--;) {
  10141. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  10142. }return f % 10 == 0 && f > 0;
  10143. }
  10144. }, minCount: function minCount(e, t) {
  10145. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  10146. }, exactCount: function exactCount(e, t) {
  10147. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  10148. }, maxCount: function maxCount(e, t) {
  10149. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  10150. } } };
  10151. }(jQuery, window, document), function (e, t, n, i) {
  10152. "use strict";
  10153. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  10154. var o,
  10155. a = e(this),
  10156. r = new Date().getTime(),
  10157. s = [],
  10158. l = arguments[0],
  10159. c = "string" == typeof l,
  10160. u = [].slice.call(arguments, 1);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function () {
  10161. var d,
  10162. f,
  10163. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  10164. g = m.className,
  10165. p = m.namespace,
  10166. h = m.selector,
  10167. v = m.error,
  10168. b = "." + p,
  10169. y = "module-" + p,
  10170. x = a.selector || "",
  10171. C = e(this),
  10172. w = C.find(h.title),
  10173. S = C.find(h.content),
  10174. k = this,
  10175. T = C.data(y);f = { initialize: function initialize() {
  10176. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  10177. }, instantiate: function instantiate() {
  10178. T = f, C.data(y, f);
  10179. }, destroy: function destroy() {
  10180. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  10181. }, refresh: function refresh() {
  10182. w = C.find(h.title), S = C.find(h.content);
  10183. }, observeChanges: function observeChanges() {
  10184. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  10185. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  10186. })).observe(k, { childList: !0, subtree: !0 }), f.debug("Setting up mutation observer", d));
  10187. }, bind: { events: function events() {
  10188. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  10189. } }, event: { click: function click() {
  10190. f.toggle.call(this);
  10191. } }, toggle: function toggle(t) {
  10192. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10193. o = n.next(S),
  10194. a = o.hasClass(g.animating),
  10195. r = o.hasClass(g.active),
  10196. s = r && !a,
  10197. 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);
  10198. }, open: function open(t) {
  10199. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10200. o = n.next(S),
  10201. 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 () {
  10202. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  10203. }));
  10204. }, close: function close(t) {
  10205. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  10206. o = n.next(S),
  10207. a = o.hasClass(g.animating),
  10208. 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 () {
  10209. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  10210. }));
  10211. }, closeOthers: function closeOthers(t) {
  10212. var n,
  10213. o,
  10214. a,
  10215. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  10216. s = r.parents(h.content).prev(h.title),
  10217. l = r.closest(h.accordion),
  10218. c = h.title + "." + g.active + ":visible",
  10219. 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 () {
  10220. e(this).removeClass(g.active), f.reset.display.call(this);
  10221. }));
  10222. }, reset: { display: function display() {
  10223. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10224. }, opacity: function opacity() {
  10225. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  10226. } }, setting: function setting(t, n) {
  10227. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  10228. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  10229. }
  10230. }, internal: function internal(t, n) {
  10231. if (f.debug("Changing internal", t, n), n === i) return f[t];e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  10232. }, debug: function debug() {
  10233. !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)));
  10234. }, verbose: function verbose() {
  10235. !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)));
  10236. }, error: function error() {
  10237. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  10238. }, performance: { log: function log(e) {
  10239. 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);
  10240. }, display: function display() {
  10241. var t = m.name + ":",
  10242. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  10243. n += t["Execution Time"];
  10244. }), 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) {
  10245. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10246. }), console.groupEnd()), s = [];
  10247. } }, invoke: function invoke(t, n, a) {
  10248. var r,
  10249. s,
  10250. l,
  10251. 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) {
  10252. 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 {
  10253. 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];
  10254. }
  10255. })), 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;
  10256. } }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  10257. }), o !== i ? o : this;
  10258. }, 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) {
  10259. return -i * (t /= o) * (t - 2) + n;
  10260. } });
  10261. }(jQuery, window, document), function (e, t, n, i) {
  10262. "use strict";
  10263. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  10264. var a,
  10265. r = e(this),
  10266. s = r.selector || "",
  10267. l = new Date().getTime(),
  10268. c = [],
  10269. u = arguments[0],
  10270. d = "string" == typeof u,
  10271. f = [].slice.call(arguments, 1);return r.each(function () {
  10272. var r,
  10273. m,
  10274. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  10275. p = g.className,
  10276. h = g.namespace,
  10277. v = g.selector,
  10278. b = g.error,
  10279. y = "." + h,
  10280. x = "module-" + h,
  10281. C = e(this),
  10282. w = e(this).children(v.label),
  10283. S = e(this).children(v.input),
  10284. k = S[0],
  10285. T = !1,
  10286. A = !1,
  10287. R = C.data(x),
  10288. P = this;m = { initialize: function initialize() {
  10289. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  10290. }, instantiate: function instantiate() {
  10291. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  10292. }, destroy: function destroy() {
  10293. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  10294. }, fix: { reference: function reference() {
  10295. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  10296. } }, setup: function setup() {
  10297. 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();
  10298. }, refresh: function refresh() {
  10299. w = C.children(v.label), S = C.children(v.input), k = S[0];
  10300. }, hide: { input: function input() {
  10301. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  10302. } }, show: { input: function input() {
  10303. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  10304. } }, observeChanges: function observeChanges() {
  10305. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  10306. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  10307. })).observe(P, { childList: !0, subtree: !0 }), m.debug("Setting up mutation observer", r));
  10308. }, attachEvents: function attachEvents(t, n) {
  10309. 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);
  10310. }, event: { click: function click(t) {
  10311. 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());
  10312. }, keydown: function keydown(e) {
  10313. var t = e.which,
  10314. n = 13,
  10315. 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);
  10316. }, keyup: function keyup(e) {
  10317. A && e.preventDefault();
  10318. } }, check: function check() {
  10319. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  10320. }, uncheck: function uncheck() {
  10321. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  10322. }, indeterminate: function indeterminate() {
  10323. 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)));
  10324. }, determinate: function determinate() {
  10325. 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)));
  10326. }, enable: function enable() {
  10327. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  10328. }, disable: function disable() {
  10329. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  10330. }, get: { radios: function radios() {
  10331. var t = m.get.name();return e('input[name="' + t + '"]').closest(v.checkbox);
  10332. }, otherRadios: function otherRadios() {
  10333. return m.get.radios().not(C);
  10334. }, name: function name() {
  10335. return S.attr("name");
  10336. } }, is: { initialLoad: function initialLoad() {
  10337. return T;
  10338. }, radio: function radio() {
  10339. return S.hasClass(p.radio) || "radio" == S.attr("type");
  10340. }, indeterminate: function indeterminate() {
  10341. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  10342. }, checked: function checked() {
  10343. return S.prop("checked") !== i && S.prop("checked");
  10344. }, disabled: function disabled() {
  10345. return S.prop("disabled") !== i && S.prop("disabled");
  10346. }, enabled: function enabled() {
  10347. return !m.is.disabled();
  10348. }, determinate: function determinate() {
  10349. return !m.is.indeterminate();
  10350. }, unchecked: function unchecked() {
  10351. return !m.is.checked();
  10352. } }, should: { allowCheck: function allowCheck() {
  10353. 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);
  10354. }, allowUncheck: function allowUncheck() {
  10355. 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);
  10356. }, allowIndeterminate: function allowIndeterminate() {
  10357. 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);
  10358. }, allowDeterminate: function allowDeterminate() {
  10359. 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);
  10360. }, forceCallbacks: function forceCallbacks() {
  10361. return m.is.initialLoad() && g.fireOnInit;
  10362. }, ignoreCallbacks: function ignoreCallbacks() {
  10363. return T && !g.fireOnInit;
  10364. } }, can: { change: function change() {
  10365. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  10366. }, uncheck: function uncheck() {
  10367. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  10368. } }, set: { initialLoad: function initialLoad() {
  10369. T = !0;
  10370. }, checked: function checked() {
  10371. 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");
  10372. }, unchecked: function unchecked() {
  10373. 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");
  10374. }, indeterminate: function indeterminate() {
  10375. 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());
  10376. }, determinate: function determinate() {
  10377. 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));
  10378. }, disabled: function disabled() {
  10379. 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());
  10380. }, enabled: function enabled() {
  10381. 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());
  10382. }, tabbable: function tabbable() {
  10383. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  10384. } }, remove: { initialLoad: function initialLoad() {
  10385. T = !1;
  10386. } }, trigger: { change: function change() {
  10387. var e = n.createEvent("HTMLEvents"),
  10388. t = S[0];t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10389. } }, create: { label: function label() {
  10390. 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));
  10391. } }, has: { label: function label() {
  10392. return w.length > 0;
  10393. } }, bind: { events: function events() {
  10394. 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);
  10395. } }, unbind: { events: function events() {
  10396. m.debug("Removing events"), C.off(y);
  10397. } }, uncheckOthers: function uncheckOthers() {
  10398. var e = m.get.otherRadios();m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  10399. }, toggle: function toggle() {
  10400. 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");
  10401. }, setting: function setting(t, n) {
  10402. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10403. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10404. }
  10405. }, internal: function internal(t, n) {
  10406. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10407. if (n === i) return m[t];m[t] = n;
  10408. }
  10409. }, debug: function debug() {
  10410. !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)));
  10411. }, verbose: function verbose() {
  10412. !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)));
  10413. }, error: function error() {
  10414. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10415. }, performance: { log: function log(e) {
  10416. 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);
  10417. }, display: function display() {
  10418. var t = g.name + ":",
  10419. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  10420. n += t["Execution Time"];
  10421. }), 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) {
  10422. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10423. }), console.groupEnd()), c = [];
  10424. } }, invoke: function invoke(t, n, o) {
  10425. var r,
  10426. s,
  10427. l,
  10428. 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) {
  10429. 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 {
  10430. 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];
  10431. }
  10432. })), 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;
  10433. } }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  10434. }), a !== i ? a : this;
  10435. }, 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]" } };
  10436. }(jQuery, window, document), function (e, t, n, i) {
  10437. "use strict";
  10438. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  10439. var o,
  10440. a = e(this),
  10441. r = new Date().getTime(),
  10442. s = [],
  10443. l = arguments[0],
  10444. c = "string" == typeof l,
  10445. u = [].slice.call(arguments, 1);return a.each(function () {
  10446. var d,
  10447. f,
  10448. m,
  10449. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  10450. p = g.selector,
  10451. h = g.namespace,
  10452. v = g.className,
  10453. b = g.error,
  10454. y = "." + h,
  10455. x = "module-" + h,
  10456. C = a.selector || "",
  10457. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  10458. S = e(this),
  10459. k = this,
  10460. T = S.data(x);(m = { preinitialize: function preinitialize() {
  10461. 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());
  10462. }, initialize: function initialize() {
  10463. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  10464. }, instantiate: function instantiate() {
  10465. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  10466. }, destroy: function destroy() {
  10467. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  10468. }, bind: { events: function events() {
  10469. 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));
  10470. } }, unbind: { events: function events() {
  10471. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, { passive: !1 }), S.removeData(x), f.off(y);
  10472. } }, event: { click: function click(t) {
  10473. 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());
  10474. }, preventScroll: function preventScroll(e) {
  10475. e.preventDefault();
  10476. } }, addContent: function addContent(t) {
  10477. var n = e(t);m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  10478. }, create: function create() {
  10479. var t = e(g.template.dimmer());return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  10480. }, show: function show(t) {
  10481. 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));
  10482. }, hide: function hide(t) {
  10483. 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");
  10484. }, toggle: function toggle() {
  10485. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  10486. }, animate: { show: function show(t) {
  10487. 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() {
  10488. m.set.dimmed();
  10489. }, onComplete: function onComplete() {
  10490. m.set.active(), t();
  10491. } })) : (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 () {
  10492. d.removeAttr("style"), m.set.active(), t();
  10493. }));
  10494. }, hide: function hide(t) {
  10495. 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() {
  10496. m.remove.dimmed();
  10497. }, onComplete: function onComplete() {
  10498. m.remove.active(), t();
  10499. } })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  10500. m.remove.active(), d.removeAttr("style"), t();
  10501. }));
  10502. } }, get: { dimmer: function dimmer() {
  10503. return d;
  10504. }, duration: function duration() {
  10505. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  10506. } }, has: { dimmer: function dimmer() {
  10507. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  10508. } }, is: { active: function active() {
  10509. return d.hasClass(v.active);
  10510. }, animating: function animating() {
  10511. return d.is(":animated") || d.hasClass(v.animating);
  10512. }, closable: function closable() {
  10513. return "auto" == g.closable ? "hover" != g.on : g.closable;
  10514. }, dimmer: function dimmer() {
  10515. return S.hasClass(v.dimmer);
  10516. }, dimmable: function dimmable() {
  10517. return S.hasClass(v.dimmable);
  10518. }, dimmed: function dimmed() {
  10519. return f.hasClass(v.dimmed);
  10520. }, disabled: function disabled() {
  10521. return f.hasClass(v.disabled);
  10522. }, enabled: function enabled() {
  10523. return !m.is.disabled();
  10524. }, page: function page() {
  10525. return f.is("body");
  10526. }, pageDimmer: function pageDimmer() {
  10527. return d.hasClass(v.pageDimmer);
  10528. } }, can: { show: function show() {
  10529. return !d.hasClass(v.disabled);
  10530. } }, set: { opacity: function opacity(e) {
  10531. var t = d.css("background-color"),
  10532. n = t.split(","),
  10533. i = n && 3 == n.length,
  10534. 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);
  10535. }, active: function active() {
  10536. d.addClass(v.active);
  10537. }, dimmable: function dimmable() {
  10538. f.addClass(v.dimmable);
  10539. }, dimmed: function dimmed() {
  10540. f.addClass(v.dimmed);
  10541. }, pageDimmer: function pageDimmer() {
  10542. d.addClass(v.pageDimmer);
  10543. }, disabled: function disabled() {
  10544. d.addClass(v.disabled);
  10545. }, variation: function variation(e) {
  10546. (e = e || g.variation) && d.addClass(e);
  10547. } }, remove: { active: function active() {
  10548. d.removeClass(v.active);
  10549. }, dimmed: function dimmed() {
  10550. f.removeClass(v.dimmed);
  10551. }, disabled: function disabled() {
  10552. d.removeClass(v.disabled);
  10553. }, variation: function variation(e) {
  10554. (e = e || g.variation) && d.removeClass(e);
  10555. } }, setting: function setting(t, n) {
  10556. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  10557. if (n === i) return g[t];e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  10558. }
  10559. }, internal: function internal(t, n) {
  10560. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  10561. if (n === i) return m[t];m[t] = n;
  10562. }
  10563. }, debug: function debug() {
  10564. !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)));
  10565. }, verbose: function verbose() {
  10566. !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)));
  10567. }, error: function error() {
  10568. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  10569. }, performance: { log: function log(e) {
  10570. 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);
  10571. }, display: function display() {
  10572. var t = g.name + ":",
  10573. n = 0;r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  10574. n += t["Execution Time"];
  10575. }), 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) {
  10576. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10577. }), console.groupEnd()), s = [];
  10578. } }, invoke: function invoke(t, n, a) {
  10579. var r,
  10580. s,
  10581. l,
  10582. 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) {
  10583. 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 {
  10584. 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];
  10585. }
  10586. })), 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;
  10587. } }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  10588. }), o !== i ? o : this;
  10589. }, 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() {
  10590. return e("<div />").attr("class", "ui dimmer");
  10591. } } };
  10592. }(jQuery, window, document), function (e, t, n, i) {
  10593. "use strict";
  10594. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  10595. var a,
  10596. r = e(this),
  10597. s = e(n),
  10598. l = r.selector || "",
  10599. c = "ontouchstart" in n.documentElement,
  10600. u = new Date().getTime(),
  10601. d = [],
  10602. f = arguments[0],
  10603. m = "string" == typeof f,
  10604. g = [].slice.call(arguments, 1);return r.each(function (p) {
  10605. var h,
  10606. v,
  10607. b,
  10608. y,
  10609. x,
  10610. C,
  10611. w,
  10612. S,
  10613. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  10614. T = k.className,
  10615. A = k.message,
  10616. R = k.fields,
  10617. P = k.keys,
  10618. E = k.metadata,
  10619. F = k.namespace,
  10620. O = k.regExp,
  10621. D = k.selector,
  10622. q = k.error,
  10623. j = k.templates,
  10624. z = "." + F,
  10625. I = "module-" + F,
  10626. M = e(this),
  10627. L = e(k.context),
  10628. V = M.find(D.text),
  10629. N = M.find(D.search),
  10630. H = M.find(D.sizer),
  10631. U = M.find(D.input),
  10632. W = M.find(D.icon),
  10633. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  10634. Q = M.children(D.menu),
  10635. X = Q.find(D.item),
  10636. $ = !1,
  10637. Y = !1,
  10638. Z = !1,
  10639. K = this,
  10640. J = M.data(I);S = { initialize: function initialize() {
  10641. 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());
  10642. }, instantiate: function instantiate() {
  10643. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  10644. }, destroy: function destroy() {
  10645. 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();
  10646. }, observeChanges: function observeChanges() {
  10647. "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());
  10648. }, disconnect: { menuObserver: function menuObserver() {
  10649. w && w.disconnect();
  10650. }, selectObserver: function selectObserver() {
  10651. C && C.disconnect();
  10652. } }, observe: { select: function select() {
  10653. S.has.input() && C.observe(M[0], { childList: !0, subtree: !0 });
  10654. }, menu: function menu() {
  10655. S.has.menu() && w.observe(Q[0], { childList: !0, subtree: !0 });
  10656. } }, create: { id: function id() {
  10657. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  10658. }, userChoice: function userChoice(t) {
  10659. var n, o, a;return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  10660. !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));
  10661. }), n);
  10662. }, userLabels: function userLabels(t) {
  10663. var n = S.get.userValues();n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  10664. S.verbose("Adding custom user value"), S.add.label(t, t);
  10665. }));
  10666. }, menu: function menu() {
  10667. Q = e("<div />").addClass(T.menu).appendTo(M);
  10668. }, sizer: function sizer() {
  10669. H = e("<span />").addClass(T.sizer).insertAfter(N);
  10670. } }, search: function search(e) {
  10671. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  10672. }, select: { firstUnfiltered: function firstUnfiltered() {
  10673. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  10674. }, nextAvailable: function nextAvailable(e) {
  10675. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  10676. 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));
  10677. } }, setup: { api: function api() {
  10678. 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);
  10679. }, layout: function layout() {
  10680. 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();
  10681. }, select: function select() {
  10682. 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();
  10683. }, menu: function menu(e) {
  10684. Q.html(j.menu(e, R)), X = Q.find(D.item);
  10685. }, reference: function reference() {
  10686. 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();
  10687. }, returnedObject: function returnedObject() {
  10688. var e = r.slice(0, p),
  10689. t = r.slice(p + 1);r = e.add(M).add(t);
  10690. } }, refresh: function refresh() {
  10691. S.refreshSelectors(), S.refreshData();
  10692. }, refreshItems: function refreshItems() {
  10693. X = Q.find(D.item);
  10694. }, refreshSelectors: function refreshSelectors() {
  10695. 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);
  10696. }, refreshData: function refreshData() {
  10697. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  10698. }, clearData: function clearData() {
  10699. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  10700. }, toggle: function toggle() {
  10701. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  10702. }, show: function show(t) {
  10703. 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()) {
  10704. 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 () {
  10705. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  10706. });
  10707. }
  10708. }, hide: function hide(t) {
  10709. 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 () {
  10710. S.remove.visible(), t.call(K);
  10711. }));
  10712. }, hideOthers: function hideOthers() {
  10713. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  10714. }, hideMenu: function hideMenu() {
  10715. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  10716. }, hideSubMenus: function hideSubMenus() {
  10717. var e = Q.children(D.item).find(D.menu);S.verbose("Hiding sub menus", e), e.transition("hide");
  10718. }, bind: { events: function events() {
  10719. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  10720. }, touchEvents: function touchEvents() {
  10721. 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);
  10722. }, keyboardEvents: function keyboardEvents() {
  10723. 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);
  10724. }, inputEvents: function inputEvents() {
  10725. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  10726. }, mouseEvents: function mouseEvents() {
  10727. 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);
  10728. }, intent: function intent() {
  10729. 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);
  10730. } }, unbind: { intent: function intent() {
  10731. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  10732. } }, filter: function filter(e) {
  10733. var t = e !== i ? e : S.get.query(),
  10734. n = function n() {
  10735. 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();
  10736. };k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  10737. k.filterRemoteData && S.filterItems(t), n();
  10738. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  10739. }, queryRemote: function queryRemote(t, n) {
  10740. var i = { errorDuration: !1, cache: "local", throttle: k.throttle, urlData: { query: t }, onError: function onError() {
  10741. S.add.message(A.serverError), n();
  10742. }, onFailure: function onFailure() {
  10743. S.add.message(A.serverError), n();
  10744. }, onSuccess: function onSuccess(t) {
  10745. 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();
  10746. } };M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  10747. }, filterItems: function filterItems(t) {
  10748. var n = t !== i ? t : S.get.query(),
  10749. o = null,
  10750. a = S.escape.string(n),
  10751. r = new RegExp("^" + a, "igm");S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  10752. var t,
  10753. i,
  10754. a = e(this);if ("both" == k.match || "text" == k.match) {
  10755. 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;
  10756. }if ("both" == k.match || "value" == k.match) {
  10757. 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;
  10758. }
  10759. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  10760. }, fuzzySearch: function fuzzySearch(e, t) {
  10761. var n = t.length,
  10762. 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++) {
  10763. for (var r = e.charCodeAt(o); a < n;) {
  10764. if (t.charCodeAt(a++) === r) continue e;
  10765. }return !1;
  10766. }return !0;
  10767. }, exactSearch: function exactSearch(e, t) {
  10768. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  10769. }, filterActive: function filterActive() {
  10770. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  10771. }, focusSearch: function focusSearch(e) {
  10772. 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());
  10773. }, forceSelection: function forceSelection() {
  10774. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  10775. t = X.not(T.filtered).filter("." + T.active).eq(0),
  10776. 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();
  10777. }, change: { values: function values(t) {
  10778. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({ values: t }), e.each(t, function (e, t) {
  10779. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  10780. });
  10781. } }, event: { change: function change() {
  10782. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  10783. }, focus: function focus() {
  10784. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  10785. }, blur: function blur(e) {
  10786. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  10787. }, mousedown: function mousedown() {
  10788. S.is.searchSelection() ? b = !0 : $ = !0;
  10789. }, mouseup: function mouseup() {
  10790. S.is.searchSelection() ? b = !1 : $ = !1;
  10791. }, click: function click(t) {
  10792. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  10793. }, search: { focus: function focus() {
  10794. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  10795. }, blur: function blur(e) {
  10796. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  10797. } }, icon: { click: function click(e) {
  10798. S.toggle();
  10799. } }, text: { focus: function focus(e) {
  10800. $ = !0, S.focusSearch();
  10801. } }, input: function input(e) {
  10802. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  10803. }, label: { click: function click(t) {
  10804. var n = e(this),
  10805. i = M.find(D.label),
  10806. o = i.filter("." + T.active),
  10807. a = n.nextAll("." + T.active),
  10808. r = n.prevAll("." + T.active),
  10809. 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));
  10810. } }, remove: { click: function click() {
  10811. var t = e(this).parent();t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  10812. } }, test: { toggle: function toggle(e) {
  10813. var t = S.is.multiple() ? S.show : S.toggle;S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  10814. }, touch: function touch(e) {
  10815. S.determine.eventOnElement(e, function () {
  10816. "touchstart" == e.type ? S.timer = setTimeout(function () {
  10817. S.hide();
  10818. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  10819. }), e.stopPropagation();
  10820. }, hide: function hide(e) {
  10821. S.determine.eventInModule(e, S.hide);
  10822. } }, select: { mutation: function mutation(t) {
  10823. S.debug("<select> modified, recreating menu");var n = !1;e.each(t, function (t, i) {
  10824. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  10825. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  10826. } }, menu: { mutation: function mutation(t) {
  10827. var n = t[0],
  10828. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  10829. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  10830. a = i.add(o),
  10831. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  10832. 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());
  10833. }, mousedown: function mousedown() {
  10834. Y = !0;
  10835. }, mouseup: function mouseup() {
  10836. Y = !1;
  10837. } }, item: { mouseenter: function mouseenter(t) {
  10838. var n = e(t.target),
  10839. i = e(this),
  10840. o = i.children(D.menu),
  10841. a = i.siblings(D.item).children(D.menu),
  10842. r = o.length > 0;!(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10843. S.verbose("Showing sub-menu", o), e.each(a, function () {
  10844. S.animate.hide(!1, e(this));
  10845. }), S.animate.show(!1, o);
  10846. }, k.delay.show), t.preventDefault());
  10847. }, mouseleave: function mouseleave(t) {
  10848. var n = e(this).children(D.menu);n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  10849. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  10850. }, k.delay.hide));
  10851. }, click: function click(t, i) {
  10852. var o = e(this),
  10853. a = e(t ? t.target : ""),
  10854. r = o.find(D.menu),
  10855. s = S.get.choiceText(o),
  10856. l = S.get.choiceValue(o, s),
  10857. c = r.length > 0,
  10858. 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));
  10859. } }, document: { keydown: function keydown(e) {
  10860. var t = e.which;if (S.is.inObject(t, P)) {
  10861. var n = M.find(D.label),
  10862. i = n.filter("." + T.active),
  10863. o = (i.data(E.value), n.index(i)),
  10864. a = n.length,
  10865. r = i.length > 0,
  10866. s = i.length > 1,
  10867. l = 0 === o,
  10868. c = o + 1 == a,
  10869. u = S.is.searchSelection(),
  10870. d = S.is.focusedOnSearch(),
  10871. f = S.is.focused(),
  10872. 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);
  10873. }
  10874. } }, keydown: function keydown(e) {
  10875. var t = e.which;if (S.is.inObject(t, P)) {
  10876. var n,
  10877. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  10878. o = Q.children("." + T.active).eq(0),
  10879. a = i.length > 0 ? i : o,
  10880. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  10881. s = a.children(D.menu),
  10882. l = a.closest(D.menu),
  10883. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  10884. u = s.length > 0,
  10885. d = a.length > 0,
  10886. f = a.not(D.unselectable).length > 0,
  10887. 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()) {
  10888. 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) {
  10889. 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();
  10890. }if (t == P.downArrow) {
  10891. 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();
  10892. }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());
  10893. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  10894. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  10895. } }, trigger: { change: function change() {
  10896. var e = n.createEvent("HTMLEvents"),
  10897. t = U[0];t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  10898. } }, determine: { selectAction: function selectAction(t, n) {
  10899. 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);
  10900. }, eventInModule: function eventInModule(t, i) {
  10901. var o = e(t.target),
  10902. a = o.closest(n.documentElement).length > 0,
  10903. 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);
  10904. }, eventOnElement: function eventOnElement(t, i) {
  10905. var o = e(t.target),
  10906. a = o.closest(D.siblingLabel),
  10907. r = n.body.contains(t.target),
  10908. s = 0 === M.find(a).length,
  10909. 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);
  10910. } }, action: { nothing: function nothing() {}, activate: function activate(t, n, o) {
  10911. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10912. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10913. }
  10914. }, select: function select(t, n, o) {
  10915. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  10916. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;S.hideAndClear();
  10917. }
  10918. }, combo: function combo(t, n, o) {
  10919. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  10920. }, hide: function hide(e, t, n) {
  10921. S.set.value(t, e), S.hideAndClear();
  10922. } }, get: { id: function id() {
  10923. return x;
  10924. }, defaultText: function defaultText() {
  10925. return M.data(E.defaultText);
  10926. }, defaultValue: function defaultValue() {
  10927. return M.data(E.defaultValue);
  10928. }, placeholderText: function placeholderText() {
  10929. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  10930. }, text: function text() {
  10931. return V.text();
  10932. }, query: function query() {
  10933. return e.trim(N.val());
  10934. }, searchWidth: function searchWidth(e) {
  10935. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  10936. }, selectionCount: function selectionCount() {
  10937. var t = S.get.values();return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  10938. }, transition: function transition(e) {
  10939. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  10940. }, userValues: function userValues() {
  10941. var t = S.get.values();return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  10942. return !1 === S.get.item(e);
  10943. }));
  10944. }, uniqueArray: function uniqueArray(t) {
  10945. return e.grep(t, function (n, i) {
  10946. return e.inArray(n, t) === i;
  10947. });
  10948. }, caretPosition: function caretPosition() {
  10949. var e,
  10950. t,
  10951. 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;
  10952. }, value: function value() {
  10953. var t = U.length > 0 ? U.val() : M.data(E.value),
  10954. n = e.isArray(t) && 1 === t.length && "" === t[0];return t === i || n ? "" : t;
  10955. }, values: function values() {
  10956. var e = S.get.value();return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  10957. }, remoteValues: function remoteValues() {
  10958. var t = S.get.values(),
  10959. n = !1;return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  10960. var i = S.read.remoteData(t);S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  10961. })), n;
  10962. }, choiceText: function choiceText(t, n) {
  10963. 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());
  10964. }, choiceValue: function choiceValue(t, n) {
  10965. 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));
  10966. }, inputEvent: function inputEvent() {
  10967. var e = N[0];return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  10968. }, selectValues: function selectValues() {
  10969. var t = { values: [] };return M.find("option").each(function () {
  10970. var n = e(this),
  10971. o = n.html(),
  10972. a = n.attr("disabled"),
  10973. 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 });
  10974. }), 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) {
  10975. return e.name > t.name ? 1 : -1;
  10976. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  10977. }, activeItem: function activeItem() {
  10978. return X.filter("." + T.active);
  10979. }, selectedItem: function selectedItem() {
  10980. var e = X.not(D.unselectable).filter("." + T.selected);return e.length > 0 ? e : X.eq(0);
  10981. }, itemWithAdditions: function itemWithAdditions(e) {
  10982. var t = S.get.item(e),
  10983. n = S.create.userChoice(e);return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  10984. }, item: function item(t, n) {
  10985. var o,
  10986. a,
  10987. 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 () {
  10988. var o = e(this),
  10989. s = S.get.choiceText(o),
  10990. 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) {
  10991. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  10992. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  10993. }), r;
  10994. } }, check: { maxSelections: function maxSelections(e) {
  10995. 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));
  10996. } }, restore: { defaults: function defaults() {
  10997. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  10998. }, defaultText: function defaultText() {
  10999. 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));
  11000. }, placeholderText: function placeholderText() {
  11001. S.set.placeholderText();
  11002. }, defaultValue: function defaultValue() {
  11003. 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()));
  11004. }, labels: function labels() {
  11005. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  11006. }, selected: function selected() {
  11007. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  11008. }, values: function values() {
  11009. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  11010. }, remoteValues: function remoteValues() {
  11011. var t = S.get.remoteValues();S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  11012. S.set.text(t);
  11013. }) : e.each(t, function (e, t) {
  11014. S.add.label(e, t);
  11015. }));
  11016. } }, read: { remoteData: function remoteData(e) {
  11017. var n;if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;S.error(q.noStorage);
  11018. } }, save: { defaults: function defaults() {
  11019. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  11020. }, defaultValue: function defaultValue() {
  11021. var e = S.get.value();S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  11022. }, defaultText: function defaultText() {
  11023. var e = S.get.text();S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  11024. }, placeholderText: function placeholderText() {
  11025. 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));
  11026. }, remoteData: function remoteData(e, n) {
  11027. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  11028. } }, clear: function clear() {
  11029. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  11030. }, clearValue: function clearValue() {
  11031. S.set.value("");
  11032. }, scrollPage: function scrollPage(e, t) {
  11033. var n,
  11034. i,
  11035. o = t || S.get.selectedItem(),
  11036. a = o.closest(D.menu),
  11037. r = a.outerHeight(),
  11038. s = a.scrollTop(),
  11039. l = X.eq(0).outerHeight(),
  11040. c = Math.floor(r / l),
  11041. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  11042. 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));
  11043. }, set: { filtered: function filtered() {
  11044. var e = S.is.multiple(),
  11045. t = S.is.searchSelection(),
  11046. n = e && t,
  11047. i = t ? S.get.query() : "",
  11048. o = "string" == typeof i && i.length > 0,
  11049. a = S.get.searchWidth(),
  11050. 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));
  11051. }, empty: function empty() {
  11052. M.addClass(T.empty);
  11053. }, loading: function loading() {
  11054. M.addClass(T.loading);
  11055. }, placeholderText: function placeholderText(e) {
  11056. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  11057. }, tabbable: function tabbable() {
  11058. 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)));
  11059. }, initialLoad: function initialLoad() {
  11060. S.verbose("Setting initial load"), h = !0;
  11061. }, activeItem: function activeItem(e) {
  11062. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  11063. }, partialSearch: function partialSearch(e) {
  11064. var t = S.get.query().length;N.val(e.substr(0, t));
  11065. }, scrollPosition: function scrollPosition(e, t) {
  11066. 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));
  11067. }, text: function text(e) {
  11068. "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)));
  11069. }, selectedItem: function selectedItem(e) {
  11070. var t = S.get.choiceValue(e),
  11071. n = S.get.choiceText(e, !1),
  11072. 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);
  11073. }, selectedLetter: function selectedLetter(t) {
  11074. var n,
  11075. i = X.filter("." + T.selected),
  11076. 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 () {
  11077. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  11078. }), 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));
  11079. }, direction: function direction(e) {
  11080. "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);
  11081. }, upward: function upward(e) {
  11082. (e || M).addClass(T.upward);
  11083. }, leftward: function leftward(e) {
  11084. (e || Q).addClass(T.leftward);
  11085. }, value: function value(e, t, n) {
  11086. var o = S.escape.value(e),
  11087. a = U.length > 0,
  11088. r = S.get.values(),
  11089. s = e !== i ? String(e) : e;if (a) {
  11090. 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;
  11091. } 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);
  11092. }, active: function active() {
  11093. M.addClass(T.active);
  11094. }, multiple: function multiple() {
  11095. M.addClass(T.multiple);
  11096. }, visible: function visible() {
  11097. M.addClass(T.visible);
  11098. }, exactly: function exactly(e, t) {
  11099. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  11100. }, selected: function selected(t, n) {
  11101. 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 () {
  11102. var t = e(this),
  11103. o = S.get.choiceText(t),
  11104. a = S.get.choiceValue(t, o),
  11105. r = t.hasClass(T.filtered),
  11106. s = t.hasClass(T.active),
  11107. l = t.hasClass(T.addition),
  11108. 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));
  11109. }));
  11110. } }, add: { label: function label(t, n, i) {
  11111. var o,
  11112. a = S.is.searchSelection() ? N : V,
  11113. 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)));
  11114. }, message: function message(t) {
  11115. var n = Q.children(D.message),
  11116. i = k.templates.message(S.add.variables(t));n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  11117. }, optionValue: function optionValue(t) {
  11118. 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());
  11119. }, userSuggestion: function userSuggestion(e) {
  11120. var t,
  11121. n = Q.children(D.addition),
  11122. i = S.get.item(e),
  11123. o = i && i.not(D.addition).length,
  11124. 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()));
  11125. }, variables: function variables(e, t) {
  11126. var n,
  11127. i,
  11128. o = -1 !== e.search("{count}"),
  11129. a = -1 !== e.search("{maxCount}"),
  11130. 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;
  11131. }, value: function value(t, n, i) {
  11132. var o,
  11133. 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");
  11134. } }, remove: { active: function active() {
  11135. M.removeClass(T.active);
  11136. }, activeLabel: function activeLabel() {
  11137. M.find(D.label).removeClass(T.active);
  11138. }, empty: function empty() {
  11139. M.removeClass(T.empty);
  11140. }, loading: function loading() {
  11141. M.removeClass(T.loading);
  11142. }, initialLoad: function initialLoad() {
  11143. h = !1;
  11144. }, upward: function upward(e) {
  11145. (e || M).removeClass(T.upward);
  11146. }, leftward: function leftward(e) {
  11147. (e || Q).removeClass(T.leftward);
  11148. }, visible: function visible() {
  11149. M.removeClass(T.visible);
  11150. }, activeItem: function activeItem() {
  11151. X.removeClass(T.active);
  11152. }, filteredItem: function filteredItem() {
  11153. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  11154. }, optionValue: function optionValue(e) {
  11155. var t = S.escape.value(e),
  11156. 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 }));
  11157. }, message: function message() {
  11158. Q.children(D.message).remove();
  11159. }, searchWidth: function searchWidth() {
  11160. N.css("width", "");
  11161. }, searchTerm: function searchTerm() {
  11162. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  11163. }, userAddition: function userAddition() {
  11164. X.filter(D.addition).remove();
  11165. }, selected: function selected(t, n) {
  11166. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;n.each(function () {
  11167. var t = e(this),
  11168. n = S.get.choiceText(t),
  11169. 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);
  11170. });
  11171. }, selectedItem: function selectedItem() {
  11172. X.removeClass(T.selected);
  11173. }, value: function value(e, t, n) {
  11174. var i,
  11175. 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();
  11176. }, arrayValue: function arrayValue(t, n) {
  11177. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  11178. return t != e;
  11179. }), S.verbose("Removed value from delimited string", t, n), n;
  11180. }, label: function label(e, t) {
  11181. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');S.verbose("Removing label", n), n.remove();
  11182. }, activeLabels: function activeLabels(e) {
  11183. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  11184. }, labels: function labels(t) {
  11185. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  11186. var t = e(this),
  11187. n = t.data(E.value),
  11188. o = n !== i ? String(n) : n,
  11189. 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");
  11190. });
  11191. }, tabbable: function tabbable() {
  11192. 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"));
  11193. } }, has: { menuSearch: function menuSearch() {
  11194. return S.has.search() && N.closest(Q).length > 0;
  11195. }, search: function search() {
  11196. return N.length > 0;
  11197. }, sizer: function sizer() {
  11198. return H.length > 0;
  11199. }, selectInput: function selectInput() {
  11200. return U.is("select");
  11201. }, minCharacters: function minCharacters(e) {
  11202. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  11203. }, firstLetter: function firstLetter(e, t) {
  11204. var n;return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  11205. }, input: function input() {
  11206. return U.length > 0;
  11207. }, items: function items() {
  11208. return X.length > 0;
  11209. }, menu: function menu() {
  11210. return Q.length > 0;
  11211. }, message: function message() {
  11212. return 0 !== Q.children(D.message).length;
  11213. }, label: function label(e) {
  11214. var t = S.escape.value(e),
  11215. n = M.find(D.label);return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  11216. }, maxSelections: function maxSelections() {
  11217. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  11218. }, allResultsFiltered: function allResultsFiltered() {
  11219. var e = X.not(D.addition);return e.filter(D.unselectable).length === e.length;
  11220. }, userSuggestion: function userSuggestion() {
  11221. return Q.children(D.addition).length > 0;
  11222. }, query: function query() {
  11223. return "" !== S.get.query();
  11224. }, value: function value(e) {
  11225. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  11226. }, valueMatchingCase: function valueMatchingCase(t) {
  11227. var n = S.get.values();return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  11228. }, valueIgnoringCase: function valueIgnoringCase(t) {
  11229. var n = S.get.values(),
  11230. i = !1;return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  11231. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  11232. }), i;
  11233. } }, is: { active: function active() {
  11234. return M.hasClass(T.active);
  11235. }, animatingInward: function animatingInward() {
  11236. return Q.transition("is inward");
  11237. }, animatingOutward: function animatingOutward() {
  11238. return Q.transition("is outward");
  11239. }, bubbledLabelClick: function bubbledLabelClick(t) {
  11240. return e(t.target).is("select, input") && M.closest("label").length > 0;
  11241. }, bubbledIconClick: function bubbledIconClick(t) {
  11242. return e(t.target).closest(W).length > 0;
  11243. }, alreadySetup: function alreadySetup() {
  11244. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  11245. }, animating: function animating(e) {
  11246. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  11247. }, leftward: function leftward(e) {
  11248. return (e || Q).hasClass(T.leftward);
  11249. }, disabled: function disabled() {
  11250. return M.hasClass(T.disabled);
  11251. }, focused: function focused() {
  11252. return n.activeElement === M[0];
  11253. }, focusedOnSearch: function focusedOnSearch() {
  11254. return n.activeElement === N[0];
  11255. }, allFiltered: function allFiltered() {
  11256. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  11257. }, hidden: function hidden(e) {
  11258. return !S.is.visible(e);
  11259. }, initialLoad: function initialLoad() {
  11260. return h;
  11261. }, inObject: function inObject(t, n) {
  11262. var i = !1;return e.each(n, function (e, n) {
  11263. if (n == t) return i = !0, !0;
  11264. }), i;
  11265. }, multiple: function multiple() {
  11266. return M.hasClass(T.multiple);
  11267. }, remote: function remote() {
  11268. return k.apiSettings && S.can.useAPI();
  11269. }, single: function single() {
  11270. return !S.is.multiple();
  11271. }, selectMutation: function selectMutation(t) {
  11272. var n = !1;return e.each(t, function (t, i) {
  11273. if (i.target && e(i.target).is("select")) return n = !0, !0;
  11274. }), n;
  11275. }, search: function search() {
  11276. return M.hasClass(T.search);
  11277. }, searchSelection: function searchSelection() {
  11278. return S.has.search() && 1 === N.parent(D.dropdown).length;
  11279. }, selection: function selection() {
  11280. return M.hasClass(T.selection);
  11281. }, userValue: function userValue(t) {
  11282. return -1 !== e.inArray(t, S.get.userValues());
  11283. }, upward: function upward(e) {
  11284. return (e || M).hasClass(T.upward);
  11285. }, visible: function visible(e) {
  11286. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  11287. }, verticallyScrollableContext: function verticallyScrollableContext() {
  11288. var e = L.get(0) !== t && L.css("overflow-y");return "auto" == e || "scroll" == e;
  11289. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  11290. var e = L.get(0) !== t && L.css("overflow-X");return "auto" == e || "scroll" == e;
  11291. } }, can: { activate: function activate(e) {
  11292. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  11293. }, openDownward: function openDownward(e) {
  11294. var n,
  11295. i,
  11296. o = e || Q,
  11297. 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;
  11298. }, openRightward: function openRightward(e) {
  11299. var n,
  11300. i,
  11301. o = e || Q,
  11302. 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;
  11303. }, click: function click() {
  11304. return c || "click" == k.on;
  11305. }, extendSelect: function extendSelect() {
  11306. return k.allowAdditions || k.apiSettings;
  11307. }, show: function show() {
  11308. return !S.is.disabled() && (S.has.items() || S.has.message());
  11309. }, useAPI: function useAPI() {
  11310. return e.fn.api !== i;
  11311. } }, animate: { show: function show(t, n) {
  11312. var o,
  11313. a = n || Q,
  11314. r = n ? function () {} : function () {
  11315. S.hideSubMenus(), S.hideOthers(), S.set.active();
  11316. };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() {
  11317. t.call(K);
  11318. } }) : S.error(q.noTransition, o));
  11319. }, hide: function hide(t, n) {
  11320. var o = n || Q,
  11321. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  11322. S.can.click() && S.unbind.intent(), S.remove.active();
  11323. }),
  11324. 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() {
  11325. t.call(K);
  11326. } }) : S.error(q.transition));
  11327. } }, hideAndClear: function hideAndClear() {
  11328. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  11329. S.remove.filteredItem();
  11330. }) : S.hide());
  11331. }, delay: { show: function show() {
  11332. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  11333. }, hide: function hide() {
  11334. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  11335. } }, escape: { value: function value(t) {
  11336. var n = e.isArray(t),
  11337. i = "string" == typeof t,
  11338. o = !i && !n,
  11339. a = i && -1 !== t.search(O.quote),
  11340. r = [];return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  11341. r.push(t.replace(O.quote, "&quot;"));
  11342. }), r) : t.replace(O.quote, "&quot;"));
  11343. }, string: function string(e) {
  11344. return (e = String(e)).replace(O.escape, "\\$&");
  11345. } }, setting: function setting(t, n) {
  11346. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  11347. if (n === i) return k[t];e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  11348. }
  11349. }, internal: function internal(t, n) {
  11350. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  11351. if (n === i) return S[t];S[t] = n;
  11352. }
  11353. }, debug: function debug() {
  11354. !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)));
  11355. }, verbose: function verbose() {
  11356. !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)));
  11357. }, error: function error() {
  11358. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  11359. }, performance: { log: function log(e) {
  11360. 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);
  11361. }, display: function display() {
  11362. var t = k.name + ":",
  11363. n = 0;u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  11364. n += t["Execution Time"];
  11365. }), 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) {
  11366. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11367. }), console.groupEnd()), d = [];
  11368. } }, invoke: function invoke(t, n, o) {
  11369. var r,
  11370. s,
  11371. l,
  11372. 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) {
  11373. 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 {
  11374. 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];
  11375. }
  11376. })), 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;
  11377. } }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  11378. }), a !== i ? a : r;
  11379. }, 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) {
  11380. return e(this);
  11381. }, onLabelRemove: function onLabelRemove(e) {
  11382. return !0;
  11383. }, onNoResults: function onNoResults(e) {
  11384. return !0;
  11385. }, 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) {
  11386. var n = t.placeholder || !1,
  11387. 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) {
  11388. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  11389. }), i += "</div>";
  11390. }, menu: function menu(t, n) {
  11391. var i = t[n.values] || {},
  11392. o = "";return e.each(i, function (e, t) {
  11393. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  11394. a = t[n.disabled] ? "disabled " : "";o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  11395. }), o;
  11396. }, label: function label(e, t) {
  11397. return t + '<i class="delete icon"></i>';
  11398. }, message: function message(e) {
  11399. return e;
  11400. }, addition: function addition(e) {
  11401. return e;
  11402. } };
  11403. }(jQuery, window, document), function (e, t, n, i) {
  11404. "use strict";
  11405. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  11406. var o,
  11407. a = e(this),
  11408. r = a.selector || "",
  11409. s = new Date().getTime(),
  11410. l = [],
  11411. c = arguments[0],
  11412. u = "string" == typeof c,
  11413. d = [].slice.call(arguments, 1);return a.each(function () {
  11414. var f,
  11415. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  11416. g = m.selector,
  11417. p = m.className,
  11418. h = m.sources,
  11419. v = m.error,
  11420. b = m.metadata,
  11421. y = m.namespace,
  11422. x = m.templates,
  11423. C = "." + y,
  11424. w = "module-" + y,
  11425. S = (e(t), e(this)),
  11426. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  11427. T = this,
  11428. A = S.data(w);f = { initialize: function initialize() {
  11429. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  11430. }, instantiate: function instantiate() {
  11431. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  11432. }, destroy: function destroy() {
  11433. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  11434. }, refresh: function refresh() {
  11435. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  11436. }, bind: { events: function events() {
  11437. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  11438. } }, create: function create() {
  11439. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  11440. }, createPlaceholder: function createPlaceholder(e) {
  11441. var t = f.get.icon(),
  11442. 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);
  11443. }, createEmbed: function createEmbed(t) {
  11444. 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);
  11445. }, changeEmbed: function changeEmbed(e) {
  11446. k.html(f.generate.embed(e));
  11447. }, createAndShow: function createAndShow() {
  11448. f.createEmbed(), f.show();
  11449. }, change: function change(e, t, n) {
  11450. 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();
  11451. }, reset: function reset() {
  11452. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  11453. }, show: function show() {
  11454. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  11455. }, hide: function hide() {
  11456. f.debug("Hiding embed"), f.showPlaceholder();
  11457. }, showPlaceholder: function showPlaceholder() {
  11458. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  11459. }, get: { id: function id() {
  11460. return m.id || S.data(b.id);
  11461. }, placeholder: function placeholder() {
  11462. return m.placeholder || S.data(b.placeholder);
  11463. }, icon: function icon() {
  11464. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  11465. }, source: function source(e) {
  11466. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  11467. }, type: function type() {
  11468. var e = f.get.source();return h[e] !== i && h[e].type;
  11469. }, url: function url() {
  11470. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  11471. } }, determine: { autoplay: function autoplay() {
  11472. f.should.autoplay() && (m.autoplay = !0);
  11473. }, source: function source(t) {
  11474. var n = !1;return (t = t || f.get.url()) && e.each(h, function (e, i) {
  11475. if (-1 !== t.search(i.domain)) return n = e, !1;
  11476. }), n;
  11477. }, icon: function icon() {
  11478. var e = f.get.source();return h[e] !== i && h[e].icon;
  11479. }, url: function url() {
  11480. var e,
  11481. t = m.id || S.data(b.id),
  11482. n = m.source || S.data(b.source);return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  11483. } }, set: { active: function active() {
  11484. S.addClass(p.active);
  11485. } }, remove: { active: function active() {
  11486. S.removeClass(p.active);
  11487. }, embed: function embed() {
  11488. k.empty();
  11489. } }, encode: { parameters: function parameters(e) {
  11490. var t,
  11491. n = [];for (t in e) {
  11492. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  11493. }return n.join("&amp;");
  11494. } }, generate: { embed: function embed(e) {
  11495. f.debug("Generating embed html");var t,
  11496. n,
  11497. 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;
  11498. }, parameters: function parameters(t, n) {
  11499. 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);
  11500. } }, has: { embed: function embed() {
  11501. return k.length > 0;
  11502. }, placeholder: function placeholder() {
  11503. return m.placeholder || S.data(b.placeholder);
  11504. } }, should: { autoplay: function autoplay() {
  11505. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  11506. } }, is: { video: function video() {
  11507. return "video" == f.get.type();
  11508. } }, setting: function setting(t, n) {
  11509. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11510. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11511. }
  11512. }, internal: function internal(t, n) {
  11513. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  11514. if (n === i) return f[t];f[t] = n;
  11515. }
  11516. }, debug: function debug() {
  11517. !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)));
  11518. }, verbose: function verbose() {
  11519. !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)));
  11520. }, error: function error() {
  11521. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11522. }, performance: { log: function log(e) {
  11523. 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);
  11524. }, display: function display() {
  11525. var t = m.name + ":",
  11526. n = 0;s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  11527. n += t["Execution Time"];
  11528. }), 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) {
  11529. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11530. }), console.groupEnd()), l = [];
  11531. } }, invoke: function invoke(t, n, a) {
  11532. var r,
  11533. s,
  11534. l,
  11535. 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) {
  11536. 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 {
  11537. 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];
  11538. }
  11539. })), 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;
  11540. } }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  11541. }), o !== i ? o : this;
  11542. }, 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) {
  11543. return e;
  11544. }, 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) {
  11545. return { autohide: !e.brandedUI, autoplay: e.autoplay, color: e.color || i, hq: e.hd, jsapi: e.api, modestbranding: !e.brandedUI };
  11546. } }, vimeo: { name: "vimeo", type: "video", icon: "video play", domain: "vimeo.com", url: "//player.vimeo.com/video/{id}", parameters: function parameters(e) {
  11547. return { api: e.api, autoplay: e.autoplay, byline: e.brandedUI, color: e.color || i, portrait: e.brandedUI, title: e.brandedUI };
  11548. } } }, templates: { iframe: function iframe(e, t) {
  11549. var n = e;return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  11550. }, placeholder: function placeholder(e, t) {
  11551. var n = "";return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  11552. } }, api: !1, onPause: function onPause() {}, onPlay: function onPlay() {}, onStop: function onStop() {} };
  11553. }(jQuery, window, document), function (e, t, n, i) {
  11554. "use strict";
  11555. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  11556. var a,
  11557. r = e(this),
  11558. s = e(t),
  11559. l = e(n),
  11560. c = e("body"),
  11561. u = r.selector || "",
  11562. d = new Date().getTime(),
  11563. f = [],
  11564. m = arguments[0],
  11565. g = "string" == typeof m,
  11566. p = [].slice.call(arguments, 1),
  11567. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  11568. setTimeout(e, 0);
  11569. };return r.each(function () {
  11570. var r,
  11571. v,
  11572. b,
  11573. y,
  11574. x,
  11575. C,
  11576. w,
  11577. S,
  11578. k,
  11579. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  11580. A = T.selector,
  11581. R = T.className,
  11582. P = T.namespace,
  11583. E = T.error,
  11584. F = "." + P,
  11585. O = "module-" + P,
  11586. D = e(this),
  11587. q = e(T.context),
  11588. j = D.find(A.close),
  11589. z = this,
  11590. I = D.data(O),
  11591. M = !1;k = { initialize: function initialize() {
  11592. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  11593. }, instantiate: function instantiate() {
  11594. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  11595. }, create: { dimmer: function dimmer() {
  11596. var t = { debug: T.debug, variation: !T.centered && "top aligned", dimmerName: "modals" },
  11597. 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);
  11598. }, id: function id() {
  11599. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  11600. } }, destroy: function destroy() {
  11601. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  11602. }, observeChanges: function observeChanges() {
  11603. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  11604. k.debug("DOM tree modified, refreshing"), k.refresh();
  11605. })).observe(z, { childList: !0, subtree: !0 }), k.debug("Setting up mutation observer", S));
  11606. }, refresh: function refresh() {
  11607. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  11608. }, refreshModals: function refreshModals() {
  11609. v = D.siblings(A.modal), r = v.add(D);
  11610. }, attachEvents: function attachEvents(t, n) {
  11611. 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);
  11612. }, bind: { events: function events() {
  11613. 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);
  11614. } }, get: { id: function id() {
  11615. return (Math.random().toString(16) + "000000000").substr(2, 8);
  11616. } }, event: { approve: function approve() {
  11617. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11618. M = !1;
  11619. }));
  11620. }, deny: function deny() {
  11621. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  11622. M = !1;
  11623. }));
  11624. }, close: function close() {
  11625. k.hide();
  11626. }, click: function click(t) {
  11627. if (T.closable) {
  11628. var i = e(t.target).closest(A.modal).length > 0,
  11629. 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());
  11630. } else k.verbose("Dimmer clicked but closable setting is disabled");
  11631. }, debounce: function debounce(e, t) {
  11632. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  11633. }, keyboard: function keyboard(e) {
  11634. 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());
  11635. }, resize: function resize() {
  11636. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  11637. } }, toggle: function toggle() {
  11638. k.is.active() || k.is.animating() ? k.hide() : k.show();
  11639. }, show: function show(t) {
  11640. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  11641. }, hide: function hide(t) {
  11642. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  11643. }, showModal: function showModal(t) {
  11644. 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() {
  11645. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  11646. } })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  11647. }, hideModal: function hideModal(t, n) {
  11648. 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() {
  11649. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  11650. }, onComplete: function onComplete() {
  11651. T.onHidden.call(z), k.restore.focus(), t();
  11652. } })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  11653. }, showDimmer: function showDimmer() {
  11654. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  11655. }, hideDimmer: function hideDimmer() {
  11656. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  11657. k.remove.clickaway(), k.remove.screenHeight();
  11658. }) : k.debug("Dimmer is not visible cannot hide");
  11659. }, hideAll: function hideAll(t) {
  11660. 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));
  11661. }, hideOthers: function hideOthers(t) {
  11662. 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));
  11663. }, others: { active: function active() {
  11664. return v.filter("." + R.active).length > 0;
  11665. }, animating: function animating() {
  11666. return v.filter("." + R.animating).length > 0;
  11667. } }, add: { keyboardShortcuts: function keyboardShortcuts() {
  11668. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  11669. } }, save: { focus: function focus() {
  11670. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  11671. } }, restore: { focus: function focus() {
  11672. b && b.length > 0 && b.focus();
  11673. } }, remove: { active: function active() {
  11674. D.removeClass(R.active);
  11675. }, clickaway: function clickaway() {
  11676. x.off("click" + C);
  11677. }, bodyStyle: function bodyStyle() {
  11678. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  11679. }, screenHeight: function screenHeight() {
  11680. k.debug("Removing page height"), c.css("height", "");
  11681. }, keyboardShortcuts: function keyboardShortcuts() {
  11682. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  11683. }, scrolling: function scrolling() {
  11684. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  11685. } }, cacheSizes: function cacheSizes() {
  11686. D.addClass(R.loading);var o = D.prop("scrollHeight"),
  11687. 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);
  11688. }, can: { fit: function fit() {
  11689. var e = k.cache.contextHeight,
  11690. t = k.cache.contextHeight / 2,
  11691. n = k.cache.topOffset,
  11692. i = k.cache.scrollHeight,
  11693. o = k.cache.height,
  11694. a = T.padding;return i > o ? t + n + i + a < e : o + 2 * a < e;
  11695. } }, is: { active: function active() {
  11696. return D.hasClass(R.active);
  11697. }, animating: function animating() {
  11698. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  11699. }, scrolling: function scrolling() {
  11700. return y.hasClass(R.scrolling);
  11701. }, modernBrowser: function modernBrowser() {
  11702. return !(t.ActiveXObject || "ActiveXObject" in t);
  11703. } }, set: { autofocus: function autofocus() {
  11704. var e = D.find("[tabindex], :input").filter(":visible"),
  11705. t = e.filter("[autofocus]"),
  11706. n = t.length > 0 ? t.first() : e.first();n.length > 0 && n.focus();
  11707. }, clickaway: function clickaway() {
  11708. x.on("click" + C, k.event.click);
  11709. }, dimmerSettings: function dimmerSettings() {
  11710. if (e.fn.dimmer !== i) {
  11711. var t = { debug: T.debug, dimmerName: "modals", closable: "auto", variation: !T.centered && "top aligned", duration: { show: T.duration, hide: T.duration } },
  11712. 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);
  11713. } else k.error(E.dimmer);
  11714. }, screenHeight: function screenHeight() {
  11715. 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));
  11716. }, active: function active() {
  11717. D.addClass(R.active);
  11718. }, scrolling: function scrolling() {
  11719. y.addClass(R.scrolling), D.addClass(R.scrolling);
  11720. }, type: function type() {
  11721. 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());
  11722. }, undetached: function undetached() {
  11723. y.addClass(R.undetached);
  11724. } }, setting: function setting(t, n) {
  11725. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  11726. if (n === i) return T[t];e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  11727. }
  11728. }, internal: function internal(t, n) {
  11729. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  11730. if (n === i) return k[t];k[t] = n;
  11731. }
  11732. }, debug: function debug() {
  11733. !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)));
  11734. }, verbose: function verbose() {
  11735. !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)));
  11736. }, error: function error() {
  11737. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  11738. }, performance: { log: function log(e) {
  11739. 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);
  11740. }, display: function display() {
  11741. var t = T.name + ":",
  11742. n = 0;d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  11743. n += t["Execution Time"];
  11744. }), 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) {
  11745. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11746. }), console.groupEnd()), f = [];
  11747. } }, invoke: function invoke(t, n, o) {
  11748. var r,
  11749. s,
  11750. l,
  11751. 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) {
  11752. 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 {
  11753. 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];
  11754. }
  11755. })), 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;
  11756. } }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  11757. }), a !== i ? a : this;
  11758. }, 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() {
  11759. return !0;
  11760. }, onHidden: function onHidden() {}, onApprove: function onApprove() {
  11761. return !0;
  11762. }, onDeny: function onDeny() {
  11763. return !0;
  11764. }, 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" } };
  11765. }(jQuery, window, document), function (e, t, n, i) {
  11766. "use strict";
  11767. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  11768. var o,
  11769. a = e(this),
  11770. r = a.selector || "",
  11771. s = new Date().getTime(),
  11772. l = [],
  11773. c = arguments[0],
  11774. u = "string" == typeof c,
  11775. d = [].slice.call(arguments, 1);return a.each(function () {
  11776. var a,
  11777. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  11778. m = (f.className, f.selector),
  11779. g = f.error,
  11780. p = f.namespace,
  11781. h = "." + p,
  11782. v = p + "-module",
  11783. b = e(this),
  11784. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  11785. x = this,
  11786. C = b.data(v);t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;a = { initialize: function initialize() {
  11787. 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();
  11788. }, destroy: function destroy() {
  11789. a.verbose("Destroying instance"), b.removeData(v).off(h);
  11790. }, show: function show() {
  11791. 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));
  11792. }, hide: function hide() {
  11793. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  11794. }, onHide: function onHide() {
  11795. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  11796. }, dismiss: function dismiss(e) {
  11797. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  11798. }, should: { show: function show() {
  11799. 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);
  11800. } }, get: { storageOptions: function storageOptions() {
  11801. var e = {};return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  11802. } }, clear: function clear() {
  11803. a.storage.remove(f.key);
  11804. }, storage: { set: function set(n, o) {
  11805. 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 {
  11806. if (e.cookie === i) return void a.error(g.noCookieStorage);e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  11807. }
  11808. }, get: function get(n, o) {
  11809. 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;
  11810. }, remove: function remove(n) {
  11811. 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);
  11812. } }, setting: function setting(t, n) {
  11813. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  11814. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  11815. }
  11816. }, internal: function internal(t, n) {
  11817. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  11818. if (n === i) return a[t];a[t] = n;
  11819. }
  11820. }, debug: function debug() {
  11821. !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)));
  11822. }, verbose: function verbose() {
  11823. !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)));
  11824. }, error: function error() {
  11825. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  11826. }, performance: { log: function log(e) {
  11827. 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);
  11828. }, display: function display() {
  11829. var t = f.name + ":",
  11830. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  11831. n += t["Execution Time"];
  11832. }), 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) {
  11833. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11834. }), console.groupEnd()), l = [];
  11835. } }, invoke: function invoke(t, n, r) {
  11836. var s,
  11837. l,
  11838. c,
  11839. 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) {
  11840. 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 {
  11841. 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];
  11842. }
  11843. })), 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;
  11844. } }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  11845. }), o !== i ? o : this;
  11846. }, 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) {
  11847. return -i * (t /= o) * (t - 2) + n;
  11848. } });
  11849. }(jQuery, window, document), function (e, t, n, i) {
  11850. "use strict";
  11851. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  11852. var a,
  11853. r = e(this),
  11854. s = e(n),
  11855. l = e(t),
  11856. c = e("body"),
  11857. u = r.selector || "",
  11858. d = new Date().getTime(),
  11859. f = [],
  11860. m = arguments[0],
  11861. g = "string" == typeof m,
  11862. p = [].slice.call(arguments, 1);return r.each(function () {
  11863. var r,
  11864. h,
  11865. v,
  11866. b,
  11867. y,
  11868. x,
  11869. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  11870. w = C.selector,
  11871. S = C.className,
  11872. k = C.error,
  11873. T = C.metadata,
  11874. A = C.namespace,
  11875. R = "." + C.namespace,
  11876. P = "module-" + A,
  11877. E = e(this),
  11878. F = e(C.context),
  11879. O = e(C.scrollContext),
  11880. D = e(C.boundary),
  11881. q = C.target ? e(C.target) : E,
  11882. j = 0,
  11883. z = !1,
  11884. I = !1,
  11885. M = this,
  11886. L = E.data(P);x = { initialize: function initialize() {
  11887. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  11888. }, instantiate: function instantiate() {
  11889. x.verbose("Storing instance", x), L = x, E.data(P, L);
  11890. }, observeChanges: function observeChanges() {
  11891. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, { childList: !0, subtree: !0 }), x.debug("Setting up mutation observer", v));
  11892. }, refresh: function refresh() {
  11893. 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();
  11894. }, reposition: function reposition() {
  11895. x.refresh(), x.set.position();
  11896. }, destroy: function destroy() {
  11897. 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);
  11898. }, event: { start: function start(t) {
  11899. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  11900. }, end: function end() {
  11901. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  11902. }, touchstart: function touchstart(e) {
  11903. I = !0, x.show();
  11904. }, resize: function resize() {
  11905. x.is.visible() && x.set.position();
  11906. }, documentChanged: function documentChanged(t) {
  11907. [].forEach.call(t, function (t) {
  11908. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  11909. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  11910. });
  11911. });
  11912. }, hideGracefully: function hideGracefully(t) {
  11913. var i = e(t.target),
  11914. o = e.contains(n.documentElement, t.target),
  11915. 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");
  11916. } }, create: function create() {
  11917. var t = x.get.html(),
  11918. n = x.get.title(),
  11919. 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);
  11920. }, createID: function createID() {
  11921. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  11922. }, toggle: function toggle() {
  11923. 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());
  11924. }, show: function show(e) {
  11925. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  11926. 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));
  11927. }
  11928. }, hide: function hide(e) {
  11929. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  11930. 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);
  11931. }
  11932. }, hideAll: function hideAll() {
  11933. e(w.popup).filter("." + S.popupVisible).each(function () {
  11934. e(this).data(T.activator).popup("hide");
  11935. });
  11936. }, exists: function exists() {
  11937. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  11938. }, removePopup: function removePopup() {
  11939. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  11940. }, save: { conditions: function conditions() {
  11941. x.cache = { title: E.attr("title") }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  11942. } }, restore: { conditions: function conditions() {
  11943. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  11944. } }, supports: { svg: function svg() {
  11945. return "undefined" == typeof SVGGraphicsElement;
  11946. } }, animate: { show: function show(t) {
  11947. 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() {
  11948. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  11949. } })) : x.error(k.noTransition);
  11950. }, hide: function hide(t) {
  11951. 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() {
  11952. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  11953. } }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  11954. } }, change: { content: function content(e) {
  11955. r.html(e);
  11956. } }, get: { html: function html() {
  11957. return E.removeData(T.html), E.data(T.html) || C.html;
  11958. }, title: function title() {
  11959. return E.removeData(T.title), E.data(T.title) || C.title;
  11960. }, content: function content() {
  11961. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  11962. }, variation: function variation() {
  11963. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  11964. }, popup: function popup() {
  11965. return r;
  11966. }, popupOffset: function popupOffset() {
  11967. return r.offset();
  11968. }, calculations: function calculations() {
  11969. var e,
  11970. n = x.get.offsetParent(r),
  11971. i = q[0],
  11972. o = D[0] == t,
  11973. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  11974. s = o ? { top: 0, left: 0 } : D.offset(),
  11975. c = {},
  11976. 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)) {
  11977. var d = n.offset();c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  11978. }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;
  11979. }, id: function id() {
  11980. return y;
  11981. }, startEvent: function startEvent() {
  11982. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  11983. }, scrollEvent: function scrollEvent() {
  11984. return "scroll";
  11985. }, endEvent: function endEvent() {
  11986. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  11987. }, distanceFromBoundary: function distanceFromBoundary(e, t) {
  11988. var n,
  11989. i,
  11990. 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;
  11991. }, offsetParent: function offsetParent(t) {
  11992. var n = (t !== i ? t[0] : q[0]).parentNode,
  11993. 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;) {
  11994. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  11995. }return o && o.length > 0 ? o : e();
  11996. }, positions: function positions() {
  11997. 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 };
  11998. }, nextPosition: function nextPosition(e) {
  11999. var t = e.split(" "),
  12000. n = t[0],
  12001. i = t[1],
  12002. o = "top" == n || "bottom" == n,
  12003. a = !1,
  12004. r = !1,
  12005. 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;
  12006. } }, set: { position: function position(e, t) {
  12007. if (0 !== q.length && 0 !== r.length) {
  12008. 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) {
  12009. return "left" == e ? "right" : "left";
  12010. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {case "top left":
  12011. c = { top: "auto", bottom: l.height - a.top + o, left: a.left + n, right: "auto" };break;case "top center":
  12012. 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":
  12013. c = { bottom: l.height - a.top + o, right: l.width - a.left - a.width - n, top: "auto", left: "auto" };break;case "left center":
  12014. 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":
  12015. 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":
  12016. c = { top: a.top + a.height + o, left: a.left + n, bottom: "auto", right: "auto" };break;case "bottom center":
  12017. 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":
  12018. 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)) {
  12019. 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");
  12020. }return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  12021. }x.error(k.notFound);
  12022. }, fluidWidth: function fluidWidth(e) {
  12023. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  12024. }, variation: function variation(e) {
  12025. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  12026. }, visible: function visible() {
  12027. E.addClass(S.visible);
  12028. } }, remove: { loading: function loading() {
  12029. r.removeClass(S.loading);
  12030. }, variation: function variation(e) {
  12031. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  12032. }, visible: function visible() {
  12033. E.removeClass(S.visible);
  12034. }, attempts: function attempts() {
  12035. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  12036. } }, bind: { events: function events() {
  12037. 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);
  12038. }, popup: function popup() {
  12039. 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);
  12040. }, close: function close() {
  12041. (!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();
  12042. }, closeOnScroll: function closeOnScroll() {
  12043. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  12044. }, touchClose: function touchClose() {
  12045. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  12046. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  12047. });
  12048. }, clickaway: function clickaway() {
  12049. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  12050. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  12051. });
  12052. } }, unbind: { events: function events() {
  12053. l.off(b), E.off(R);
  12054. }, close: function close() {
  12055. s.off(b), O.off(b);
  12056. } }, has: { popup: function popup() {
  12057. return r && r.length > 0;
  12058. } }, should: { centerArrow: function centerArrow(e) {
  12059. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  12060. } }, is: { offstage: function offstage(t, n) {
  12061. var i = [];return e.each(t, function (e, t) {
  12062. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  12063. }), i.length > 0;
  12064. }, svg: function svg(e) {
  12065. return x.supports.svg() && e instanceof SVGGraphicsElement;
  12066. }, basic: function basic() {
  12067. return E.hasClass(S.basic);
  12068. }, active: function active() {
  12069. return E.hasClass(S.active);
  12070. }, animating: function animating() {
  12071. return r !== i && r.hasClass(S.animating);
  12072. }, fluid: function fluid() {
  12073. return r !== i && r.hasClass(S.fluid);
  12074. }, visible: function visible() {
  12075. return r !== i && r.hasClass(S.popupVisible);
  12076. }, dropdown: function dropdown() {
  12077. return E.hasClass(S.dropdown);
  12078. }, hidden: function hidden() {
  12079. return !x.is.visible();
  12080. }, rtl: function rtl() {
  12081. return "rtl" == E.css("direction");
  12082. } }, reset: function reset() {
  12083. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  12084. }, setting: function setting(t, n) {
  12085. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  12086. if (n === i) return C[t];C[t] = n;
  12087. }
  12088. }, internal: function internal(t, n) {
  12089. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  12090. if (n === i) return x[t];x[t] = n;
  12091. }
  12092. }, debug: function debug() {
  12093. !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)));
  12094. }, verbose: function verbose() {
  12095. !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)));
  12096. }, error: function error() {
  12097. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  12098. }, performance: { log: function log(e) {
  12099. 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);
  12100. }, display: function display() {
  12101. var t = C.name + ":",
  12102. n = 0;d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  12103. n += t["Execution Time"];
  12104. }), 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) {
  12105. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12106. }), console.groupEnd()), f = [];
  12107. } }, invoke: function invoke(t, n, o) {
  12108. var r,
  12109. s,
  12110. l,
  12111. 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) {
  12112. 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 {
  12113. 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];
  12114. }
  12115. })), 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;
  12116. } }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  12117. }), a !== i ? a : this;
  12118. }, 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) {
  12119. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12120. return t[e];
  12121. }) : e
  12122. );
  12123. }, popup: function popup(t) {
  12124. var n = "",
  12125. 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;
  12126. } } };
  12127. }(jQuery, window, document), function (e, t, n, i) {
  12128. "use strict";
  12129. 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) {
  12130. var o,
  12131. a = e(this),
  12132. r = a.selector || "",
  12133. s = new Date().getTime(),
  12134. l = [],
  12135. c = arguments[0],
  12136. u = "string" == typeof c,
  12137. d = [].slice.call(arguments, 1);return a.each(function () {
  12138. var a,
  12139. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  12140. m = f.className,
  12141. g = f.metadata,
  12142. p = f.namespace,
  12143. h = f.selector,
  12144. v = f.error,
  12145. b = "." + p,
  12146. y = "module-" + p,
  12147. x = e(this),
  12148. C = e(this).find(h.bar),
  12149. w = e(this).find(h.progress),
  12150. S = e(this).find(h.label),
  12151. k = this,
  12152. T = x.data(y),
  12153. A = !1;a = { initialize: function initialize() {
  12154. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  12155. }, instantiate: function instantiate() {
  12156. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  12157. }, destroy: function destroy() {
  12158. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  12159. }, reset: function reset() {
  12160. a.remove.nextValue(), a.update.progress(0);
  12161. }, complete: function complete() {
  12162. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  12163. }, read: { metadata: function metadata() {
  12164. 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));
  12165. }, settings: function settings() {
  12166. !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));
  12167. } }, bind: { transitionEnd: function transitionEnd(e) {
  12168. var t = a.get.transitionEnd();C.one(t + b, function (t) {
  12169. clearTimeout(a.failSafeTimer), e.call(this, t);
  12170. }), a.failSafeTimer = setTimeout(function () {
  12171. C.triggerHandler(t);
  12172. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  12173. } }, increment: function increment(e) {
  12174. 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);
  12175. }, decrement: function decrement(e) {
  12176. 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);
  12177. }, has: { progressPoll: function progressPoll() {
  12178. return a.progressPoll;
  12179. }, total: function total() {
  12180. return !1 !== a.get.total();
  12181. } }, get: { text: function text(e) {
  12182. var t = a.value || 0,
  12183. n = a.total || 0,
  12184. i = A ? a.get.displayPercent() : a.percent || 0,
  12185. 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;
  12186. }, normalizedValue: function normalizedValue(e) {
  12187. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;if (a.has.total()) {
  12188. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  12189. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;return e;
  12190. }, updateInterval: function updateInterval() {
  12191. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  12192. }, randomValue: function randomValue() {
  12193. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  12194. }, numericValue: function numericValue(e) {
  12195. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  12196. }, transitionEnd: function transitionEnd() {
  12197. var e,
  12198. t = n.createElement("element"),
  12199. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12200. if (t.style[e] !== i) return o[e];
  12201. }
  12202. }, displayPercent: function displayPercent() {
  12203. var e = C.width(),
  12204. t = x.width(),
  12205. 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);
  12206. }, percent: function percent() {
  12207. return a.percent || 0;
  12208. }, value: function value() {
  12209. return a.nextValue || a.value || 0;
  12210. }, total: function total() {
  12211. return a.total || !1;
  12212. } }, create: { progressPoll: function progressPoll() {
  12213. a.progressPoll = setTimeout(function () {
  12214. a.update.toNextValue(), a.remove.progressPoll();
  12215. }, a.get.updateInterval());
  12216. } }, is: { complete: function complete() {
  12217. return a.is.success() || a.is.warning() || a.is.error();
  12218. }, success: function success() {
  12219. return x.hasClass(m.success);
  12220. }, warning: function warning() {
  12221. return x.hasClass(m.warning);
  12222. }, error: function error() {
  12223. return x.hasClass(m.error);
  12224. }, active: function active() {
  12225. return x.hasClass(m.active);
  12226. }, visible: function visible() {
  12227. return x.is(":visible");
  12228. } }, remove: { progressPoll: function progressPoll() {
  12229. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  12230. }, nextValue: function nextValue() {
  12231. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  12232. }, state: function state() {
  12233. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  12234. }, active: function active() {
  12235. a.verbose("Removing active state"), x.removeClass(m.active);
  12236. }, success: function success() {
  12237. a.verbose("Removing success state"), x.removeClass(m.success);
  12238. }, warning: function warning() {
  12239. a.verbose("Removing warning state"), x.removeClass(m.warning);
  12240. }, error: function error() {
  12241. a.verbose("Removing error state"), x.removeClass(m.error);
  12242. } }, set: { barWidth: function barWidth(e) {
  12243. 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)));
  12244. }, duration: function duration(e) {
  12245. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({ "transition-duration": e });
  12246. }, percent: function percent(e) {
  12247. 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);
  12248. }, labelInterval: function labelInterval() {
  12249. clearInterval(a.interval), a.bind.transitionEnd(function () {
  12250. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  12251. }), A = !0, a.interval = setInterval(function () {
  12252. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  12253. }, f.framerate);
  12254. }, labels: function labels() {
  12255. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  12256. }, label: function label(e) {
  12257. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  12258. }, state: function state(e) {
  12259. 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));
  12260. }, barLabel: function barLabel(e) {
  12261. 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)));
  12262. }, active: function active(e) {
  12263. 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 () {
  12264. f.onActive.call(k, a.value, a.total);
  12265. });
  12266. }, success: function success(e) {
  12267. 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 () {
  12268. f.onSuccess.call(k, a.total);
  12269. });
  12270. }, warning: function warning(e) {
  12271. 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 () {
  12272. f.onWarning.call(k, a.value, a.total);
  12273. });
  12274. }, error: function error(e) {
  12275. 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 () {
  12276. f.onError.call(k, a.value, a.total);
  12277. });
  12278. }, transitionEvent: function transitionEvent() {
  12279. a.get.transitionEnd();
  12280. }, total: function total(e) {
  12281. a.total = e;
  12282. }, value: function value(e) {
  12283. a.value = e;
  12284. }, progress: function progress(e) {
  12285. 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());
  12286. }, nextValue: function nextValue(e) {
  12287. a.nextValue = e;
  12288. } }, update: { toNextValue: function toNextValue() {
  12289. var e = a.nextValue;e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  12290. }, progress: function progress(e) {
  12291. 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));
  12292. } }, setting: function setting(t, n) {
  12293. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  12294. if (n === i) return f[t];e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  12295. }
  12296. }, internal: function internal(t, n) {
  12297. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  12298. if (n === i) return a[t];a[t] = n;
  12299. }
  12300. }, debug: function debug() {
  12301. !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)));
  12302. }, verbose: function verbose() {
  12303. !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)));
  12304. }, error: function error() {
  12305. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  12306. }, performance: { log: function log(e) {
  12307. 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);
  12308. }, display: function display() {
  12309. var t = f.name + ":",
  12310. n = 0;s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  12311. n += t["Execution Time"];
  12312. }), 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) {
  12313. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12314. }), console.groupEnd()), l = [];
  12315. } }, invoke: function invoke(t, n, r) {
  12316. var s,
  12317. l,
  12318. c,
  12319. 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) {
  12320. 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 {
  12321. 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];
  12322. }
  12323. })), 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;
  12324. } }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  12325. }), o !== i ? o : this;
  12326. }, 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) {
  12327. return t;
  12328. }, 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" } };
  12329. }(jQuery, window, document), function (e, t, n, i) {
  12330. "use strict";
  12331. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  12332. var n,
  12333. o = e(this),
  12334. a = o.selector || "",
  12335. r = new Date().getTime(),
  12336. s = [],
  12337. l = arguments[0],
  12338. c = "string" == typeof l,
  12339. u = [].slice.call(arguments, 1);return o.each(function () {
  12340. var d,
  12341. f,
  12342. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  12343. g = m.namespace,
  12344. p = m.className,
  12345. h = m.metadata,
  12346. v = m.selector,
  12347. b = (m.error, "." + g),
  12348. y = "module-" + g,
  12349. x = this,
  12350. C = e(this).data(y),
  12351. w = e(this),
  12352. S = w.find(v.icon);f = { initialize: function initialize() {
  12353. 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();
  12354. }, instantiate: function instantiate() {
  12355. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  12356. }, destroy: function destroy() {
  12357. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  12358. }, refresh: function refresh() {
  12359. S = w.find(v.icon);
  12360. }, setup: { layout: function layout() {
  12361. var t = f.get.maxRating(),
  12362. n = e.fn.rating.settings.templates.icon(t);f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  12363. } }, event: { mouseenter: function mouseenter() {
  12364. var t = e(this);t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  12365. }, mouseleave: function mouseleave() {
  12366. w.removeClass(p.selected), S.removeClass(p.selected);
  12367. }, click: function click() {
  12368. var t = e(this),
  12369. n = f.get.rating(),
  12370. i = S.index(t) + 1;("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  12371. } }, clearRating: function clearRating() {
  12372. f.debug("Clearing current rating"), f.set.rating(0);
  12373. }, bind: { events: function events() {
  12374. 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);
  12375. } }, remove: { events: function events() {
  12376. f.verbose("Removing events"), w.off(b);
  12377. }, initialLoad: function initialLoad() {
  12378. d = !1;
  12379. } }, enable: function enable() {
  12380. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  12381. }, disable: function disable() {
  12382. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  12383. }, is: { initialLoad: function initialLoad() {
  12384. return d;
  12385. } }, get: { initialRating: function initialRating() {
  12386. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  12387. }, maxRating: function maxRating() {
  12388. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  12389. }, rating: function rating() {
  12390. var e = S.filter("." + p.active).length;return f.verbose("Current rating retrieved", e), e;
  12391. } }, set: { rating: function rating(e) {
  12392. var t = e - 1 >= 0 ? e - 1 : 0,
  12393. 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);
  12394. }, initialLoad: function initialLoad() {
  12395. d = !0;
  12396. } }, setting: function setting(t, n) {
  12397. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  12398. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  12399. }
  12400. }, internal: function internal(t, n) {
  12401. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  12402. if (n === i) return f[t];f[t] = n;
  12403. }
  12404. }, debug: function debug() {
  12405. !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)));
  12406. }, verbose: function verbose() {
  12407. !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)));
  12408. }, error: function error() {
  12409. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  12410. }, performance: { log: function log(e) {
  12411. 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);
  12412. }, display: function display() {
  12413. var t = m.name + ":",
  12414. n = 0;r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  12415. n += t["Execution Time"];
  12416. }), 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) {
  12417. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12418. }), console.groupEnd()), s = [];
  12419. } }, invoke: function invoke(t, o, a) {
  12420. var r,
  12421. s,
  12422. l,
  12423. 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) {
  12424. 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 {
  12425. 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];
  12426. }
  12427. })), 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;
  12428. } }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  12429. }), n !== i ? n : this;
  12430. }, 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) {
  12431. for (var t = 1, n = ""; t <= e;) {
  12432. n += '<i class="icon"></i>', t++;
  12433. }return n;
  12434. } } };
  12435. }(jQuery, window, document), function (e, t, n, i) {
  12436. "use strict";
  12437. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  12438. var a,
  12439. r = e(this),
  12440. s = r.selector || "",
  12441. l = new Date().getTime(),
  12442. c = [],
  12443. u = arguments[0],
  12444. d = "string" == typeof u,
  12445. f = [].slice.call(arguments, 1);return e(this).each(function () {
  12446. var m,
  12447. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  12448. p = g.className,
  12449. h = g.metadata,
  12450. v = g.regExp,
  12451. b = g.fields,
  12452. y = g.selector,
  12453. x = g.error,
  12454. C = g.namespace,
  12455. w = "." + C,
  12456. S = C + "-module",
  12457. k = e(this),
  12458. T = k.find(y.prompt),
  12459. A = k.find(y.searchButton),
  12460. R = k.find(y.results),
  12461. P = k.find(y.result),
  12462. E = (k.find(y.category), this),
  12463. F = k.data(S),
  12464. O = !1,
  12465. D = !1;m = { initialize: function initialize() {
  12466. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  12467. }, instantiate: function instantiate() {
  12468. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  12469. }, destroy: function destroy() {
  12470. m.verbose("Destroying instance"), k.off(w).removeData(S);
  12471. }, refresh: function refresh() {
  12472. 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);
  12473. }, refreshResults: function refreshResults() {
  12474. R = k.find(y.results), P = k.find(y.result);
  12475. }, bind: { events: function events() {
  12476. 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);
  12477. } }, determine: { searchFields: function searchFields() {
  12478. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  12479. } }, event: { input: function input() {
  12480. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  12481. m.is.focused() && m.query();
  12482. }, g.searchDelay)) : m.query();
  12483. }, focus: function focus() {
  12484. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  12485. m.can.show() && m.showResults();
  12486. });
  12487. }, blur: function blur(e) {
  12488. var t = function t() {
  12489. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  12490. };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) {
  12491. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  12492. })) : (m.debug("Input blurred without user action, closing results"), t()));
  12493. }, result: { mousedown: function mousedown() {
  12494. m.resultsClicked = !0;
  12495. }, mouseup: function mouseup() {
  12496. m.resultsClicked = !1;
  12497. }, click: function click(n) {
  12498. m.debug("Search result selected");var i = e(this),
  12499. o = i.find(y.title).eq(0),
  12500. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  12501. r = a.attr("href") || !1,
  12502. s = a.attr("target") || !1,
  12503. l = (o.html(), o.length > 0 && o.text()),
  12504. c = m.get.results(),
  12505. 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);
  12506. } } }, handleKeyboard: function handleKeyboard(e) {
  12507. var t,
  12508. n = k.find(y.result),
  12509. i = k.find(y.category),
  12510. o = n.filter("." + p.active),
  12511. a = n.index(o),
  12512. r = n.length,
  12513. s = o.length > 0,
  12514. l = e.which,
  12515. c = 13,
  12516. u = 38,
  12517. d = 40;if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  12518. if (l == c) {
  12519. 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;
  12520. } 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());
  12521. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  12522. }, setup: { api: function api(t, n) {
  12523. var i = { debug: g.debug, on: !1, cache: g.cache, action: "search", urlData: { query: t }, onSuccess: function onSuccess(e) {
  12524. m.parse.response.call(E, e, t), n();
  12525. }, onFailure: function onFailure() {
  12526. m.displayMessage(x.serverError), n();
  12527. }, onAbort: function onAbort(e) {}, onError: m.error };e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  12528. } }, can: { useAPI: function useAPI() {
  12529. return e.fn.api !== i;
  12530. }, show: function show() {
  12531. return m.is.focused() && !m.is.visible() && !m.is.empty();
  12532. }, transition: function transition() {
  12533. return g.transition && e.fn.transition !== i && k.transition("is supported");
  12534. } }, is: { animating: function animating() {
  12535. return R.hasClass(p.animating);
  12536. }, hidden: function hidden() {
  12537. return R.hasClass(p.hidden);
  12538. }, inMessage: function inMessage(t) {
  12539. if (t.target) {
  12540. var i = e(t.target);return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  12541. }
  12542. }, empty: function empty() {
  12543. return "" === R.html();
  12544. }, visible: function visible() {
  12545. return R.filter(":visible").length > 0;
  12546. }, focused: function focused() {
  12547. return T.filter(":focus").length > 0;
  12548. } }, get: { settings: function settings() {
  12549. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  12550. }, inputEvent: function inputEvent() {
  12551. var e = T[0];return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  12552. }, value: function value() {
  12553. return T.val();
  12554. }, results: function results() {
  12555. return k.data(h.results);
  12556. }, result: function result(t, n) {
  12557. var o = ["title", "id"],
  12558. 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) {
  12559. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  12560. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  12561. } }, select: { firstResult: function firstResult() {
  12562. m.verbose("Selecting first result"), P.first().addClass(p.active);
  12563. } }, set: { focus: function focus() {
  12564. k.addClass(p.focus);
  12565. }, loading: function loading() {
  12566. k.addClass(p.loading);
  12567. }, value: function value(e) {
  12568. m.verbose("Setting search input value", e), T.val(e);
  12569. }, type: function type(e) {
  12570. e = e || g.type, "category" == g.type && k.addClass(g.type);
  12571. }, buttonPressed: function buttonPressed() {
  12572. A.addClass(p.pressed);
  12573. } }, remove: { loading: function loading() {
  12574. k.removeClass(p.loading);
  12575. }, focus: function focus() {
  12576. k.removeClass(p.focus);
  12577. }, buttonPressed: function buttonPressed() {
  12578. A.removeClass(p.pressed);
  12579. } }, query: function query(t) {
  12580. t = e.isFunction(t) ? t : function () {};var n = m.get.value(),
  12581. 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();
  12582. }, search: { local: function local(e) {
  12583. var t,
  12584. 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 });
  12585. }, remote: function remote(t, n) {
  12586. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  12587. }, object: function object(t, n, o) {
  12588. var a = [],
  12589. r = [],
  12590. s = [],
  12591. l = t.toString().replace(v.escape, "\\$&"),
  12592. c = new RegExp(v.beginsWith + l, "i"),
  12593. u = function u(t, n) {
  12594. var i = -1 == e.inArray(n, a),
  12595. o = -1 == e.inArray(n, s),
  12596. l = -1 == e.inArray(n, r);i && o && l && t.push(n);
  12597. };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) {
  12598. e.each(n, function (e, n) {
  12599. "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));
  12600. });
  12601. }), e.merge(r, s), e.merge(a, r), a);
  12602. } }, exactSearch: function exactSearch(e, t) {
  12603. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12604. }, fuzzySearch: function fuzzySearch(e, t) {
  12605. var n = t.length,
  12606. 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++) {
  12607. for (var r = e.charCodeAt(o); a < n;) {
  12608. if (t.charCodeAt(a++) === r) continue e;
  12609. }return !1;
  12610. }return !0;
  12611. }, parse: { response: function response(e, t) {
  12612. 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]));
  12613. } }, cancel: { query: function query() {
  12614. m.can.useAPI() && k.api("abort");
  12615. } }, has: { minimumCharacters: function minimumCharacters() {
  12616. return m.get.value().length >= g.minCharacters;
  12617. }, results: function results() {
  12618. return 0 !== R.length && "" != R.html();
  12619. } }, clear: { cache: function cache(e) {
  12620. 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));
  12621. } }, read: { cache: function cache(e) {
  12622. 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]);
  12623. } }, create: { categoryResults: function categoryResults(t) {
  12624. var n = {};return e.each(t, function (e, t) {
  12625. 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));
  12626. }), n;
  12627. }, id: function id(e, t) {
  12628. var n,
  12629. 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;
  12630. }, results: function results() {
  12631. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  12632. } }, inject: { result: function result(e, t, n) {
  12633. 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);
  12634. }, id: function id(t) {
  12635. m.debug("Injecting unique ids into results");var n = 0,
  12636. o = 0;return "category" === g.type ? e.each(t, function (t, a) {
  12637. o = 0, e.each(a.results, function (e, t) {
  12638. var r = a.results[e];r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  12639. }), n++;
  12640. }) : e.each(t, function (e, n) {
  12641. var a = t[e];a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  12642. }), t;
  12643. } }, save: { results: function results(e) {
  12644. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  12645. } }, write: { cache: function cache(e, t) {
  12646. 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));
  12647. } }, addResults: function addResults(t) {
  12648. 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 () {
  12649. R.empty();
  12650. });
  12651. }, showResults: function showResults(t) {
  12652. 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() {
  12653. t();
  12654. }, queue: !0 })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  12655. }, hideResults: function hideResults(t) {
  12656. 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() {
  12657. t();
  12658. }, queue: !0 })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  12659. }, generateResults: function generateResults(t) {
  12660. m.debug("Generating html from response", t);var n = g.templates[g.type],
  12661. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  12662. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  12663. 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;
  12664. }, displayMessage: function displayMessage(e, t) {
  12665. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  12666. }, setting: function setting(t, n) {
  12667. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12668. if (n === i) return g[t];g[t] = n;
  12669. }
  12670. }, internal: function internal(t, n) {
  12671. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  12672. if (n === i) return m[t];m[t] = n;
  12673. }
  12674. }, debug: function debug() {
  12675. !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)));
  12676. }, verbose: function verbose() {
  12677. !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)));
  12678. }, error: function error() {
  12679. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  12680. }, performance: { log: function log(e) {
  12681. 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);
  12682. }, display: function display() {
  12683. var t = g.name + ":",
  12684. n = 0;l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  12685. n += t["Execution Time"];
  12686. }), 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) {
  12687. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12688. }), console.groupEnd()), c = [];
  12689. } }, invoke: function invoke(t, n, o) {
  12690. var r,
  12691. s,
  12692. l,
  12693. 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) {
  12694. 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 {
  12695. 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];
  12696. }
  12697. })), 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;
  12698. } }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  12699. }), a !== i ? a : this;
  12700. }, 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) {
  12701. var t = { "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#x27;", "`": "&#x60;" };return (/[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  12702. return t[e];
  12703. }) : e
  12704. );
  12705. }, message: function message(e, t) {
  12706. 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;
  12707. }, category: function category(t, n) {
  12708. var o = "";e.fn.search.settings.templates.escape;return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  12709. 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) {
  12710. 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>";
  12711. }), o += "</div>", o += "</div>");
  12712. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12713. }, standard: function standard(t, n) {
  12714. var o = "";return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  12715. 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>";
  12716. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  12717. } } };
  12718. }(jQuery, window, document), function (e, t, n, i) {
  12719. "use strict";
  12720. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  12721. var a,
  12722. r = e(this),
  12723. s = (e("body"), new Date().getTime()),
  12724. l = [],
  12725. c = arguments[0],
  12726. u = "string" == typeof c,
  12727. d = [].slice.call(arguments, 1),
  12728. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12729. setTimeout(e, 0);
  12730. };return r.each(function () {
  12731. var t,
  12732. m,
  12733. g,
  12734. p = r.selector || "",
  12735. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  12736. v = h.namespace,
  12737. b = h.selector,
  12738. y = h.error,
  12739. x = h.className,
  12740. C = "." + v,
  12741. w = "module-" + v,
  12742. S = e(this),
  12743. k = S.find(b.sides),
  12744. T = S.find(b.side),
  12745. A = !1,
  12746. R = this,
  12747. P = S.data(w);g = { initialize: function initialize() {
  12748. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  12749. }, instantiate: function instantiate() {
  12750. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  12751. }, destroy: function destroy() {
  12752. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  12753. }, refresh: function refresh() {
  12754. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  12755. }, repaint: function repaint() {
  12756. g.verbose("Forcing repaint event");(k[0] || n.createElement("div")).offsetWidth;
  12757. }, animate: function animate(e, n) {
  12758. g.verbose("Animating box with properties", e), n = n || function (e) {
  12759. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  12760. }, 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 () {
  12761. S.addClass(x.animating), t.addClass(x.hidden);
  12762. })) : n();
  12763. }, queue: function queue(e) {
  12764. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  12765. g.debug("Executing queued animation"), setTimeout(function () {
  12766. S.shape(e);
  12767. }, 0);
  12768. });
  12769. }, reset: function reset() {
  12770. 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");
  12771. }, is: { complete: function complete() {
  12772. return T.filter("." + x.active)[0] == m[0];
  12773. }, animating: function animating() {
  12774. return S.hasClass(x.animating);
  12775. } }, set: { defaultSide: function defaultSide() {
  12776. 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);
  12777. }, duration: function duration(e) {
  12778. 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 });
  12779. }, currentStageSize: function currentStageSize() {
  12780. var e = S.find("." + h.className.active),
  12781. t = e.outerWidth(!0),
  12782. n = e.outerHeight(!0);S.css({ width: t, height: n });
  12783. }, stageSize: function stageSize() {
  12784. var e = S.clone().addClass(x.loading),
  12785. t = e.find("." + h.className.active),
  12786. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  12787. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  12788. 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));
  12789. }, nextSide: function nextSide(e) {
  12790. 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);
  12791. }, active: function active() {
  12792. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  12793. } }, flip: { up: function up() {
  12794. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12795. if (g.is.animating()) g.queue("flip up");else {
  12796. g.debug("Flipping up", m);var e = g.get.transform.up();g.set.stageSize(), g.stage.above(), g.animate(e);
  12797. }
  12798. } else g.debug("Side already visible", m);
  12799. }, down: function down() {
  12800. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12801. if (g.is.animating()) g.queue("flip down");else {
  12802. g.debug("Flipping down", m);var e = g.get.transform.down();g.set.stageSize(), g.stage.below(), g.animate(e);
  12803. }
  12804. } else g.debug("Side already visible", m);
  12805. }, left: function left() {
  12806. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12807. if (g.is.animating()) g.queue("flip left");else {
  12808. g.debug("Flipping left", m);var e = g.get.transform.left();g.set.stageSize(), g.stage.left(), g.animate(e);
  12809. }
  12810. } else g.debug("Side already visible", m);
  12811. }, right: function right() {
  12812. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  12813. if (g.is.animating()) g.queue("flip right");else {
  12814. g.debug("Flipping right", m);var e = g.get.transform.right();g.set.stageSize(), g.stage.right(), g.animate(e);
  12815. }
  12816. } else g.debug("Side already visible", m);
  12817. }, over: function over() {
  12818. !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);
  12819. }, back: function back() {
  12820. !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);
  12821. } }, get: { transform: { up: function up() {
  12822. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)" };
  12823. }, down: function down() {
  12824. return { transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)" };
  12825. }, left: function left() {
  12826. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)" };
  12827. }, right: function right() {
  12828. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)" };
  12829. }, over: function over() {
  12830. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)" };
  12831. }, back: function back() {
  12832. return { transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)" };
  12833. } }, transitionEvent: function transitionEvent() {
  12834. var e,
  12835. t = n.createElement("element"),
  12836. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  12837. if (t.style[e] !== i) return o[e];
  12838. }
  12839. }, nextSide: function nextSide() {
  12840. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  12841. } }, stage: { above: function above() {
  12842. 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)" });
  12843. }, below: function below() {
  12844. 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)" });
  12845. }, left: function left() {
  12846. var e = t.outerWidth(!0),
  12847. n = m.outerWidth(!0),
  12848. 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)" });
  12849. }, right: function right() {
  12850. var e = t.outerWidth(!0),
  12851. n = m.outerWidth(!0),
  12852. 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)" });
  12853. }, behind: function behind() {
  12854. var e = t.outerWidth(!0),
  12855. n = m.outerWidth(!0),
  12856. 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)" });
  12857. } }, setting: function setting(t, n) {
  12858. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  12859. if (n === i) return h[t];e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  12860. }
  12861. }, internal: function internal(t, n) {
  12862. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  12863. if (n === i) return g[t];g[t] = n;
  12864. }
  12865. }, debug: function debug() {
  12866. !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)));
  12867. }, verbose: function verbose() {
  12868. !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)));
  12869. }, error: function error() {
  12870. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  12871. }, performance: { log: function log(e) {
  12872. 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);
  12873. }, display: function display() {
  12874. var t = h.name + ":",
  12875. n = 0;s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  12876. n += t["Execution Time"];
  12877. }), 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) {
  12878. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  12879. }), console.groupEnd()), l = [];
  12880. } }, invoke: function invoke(t, n, o) {
  12881. var r,
  12882. s,
  12883. l,
  12884. 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) {
  12885. 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 {
  12886. 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];
  12887. }
  12888. })), 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;
  12889. } }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  12890. }), a !== i ? a : this;
  12891. }, 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" } };
  12892. }(jQuery, window, document), function (e, t, n, i) {
  12893. "use strict";
  12894. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  12895. var a,
  12896. r = e(this),
  12897. s = e(t),
  12898. l = e(n),
  12899. c = e("html"),
  12900. u = e("head"),
  12901. d = r.selector || "",
  12902. f = new Date().getTime(),
  12903. m = [],
  12904. g = arguments[0],
  12905. p = "string" == typeof g,
  12906. h = [].slice.call(arguments, 1),
  12907. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  12908. setTimeout(e, 0);
  12909. };return r.each(function () {
  12910. var r,
  12911. b,
  12912. y,
  12913. x,
  12914. C,
  12915. w,
  12916. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  12917. k = S.selector,
  12918. T = S.className,
  12919. A = S.namespace,
  12920. R = S.regExp,
  12921. P = S.error,
  12922. E = "." + A,
  12923. F = "module-" + A,
  12924. O = e(this),
  12925. D = e(S.context),
  12926. q = O.children(k.sidebar),
  12927. j = (D.children(k.fixed), D.children(k.pusher)),
  12928. z = this,
  12929. I = O.data(F);w = { initialize: function initialize() {
  12930. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  12931. w.setup.cache();
  12932. }), w.instantiate();
  12933. }, instantiate: function instantiate() {
  12934. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  12935. }, create: { id: function id() {
  12936. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  12937. } }, destroy: function destroy() {
  12938. 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);
  12939. }, event: { clickaway: function clickaway(e) {
  12940. var t = j.find(e.target).length > 0 || j.is(e.target),
  12941. 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());
  12942. }, touch: function touch(e) {}, containScroll: function containScroll(e) {
  12943. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  12944. }, scroll: function scroll(t) {
  12945. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  12946. } }, bind: { clickaway: function clickaway() {
  12947. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  12948. }, scrollLock: function scrollLock() {
  12949. 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);
  12950. } }, unbind: { clickaway: function clickaway() {
  12951. w.verbose("Removing clickaway events from context", D), D.off(b);
  12952. }, scrollLock: function scrollLock() {
  12953. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  12954. } }, add: { inlineCSS: function inlineCSS() {
  12955. var t,
  12956. n = w.cache.width || O.outerWidth(),
  12957. i = w.cache.height || O.outerHeight(),
  12958. o = w.is.rtl(),
  12959. a = w.get.direction(),
  12960. 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);
  12961. } }, refresh: function refresh() {
  12962. 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();
  12963. }, refreshSidebars: function refreshSidebars() {
  12964. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  12965. }, repaint: function repaint() {
  12966. w.verbose("Forcing repaint event"), z.style.display = "none";z.offsetHeight;z.scrollTop = z.scrollTop, z.style.display = "";
  12967. }, setup: { cache: function cache() {
  12968. w.cache = { width: O.outerWidth(), height: O.outerHeight(), rtl: "rtl" == O.css("direction") };
  12969. }, layout: function layout() {
  12970. 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();
  12971. } }, attachEvents: function attachEvents(t, n) {
  12972. 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);
  12973. }, show: function show(t) {
  12974. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  12975. 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) {
  12976. if ("overlay" != S.transition) return void w.hideOthers(w.show);w.hideOthers();
  12977. } else S.transition = "overlay";w.pushPage(function () {
  12978. t.call(z), S.onShow.call(z);
  12979. }), S.onChange.call(z), S.onVisible.call(z);
  12980. } else w.debug("Sidebar is already visible");
  12981. }, hide: function hide(t) {
  12982. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  12983. t.call(z), S.onHidden.call(z);
  12984. }), S.onChange.call(z), S.onHide.call(z));
  12985. }, othersAnimating: function othersAnimating() {
  12986. return q.not(O).filter("." + T.animating).length > 0;
  12987. }, othersVisible: function othersVisible() {
  12988. return q.not(O).filter("." + T.visible).length > 0;
  12989. }, othersActive: function othersActive() {
  12990. return w.othersVisible() || w.othersAnimating();
  12991. }, hideOthers: function hideOthers(e) {
  12992. var t = q.not(O).filter("." + T.visible),
  12993. n = t.length,
  12994. i = 0;e = e || function () {}, t.sidebar("hide", function () {
  12995. ++i == n && e();
  12996. });
  12997. }, toggle: function toggle() {
  12998. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  12999. }, pushPage: function pushPage(t) {
  13000. var n,
  13001. i,
  13002. _o,
  13003. a = w.get.transition(),
  13004. 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() {
  13005. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  13006. }, i = function i() {
  13007. w.set.dimmed();
  13008. }, _o = function o(e) {
  13009. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  13010. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  13011. }, pullPage: function pullPage(t) {
  13012. var n,
  13013. _i,
  13014. o = w.get.transition(),
  13015. 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() {
  13016. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  13017. }, _i = function i(e) {
  13018. 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));
  13019. }, a.off(C + b), a.on(C + b, _i), v(n);
  13020. }, scrollToTop: function scrollToTop() {
  13021. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  13022. }, scrollBack: function scrollBack() {
  13023. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  13024. }, clear: { cache: function cache() {
  13025. w.verbose("Clearing cached dimensions"), w.cache = {};
  13026. } }, set: { ios: function ios() {
  13027. c.addClass(T.ios);
  13028. }, pushed: function pushed() {
  13029. D.addClass(T.pushed);
  13030. }, pushable: function pushable() {
  13031. D.addClass(T.pushable);
  13032. }, dimmed: function dimmed() {
  13033. j.addClass(T.dimmed);
  13034. }, active: function active() {
  13035. O.addClass(T.active);
  13036. }, animating: function animating() {
  13037. O.addClass(T.animating);
  13038. }, transition: function transition(e) {
  13039. e = e || w.get.transition(), O.addClass(e);
  13040. }, direction: function direction(e) {
  13041. e = e || w.get.direction(), O.addClass(T[e]);
  13042. }, visible: function visible() {
  13043. O.addClass(T.visible);
  13044. }, overlay: function overlay() {
  13045. O.addClass(T.overlay);
  13046. } }, remove: { inlineCSS: function inlineCSS() {
  13047. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  13048. }, ios: function ios() {
  13049. c.removeClass(T.ios);
  13050. }, pushed: function pushed() {
  13051. D.removeClass(T.pushed);
  13052. }, pushable: function pushable() {
  13053. D.removeClass(T.pushable);
  13054. }, active: function active() {
  13055. O.removeClass(T.active);
  13056. }, animating: function animating() {
  13057. O.removeClass(T.animating);
  13058. }, transition: function transition(e) {
  13059. e = e || w.get.transition(), O.removeClass(e);
  13060. }, direction: function direction(e) {
  13061. e = e || w.get.direction(), O.removeClass(T[e]);
  13062. }, visible: function visible() {
  13063. O.removeClass(T.visible);
  13064. }, overlay: function overlay() {
  13065. O.removeClass(T.overlay);
  13066. } }, get: { direction: function direction() {
  13067. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  13068. }, transition: function transition() {
  13069. var e,
  13070. 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;
  13071. }, transitionEvent: function transitionEvent() {
  13072. var e,
  13073. t = n.createElement("element"),
  13074. o = { transition: "transitionend", OTransition: "oTransitionEnd", MozTransition: "transitionend", WebkitTransition: "webkitTransitionEnd" };for (e in o) {
  13075. if (t.style[e] !== i) return o[e];
  13076. }
  13077. } }, is: { ie: function ie() {
  13078. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  13079. }, ios: function ios() {
  13080. var e = navigator.userAgent,
  13081. t = e.match(R.ios),
  13082. n = e.match(R.mobileChrome);return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  13083. }, mobile: function mobile() {
  13084. 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);
  13085. }, hidden: function hidden() {
  13086. return !w.is.visible();
  13087. }, visible: function visible() {
  13088. return O.hasClass(T.visible);
  13089. }, open: function open() {
  13090. return w.is.visible();
  13091. }, closed: function closed() {
  13092. return w.is.hidden();
  13093. }, vertical: function vertical() {
  13094. return O.hasClass(T.top);
  13095. }, animating: function animating() {
  13096. return D.hasClass(T.animating);
  13097. }, rtl: function rtl() {
  13098. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  13099. } }, setting: function setting(t, n) {
  13100. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  13101. if (n === i) return S[t];e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  13102. }
  13103. }, internal: function internal(t, n) {
  13104. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  13105. if (n === i) return w[t];w[t] = n;
  13106. }
  13107. }, debug: function debug() {
  13108. !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)));
  13109. }, verbose: function verbose() {
  13110. !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)));
  13111. }, error: function error() {
  13112. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  13113. }, performance: { log: function log(e) {
  13114. 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);
  13115. }, display: function display() {
  13116. var t = S.name + ":",
  13117. n = 0;f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  13118. n += t["Execution Time"];
  13119. }), 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) {
  13120. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13121. }), console.groupEnd()), m = [];
  13122. } }, invoke: function invoke(t, n, o) {
  13123. var r,
  13124. s,
  13125. l,
  13126. 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) {
  13127. 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 {
  13128. 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];
  13129. }
  13130. })), 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;
  13131. } }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  13132. }), a !== i ? a : this;
  13133. }, 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" } };
  13134. }(jQuery, window, document), function (e, t, n, i) {
  13135. "use strict";
  13136. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  13137. var a,
  13138. r = e(this),
  13139. s = r.selector || "",
  13140. l = new Date().getTime(),
  13141. c = [],
  13142. u = arguments[0],
  13143. d = "string" == typeof u,
  13144. f = [].slice.call(arguments, 1);return r.each(function () {
  13145. var r,
  13146. m,
  13147. g,
  13148. p,
  13149. h,
  13150. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  13151. b = v.className,
  13152. y = v.namespace,
  13153. x = v.error,
  13154. C = "." + y,
  13155. w = "module-" + y,
  13156. S = e(this),
  13157. k = e(t),
  13158. T = e(v.scrollContext),
  13159. A = (S.selector, S.data(w)),
  13160. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13161. setTimeout(e, 0);
  13162. },
  13163. P = this;h = { initialize: function initialize() {
  13164. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  13165. }, instantiate: function instantiate() {
  13166. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  13167. }, destroy: function destroy() {
  13168. 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);
  13169. }, observeChanges: function observeChanges() {
  13170. "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));
  13171. }, determineContainer: function determineContainer() {
  13172. r = v.container ? e(v.container) : S.offsetParent();
  13173. }, determineContext: function determineContext() {
  13174. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  13175. }, checkErrors: function checkErrors() {
  13176. 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);
  13177. }, bind: { events: function events() {
  13178. 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);
  13179. } }, event: { changed: function changed(e) {
  13180. clearTimeout(h.timer), h.timer = setTimeout(function () {
  13181. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  13182. }, 100);
  13183. }, documentChanged: function documentChanged(t) {
  13184. [].forEach.call(t, function (t) {
  13185. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13186. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  13187. });
  13188. });
  13189. }, load: function load() {
  13190. h.verbose("Page contents finished loading"), R(h.refresh);
  13191. }, resize: function resize() {
  13192. h.verbose("Window resized"), R(h.refresh);
  13193. }, scroll: function scroll() {
  13194. R(function () {
  13195. T.triggerHandler("scrollchange" + C, T.scrollTop());
  13196. });
  13197. }, scrollchange: function scrollchange(e, t) {
  13198. h.stick(t), v.onScroll.call(P);
  13199. } }, refresh: function refresh(e) {
  13200. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  13201. }, supports: { sticky: function sticky() {
  13202. var t = e("<div/>");t[0];return t.addClass(b.supported), t.css("position").match("sticky");
  13203. } }, save: { lastScroll: function lastScroll(e) {
  13204. h.lastScroll = e;
  13205. }, elementScroll: function elementScroll(e) {
  13206. h.elementScroll = e;
  13207. }, positions: function positions() {
  13208. var e = { height: T.height() },
  13209. 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() },
  13210. 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);
  13211. } }, get: { direction: function direction(e) {
  13212. var t = "down";return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  13213. }, scrollChange: function scrollChange(e) {
  13214. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  13215. }, currentElementScroll: function currentElementScroll() {
  13216. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  13217. }, elementScroll: function elementScroll(e) {
  13218. e = e || T.scrollTop();var t = h.cache.element,
  13219. n = h.cache.scrollContext,
  13220. i = h.get.scrollChange(e),
  13221. o = t.height - n.height + v.offset,
  13222. a = h.get.currentElementScroll(),
  13223. r = a + i;return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  13224. } }, remove: { lastScroll: function lastScroll() {
  13225. delete h.lastScroll;
  13226. }, elementScroll: function elementScroll(e) {
  13227. delete h.elementScroll;
  13228. }, minimumSize: function minimumSize() {
  13229. r.css("min-height", "");
  13230. }, offset: function offset() {
  13231. S.css("margin-top", "");
  13232. } }, set: { offset: function offset() {
  13233. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  13234. }, containerSize: function containerSize() {
  13235. 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 }));
  13236. }, minimumSize: function minimumSize() {
  13237. var e = h.cache.element;r.css("min-height", e.height);
  13238. }, scroll: function scroll(e) {
  13239. 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));
  13240. }, size: function size() {
  13241. 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"));
  13242. } }, is: { standardScroll: function standardScroll() {
  13243. return T[0] == t;
  13244. }, top: function top() {
  13245. return S.hasClass(b.top);
  13246. }, bottom: function bottom() {
  13247. return S.hasClass(b.bottom);
  13248. }, initialPosition: function initialPosition() {
  13249. return !h.is.fixed() && !h.is.bound();
  13250. }, hidden: function hidden() {
  13251. return !S.is(":visible");
  13252. }, bound: function bound() {
  13253. return S.hasClass(b.bound);
  13254. }, fixed: function fixed() {
  13255. return S.hasClass(b.fixed);
  13256. } }, stick: function stick(e) {
  13257. var t = e || T.scrollTop(),
  13258. n = h.cache,
  13259. i = n.fits,
  13260. o = n.sameHeight,
  13261. a = n.element,
  13262. r = n.scrollContext,
  13263. s = n.context,
  13264. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  13265. c = (e = { top: t + l, bottom: t + l + r.height }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  13266. 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())));
  13267. }, bindTop: function bindTop() {
  13268. 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);
  13269. }, bindBottom: function bindBottom() {
  13270. 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);
  13271. }, setInitialPosition: function setInitialPosition() {
  13272. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  13273. }, fixTop: function fixTop() {
  13274. 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);
  13275. }, fixBottom: function fixBottom() {
  13276. 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);
  13277. }, unbind: function unbind() {
  13278. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  13279. }, unfix: function unfix() {
  13280. 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));
  13281. }, reset: function reset() {
  13282. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  13283. }, resetCSS: function resetCSS() {
  13284. S.css({ width: "", height: "" }), r.css({ height: "" });
  13285. }, setting: function setting(t, n) {
  13286. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  13287. if (n === i) return v[t];v[t] = n;
  13288. }
  13289. }, internal: function internal(t, n) {
  13290. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13291. if (n === i) return h[t];h[t] = n;
  13292. }
  13293. }, debug: function debug() {
  13294. !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)));
  13295. }, verbose: function verbose() {
  13296. !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)));
  13297. }, error: function error() {
  13298. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13299. }, performance: { log: function log(e) {
  13300. 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);
  13301. }, display: function display() {
  13302. var t = v.name + ":",
  13303. n = 0;l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  13304. n += t["Execution Time"];
  13305. }), 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) {
  13306. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13307. }), console.groupEnd()), c = [];
  13308. } }, invoke: function invoke(t, n, o) {
  13309. var r,
  13310. s,
  13311. l,
  13312. 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) {
  13313. 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 {
  13314. 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];
  13315. }
  13316. })), 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;
  13317. } }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  13318. }), a !== i ? a : this;
  13319. }, 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" } };
  13320. }(jQuery, window, document), function (e, t, n, i) {
  13321. "use strict";
  13322. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  13323. var a,
  13324. r = e.isFunction(this) ? e(t) : e(this),
  13325. s = r.selector || "",
  13326. l = new Date().getTime(),
  13327. c = [],
  13328. u = arguments[0],
  13329. d = "string" == typeof u,
  13330. f = [].slice.call(arguments, 1),
  13331. m = !1;return r.each(function () {
  13332. var g,
  13333. p,
  13334. h,
  13335. v,
  13336. b,
  13337. y,
  13338. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  13339. C = x.className,
  13340. w = x.metadata,
  13341. S = x.selector,
  13342. k = x.error,
  13343. T = "." + x.namespace,
  13344. A = "module-" + x.namespace,
  13345. R = e(this),
  13346. P = {},
  13347. E = !0,
  13348. F = 0,
  13349. O = this,
  13350. D = R.data(A);b = { initialize: function initialize() {
  13351. 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();
  13352. }, instantiate: function instantiate() {
  13353. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  13354. }, destroy: function destroy() {
  13355. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  13356. }, bind: { events: function events() {
  13357. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  13358. } }, determineTabs: function determineTabs() {
  13359. 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));
  13360. }, fix: { callbacks: function callbacks() {
  13361. 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));
  13362. } }, initializeHistory: function initializeHistory() {
  13363. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;if ("state" == x.historyType) {
  13364. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;e.address.history(!0).state(x.path);
  13365. }e.address.bind("change", b.event.history.change);
  13366. }, event: { click: function click(t) {
  13367. 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");
  13368. }, history: { change: function change(t) {
  13369. var n = t.pathNames.join("/") || b.get.initialPath(),
  13370. 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);
  13371. } } }, refresh: function refresh() {
  13372. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  13373. }, cache: { read: function read(e) {
  13374. return e !== i && P[e];
  13375. }, add: function add(e, t) {
  13376. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  13377. }, remove: function remove(e) {
  13378. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  13379. } }, set: { auto: function auto() {
  13380. 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 };
  13381. }, loading: function loading(e) {
  13382. 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));
  13383. }, state: function state(t) {
  13384. e.address.value(t);
  13385. } }, changeTab: function changeTab(n) {
  13386. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  13387. o = x.auto || e.isPlainObject(x.apiSettings),
  13388. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  13389. var s,
  13390. l,
  13391. c,
  13392. u,
  13393. d = a.slice(0, t + 1),
  13394. f = b.utilities.arrayToPath(d),
  13395. m = b.is.tab(f),
  13396. p = t + 1 == a.length,
  13397. S = b.get.tabElement(f);if (b.verbose("Looking for tab", r), m) {
  13398. 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);
  13399. } else {
  13400. 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 () {
  13401. b.scrollTo(s);
  13402. }, 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;
  13403. }
  13404. });
  13405. }, scrollTo: function scrollTo(t) {
  13406. 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));
  13407. }, update: { content: function content(t, n, o) {
  13408. var a = b.get.tabElement(t),
  13409. 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);
  13410. } }, fetch: { content: function content(t, n) {
  13411. var o,
  13412. a,
  13413. r = b.get.tabElement(t),
  13414. s = { dataType: "html", encodeParameters: !1, on: "now", cache: x.alwaysRefresh, headers: { "X-Remote": !0 }, onSuccess: function onSuccess(e) {
  13415. "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 () {
  13416. var e = r.children().clone(!0);e = e.not("script"), b.cache.add(n, e);
  13417. }, 0) : b.cache.add(n, r.html());
  13418. }, urlData: { tab: n } },
  13419. l = r.api("get request") || !1,
  13420. 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);
  13421. } }, activate: { all: function all(e) {
  13422. b.activate.tab(e), b.activate.navigation(e);
  13423. }, tab: function tab(e) {
  13424. var t = b.get.tabElement(e),
  13425. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  13426. 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));
  13427. }, navigation: function navigation(e) {
  13428. var t = b.get.navElement(e),
  13429. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  13430. i = t.hasClass(C.active);b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  13431. } }, deactivate: { all: function all() {
  13432. b.deactivate.navigation(), b.deactivate.tabs();
  13433. }, navigation: function navigation() {
  13434. r.removeClass(C.active);
  13435. }, tabs: function tabs() {
  13436. p.removeClass(C.active + " " + C.loading);
  13437. } }, is: { tab: function tab(e) {
  13438. return e !== i && b.get.tabElement(e).length > 0;
  13439. } }, get: { initialPath: function initialPath() {
  13440. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  13441. }, path: function path() {
  13442. return e.address.value();
  13443. }, defaultPathArray: function defaultPathArray(e) {
  13444. return b.utilities.pathToArray(b.get.defaultPath(e));
  13445. }, defaultPath: function defaultPath(e) {
  13446. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;if (t) {
  13447. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);b.error(k.recursion);
  13448. } else b.debug("No default tabs found for", e, p);return F = 0, e;
  13449. }, navElement: function navElement(e) {
  13450. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  13451. }, tabElement: function tabElement(e) {
  13452. 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;
  13453. }, tab: function tab() {
  13454. return h;
  13455. } }, utilities: { filterArray: function filterArray(t, n) {
  13456. return e.grep(t, function (t) {
  13457. return -1 == e.inArray(t, n);
  13458. });
  13459. }, last: function last(t) {
  13460. return !!e.isArray(t) && t[t.length - 1];
  13461. }, pathToArray: function pathToArray(e) {
  13462. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  13463. }, arrayToPath: function arrayToPath(t) {
  13464. return !!e.isArray(t) && t.join("/");
  13465. } }, setting: function setting(t, n) {
  13466. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  13467. if (n === i) return x[t];e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  13468. }
  13469. }, internal: function internal(t, n) {
  13470. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  13471. if (n === i) return b[t];b[t] = n;
  13472. }
  13473. }, debug: function debug() {
  13474. !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)));
  13475. }, verbose: function verbose() {
  13476. !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)));
  13477. }, error: function error() {
  13478. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  13479. }, performance: { log: function log(e) {
  13480. 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);
  13481. }, display: function display() {
  13482. var t = x.name + ":",
  13483. n = 0;l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  13484. n += t["Execution Time"];
  13485. }), 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) {
  13486. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13487. }), console.groupEnd()), c = [];
  13488. } }, invoke: function invoke(t, n, o) {
  13489. var r,
  13490. s,
  13491. l,
  13492. 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) {
  13493. 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 {
  13494. 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];
  13495. }
  13496. })), 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;
  13497. } }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  13498. }), a !== i ? a : this;
  13499. }, e.tab = function () {
  13500. e(t).tab.apply(this, arguments);
  13501. }, 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" } };
  13502. }(jQuery, window, document), function (e, t, n, i) {
  13503. "use strict";
  13504. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  13505. var o,
  13506. a = e(this),
  13507. r = a.selector || "",
  13508. s = new Date().getTime(),
  13509. l = [],
  13510. c = arguments,
  13511. u = c[0],
  13512. d = [].slice.call(arguments, 1),
  13513. f = "string" == typeof u;t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;return a.each(function (t) {
  13514. var m,
  13515. g,
  13516. p,
  13517. h,
  13518. v,
  13519. b,
  13520. y,
  13521. x,
  13522. C,
  13523. w = e(this),
  13524. S = this;(C = { initialize: function initialize() {
  13525. 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());
  13526. }, instantiate: function instantiate() {
  13527. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  13528. }, destroy: function destroy() {
  13529. C.verbose("Destroying previous module for", S), w.removeData(y);
  13530. }, refresh: function refresh() {
  13531. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  13532. }, forceRepaint: function forceRepaint() {
  13533. C.verbose("Forcing element repaint");var e = w.parent(),
  13534. t = w.next();0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  13535. }, repaint: function repaint() {
  13536. C.verbose("Repainting element");S.offsetWidth;
  13537. }, delay: function delay(e) {
  13538. var n,
  13539. 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);
  13540. }, animate: function animate(e) {
  13541. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  13542. 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();
  13543. }C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  13544. }, reset: function reset() {
  13545. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  13546. }, queue: function queue(e) {
  13547. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  13548. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  13549. });
  13550. }, complete: function complete(e) {
  13551. 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)));
  13552. }, force: { visible: function visible() {
  13553. var e = w.attr("style"),
  13554. t = C.get.userStyle(),
  13555. n = C.get.displayType(),
  13556. o = t + "display: " + n + " !important;",
  13557. a = w.css("display"),
  13558. r = e === i || "" === e;a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  13559. }, hidden: function hidden() {
  13560. var e = w.attr("style"),
  13561. t = w.css("display"),
  13562. 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"));
  13563. } }, has: { direction: function direction(t) {
  13564. var n = !1;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13565. t !== h.inward && t !== h.outward || (n = !0);
  13566. })), n;
  13567. }, inlineDisplay: function inlineDisplay() {
  13568. var t = w.attr("style") || "";return e.isArray(t.match(/display.*?;/, ""));
  13569. } }, set: { animating: function animating(e) {
  13570. 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);
  13571. }, duration: function duration(e, t) {
  13572. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({ "animation-duration": t }));
  13573. }, direction: function direction(e) {
  13574. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  13575. }, looping: function looping() {
  13576. C.debug("Transition set to loop"), w.addClass(h.looping);
  13577. }, hidden: function hidden() {
  13578. w.addClass(h.transition).addClass(h.hidden);
  13579. }, inward: function inward() {
  13580. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  13581. }, outward: function outward() {
  13582. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  13583. }, visible: function visible() {
  13584. w.addClass(h.transition).addClass(h.visible);
  13585. } }, start: { animation: function animation(e) {
  13586. 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);
  13587. } }, save: { animation: function animation(e) {
  13588. C.cache || (C.cache = {}), C.cache.animation = e;
  13589. }, displayType: function displayType(e) {
  13590. "none" !== e && w.data(v.displayType, e);
  13591. }, transitionExists: function transitionExists(t, n) {
  13592. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  13593. } }, restore: { conditions: function conditions() {
  13594. var e = C.get.currentAnimation();e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  13595. } }, add: { failSafe: function failSafe() {
  13596. var e = C.get.duration();C.timer = setTimeout(function () {
  13597. w.triggerHandler(b);
  13598. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  13599. } }, remove: { animating: function animating() {
  13600. w.removeClass(h.animating);
  13601. }, animationCallbacks: function animationCallbacks() {
  13602. C.remove.queueCallback(), C.remove.completeCallback();
  13603. }, queueCallback: function queueCallback() {
  13604. w.off(".queue" + x);
  13605. }, completeCallback: function completeCallback() {
  13606. w.off(".complete" + x);
  13607. }, display: function display() {
  13608. w.css("display", "");
  13609. }, direction: function direction() {
  13610. w.removeClass(h.inward).removeClass(h.outward);
  13611. }, duration: function duration() {
  13612. w.css("animation-duration", "");
  13613. }, failSafe: function failSafe() {
  13614. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  13615. }, hidden: function hidden() {
  13616. w.removeClass(h.hidden);
  13617. }, visible: function visible() {
  13618. w.removeClass(h.visible);
  13619. }, looping: function looping() {
  13620. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  13621. }, transition: function transition() {
  13622. w.removeClass(h.visible).removeClass(h.hidden);
  13623. } }, get: { settings: function settings(t, n, i) {
  13624. 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 });
  13625. }, animationClass: function animationClass(e) {
  13626. var t = e || m.animation,
  13627. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";return h.animating + " " + h.transition + " " + n + t;
  13628. }, currentAnimation: function currentAnimation() {
  13629. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  13630. }, currentDirection: function currentDirection() {
  13631. return C.is.inward() ? h.inward : h.outward;
  13632. }, direction: function direction() {
  13633. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  13634. }, animationDirection: function animationDirection(t) {
  13635. var n;return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  13636. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  13637. })), n || !1;
  13638. }, duration: function duration(e) {
  13639. 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;
  13640. }, displayType: function displayType(e) {
  13641. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  13642. }, userStyle: function userStyle(e) {
  13643. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  13644. }, transitionExists: function transitionExists(t) {
  13645. return e.fn.transition.exists[t];
  13646. }, animationStartEvent: function animationStartEvent() {
  13647. var e,
  13648. t = n.createElement("div"),
  13649. o = { animation: "animationstart", OAnimation: "oAnimationStart", MozAnimation: "mozAnimationStart", WebkitAnimation: "webkitAnimationStart" };for (e in o) {
  13650. if (t.style[e] !== i) return o[e];
  13651. }return !1;
  13652. }, animationEndEvent: function animationEndEvent() {
  13653. var e,
  13654. t = n.createElement("div"),
  13655. o = { animation: "animationend", OAnimation: "oAnimationEnd", MozAnimation: "mozAnimationEnd", WebkitAnimation: "webkitAnimationEnd" };for (e in o) {
  13656. if (t.style[e] !== i) return o[e];
  13657. }return !1;
  13658. } }, can: { transition: function transition(t) {
  13659. var n,
  13660. o,
  13661. a,
  13662. r,
  13663. s,
  13664. l,
  13665. c = m.animation,
  13666. u = C.get.transitionExists(c),
  13667. d = C.get.displayType(!1);if (u === i || t) {
  13668. 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 {
  13669. if ("none" == r || !r) return void C.debug("No animation defined in css", c);C.debug("Static animation found", c, d), l = !1;
  13670. }C.save.transitionExists(c, l);
  13671. }return u !== i ? u : l;
  13672. }, animate: function animate() {
  13673. return C.can.transition() !== i;
  13674. } }, is: { animating: function animating() {
  13675. return w.hasClass(h.animating);
  13676. }, inward: function inward() {
  13677. return w.hasClass(h.inward);
  13678. }, outward: function outward() {
  13679. return w.hasClass(h.outward);
  13680. }, looping: function looping() {
  13681. return w.hasClass(h.looping);
  13682. }, occurring: function occurring(e) {
  13683. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  13684. }, visible: function visible() {
  13685. return w.is(":visible");
  13686. }, hidden: function hidden() {
  13687. return "hidden" === w.css("visibility");
  13688. }, supported: function supported() {
  13689. return !1 !== b;
  13690. } }, hide: function hide() {
  13691. 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);
  13692. }, show: function show(e) {
  13693. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  13694. }, toggle: function toggle() {
  13695. C.is.visible() ? C.hide() : C.show();
  13696. }, stop: function stop() {
  13697. C.debug("Stopping current animation"), w.triggerHandler(b);
  13698. }, stopAll: function stopAll() {
  13699. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  13700. }, clear: { queue: function queue() {
  13701. C.debug("Clearing animation queue"), C.remove.queueCallback();
  13702. } }, enable: function enable() {
  13703. C.verbose("Starting animation"), w.removeClass(h.disabled);
  13704. }, disable: function disable() {
  13705. C.debug("Stopping animation"), w.addClass(h.disabled);
  13706. }, setting: function setting(t, n) {
  13707. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13708. if (n === i) return m[t];e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13709. }
  13710. }, internal: function internal(t, n) {
  13711. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  13712. if (n === i) return C[t];C[t] = n;
  13713. }
  13714. }, debug: function debug() {
  13715. !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)));
  13716. }, verbose: function verbose() {
  13717. !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)));
  13718. }, error: function error() {
  13719. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  13720. }, performance: { log: function log(e) {
  13721. 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);
  13722. }, display: function display() {
  13723. var t = m.name + ":",
  13724. n = 0;s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  13725. n += t["Execution Time"];
  13726. }), 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) {
  13727. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13728. }), console.groupEnd()), l = [];
  13729. } }, invoke: function invoke(t, n, a) {
  13730. var r,
  13731. s,
  13732. l,
  13733. 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) {
  13734. 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 {
  13735. 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];
  13736. }
  13737. })), 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;
  13738. } }).initialize();
  13739. }), o !== i ? o : this;
  13740. }, 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" } };
  13741. }(jQuery, window, document), function (e, t, n, i) {
  13742. "use strict";
  13743. 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) {
  13744. var o,
  13745. a = e.isFunction(this) ? e(t) : e(this),
  13746. r = a.selector || "",
  13747. s = new Date().getTime(),
  13748. l = [],
  13749. c = arguments[0],
  13750. u = "string" == typeof c,
  13751. d = [].slice.call(arguments, 1);return a.each(function () {
  13752. var a,
  13753. f,
  13754. m,
  13755. g,
  13756. p,
  13757. h,
  13758. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  13759. b = v.namespace,
  13760. y = v.metadata,
  13761. x = v.selector,
  13762. C = v.error,
  13763. w = v.className,
  13764. S = "." + b,
  13765. k = "module-" + b,
  13766. T = e(this),
  13767. A = T.closest(x.form),
  13768. R = v.stateContext ? e(v.stateContext) : T,
  13769. P = this,
  13770. E = R[0],
  13771. F = T.data(k);h = { initialize: function initialize() {
  13772. u || h.bind.events(), h.instantiate();
  13773. }, instantiate: function instantiate() {
  13774. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  13775. }, destroy: function destroy() {
  13776. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  13777. }, bind: { events: function events() {
  13778. 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());
  13779. } }, decode: { json: function json(e) {
  13780. if (e !== i && "string" == typeof e) try {
  13781. e = JSON.parse(e);
  13782. } catch (e) {}return e;
  13783. } }, read: { cachedResponse: function cachedResponse(e) {
  13784. 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);
  13785. } }, write: { cachedResponse: function cachedResponse(n, o) {
  13786. 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);
  13787. } }, query: function query() {
  13788. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  13789. if (h.is.loading()) {
  13790. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");h.debug("Interrupting previous request"), h.abort();
  13791. }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()) {
  13792. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  13793. 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 () {
  13794. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  13795. }, 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());
  13796. }
  13797. } else h.error(C.missingURL);
  13798. }
  13799. }, should: { removeError: function removeError() {
  13800. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  13801. } }, is: { disabled: function disabled() {
  13802. return T.filter(x.disabled).length > 0;
  13803. }, expectingJSON: function expectingJSON() {
  13804. return "json" === v.dataType || "jsonp" === v.dataType;
  13805. }, form: function form() {
  13806. return T.is("form") || R.is("form");
  13807. }, mocked: function mocked() {
  13808. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  13809. }, input: function input() {
  13810. return T.is("input");
  13811. }, loading: function loading() {
  13812. return !!h.request && "pending" == h.request.state();
  13813. }, abortedRequest: function abortedRequest(e) {
  13814. 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);
  13815. }, validResponse: function validResponse(t) {
  13816. 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);
  13817. } }, was: { cancelled: function cancelled() {
  13818. return h.cancelled || !1;
  13819. }, succesful: function succesful() {
  13820. return h.request && "resolved" == h.request.state();
  13821. }, failure: function failure() {
  13822. return h.request && "rejected" == h.request.state();
  13823. }, complete: function complete() {
  13824. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  13825. } }, add: { urlData: function urlData(t, n) {
  13826. 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) {
  13827. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  13828. 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);
  13829. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  13830. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  13831. 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, ""));
  13832. }))), t;
  13833. }, formData: function formData(t) {
  13834. var n = e.fn.serializeObject !== i,
  13835. 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;
  13836. } }, send: { request: function request() {
  13837. 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);
  13838. } }, event: { trigger: function trigger(e) {
  13839. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  13840. }, xhr: { always: function always() {}, done: function done(t, n, i) {
  13841. var o = this,
  13842. a = new Date().getTime() - p,
  13843. r = v.loadingDuration - a,
  13844. 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 () {
  13845. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  13846. }, r);
  13847. }, fail: function fail(e, t, n) {
  13848. var i = this,
  13849. o = new Date().getTime() - p,
  13850. a = v.loadingDuration - o;(a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  13851. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  13852. }, a);
  13853. } }, request: { done: function done(e, t) {
  13854. 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);
  13855. }, complete: function complete(e, t) {
  13856. 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);
  13857. }, fail: function fail(e, t, n) {
  13858. var o = h.get.responseFromXHR(e),
  13859. 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);
  13860. } } }, create: { request: function request() {
  13861. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  13862. }, mockedXHR: function mockedXHR() {
  13863. var t,
  13864. n,
  13865. i,
  13866. o = v.mockResponse || v.response,
  13867. 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) {
  13868. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, { responseText: e }]) : i.rejectWith(E, [{ responseText: e }, !1, !1]);
  13869. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  13870. }, xhr: function xhr() {
  13871. 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;
  13872. } }, set: { error: function error() {
  13873. h.verbose("Adding error state to element", R), R.addClass(w.error);
  13874. }, loading: function loading() {
  13875. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  13876. } }, remove: { error: function error() {
  13877. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  13878. }, loading: function loading() {
  13879. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  13880. } }, get: { responseFromXHR: function responseFromXHR(t) {
  13881. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  13882. }, errorFromRequest: function errorFromRequest(t, n, o) {
  13883. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  13884. }, request: function request() {
  13885. return h.request || !1;
  13886. }, xhr: function xhr() {
  13887. return h.xhr || !1;
  13888. }, settings: function settings() {
  13889. 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);
  13890. }, urlEncodedValue: function urlEncodedValue(e) {
  13891. var n = t.decodeURIComponent(e),
  13892. 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);
  13893. }, defaultData: function defaultData() {
  13894. var t = {};return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  13895. }, event: function event() {
  13896. 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;
  13897. }, templatedURL: function templatedURL(e) {
  13898. 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) {
  13899. 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];
  13900. } 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;
  13901. } }, abort: function abort() {
  13902. var e = h.get.xhr();e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  13903. }, reset: function reset() {
  13904. h.remove.error(), h.remove.loading();
  13905. }, setting: function setting(t, n) {
  13906. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  13907. if (n === i) return v[t];e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  13908. }
  13909. }, internal: function internal(t, n) {
  13910. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  13911. if (n === i) return h[t];h[t] = n;
  13912. }
  13913. }, debug: function debug() {
  13914. !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)));
  13915. }, verbose: function verbose() {
  13916. !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)));
  13917. }, error: function error() {
  13918. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  13919. }, performance: { log: function log(e) {
  13920. 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);
  13921. }, display: function display() {
  13922. var t = v.name + ":",
  13923. n = 0;s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  13924. n += t["Execution Time"];
  13925. }), 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) {
  13926. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13927. }), console.groupEnd()), l = [];
  13928. } }, invoke: function invoke(t, n, a) {
  13929. var r,
  13930. s,
  13931. l,
  13932. 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) {
  13933. 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 {
  13934. 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];
  13935. }
  13936. })), 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;
  13937. } }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  13938. }), o !== i ? o : this;
  13939. }, 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) {
  13940. return e;
  13941. }, 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" } };
  13942. }(jQuery, window, document), function (e, t, n, i) {
  13943. "use strict";
  13944. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  13945. var a,
  13946. r = e(this),
  13947. s = r.selector || "",
  13948. l = new Date().getTime(),
  13949. c = [],
  13950. u = arguments[0],
  13951. d = "string" == typeof u,
  13952. f = [].slice.call(arguments, 1),
  13953. m = r.length,
  13954. g = 0;return r.each(function () {
  13955. var r,
  13956. p,
  13957. h,
  13958. v,
  13959. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  13960. y = b.className,
  13961. x = b.namespace,
  13962. C = b.error,
  13963. w = b.metadata,
  13964. S = "." + x,
  13965. k = "module-" + x,
  13966. T = e(t),
  13967. A = e(this),
  13968. R = e(b.context),
  13969. P = (A.selector, A.data(k)),
  13970. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13971. setTimeout(e, 0);
  13972. },
  13973. F = this,
  13974. O = !1;v = { initialize: function initialize() {
  13975. 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();
  13976. }, instantiate: function instantiate() {
  13977. v.debug("Storing instance", v), A.data(k, v), P = v;
  13978. }, destroy: function destroy() {
  13979. 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);
  13980. }, observeChanges: function observeChanges() {
  13981. "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));
  13982. }, bind: { events: function events() {
  13983. 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);
  13984. } }, event: { changed: function changed(e) {
  13985. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  13986. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  13987. }, 100);
  13988. }, contextChanged: function contextChanged(t) {
  13989. [].forEach.call(t, function (t) {
  13990. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  13991. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  13992. });
  13993. });
  13994. }, resize: function resize() {
  13995. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  13996. }, load: function load() {
  13997. v.debug("Page finished loading"), E(v.refresh);
  13998. }, scroll: function scroll() {
  13999. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  14000. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14001. }, b.throttle)) : E(function () {
  14002. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  14003. });
  14004. }, scrollchange: function scrollchange(e, t) {
  14005. v.checkVisibility(t);
  14006. } }, precache: function precache(t, i) {
  14007. t instanceof Array || (t = [t]);for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  14008. ++a >= t.length && e.isFunction(i) && i();
  14009. }; o--;) {
  14010. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  14011. }
  14012. }, enableCallbacks: function enableCallbacks() {
  14013. v.debug("Allowing callbacks to occur"), O = !1;
  14014. }, disableCallbacks: function disableCallbacks() {
  14015. v.debug("Disabling all callbacks temporarily"), O = !0;
  14016. }, should: { trackChanges: function trackChanges() {
  14017. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  14018. } }, setup: { cache: function cache() {
  14019. v.cache = { occurred: {}, screen: {}, element: {} };
  14020. }, image: function image() {
  14021. var e = A.data(w.src);e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  14022. v.debug("Image on screen", F), v.precache(e, function () {
  14023. v.set.image(e, function () {
  14024. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  14025. });
  14026. });
  14027. });
  14028. }, fixed: function fixed() {
  14029. 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 () {
  14030. 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);
  14031. }, b.onTopPassedReverse = function () {
  14032. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  14033. };
  14034. } }, create: { placeholder: function placeholder() {
  14035. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  14036. } }, show: { placeholder: function placeholder() {
  14037. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  14038. } }, hide: { placeholder: function placeholder() {
  14039. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  14040. } }, set: { fixed: function fixed() {
  14041. 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);
  14042. }, image: function image(t, n) {
  14043. if (A.attr("src", t), b.transition) {
  14044. if (e.fn.transition !== i) {
  14045. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");A.transition(b.transition, b.duration, n);
  14046. } else A.fadeIn(b.duration, n);
  14047. } else A.show();
  14048. } }, is: { onScreen: function onScreen() {
  14049. return v.get.elementCalculations().onScreen;
  14050. }, offScreen: function offScreen() {
  14051. return v.get.elementCalculations().offScreen;
  14052. }, visible: function visible() {
  14053. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  14054. }, verticallyScrollableContext: function verticallyScrollableContext() {
  14055. var e = R.get(0) !== t && R.css("overflow-y");return "auto" == e || "scroll" == e;
  14056. }, horizontallyScrollableContext: function horizontallyScrollableContext() {
  14057. var e = R.get(0) !== t && R.css("overflow-x");return "auto" == e || "scroll" == e;
  14058. } }, refresh: function refresh() {
  14059. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  14060. }, resetFixed: function resetFixed() {
  14061. v.remove.fixed(), v.remove.occurred();
  14062. }, reset: function reset() {
  14063. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  14064. }, checkVisibility: function checkVisibility(e) {
  14065. 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()));
  14066. }, passed: function passed(t, n) {
  14067. var o = v.get.elementCalculations();if (t && n) b.onPassed[t] = n;else {
  14068. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;o.passing && e.each(b.onPassed, function (e, t) {
  14069. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  14070. });
  14071. }
  14072. }, onScreen: function onScreen(e) {
  14073. var t = v.get.elementCalculations(),
  14074. n = e || b.onOnScreen,
  14075. 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;
  14076. }, offScreen: function offScreen(e) {
  14077. var t = v.get.elementCalculations(),
  14078. n = e || b.onOffScreen,
  14079. 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;
  14080. }, passing: function passing(e) {
  14081. var t = v.get.elementCalculations(),
  14082. n = e || b.onPassing,
  14083. 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;
  14084. }, topVisible: function topVisible(e) {
  14085. var t = v.get.elementCalculations(),
  14086. n = e || b.onTopVisible,
  14087. 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;
  14088. }, bottomVisible: function bottomVisible(e) {
  14089. var t = v.get.elementCalculations(),
  14090. n = e || b.onBottomVisible,
  14091. 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;
  14092. }, topPassed: function topPassed(e) {
  14093. var t = v.get.elementCalculations(),
  14094. n = e || b.onTopPassed,
  14095. 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;
  14096. }, bottomPassed: function bottomPassed(e) {
  14097. var t = v.get.elementCalculations(),
  14098. n = e || b.onBottomPassed,
  14099. 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;
  14100. }, passingReverse: function passingReverse(e) {
  14101. var t = v.get.elementCalculations(),
  14102. n = e || b.onPassingReverse,
  14103. 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;
  14104. }, topVisibleReverse: function topVisibleReverse(e) {
  14105. var t = v.get.elementCalculations(),
  14106. n = e || b.onTopVisibleReverse,
  14107. 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;
  14108. }, bottomVisibleReverse: function bottomVisibleReverse(e) {
  14109. var t = v.get.elementCalculations(),
  14110. n = e || b.onBottomVisibleReverse,
  14111. 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;
  14112. }, topPassedReverse: function topPassedReverse(e) {
  14113. var t = v.get.elementCalculations(),
  14114. n = e || b.onTopPassedReverse,
  14115. 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;
  14116. }, bottomPassedReverse: function bottomPassedReverse(e) {
  14117. var t = v.get.elementCalculations(),
  14118. n = e || b.onBottomPassedReverse,
  14119. 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;
  14120. }, execute: function execute(e, t) {
  14121. var n = v.get.elementCalculations(),
  14122. 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);
  14123. }, remove: { fixed: function fixed() {
  14124. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({ position: "", top: "", left: "", zIndex: "" }), b.onUnfixed.call(F);
  14125. }, placeholder: function placeholder() {
  14126. v.debug("Removing placeholder content"), r && r.remove();
  14127. }, occurred: function occurred(e) {
  14128. if (e) {
  14129. 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);
  14130. } else v.cache.occurred = {};
  14131. } }, save: { calculations: function calculations() {
  14132. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  14133. }, occurred: function occurred(e) {
  14134. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  14135. }, scroll: function scroll(e) {
  14136. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  14137. }, direction: function direction() {
  14138. var e,
  14139. t = v.get.scroll(),
  14140. n = v.get.lastScroll();return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  14141. }, elementPosition: function elementPosition() {
  14142. var e = v.cache.element,
  14143. 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;
  14144. }, elementCalculations: function elementCalculations() {
  14145. var e = v.get.screenCalculations(),
  14146. 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;
  14147. }, screenCalculations: function screenCalculations() {
  14148. 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;
  14149. }, screenSize: function screenSize() {
  14150. v.verbose("Saving window position"), v.cache.screen = { height: R.height() };
  14151. }, position: function position() {
  14152. v.save.screenSize(), v.save.elementPosition();
  14153. } }, get: { pixelsPassed: function pixelsPassed(e) {
  14154. var t = v.get.elementCalculations();return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  14155. }, occurred: function occurred(e) {
  14156. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  14157. }, direction: function direction() {
  14158. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  14159. }, elementPosition: function elementPosition() {
  14160. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  14161. }, elementCalculations: function elementCalculations() {
  14162. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  14163. }, screenCalculations: function screenCalculations() {
  14164. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  14165. }, screenSize: function screenSize() {
  14166. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  14167. }, scroll: function scroll() {
  14168. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  14169. }, lastScroll: function lastScroll() {
  14170. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  14171. } }, setting: function setting(t, n) {
  14172. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  14173. if (n === i) return b[t];b[t] = n;
  14174. }
  14175. }, internal: function internal(t, n) {
  14176. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  14177. if (n === i) return v[t];v[t] = n;
  14178. }
  14179. }, debug: function debug() {
  14180. !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)));
  14181. }, verbose: function verbose() {
  14182. !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)));
  14183. }, error: function error() {
  14184. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  14185. }, performance: { log: function log(e) {
  14186. 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);
  14187. }, display: function display() {
  14188. var t = b.name + ":",
  14189. n = 0;l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  14190. n += t["Execution Time"];
  14191. }), 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) {
  14192. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14193. }), console.groupEnd()), c = [];
  14194. } }, invoke: function invoke(t, n, o) {
  14195. var r,
  14196. s,
  14197. l,
  14198. 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) {
  14199. 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 {
  14200. 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];
  14201. }
  14202. })), 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;
  14203. } }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  14204. }), a !== i ? a : this;
  14205. }, 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" } };
  14206. }(jQuery, window, document);
  14207. /***/ }),
  14208. /***/ "./js/services/i18nHelper.js":
  14209. /*!***********************************!*\
  14210. !*** ./js/services/i18nHelper.js ***!
  14211. \***********************************/
  14212. /*! no static exports found */
  14213. /***/ (function(module, exports, __webpack_require__) {
  14214. "use strict";
  14215. Object.defineProperty(exports, "__esModule", {
  14216. value: true
  14217. });
  14218. exports.i18nHelper = undefined;
  14219. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14220. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14221. var _localizedStringsService = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  14222. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14223. var StringTypes = _lineI18n2.default.StringTypes;
  14224. var i18nHelper = exports.i18nHelper = Object.freeze({
  14225. i18n: function i18n(identifier) {
  14226. var opts = identifier.split(':');
  14227. var type = opts[0].toLowerCase();
  14228. var id = opts[1];
  14229. if (StringTypes.ERROR === type) {
  14230. return _localizedStringsService.LocalizedStrings.getError(id);
  14231. } else if (StringTypes.MESSAGE === type) {
  14232. return _localizedStringsService.LocalizedStrings.getMessage(id);
  14233. } else if (StringTypes.UI === type) {
  14234. return _localizedStringsService.LocalizedStrings.getUI(id);
  14235. } else {
  14236. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  14237. return _localizedStringsService.LocalizedStrings.getString(identifier, type);
  14238. }
  14239. }
  14240. });
  14241. /***/ }),
  14242. /***/ "./js/services/languageService.js":
  14243. /*!****************************************!*\
  14244. !*** ./js/services/languageService.js ***!
  14245. \****************************************/
  14246. /*! no static exports found */
  14247. /***/ (function(module, exports, __webpack_require__) {
  14248. "use strict";
  14249. Object.defineProperty(exports, "__esModule", {
  14250. value: true
  14251. });
  14252. exports.LanguageService = undefined;
  14253. 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; }; }();
  14254. var _grammar = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  14255. var _grammar2 = _interopRequireDefault(_grammar);
  14256. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14257. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14258. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14260. 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; }
  14261. 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; }
  14262. // This is for LanguageService with localStorage
  14263. // const DEFAULT_LANG = "pt";
  14264. var LanguageServiceExtended = function (_line_i18n$LanguageSe) {
  14265. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  14266. function LanguageServiceExtended() {
  14267. _classCallCheck(this, LanguageServiceExtended);
  14268. return _possibleConstructorReturn(this, (LanguageServiceExtended.__proto__ || Object.getPrototypeOf(LanguageServiceExtended)).call(this, iLMparameters.lang));
  14269. }
  14270. _createClass(LanguageServiceExtended, [{
  14271. key: 'getCurrentLexer',
  14272. value: function getCurrentLexer() {
  14273. var langInfo = _grammar2.default[this.getLang()];
  14274. if (langInfo === null || langInfo === undefined) {
  14275. return _grammar2.default[this.getDefaultLang()].lexer;
  14276. } else {
  14277. return langInfo.lexer;
  14278. }
  14279. }
  14280. }, {
  14281. key: 'getCurrentLangFuncs',
  14282. value: function getCurrentLangFuncs() {
  14283. var langInfo = _grammar2.default[this.getLang()];
  14284. if (langInfo === null || langInfo === undefined) {
  14285. return _grammar2.default[this.getDefaultLang()].langFuncs;
  14286. } else {
  14287. return langInfo.langFuncs;
  14288. }
  14289. }
  14290. }, {
  14291. key: 'getCurrentLangLibs',
  14292. value: function getCurrentLangLibs() {
  14293. var langInfo = _grammar2.default[this.getLang()];
  14294. if (langInfo === null || langInfo === undefined) {
  14295. return _grammar2.default[this.getDefaultLang()].langLibs;
  14296. }
  14297. return langInfo.langLibs;
  14298. }
  14299. }]);
  14300. return LanguageServiceExtended;
  14301. }(_lineI18n2.default.LanguageServiceNoLS);
  14302. var LanguageService = exports.LanguageService = new LanguageServiceExtended();
  14303. /***/ }),
  14304. /***/ "./js/services/localizedStringsService.js":
  14305. /*!************************************************!*\
  14306. !*** ./js/services/localizedStringsService.js ***!
  14307. \************************************************/
  14308. /*! no static exports found */
  14309. /***/ (function(module, exports, __webpack_require__) {
  14310. "use strict";
  14311. Object.defineProperty(exports, "__esModule", {
  14312. value: true
  14313. });
  14314. exports.LocalizedStrings = undefined;
  14315. var _languageService = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  14316. var _lineI18n = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  14317. var _lineI18n2 = _interopRequireDefault(_lineI18n);
  14318. var _i18n = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  14319. var _i18n2 = _interopRequireDefault(_i18n);
  14320. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14321. var LocalizedStrings = exports.LocalizedStrings = Object.freeze(new _lineI18n2.default.LocalizedStrings(_languageService.LanguageService, _i18n2.default, true));
  14322. /***/ }),
  14323. /***/ "./js/typeSystem/baseTypes.js":
  14324. /*!************************************!*\
  14325. !*** ./js/typeSystem/baseTypes.js ***!
  14326. \************************************/
  14327. /*! no static exports found */
  14328. /***/ (function(module, exports, __webpack_require__) {
  14329. "use strict";
  14330. Object.defineProperty(exports, "__esModule", {
  14331. value: true
  14332. });
  14333. 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; }; }();
  14334. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14335. var BaseType = function () {
  14336. function BaseType(name, ord) {
  14337. _classCallCheck(this, BaseType);
  14338. this.name = name;
  14339. this.ord = ord;
  14340. }
  14341. _createClass(BaseType, [{
  14342. key: "isCompatible",
  14343. value: function isCompatible(another) {
  14344. if (another instanceof BaseType) {
  14345. return this.name === another.name && this.ord === another.ord;
  14346. }
  14347. return false;
  14348. }
  14349. }, {
  14350. key: "value",
  14351. get: function get() {
  14352. return this.name;
  14353. }
  14354. }]);
  14355. return BaseType;
  14356. }();
  14357. // Base types names are the same as i18n ui type keys
  14358. var BaseTypes = exports.BaseTypes = Object.freeze({
  14359. INTEGER: new BaseType("integer", 0),
  14360. REAL: new BaseType("real", 1),
  14361. STRING: new BaseType("text", 2),
  14362. BOOLEAN: new BaseType("boolean", 3),
  14363. VOID: new BaseType("void", 4),
  14364. UNDEFINED: new BaseType("undefined", 5)
  14365. });
  14366. /***/ }),
  14367. /***/ "./js/typeSystem/compoundType.js":
  14368. /*!***************************************!*\
  14369. !*** ./js/typeSystem/compoundType.js ***!
  14370. \***************************************/
  14371. /*! no static exports found */
  14372. /***/ (function(module, exports, __webpack_require__) {
  14373. "use strict";
  14374. Object.defineProperty(exports, "__esModule", {
  14375. value: true
  14376. });
  14377. exports.CompoundType = undefined;
  14378. 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; }; }();
  14379. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14380. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14381. 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; }
  14382. 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; }
  14383. var CompoundType = exports.CompoundType = function (_Type) {
  14384. _inherits(CompoundType, _Type);
  14385. function CompoundType(type, dimensions) {
  14386. _classCallCheck(this, CompoundType);
  14387. var _this = _possibleConstructorReturn(this, (CompoundType.__proto__ || Object.getPrototypeOf(CompoundType)).call(this, null));
  14388. _this.innerType = type;
  14389. _this.dimensions = dimensions;
  14390. return _this;
  14391. }
  14392. _createClass(CompoundType, [{
  14393. key: "isCompatible",
  14394. value: function isCompatible(another) {
  14395. if (another instanceof CompoundType) {
  14396. if (this.dimensions !== another.dimensions) {
  14397. return false;
  14398. }
  14399. return this.innerType.isCompatible(another.innerType);
  14400. }
  14401. return false;
  14402. }
  14403. }, {
  14404. key: "stringInfo",
  14405. value: function stringInfo() {
  14406. var _this2 = this;
  14407. var list = this.innerType.stringInfo();
  14408. list.forEach(function (v) {
  14409. v.dim = _this2.dimensions;
  14410. });
  14411. return list;
  14412. }
  14413. }, {
  14414. key: "canAccept",
  14415. value: function canAccept(another) {
  14416. if (another instanceof CompoundType) {
  14417. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  14418. } else {
  14419. return this.innerType.isCompatible(another);
  14420. }
  14421. }
  14422. }]);
  14423. return CompoundType;
  14424. }(_type.Type);
  14425. /***/ }),
  14426. /***/ "./js/typeSystem/multiType.js":
  14427. /*!************************************!*\
  14428. !*** ./js/typeSystem/multiType.js ***!
  14429. \************************************/
  14430. /*! no static exports found */
  14431. /***/ (function(module, exports, __webpack_require__) {
  14432. "use strict";
  14433. Object.defineProperty(exports, "__esModule", {
  14434. value: true
  14435. });
  14436. exports.MultiType = undefined;
  14437. 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; }; }();
  14438. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14439. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14440. 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; }
  14441. 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; }
  14442. var MultiType = exports.MultiType = function (_Type) {
  14443. _inherits(MultiType, _Type);
  14444. function MultiType(types) {
  14445. _classCallCheck(this, MultiType);
  14446. var _this = _possibleConstructorReturn(this, (MultiType.__proto__ || Object.getPrototypeOf(MultiType)).call(this, null));
  14447. _this.types = types;
  14448. return _this;
  14449. }
  14450. _createClass(MultiType, [{
  14451. key: "stringInfo",
  14452. value: function stringInfo() {
  14453. var list = [];
  14454. for (var i = 0; i < this.types.length; i++) {
  14455. var t = this.types[i];
  14456. list = list.concat(t.stringInfo());
  14457. }
  14458. return list;
  14459. }
  14460. }, {
  14461. key: "isCompatible",
  14462. value: function isCompatible(another) {
  14463. if (another instanceof _type.Type) {
  14464. for (var i = 0; i < this.types.length; i++) {
  14465. var t = this.types[i];
  14466. if (t.isCompatible(another)) {
  14467. return true;
  14468. }
  14469. }
  14470. }
  14471. return false;
  14472. }
  14473. }, {
  14474. key: "value",
  14475. get: function get() {
  14476. return null;
  14477. }
  14478. }, {
  14479. key: "ord",
  14480. get: function get() {
  14481. return null;
  14482. }
  14483. }]);
  14484. return MultiType;
  14485. }(_type.Type);
  14486. /***/ }),
  14487. /***/ "./js/typeSystem/parsers.js":
  14488. /*!**********************************!*\
  14489. !*** ./js/typeSystem/parsers.js ***!
  14490. \**********************************/
  14491. /*! no static exports found */
  14492. /***/ (function(module, exports, __webpack_require__) {
  14493. "use strict";
  14494. Object.defineProperty(exports, "__esModule", {
  14495. value: true
  14496. });
  14497. exports.toInt = toInt;
  14498. exports.toString = toString;
  14499. exports.toReal = toReal;
  14500. exports.toBool = toBool;
  14501. exports.convertToString = convertToString;
  14502. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14503. var _types = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  14504. var _decimal = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  14505. var _decimal2 = _interopRequireDefault(_decimal);
  14506. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14507. function toInt(str) {
  14508. return new _decimal2.default(str);
  14509. }
  14510. function toString(str) {
  14511. var value = str.replace(/^"/, '');
  14512. value = value.replace(/"$/, '');
  14513. value = value.replace(/\\b/g, "\b");
  14514. value = value.replace(/\\t/g, "\t");
  14515. value = value.replace(/\\n/g, "\n");
  14516. value = value.replace(/\\r/g, "\r");
  14517. value = value.replace(/\\\"/g, "\"");
  14518. value = value.replace(/\\\'/g, "\'");
  14519. value = value.replace(/\\\\/g, "\\");
  14520. return value;
  14521. }
  14522. function toReal(value) {
  14523. return new _decimal2.default(value);
  14524. }
  14525. function toBool(str) {
  14526. var val = "'" + str + "'";
  14527. var lexer = _languageService.LanguageService.getCurrentLexer();
  14528. var instance = new lexer(null);
  14529. if (instance.literalNames[lexer.RK_TRUE] === val) {
  14530. return true;
  14531. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  14532. return false;
  14533. } else {
  14534. // TODO: better error message
  14535. throw new Error(str + "not a valid boolean");
  14536. }
  14537. }
  14538. function convertBoolToString(bool) {
  14539. var lexer = _languageService.LanguageService.getCurrentLexer();
  14540. var instance = new lexer(null);
  14541. if (bool) {
  14542. return instance.literalNames[lexer.RK_TRUE];
  14543. } else {
  14544. return instance.literalNames[lexer.RK_FALSE];
  14545. }
  14546. }
  14547. function convertToString(stoObj, type) {
  14548. switch (type.ord) {
  14549. case _types.Types.INTEGER.ord:
  14550. return stoObj.toString();
  14551. case _types.Types.REAL.ord:
  14552. {
  14553. if (stoObj.dp() <= 0) {
  14554. return stoObj.toFixed(1);
  14555. } else {
  14556. return stoObj.toNumber();
  14557. }
  14558. }
  14559. case _types.Types.BOOLEAN.ord:
  14560. return convertBoolToString(stoObj);
  14561. default:
  14562. return stoObj;
  14563. }
  14564. }
  14565. /***/ }),
  14566. /***/ "./js/typeSystem/type.js":
  14567. /*!*******************************!*\
  14568. !*** ./js/typeSystem/type.js ***!
  14569. \*******************************/
  14570. /*! no static exports found */
  14571. /***/ (function(module, exports, __webpack_require__) {
  14572. "use strict";
  14573. Object.defineProperty(exports, "__esModule", {
  14574. value: true
  14575. });
  14576. 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; }; }();
  14577. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14578. var Type = exports.Type = function () {
  14579. function Type(baseType) {
  14580. _classCallCheck(this, Type);
  14581. this.baseType = baseType;
  14582. }
  14583. _createClass(Type, [{
  14584. key: "stringInfo",
  14585. value: function stringInfo() {
  14586. return [{ type: this.baseType.name, dim: 0 }];
  14587. }
  14588. }, {
  14589. key: "isCompatible",
  14590. value: function isCompatible(another) {
  14591. if (another instanceof Type) {
  14592. return this.baseType.isCompatible(another.baseType);
  14593. }
  14594. return false;
  14595. }
  14596. }, {
  14597. key: "value",
  14598. get: function get() {
  14599. return this.baseType.value;
  14600. }
  14601. }, {
  14602. key: "ord",
  14603. get: function get() {
  14604. return this.baseType.ord;
  14605. }
  14606. }]);
  14607. return Type;
  14608. }();
  14609. /***/ }),
  14610. /***/ "./js/typeSystem/types.js":
  14611. /*!********************************!*\
  14612. !*** ./js/typeSystem/types.js ***!
  14613. \********************************/
  14614. /*! no static exports found */
  14615. /***/ (function(module, exports, __webpack_require__) {
  14616. "use strict";
  14617. Object.defineProperty(exports, "__esModule", {
  14618. value: true
  14619. });
  14620. exports.Types = undefined;
  14621. var _baseTypes = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  14622. var _type = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  14623. var _multiType = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  14624. var INTEGER = new _type.Type(_baseTypes.BaseTypes.INTEGER);
  14625. var REAL = new _type.Type(_baseTypes.BaseTypes.REAL);
  14626. var STRING = new _type.Type(_baseTypes.BaseTypes.STRING);
  14627. var BOOLEAN = new _type.Type(_baseTypes.BaseTypes.BOOLEAN);
  14628. var VOID = new _type.Type(_baseTypes.BaseTypes.VOID);
  14629. var UNDEFINED = new _type.Type(_baseTypes.BaseTypes.UNDEFINED);
  14630. var ALL = new _multiType.MultiType([INTEGER, REAL, STRING, BOOLEAN]);
  14631. var Types = exports.Types = Object.freeze({
  14632. INTEGER: INTEGER,
  14633. REAL: REAL,
  14634. STRING: STRING,
  14635. BOOLEAN: BOOLEAN,
  14636. VOID: VOID,
  14637. UNDEFINED: UNDEFINED,
  14638. ALL: ALL
  14639. });
  14640. /***/ }),
  14641. /***/ "./js/util/config.js":
  14642. /*!***************************!*\
  14643. !*** ./js/util/config.js ***!
  14644. \***************************/
  14645. /*! no static exports found */
  14646. /***/ (function(module, exports, __webpack_require__) {
  14647. "use strict";
  14648. Object.defineProperty(exports, "__esModule", {
  14649. value: true
  14650. });
  14651. 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; }; }();
  14652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14653. var ConfigObject = function () {
  14654. function ConfigObject() {
  14655. _classCallCheck(this, ConfigObject);
  14656. this.loopTimeout = 5000;
  14657. this.decimalPlaces = 5;
  14658. this.intConvertRoundMode = 2;
  14659. }
  14660. _createClass(ConfigObject, [{
  14661. key: "setConfig",
  14662. value: function setConfig(opts) {
  14663. for (var key in opts) {
  14664. if (this.hasOwnProperty(key)) {
  14665. this[key] = opts[key];
  14666. }
  14667. }
  14668. }
  14669. }]);
  14670. return ConfigObject;
  14671. }();
  14672. var config = new ConfigObject();
  14673. var Config = exports.Config = config;
  14674. /***/ }),
  14675. /***/ "./js/util/inputTest.js":
  14676. /*!******************************!*\
  14677. !*** ./js/util/inputTest.js ***!
  14678. \******************************/
  14679. /*! no static exports found */
  14680. /***/ (function(module, exports, __webpack_require__) {
  14681. "use strict";
  14682. Object.defineProperty(exports, "__esModule", {
  14683. value: true
  14684. });
  14685. exports.InputTest = undefined;
  14686. 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; }; }();
  14687. var _input = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  14688. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14689. 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; }
  14690. 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; }
  14691. var InputTest = exports.InputTest = function (_Input) {
  14692. _inherits(InputTest, _Input);
  14693. function InputTest(inputList) {
  14694. _classCallCheck(this, InputTest);
  14695. var _this = _possibleConstructorReturn(this, (InputTest.__proto__ || Object.getPrototypeOf(InputTest)).call(this));
  14696. _this.index = 0;
  14697. _this.inputList = inputList;
  14698. return _this;
  14699. }
  14700. _createClass(InputTest, [{
  14701. key: 'requestInput',
  14702. value: function requestInput(callback) {
  14703. if (this.index < this.inputList.length) {
  14704. callback(this.inputList[this.index]);
  14705. this.index++;
  14706. } else {
  14707. throw new Error('The amount of requests exceeded the amount of available inputs');
  14708. }
  14709. }
  14710. }]);
  14711. return InputTest;
  14712. }(_input.Input);
  14713. /***/ }),
  14714. /***/ "./js/util/outputTest.js":
  14715. /*!*******************************!*\
  14716. !*** ./js/util/outputTest.js ***!
  14717. \*******************************/
  14718. /*! no static exports found */
  14719. /***/ (function(module, exports, __webpack_require__) {
  14720. "use strict";
  14721. Object.defineProperty(exports, "__esModule", {
  14722. value: true
  14723. });
  14724. exports.OutputTest = undefined;
  14725. 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; }; }();
  14726. var _output = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  14727. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  14728. 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; }
  14729. 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; }
  14730. var OutputTest = exports.OutputTest = function (_Output) {
  14731. _inherits(OutputTest, _Output);
  14732. function OutputTest() {
  14733. _classCallCheck(this, OutputTest);
  14734. var _this = _possibleConstructorReturn(this, (OutputTest.__proto__ || Object.getPrototypeOf(OutputTest)).call(this));
  14735. _this.list = [];
  14736. return _this;
  14737. }
  14738. _createClass(OutputTest, [{
  14739. key: 'sendOutput',
  14740. value: function sendOutput(text) {
  14741. this.list.push(text);
  14742. }
  14743. }]);
  14744. return OutputTest;
  14745. }(_output.Output);
  14746. /***/ }),
  14747. /***/ "./js/visualUI/algorithm.js":
  14748. /*!**********************************!*\
  14749. !*** ./js/visualUI/algorithm.js ***!
  14750. \**********************************/
  14751. /*! no static exports found */
  14752. /***/ (function(module, exports, __webpack_require__) {
  14753. "use strict";
  14754. Object.defineProperty(exports, "__esModule", {
  14755. value: true
  14756. });
  14757. exports.renderAlgorithm = renderAlgorithm;
  14758. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14759. var _jquery2 = _interopRequireDefault(_jquery);
  14760. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14761. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14762. var Models = _interopRequireWildcard(_ivprog_elements);
  14763. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14764. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14765. var GlobalsManagement = _interopRequireWildcard(_globals);
  14766. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14767. var VariablesManagement = _interopRequireWildcard(_variables);
  14768. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14769. var CommandsManagement = _interopRequireWildcard(_commands);
  14770. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  14771. var CodeManagement = _interopRequireWildcard(_code_generator);
  14772. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  14773. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  14774. var _functions = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  14775. var FunctionsManagement = _interopRequireWildcard(_functions);
  14776. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  14777. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  14778. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  14779. var _languageService = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  14780. 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; } }
  14781. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14782. var block_render = false;
  14783. function renderAlgorithm() {
  14784. if (block_render) {
  14785. return;
  14786. }
  14787. block_render = true;
  14788. (0, _jquery2.default)('.all_functions').children().off();
  14789. (0, _jquery2.default)('.all_functions').empty();
  14790. (0, _jquery2.default)('.list_globals').children().off();
  14791. (0, _jquery2.default)('.list_globals').empty();
  14792. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14793. FunctionsManagement.renderFunction(window.program_obj.functions[i]);
  14794. }
  14795. for (var i = 0; i < window.program_obj.globals.length; i++) {
  14796. GlobalsManagement.renderGlobal(window.program_obj.globals[i]);
  14797. }
  14798. setTimeout(function () {
  14799. block_render = false;
  14800. }, 500);
  14801. }
  14802. /***/ }),
  14803. /***/ "./js/visualUI/code_generator.js":
  14804. /*!***************************************!*\
  14805. !*** ./js/visualUI/code_generator.js ***!
  14806. \***************************************/
  14807. /*! no static exports found */
  14808. /***/ (function(module, exports, __webpack_require__) {
  14809. "use strict";
  14810. Object.defineProperty(exports, "__esModule", {
  14811. value: true
  14812. });
  14813. exports.generate = generate;
  14814. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  14815. var _jquery2 = _interopRequireDefault(_jquery);
  14816. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  14817. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  14818. var Models = _interopRequireWildcard(_ivprog_elements);
  14819. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  14820. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  14821. var GlobalsManagement = _interopRequireWildcard(_globals);
  14822. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  14823. var VariablesManagement = _interopRequireWildcard(_variables);
  14824. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  14825. var CommandsManagement = _interopRequireWildcard(_commands);
  14826. 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; } }
  14827. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14828. function generate() {
  14829. (0, _jquery2.default)('.ivprog_visual_panel').find('.error_icon').remove();
  14830. var code = _localizedStringsService.LocalizedStrings.getUI('program') + ' { ';
  14831. code += globalsCode();
  14832. code += '\n';
  14833. var has_error = false;
  14834. for (var i = 0; i < window.program_obj.functions.length; i++) {
  14835. var n_code = functionsCode(window.program_obj.functions[i]);
  14836. if (n_code == null) {
  14837. has_error = true;
  14838. }
  14839. code += n_code;
  14840. code += '\n';
  14841. }
  14842. code += '\n}';
  14843. if (has_error) {
  14844. return null;
  14845. } else {
  14846. return code;
  14847. }
  14848. }
  14849. function functionsCode(function_obj) {
  14850. var ret = '\n\t' + _localizedStringsService.LocalizedStrings.getUI('function') + ' ';
  14851. var has_error = false;
  14852. switch (function_obj.return_type) {
  14853. case _types.Types.INTEGER:
  14854. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  14855. break;
  14856. case _types.Types.REAL:
  14857. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  14858. break;
  14859. case _types.Types.TEXT:
  14860. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  14861. break;
  14862. case _types.Types.BOOLEAN:
  14863. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  14864. break;
  14865. case _types.Types.VOID:
  14866. ret += _localizedStringsService.LocalizedStrings.getUI('void');
  14867. break;
  14868. }
  14869. ret += ' ';
  14870. if (function_obj.return_dimensions == 1) {
  14871. ret += '[] ';
  14872. } else if (function_obj.return_dimensions == 2) {
  14873. ret += '[][] ';
  14874. }
  14875. ret += function_obj.name + ' ( ';
  14876. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  14877. ret += parametersCode(function_obj.parameters_list[j]);
  14878. if (j + 1 < function_obj.parameters_list.length) {
  14879. ret += ',';
  14880. }
  14881. }
  14882. ret += ' ) {';
  14883. for (var j = 0; j < function_obj.variables_list.length; j++) {
  14884. ret += variablesCode(function_obj.variables_list[j]);
  14885. }
  14886. for (var j = 0; j < function_obj.commands.length; j++) {
  14887. //try {
  14888. ret += commandsCode(function_obj.commands[j]);
  14889. /*} catch (err) {
  14890. has_error = true;
  14891. console.error(err.message);
  14892. var todos = $('body').find('.command_container');
  14893. for (var i = 0; i < todos.length; i++) {
  14894. if ($(todos[i]).data('command') == function_obj.commands[j]) {
  14895. $( todos[i] ).prepend( ' <i class="ui icon red exclamation triangle error_icon"></i> ' );
  14896. break;
  14897. }
  14898. }
  14899. }*/
  14900. }
  14901. ret += '\n\t}';
  14902. if (has_error) {
  14903. return null;
  14904. } else {
  14905. return ret;
  14906. }
  14907. }
  14908. function commandsCode(command_obj) {
  14909. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  14910. switch (command_obj.type) {
  14911. case Models.COMMAND_TYPES.break:
  14912. return breaksCode(command_obj, indentation);
  14913. case Models.COMMAND_TYPES.comment:
  14914. return commentsCode(command_obj, indentation);
  14915. case Models.COMMAND_TYPES.reader:
  14916. return readersCode(command_obj, indentation);
  14917. case Models.COMMAND_TYPES.writer:
  14918. return writersCode(command_obj, indentation);
  14919. case Models.COMMAND_TYPES.functioncall:
  14920. return functioncallsCode(command_obj, indentation);
  14921. case Models.COMMAND_TYPES.attribution:
  14922. return attributionsCode(command_obj, indentation);
  14923. case Models.COMMAND_TYPES.whiletrue:
  14924. return whiletruesCode(command_obj, indentation);
  14925. case Models.COMMAND_TYPES.dowhiletrue:
  14926. return doWhilesCode(command_obj, indentation);
  14927. case Models.COMMAND_TYPES.iftrue:
  14928. return iftruesCode(command_obj, indentation);
  14929. case Models.COMMAND_TYPES.repeatNtimes:
  14930. return repeatNtimesCode(command_obj, indentation);
  14931. case Models.COMMAND_TYPES.switch:
  14932. return switchsCode(command_obj, indentation);
  14933. case Models.COMMAND_TYPES.return:
  14934. return returnsCode(command_obj, indentation);
  14935. }
  14936. }
  14937. function returnsCode(command_obj, indentation) {
  14938. var ret = '\n';
  14939. for (var i = 0; i < indentation; i++) {
  14940. ret += '\t';
  14941. }
  14942. ret += _localizedStringsService.LocalizedStrings.getUI('text_return');
  14943. if (command_obj.variable_value_menu) {
  14944. try {
  14945. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu);
  14946. } catch (err) {}
  14947. }
  14948. return ret;
  14949. }
  14950. function breaksCode(command_obj, indentation) {
  14951. var ret = '\n';
  14952. for (var i = 0; i < indentation; i++) {
  14953. ret += '\t';
  14954. }
  14955. ret += _localizedStringsService.LocalizedStrings.getUI('text_break');
  14956. return ret;
  14957. }
  14958. function switchsCode(command_obj, indentation) {
  14959. var ret = '\n';
  14960. for (var i = 0; i < indentation; i++) {
  14961. ret += '\t';
  14962. }
  14963. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_switch') + ' ( ';
  14964. ret += variableValueMenuCode(command_obj.variable);
  14965. ret += ' ) { ';
  14966. if (command_obj.cases) {
  14967. for (var i = 0; i < command_obj.cases.length; i++) {
  14968. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  14969. }
  14970. }
  14971. ret += '\n';
  14972. for (var i = 0; i < indentation; i++) {
  14973. ret += '\t';
  14974. }
  14975. ret += '} ';
  14976. return ret;
  14977. }
  14978. function switchcasesCode(switchcase, indentation) {
  14979. var ret = '\n';
  14980. for (var i = 0; i < indentation; i++) {
  14981. ret += '\t';
  14982. }
  14983. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_case') + ' ';
  14984. ret += variableValueMenuCode(switchcase.variable_value_menu);
  14985. ret += ' :';
  14986. if (switchcase.commands_block) {
  14987. for (var i = 0; i < switchcase.commands_block.length; i++) {
  14988. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  14989. }
  14990. }
  14991. return ret;
  14992. }
  14993. function repeatNtimesCode(command_obj, indentation) {
  14994. var ret = '\n';
  14995. for (var i = 0; i < indentation; i++) {
  14996. ret += '\t';
  14997. }
  14998. ret += _localizedStringsService.LocalizedStrings.getUI('text_for') + ' ( ';
  14999. if (command_obj.var_attribution) {
  15000. ret += variableValueMenuCode(command_obj.var_attribution);
  15001. ret += ' = ';
  15002. ret += variableValueMenuCode(command_obj.expression1);
  15003. }
  15004. ret += ' ; ';
  15005. if (command_obj.expression2) {
  15006. switch (command_obj.expression2.expression.type) {
  15007. case Models.EXPRESSION_TYPES.exp_logic:
  15008. ret += logicExpressionCode(command_obj.expression2.expression);
  15009. break;
  15010. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15011. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  15012. break;
  15013. }
  15014. }
  15015. ret += ' ; ';
  15016. if (command_obj.var_incrementation) {
  15017. ret += variableValueMenuCode(command_obj.var_incrementation);
  15018. ret += ' = ';
  15019. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  15020. switch (command_obj.expression3.itens[1]) {
  15021. case Models.ARITHMETIC_TYPES.plus:
  15022. ret += ' + ';
  15023. break;
  15024. case Models.ARITHMETIC_TYPES.minus:
  15025. ret += ' - ';
  15026. break;
  15027. case Models.ARITHMETIC_TYPES.multiplication:
  15028. ret += ' * ';
  15029. break;
  15030. case Models.ARITHMETIC_TYPES.division:
  15031. ret += ' / ';
  15032. break;
  15033. case Models.ARITHMETIC_TYPES.module:
  15034. ret += ' % ';
  15035. break;
  15036. }
  15037. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  15038. }
  15039. ret += ' ) { ';
  15040. if (command_obj.commands_block) {
  15041. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15042. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15043. }
  15044. }
  15045. ret += '\n';
  15046. for (var i = 0; i < indentation; i++) {
  15047. ret += '\t';
  15048. }
  15049. ret += '}';
  15050. return ret;
  15051. }
  15052. function iftruesCode(command_obj, indentation) {
  15053. var ret = '\n';
  15054. for (var i = 0; i < indentation; i++) {
  15055. ret += '\t';
  15056. }
  15057. ret += _localizedStringsService.LocalizedStrings.getUI('text_if');
  15058. switch (command_obj.expression.expression.type) {
  15059. case Models.EXPRESSION_TYPES.exp_logic:
  15060. ret += logicExpressionCode(command_obj.expression.expression);
  15061. break;
  15062. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15063. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15064. break;
  15065. }
  15066. ret += ' { ';
  15067. if (command_obj.commands_block) {
  15068. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15069. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15070. }
  15071. }
  15072. ret += '\n';
  15073. for (var i = 0; i < indentation; i++) {
  15074. ret += '\t';
  15075. }
  15076. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' {';
  15077. if (command_obj.commands_else) {
  15078. for (var i = 0; i < command_obj.commands_else.length; i++) {
  15079. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  15080. }
  15081. }
  15082. ret += '\n';
  15083. for (var i = 0; i < indentation; i++) {
  15084. ret += '\t';
  15085. }
  15086. ret += '}';
  15087. return ret;
  15088. }
  15089. function doWhilesCode(command_obj, indentation) {
  15090. var ret = '\n';
  15091. for (var i = 0; i < indentation; i++) {
  15092. ret += '\t';
  15093. }
  15094. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_do') + ' { ';
  15095. if (command_obj.commands_block) {
  15096. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15097. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15098. }
  15099. }
  15100. ret += '\n';
  15101. for (var i = 0; i < indentation; i++) {
  15102. ret += '\t';
  15103. }
  15104. ret += '} ' + _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15105. switch (command_obj.expression.expression.type) {
  15106. case Models.EXPRESSION_TYPES.exp_logic:
  15107. ret += logicExpressionCode(command_obj.expression.expression);
  15108. break;
  15109. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15110. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15111. break;
  15112. }
  15113. return ret;
  15114. }
  15115. function whiletruesCode(command_obj, indentation) {
  15116. var ret = '\n';
  15117. for (var i = 0; i < indentation; i++) {
  15118. ret += '\t';
  15119. }
  15120. ret += _localizedStringsService.LocalizedStrings.getUI('text_code_while');
  15121. switch (command_obj.expression.expression.type) {
  15122. case Models.EXPRESSION_TYPES.exp_logic:
  15123. ret += logicExpressionCode(command_obj.expression.expression);
  15124. break;
  15125. case Models.EXPRESSION_TYPES.exp_arithmetic:
  15126. ret += arithmeticExpressionCode(command_obj.expression.expression);
  15127. break;
  15128. }
  15129. ret += ' { ';
  15130. if (command_obj.commands_block) {
  15131. for (var i = 0; i < command_obj.commands_block.length; i++) {
  15132. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  15133. }
  15134. }
  15135. ret += '\n';
  15136. for (var i = 0; i < indentation; i++) {
  15137. ret += '\t';
  15138. }
  15139. ret += '}';
  15140. return ret;
  15141. }
  15142. function logicExpressionCode(expression) {
  15143. var ret = ' ( ';
  15144. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15145. ret += logicExpressionCode(expression.first_operand);
  15146. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15147. ret += arithmeticExpressionCode(expression.first_operand);
  15148. } else {
  15149. ret += variableValueMenuCode(expression.first_operand);
  15150. }
  15151. if (expression.operator) {
  15152. switch (expression.operator) {
  15153. case Models.LOGIC_COMPARISON.equals_to:
  15154. ret += ' == ';
  15155. break;
  15156. case Models.LOGIC_COMPARISON.not_equals_to:
  15157. ret += ' != ';
  15158. break;
  15159. case Models.LOGIC_COMPARISON.and:
  15160. ret += ' && ';
  15161. break;
  15162. case Models.LOGIC_COMPARISON.or:
  15163. ret += ' || ';
  15164. break;
  15165. }
  15166. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15167. ret += logicExpressionCode(expression.second_operand);
  15168. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15169. ret += arithmeticExpressionCode(expression.second_operand);
  15170. } else {
  15171. ret += variableValueMenuCode(expression.second_operand);
  15172. }
  15173. }
  15174. ret += ' ) ';
  15175. return ret;
  15176. }
  15177. function arithmeticExpressionCode(expression) {
  15178. var ret = ' ( ';
  15179. if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15180. ret += logicExpressionCode(expression.first_operand);
  15181. } else if (expression.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15182. ret += arithmeticExpressionCode(expression.first_operand);
  15183. } else {
  15184. ret += variableValueMenuCode(expression.first_operand);
  15185. }
  15186. switch (expression.operator) {
  15187. case Models.ARITHMETIC_COMPARISON.greater_than:
  15188. ret += ' > ';
  15189. break;
  15190. case Models.ARITHMETIC_COMPARISON.less_than:
  15191. ret += ' < ';
  15192. break;
  15193. case Models.ARITHMETIC_COMPARISON.equals_to:
  15194. ret += ' == ';
  15195. break;
  15196. case Models.ARITHMETIC_COMPARISON.not_equals_to:
  15197. ret += ' != ';
  15198. break;
  15199. case Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to:
  15200. ret += ' >= ';
  15201. break;
  15202. case Models.ARITHMETIC_COMPARISON.less_than_or_equals_to:
  15203. ret += ' <= ';
  15204. break;
  15205. }
  15206. if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  15207. ret += logicExpressionCode(expression.second_operand);
  15208. } else if (expression.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  15209. ret += arithmeticExpressionCode(expression.second_operand);
  15210. } else {
  15211. ret += variableValueMenuCode(expression.second_operand);
  15212. }
  15213. ret += ' ) ';
  15214. return ret;
  15215. }
  15216. function attributionsCode(command_obj, indentation) {
  15217. var ret = '\n';
  15218. for (var i = 0; i < indentation; i++) {
  15219. ret += '\t';
  15220. }
  15221. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  15222. for (var i = 0; i < command_obj.expression.length; i++) {
  15223. ret += elementExpressionCode(command_obj.expression[i]);
  15224. }
  15225. return ret;
  15226. }
  15227. function elementExpressionCode(expression_obj) {
  15228. var ret = '';
  15229. for (var i = 0; i < expression_obj.itens.length; i++) {
  15230. if (expression_obj.itens[i].type) {
  15231. ret += variableValueMenuCode(expression_obj.itens[i]);
  15232. } else if (expression_obj.itens[i].type_exp) {
  15233. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15234. ret += ' ( ';
  15235. }
  15236. ret += elementExpressionCode(expression_obj.itens[i]);
  15237. if (expression_obj.itens[i].type_exp == Models.EXPRESSION_ELEMENTS.par_exp_par) {
  15238. ret += ' ) ';
  15239. }
  15240. } else {
  15241. switch (expression_obj.itens[i]) {
  15242. case Models.ARITHMETIC_TYPES.plus:
  15243. ret += ' + ';
  15244. break;
  15245. case Models.ARITHMETIC_TYPES.minus:
  15246. ret += ' - ';
  15247. break;
  15248. case Models.ARITHMETIC_TYPES.multiplication:
  15249. ret += ' * ';
  15250. break;
  15251. case Models.ARITHMETIC_TYPES.division:
  15252. ret += ' / ';
  15253. break;
  15254. case Models.ARITHMETIC_TYPES.module:
  15255. ret += ' % ';
  15256. break;
  15257. }
  15258. }
  15259. }
  15260. return ret;
  15261. }
  15262. function functioncallsCode(command_obj, indentation) {
  15263. var ret = '\n';
  15264. for (var i = 0; i < indentation; i++) {
  15265. ret += '\t';
  15266. }
  15267. ret += variableValueMenuCode(command_obj.function_called);
  15268. return ret;
  15269. }
  15270. function readersCode(command_obj, indentation) {
  15271. var ret = '\n';
  15272. for (var i = 0; i < indentation; i++) {
  15273. ret += '\t';
  15274. }
  15275. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_read') + ' ( ';
  15276. ret += variableValueMenuCode(command_obj.variable_value_menu);
  15277. ret += ' ) ';
  15278. return ret;
  15279. }
  15280. function variableValueMenuCode(variable_obj) {
  15281. var ret = '';
  15282. if (variable_obj.function_called) {
  15283. if (variable_obj.function_called.name) {
  15284. ret += variable_obj.function_called.name + ' ( ';
  15285. } else {
  15286. ret += _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(variable_obj.function_called.identifier) + ' ( ';
  15287. }
  15288. if (variable_obj.parameters_list) {
  15289. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  15290. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  15291. if (i + 1 < variable_obj.parameters_list.length) {
  15292. ret += ', ';
  15293. }
  15294. }
  15295. }
  15296. ret += ' )';
  15297. } else if (variable_obj.content.type) {
  15298. ret += variable_obj.content.name;
  15299. if (variable_obj.content.dimensions == 1) {
  15300. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15301. }
  15302. if (variable_obj.content.dimensions == 2) {
  15303. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  15304. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  15305. }
  15306. } else {
  15307. if (isNaN(variable_obj.content)) {
  15308. ret += '"' + variable_obj.content + '"';
  15309. } else {
  15310. ret += variable_obj.content;
  15311. }
  15312. }
  15313. return ret;
  15314. }
  15315. function writersCode(command_obj, indentation) {
  15316. var ret = '\n';
  15317. for (var i = 0; i < indentation; i++) {
  15318. ret += '\t';
  15319. }
  15320. ret += _localizedStringsService.LocalizedStrings.getUI('text_command_write') + ' ( ';
  15321. for (var i = 0; i < command_obj.content.length; i++) {
  15322. ret += variableValueMenuCode(command_obj.content[i]);
  15323. if (i + 1 < command_obj.content.length) {
  15324. ret += ' + ';
  15325. }
  15326. }
  15327. ret += ' ) ';
  15328. return ret;
  15329. }
  15330. function commentsCode(command_obj, indentation) {
  15331. var ret = '\n';
  15332. for (var i = 0; i < indentation; i++) {
  15333. ret += '\t';
  15334. }
  15335. ret += '// ';
  15336. ret += command_obj.comment_text.content;
  15337. return ret;
  15338. }
  15339. function parametersCode(parameter_obj) {
  15340. var ret = '';
  15341. switch (parameter_obj.type) {
  15342. case _types.Types.INTEGER:
  15343. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15344. break;
  15345. case _types.Types.REAL:
  15346. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15347. break;
  15348. case _types.Types.TEXT:
  15349. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15350. break;
  15351. case _types.Types.BOOLEAN:
  15352. ret += ' ' + _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15353. break;
  15354. }
  15355. ret += parameter_obj.name + '';
  15356. if (parameter_obj.dimensions == 1) {
  15357. ret += ' []';
  15358. } else if (parameter_obj.dimensions == 2) {
  15359. ret += ' [][]';
  15360. }
  15361. return ret;
  15362. }
  15363. function variablesCode(variable_obj) {
  15364. var ret = '';
  15365. var temp = variable_obj;
  15366. ret += '\n\t\t';
  15367. if (temp.is_constant) {
  15368. ret += 'const ';
  15369. }
  15370. switch (temp.type) {
  15371. case _types.Types.INTEGER:
  15372. ret += _localizedStringsService.LocalizedStrings.getUI('integer') + ' ';
  15373. break;
  15374. case _types.Types.REAL:
  15375. ret += _localizedStringsService.LocalizedStrings.getUI('real') + ' ';
  15376. break;
  15377. case _types.Types.TEXT:
  15378. ret += _localizedStringsService.LocalizedStrings.getUI('text') + ' ';
  15379. break;
  15380. case _types.Types.BOOLEAN:
  15381. ret += _localizedStringsService.LocalizedStrings.getUI('boolean') + ' ';
  15382. break;
  15383. }
  15384. ret += temp.name + ' ';
  15385. if (temp.dimensions == 1) {
  15386. ret += '[' + temp.columns + '] ';
  15387. switch (temp.type) {
  15388. case _types.Types.INTEGER:
  15389. ret += '= {' + temp.value + '}';
  15390. break;
  15391. case _types.Types.REAL:
  15392. ret += '= {' + temp.value.toFixed(2) + '}';
  15393. break;
  15394. case _types.Types.TEXT:
  15395. ret += '= {';
  15396. for (var j = 0; j < temp.value.length; j++) {
  15397. ret += '"' + temp.value[j] + '"';
  15398. if (j + 1 < temp.value.length) {
  15399. ret += ',';
  15400. }
  15401. }
  15402. ret += '}';
  15403. break;
  15404. case _types.Types.BOOLEAN:
  15405. ret += '= {';
  15406. for (var j = 0; j < temp.value.length; j++) {
  15407. if (temp.value[j]) {
  15408. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15409. } else {
  15410. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15411. }
  15412. if (j + 1 < temp.value.length) {
  15413. ret += ',';
  15414. }
  15415. }
  15416. ret += '}';
  15417. break;
  15418. }
  15419. } else if (temp.dimensions == 2) {
  15420. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15421. switch (temp.type) {
  15422. case _types.Types.INTEGER:
  15423. ret += '= {';
  15424. for (var j = 0; j < temp.rows; j++) {
  15425. ret += '{' + temp.value[j] + '}';
  15426. if (j + 1 < temp.rows) {
  15427. ret += ',';
  15428. }
  15429. }
  15430. ret += '}';
  15431. break;
  15432. case _types.Types.REAL:
  15433. ret += '= {';
  15434. for (var j = 0; j < temp.rows; j++) {
  15435. ret += '{' + temp.value[j].toFixed(2) + '}';
  15436. if (j + 1 < temp.rows) {
  15437. ret += ',';
  15438. }
  15439. }
  15440. ret += '}';
  15441. break;
  15442. case _types.Types.TEXT:
  15443. ret += '= {';
  15444. for (var j = 0; j < temp.rows; j++) {
  15445. ret += '{';
  15446. for (var k = 0; k < temp.columns; k++) {
  15447. ret += '"' + temp.value[j][k] + '"';
  15448. if (k + 1 < temp.columns) {
  15449. ret += ',';
  15450. }
  15451. }
  15452. ret += '}';
  15453. if (j + 1 < temp.rows) {
  15454. ret += ',';
  15455. }
  15456. }
  15457. ret += '}';
  15458. break;
  15459. case _types.Types.BOOLEAN:
  15460. ret += '= {';
  15461. for (var j = 0; j < temp.rows; j++) {
  15462. ret += '{';
  15463. for (var k = 0; k < temp.columns; k++) {
  15464. if (temp.value[j][k]) {
  15465. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15466. } else {
  15467. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15468. }
  15469. if (k + 1 < temp.columns) {
  15470. ret += ',';
  15471. }
  15472. }
  15473. ret += '}';
  15474. if (j + 1 < temp.rows) {
  15475. ret += ',';
  15476. }
  15477. }
  15478. ret += '}';
  15479. break;
  15480. }
  15481. } else {
  15482. switch (temp.type) {
  15483. case _types.Types.INTEGER:
  15484. ret += '= ' + temp.value;
  15485. break;
  15486. case _types.Types.REAL:
  15487. ret += '= ' + temp.value.toFixed(2);
  15488. break;
  15489. case _types.Types.TEXT:
  15490. ret += '= "' + temp.value + '"';
  15491. break;
  15492. case _types.Types.BOOLEAN:
  15493. ret += '= ';
  15494. if (temp.value) {
  15495. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15496. } else {
  15497. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15498. }
  15499. break;
  15500. }
  15501. }
  15502. return ret;
  15503. }
  15504. function globalsCode() {
  15505. var ret = '';
  15506. if (window.program_obj.globals) {
  15507. for (var i = 0; i < window.program_obj.globals.length; i++) {
  15508. var temp = window.program_obj.globals[i];
  15509. ret += '\n\t';
  15510. if (temp.is_constant) {
  15511. ret += 'const ';
  15512. }
  15513. switch (temp.type) {
  15514. case _types.Types.INTEGER:
  15515. ret += _localizedStringsService.LocalizedStrings.getUI('integer');
  15516. break;
  15517. case _types.Types.REAL:
  15518. ret += _localizedStringsService.LocalizedStrings.getUI('real');
  15519. break;
  15520. case _types.Types.TEXT:
  15521. ret += _localizedStringsService.LocalizedStrings.getUI('text');
  15522. break;
  15523. case _types.Types.BOOLEAN:
  15524. ret += _localizedStringsService.LocalizedStrings.getUI('boolean');
  15525. break;
  15526. }
  15527. ret += ' ' + temp.name + ' ';
  15528. if (temp.dimensions == 1) {
  15529. ret += '[' + temp.columns + '] ';
  15530. switch (temp.type) {
  15531. case _types.Types.INTEGER:
  15532. ret += '= {' + temp.value + '}';
  15533. break;
  15534. case _types.Types.REAL:
  15535. ret += '= {';
  15536. for (var j = 0; j < temp.value.length; j++) {
  15537. ret += temp.value[j].toFixed(2);
  15538. if (j + 1 < temp.value.length) {
  15539. ret += ',';
  15540. }
  15541. }
  15542. ret += '}';
  15543. break;
  15544. case _types.Types.TEXT:
  15545. ret += '= {';
  15546. for (var j = 0; j < temp.value.length; j++) {
  15547. ret += '"' + temp.value[j] + '"';
  15548. if (j + 1 < temp.value.length) {
  15549. ret += ',';
  15550. }
  15551. }
  15552. ret += '}';
  15553. break;
  15554. case _types.Types.BOOLEAN:
  15555. ret += '= {';
  15556. for (var j = 0; j < temp.value.length; j++) {
  15557. if (temp.value[j]) {
  15558. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15559. } else {
  15560. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15561. }
  15562. if (j + 1 < temp.value.length) {
  15563. ret += ',';
  15564. }
  15565. }
  15566. ret += '}';
  15567. break;
  15568. }
  15569. } else if (temp.dimensions == 2) {
  15570. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  15571. switch (temp.type) {
  15572. case _types.Types.INTEGER:
  15573. ret += '= {';
  15574. for (var j = 0; j < temp.rows; j++) {
  15575. ret += '{' + temp.value[j] + '}';
  15576. if (j + 1 < temp.rows) {
  15577. ret += ',';
  15578. }
  15579. }
  15580. ret += '}';
  15581. break;
  15582. case _types.Types.REAL:
  15583. ret += '= {';
  15584. for (var j = 0; j < temp.rows; j++) {
  15585. ret += '{';
  15586. for (var k = 0; k < temp.columns; k++) {
  15587. ret += temp.value[j][k].toFixed(2);
  15588. if (k + 1 < temp.columns) {
  15589. ret += ',';
  15590. }
  15591. }
  15592. ret += '}';
  15593. if (j + 1 < temp.rows) {
  15594. ret += ',';
  15595. }
  15596. }
  15597. ret += '}';
  15598. break;
  15599. case _types.Types.TEXT:
  15600. ret += '= {';
  15601. for (var j = 0; j < temp.rows; j++) {
  15602. ret += '{';
  15603. for (var k = 0; k < temp.columns; k++) {
  15604. ret += '"' + temp.value[j][k] + '"';
  15605. if (k + 1 < temp.columns) {
  15606. ret += ',';
  15607. }
  15608. }
  15609. ret += '}';
  15610. if (j + 1 < temp.rows) {
  15611. ret += ',';
  15612. }
  15613. }
  15614. ret += '}';
  15615. break;
  15616. case _types.Types.BOOLEAN:
  15617. ret += '= {';
  15618. for (var j = 0; j < temp.rows; j++) {
  15619. ret += '{';
  15620. for (var k = 0; k < temp.columns; k++) {
  15621. if (temp.value[j][k]) {
  15622. ret += _localizedStringsService.LocalizedStrings.getUI("true");
  15623. } else {
  15624. ret += _localizedStringsService.LocalizedStrings.getUI("false");
  15625. }
  15626. if (k + 1 < temp.columns) {
  15627. ret += ',';
  15628. }
  15629. }
  15630. ret += '}';
  15631. if (j + 1 < temp.rows) {
  15632. ret += ',';
  15633. }
  15634. }
  15635. ret += '}';
  15636. break;
  15637. }
  15638. } else {
  15639. switch (temp.type) {
  15640. case _types.Types.INTEGER:
  15641. ret += '= ' + temp.value;
  15642. break;
  15643. case _types.Types.REAL:
  15644. ret += '= ' + temp.value.toFixed(2);
  15645. break;
  15646. case _types.Types.TEXT:
  15647. ret += '= "' + temp.value + '"';
  15648. break;
  15649. case _types.Types.BOOLEAN:
  15650. ret += '= ';
  15651. if (temp.value) {
  15652. ret += _localizedStringsService.LocalizedStrings.getUI("true");;
  15653. } else {
  15654. ret += _localizedStringsService.LocalizedStrings.getUI("false");;
  15655. }
  15656. break;
  15657. }
  15658. }
  15659. }
  15660. }
  15661. return ret;
  15662. }
  15663. /***/ }),
  15664. /***/ "./js/visualUI/commands.js":
  15665. /*!*********************************!*\
  15666. !*** ./js/visualUI/commands.js ***!
  15667. \*********************************/
  15668. /*! no static exports found */
  15669. /***/ (function(module, exports, __webpack_require__) {
  15670. "use strict";
  15671. Object.defineProperty(exports, "__esModule", {
  15672. value: true
  15673. });
  15674. exports.removeCommand = removeCommand;
  15675. exports.createFloatingCommand = createFloatingCommand;
  15676. exports.renderCommand = renderCommand;
  15677. exports.genericCreateCommand = genericCreateCommand;
  15678. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  15679. var _jquery2 = _interopRequireDefault(_jquery);
  15680. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  15681. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  15682. var Models = _interopRequireWildcard(_ivprog_elements);
  15683. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  15684. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  15685. var GlobalsManagement = _interopRequireWildcard(_globals);
  15686. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  15687. var VariablesManagement = _interopRequireWildcard(_variables);
  15688. var _comment = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  15689. var CommentsManagement = _interopRequireWildcard(_comment);
  15690. var _reader = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  15691. var ReadersManagement = _interopRequireWildcard(_reader);
  15692. var _writer = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  15693. var WritersManagement = _interopRequireWildcard(_writer);
  15694. var _attribution = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  15695. var AttributionsManagement = _interopRequireWildcard(_attribution);
  15696. var _iftrue = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  15697. var IftruesManagement = _interopRequireWildcard(_iftrue);
  15698. var _repeatNtimes = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  15699. var RepeatNtimesManagement = _interopRequireWildcard(_repeatNtimes);
  15700. var _whiletrue = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  15701. var WhiletruesManagement = _interopRequireWildcard(_whiletrue);
  15702. var _dowhiletrue = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  15703. var DowhiletruesManagement = _interopRequireWildcard(_dowhiletrue);
  15704. var _switch = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  15705. var SwitchesManagement = _interopRequireWildcard(_switch);
  15706. var _functioncall = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  15707. var FunctioncallsManagement = _interopRequireWildcard(_functioncall);
  15708. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  15709. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  15710. var _break = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  15711. var BreaksManagement = _interopRequireWildcard(_break);
  15712. var _return = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  15713. var ReturnsManagement = _interopRequireWildcard(_return);
  15714. 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; } }
  15715. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  15716. var has_element_created_draged = false;
  15717. var which_element_is_draged = null;
  15718. function removeCommand(command, function_obj, dom_obj) {
  15719. if (function_obj.commands.indexOf(command) > -1) {
  15720. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15721. return true;
  15722. }
  15723. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15724. try {
  15725. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15726. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15727. return true;
  15728. }
  15729. } catch (err) {}
  15730. try {
  15731. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15732. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15733. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15734. return true;
  15735. }
  15736. }
  15737. } catch (err) {}
  15738. if (dom_obj.parent().data('switchcase')) {
  15739. console.log("o que encontrei: ");
  15740. console.log(dom_obj.parent().data('switchcase'));
  15741. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15742. return true;
  15743. }
  15744. return false;
  15745. }
  15746. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15747. var floatingObject;
  15748. switch (command_type) {
  15749. case Models.COMMAND_TYPES.break:
  15750. floatingObject = BreaksManagement.createFloatingCommand();
  15751. break;
  15752. case Models.COMMAND_TYPES.comment:
  15753. floatingObject = CommentsManagement.createFloatingCommand();
  15754. break;
  15755. case Models.COMMAND_TYPES.reader:
  15756. floatingObject = ReadersManagement.createFloatingCommand();
  15757. break;
  15758. case Models.COMMAND_TYPES.writer:
  15759. floatingObject = WritersManagement.createFloatingCommand();
  15760. break;
  15761. case Models.COMMAND_TYPES.attribution:
  15762. floatingObject = AttributionsManagement.createFloatingCommand();
  15763. break;
  15764. case Models.COMMAND_TYPES.iftrue:
  15765. floatingObject = IftruesManagement.createFloatingCommand();
  15766. break;
  15767. case Models.COMMAND_TYPES.repeatNtimes:
  15768. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15769. break;
  15770. case Models.COMMAND_TYPES.whiletrue:
  15771. floatingObject = WhiletruesManagement.createFloatingCommand();
  15772. break;
  15773. case Models.COMMAND_TYPES.dowhiletrue:
  15774. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15775. break;
  15776. case Models.COMMAND_TYPES.switch:
  15777. floatingObject = SwitchesManagement.createFloatingCommand();
  15778. break;
  15779. case Models.COMMAND_TYPES.functioncall:
  15780. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15781. break;
  15782. case Models.COMMAND_TYPES.return:
  15783. floatingObject = ReturnsManagement.createFloatingCommand();
  15784. break;
  15785. }
  15786. floatingObject.draggable({
  15787. drag: function drag(evt) {
  15788. borderMouseDragCommand(function_obj, function_container, evt);
  15789. },
  15790. stop: function stop(evt) {
  15791. function_container.find('.over_command_drag').each(function (index) {
  15792. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15793. });
  15794. }
  15795. }).appendTo("body");
  15796. floatingObject.mouseup(function (evt) {
  15797. manageCommand(function_obj, function_container, evt, command_type);
  15798. });
  15799. floatingObject.css("position", "absolute");
  15800. mouse_event.type = "mousedown.draggable";
  15801. mouse_event.target = floatingObject[0];
  15802. floatingObject.css("left", mouse_event.pageX - 15);
  15803. floatingObject.css("top", mouse_event.pageY - 15);
  15804. floatingObject.trigger(mouse_event);
  15805. }
  15806. function borderMouseDragCommand(function_obj, function_container, evt) {
  15807. function_container.find('.over_command_drag').each(function (index) {
  15808. (0, _jquery2.default)(this).removeClass('over_command_drag');
  15809. });
  15810. var prev = null;
  15811. function_container.find('.commands_list_div').each(function (index) {
  15812. prev = (0, _jquery2.default)(this);
  15813. var objLeft = prev.offset().left;
  15814. var objTop = prev.offset().top;
  15815. var objRight = objLeft + prev.width();
  15816. var objBottom = objTop + prev.height();
  15817. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15818. prev.addClass("over_command_drag");
  15819. }
  15820. });
  15821. function_container.find('.command_container').each(function (index) {
  15822. var obj = (0, _jquery2.default)(this);
  15823. var objLeft = obj.offset().left;
  15824. var objTop = obj.offset().top;
  15825. var objRight = objLeft + obj.width();
  15826. var objBottom = objTop + obj.height();
  15827. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  15828. prev.removeClass('over_command_drag');
  15829. obj.addClass("over_command_drag");
  15830. return;
  15831. }
  15832. });
  15833. }
  15834. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15835. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15836. var createdElement;
  15837. switch (command.type) {
  15838. case Models.COMMAND_TYPES.comment:
  15839. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15840. break;
  15841. case Models.COMMAND_TYPES.break:
  15842. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15843. break;
  15844. case Models.COMMAND_TYPES.reader:
  15845. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15846. break;
  15847. case Models.COMMAND_TYPES.writer:
  15848. createdElement = WritersManagement.renderCommand(command, function_obj);
  15849. break;
  15850. case Models.COMMAND_TYPES.attribution:
  15851. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15852. break;
  15853. case Models.COMMAND_TYPES.functioncall:
  15854. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15855. break;
  15856. case Models.COMMAND_TYPES.iftrue:
  15857. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15858. break;
  15859. case Models.COMMAND_TYPES.repeatNtimes:
  15860. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15861. break;
  15862. case Models.COMMAND_TYPES.whiletrue:
  15863. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15864. break;
  15865. case Models.COMMAND_TYPES.dowhiletrue:
  15866. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  15867. break;
  15868. case Models.COMMAND_TYPES.switch:
  15869. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  15870. break;
  15871. case Models.COMMAND_TYPES.return:
  15872. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  15873. break;
  15874. }
  15875. switch (before_after_inside) {
  15876. case 1:
  15877. createdElement.insertBefore(element_reference);
  15878. break;
  15879. case 2:
  15880. createdElement.insertAfter(element_reference);
  15881. break;
  15882. case 3:
  15883. element_reference.append(createdElement);
  15884. break;
  15885. }
  15886. }
  15887. function genericCreateCommand(command_type) {
  15888. switch (command_type) {
  15889. case Models.COMMAND_TYPES.break:
  15890. return new Models.Break();
  15891. case Models.COMMAND_TYPES.comment:
  15892. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  15893. case Models.COMMAND_TYPES.reader:
  15894. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  15895. case Models.COMMAND_TYPES.writer:
  15896. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15897. case Models.COMMAND_TYPES.attribution:
  15898. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  15899. case Models.COMMAND_TYPES.functioncall:
  15900. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  15901. case Models.COMMAND_TYPES.iftrue:
  15902. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  15903. case Models.COMMAND_TYPES.repeatNtimes:
  15904. 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);
  15905. case Models.COMMAND_TYPES.whiletrue:
  15906. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  15907. case Models.COMMAND_TYPES.dowhiletrue:
  15908. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  15909. case Models.COMMAND_TYPES.switch:
  15910. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  15911. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  15912. case Models.COMMAND_TYPES.return:
  15913. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15914. }
  15915. }
  15916. function manageCommand(function_obj, function_container, event, command_type) {
  15917. (0, _jquery2.default)(".created_element").each(function (index) {
  15918. (0, _jquery2.default)(this).remove();
  15919. });
  15920. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  15921. console.log('soltou no: ');
  15922. console.log(el);
  15923. console.log(el.data('fun'));
  15924. // Primeiro verificar se ele soltou no espaço da função correta:
  15925. var hier = el.parentsUntil(".all_functions");
  15926. var esta_correto = false;
  15927. var esta_na_div_correta = false;
  15928. if (el.hasClass("commands_list_div")) {
  15929. esta_na_div_correta = true;
  15930. }
  15931. for (var i = 0; i < hier.length; i++) {
  15932. var temp = (0, _jquery2.default)(hier[i]);
  15933. if (temp.hasClass("commands_list_div")) {
  15934. esta_na_div_correta = true;
  15935. }
  15936. if (temp.data('fun') == function_obj) {
  15937. esta_correto = true;
  15938. break;
  15939. }
  15940. }
  15941. if (!esta_correto) {
  15942. has_element_created_draged = false;
  15943. which_element_is_draged = null;
  15944. return;
  15945. } else {
  15946. if (!esta_na_div_correta) {
  15947. has_element_created_draged = false;
  15948. which_element_is_draged = null;
  15949. return;
  15950. }
  15951. }
  15952. // Agora é descobrir qual o escopo para adicionar o comando:
  15953. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  15954. if (typeof el.data('fun') !== 'undefined') {
  15955. // Se a lista de comandos estiver vazia, então é o primeiro.
  15956. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  15957. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  15958. // pode adicionar
  15959. el.data('fun').commands = [];
  15960. var new_cmd = genericCreateCommand(command_type);
  15961. el.data('fun').commands.push(new_cmd);
  15962. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  15963. } else {
  15964. // Entra nesse else, caso já existam outros comandos no bloco:
  15965. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  15966. }
  15967. } else {
  15968. console.log("soltou em um comando");
  15969. // descobrir em qual comando ele soltou:
  15970. var hier_find = el.parentsUntil(".commands_list_div");
  15971. var hierarquia_bottom_up = [];
  15972. if (typeof el.data('command') !== 'undefined') {
  15973. hierarquia_bottom_up.push(el.data('command'));
  15974. }
  15975. for (var i = 0; i < hier_find.length; i++) {
  15976. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15977. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  15978. }
  15979. }
  15980. console.log("comando em que soltou: ");
  15981. console.log(hierarquia_bottom_up[0]);
  15982. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  15983. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15984. console.log(hierarquia_bottom_up[i]);
  15985. }
  15986. // Se for do tipo break, verificar se está no contexto correto:
  15987. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  15988. var is_correct_context = false;
  15989. if (command_type == Models.COMMAND_TYPES.break) {
  15990. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15991. 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) {
  15992. is_correct_context = true;
  15993. break;
  15994. }
  15995. }
  15996. if (!is_correct_context) {
  15997. console.error("Context not allowed to insert BREAK COMMAND!");
  15998. return;
  15999. }
  16000. }
  16001. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  16002. if (hierarquia_bottom_up.length == 1) {
  16003. console.log('QQ1');
  16004. var sub_elemento = false;
  16005. for (var i = 0; i < hier_find.length; i++) {
  16006. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16007. console.log('QQ2');
  16008. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  16009. sub_elemento = true;
  16010. break;
  16011. }
  16012. }
  16013. if (!sub_elemento) {
  16014. console.log('QQ3');
  16015. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  16016. }
  16017. } else {
  16018. console.log('QQ4');
  16019. // caso exista mais de um elemento na hierarquia:
  16020. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  16021. console.log('QQ5');
  16022. console.log("PPP1");
  16023. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16024. } else {
  16025. console.log('QQ6');
  16026. var sub_elemento = false;
  16027. for (var i = 0; i < hier_find.length; i++) {
  16028. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16029. console.log('QQ7');
  16030. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16031. sub_elemento = true;
  16032. break;
  16033. }
  16034. }
  16035. }
  16036. }
  16037. }
  16038. has_element_created_draged = false;
  16039. which_element_is_draged = null;
  16040. }
  16041. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16042. var el_jq = (0, _jquery2.default)(el);
  16043. var command_parent = el_jq.data('command');
  16044. 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) {
  16045. console.log('QQ17');
  16046. 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) {
  16047. console.log('QQ18');
  16048. // Se não tiver outro comando ainda no bloco, só adiciona:
  16049. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16050. command_parent.commands_block = [];
  16051. var recentComand = genericCreateCommand(command_type);
  16052. command_parent.commands_block.push(recentComand);
  16053. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16054. } else {
  16055. // Se já tem algum comando no bloco:
  16056. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16057. }
  16058. } else {
  16059. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16060. addCommandToSwitchCase(event, function_obj, command_type);
  16061. }
  16062. } else {
  16063. console.log('QQ19');
  16064. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16065. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16066. }
  16067. }
  16068. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16069. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16070. var menor_distancia = 999999999;
  16071. var elemento_menor_distancia = null;
  16072. var antes = true;
  16073. var t_bot;
  16074. var t_top;
  16075. // Descobrindo o elemento mais próximo:
  16076. for (var i = 0; i < all_sub.length; i++) {
  16077. t_top = all_sub[i].getBoundingClientRect().top;
  16078. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16079. if (t_top - event.clientY < menor_distancia) {
  16080. menor_distancia = event.clientY - t_top;
  16081. elemento_menor_distancia = all_sub[i];
  16082. }
  16083. }
  16084. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16085. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16086. if (borda_inferior - event.clientY < menor_distancia) {
  16087. var recentComand = genericCreateCommand(command_type);
  16088. command_parent.commands_block.push(recentComand);
  16089. //
  16090. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16091. } else {
  16092. var recentComand = genericCreateCommand(command_type);
  16093. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16094. if (index > -1) {
  16095. command_parent.commands_block.splice(index, 0, recentComand);
  16096. }
  16097. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16098. }
  16099. }
  16100. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16101. var el_jq = (0, _jquery2.default)(el);
  16102. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16103. var command_target = el_jq.data('command');
  16104. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16105. var is_in_else = false;
  16106. if (!command_parent) {
  16107. command_parent = el_jq.data('command');
  16108. temp_parent = el_jq;
  16109. var hier = el_jq.parentsUntil(".command_container");
  16110. for (var i = 0; i < hier.length; i++) {
  16111. var temp = (0, _jquery2.default)(hier[i]);
  16112. if (typeof temp.data('else') != 'undefined') {
  16113. is_in_else = true;
  16114. }
  16115. if (typeof temp.data('command') != 'undefined') {
  16116. command_parent = temp.data('command');
  16117. temp_parent = temp;
  16118. }
  16119. }
  16120. }
  16121. var hier = el_jq.parentsUntil(".command_container");
  16122. for (var i = 0; i < hier.length; i++) {
  16123. var temp = (0, _jquery2.default)(hier[i]);
  16124. if (typeof temp.data('else') != 'undefined') {
  16125. is_in_else = true;
  16126. }
  16127. }
  16128. if (command_parent == command_target) {
  16129. var hier = el_jq.parentsUntil(".command_container");
  16130. for (var i = 0; i < hier.length; i++) {
  16131. var temp = (0, _jquery2.default)(hier[i]);
  16132. if (typeof temp.data('else') !== 'undefined') {
  16133. is_in_else = true;
  16134. break;
  16135. }
  16136. }
  16137. }
  16138. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16139. var hier = temp_parent.parentsUntil(".all_cases_div");
  16140. console.log("vou procurar!!");
  16141. for (var i = 0; i < hier.length; i++) {
  16142. console.log("estou vasculhando...");
  16143. var temp = (0, _jquery2.default)(hier[i]);
  16144. if (typeof temp.data('switchcase') !== 'undefined') {
  16145. console.log("encontrei");
  16146. command_parent = temp.data('switchcase');
  16147. is_in_else = false;
  16148. break;
  16149. }
  16150. }
  16151. }
  16152. console.log('debugging:');
  16153. console.log('el_jq');
  16154. console.log(el_jq);
  16155. console.log('command_parent');
  16156. console.log(command_parent);
  16157. console.log('command_target');
  16158. console.log(command_target);
  16159. var menor_distancia = 999999999;
  16160. var antes = true;
  16161. var t_bot;
  16162. var t_top;
  16163. t_top = el.getBoundingClientRect().top;
  16164. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16165. var d_top = event.clientY - t_top; // distancia topo
  16166. var d_bot = t_bot - event.clientY; // distancia baixo
  16167. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16168. if (d_top < d_bot) {
  16169. var recentComand = genericCreateCommand(command_type);
  16170. console.log('MMM1');
  16171. if (is_in_else) {
  16172. console.log('MMM2');
  16173. if (command_parent == command_target) {
  16174. console.log('MMM3');
  16175. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16176. command_parent.commands_else = [];
  16177. var recentComand = genericCreateCommand(command_type);
  16178. command_parent.commands_else.push(recentComand);
  16179. renderCommand(recentComand, el_jq, 3, function_obj);
  16180. } else {
  16181. // Se já tem algum comando no bloco:
  16182. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16183. }
  16184. return;
  16185. }
  16186. console.log('MMM7');
  16187. var index = command_parent.commands_else.indexOf(command_target);
  16188. if (index > -1) {
  16189. command_parent.commands_else.splice(index, 0, recentComand);
  16190. }
  16191. renderCommand(recentComand, el, 1, function_obj);
  16192. } else {
  16193. console.log('MMM4');
  16194. if (command_parent == command_target) {
  16195. console.log('Nxxxx5');
  16196. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16197. command_parent.commands_block = [];
  16198. console.log('SSS4');
  16199. var recentComand = genericCreateCommand(command_type);
  16200. command_parent.commands_block.push(recentComand);
  16201. renderCommand(recentComand, el_jq, 3, function_obj);
  16202. } else {
  16203. console.log('SSS5');
  16204. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16205. }
  16206. return;
  16207. }
  16208. console.log('MMM6');
  16209. var index = command_parent.commands_block.indexOf(command_target);
  16210. if (index > -1) {
  16211. command_parent.commands_block.splice(index, 0, recentComand);
  16212. }
  16213. renderCommand(recentComand, el, 1, function_obj);
  16214. }
  16215. } else {
  16216. console.log('XXX1');
  16217. var recentComand = genericCreateCommand(command_type);
  16218. if (is_in_else) {
  16219. if (command_parent == command_target) {
  16220. console.log('MMM3');
  16221. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16222. command_parent.commands_else = [];
  16223. console.log('SSS1');
  16224. var recentComand = genericCreateCommand(command_type);
  16225. command_parent.commands_else.push(recentComand);
  16226. renderCommand(recentComand, el_jq, 3, function_obj);
  16227. } else {
  16228. // Se já tem algum comando no bloco:
  16229. console.log('SSS2');
  16230. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16231. }
  16232. return;
  16233. }
  16234. console.log('XXX2');
  16235. var index = command_parent.commands_else.indexOf(command_target);
  16236. if (index > -1) {
  16237. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16238. }
  16239. renderCommand(recentComand, el, 2, function_obj);
  16240. } else {
  16241. if (command_parent == command_target) {
  16242. console.log('Nxxxx78');
  16243. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16244. command_parent.commands_block = [];
  16245. var recentComand = genericCreateCommand(command_type);
  16246. command_parent.commands_block.push(recentComand);
  16247. console.log('SSS6');
  16248. renderCommand(recentComand, el_jq, 3, function_obj);
  16249. } else {
  16250. console.log('SSS7');
  16251. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16252. }
  16253. return;
  16254. }
  16255. console.log('XXX3');
  16256. var index = command_parent.commands_block.indexOf(command_target);
  16257. if (index > -1) {
  16258. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16259. }
  16260. renderCommand(recentComand, el, 2, function_obj);
  16261. }
  16262. }
  16263. }
  16264. function insertCommandInBlock(el, event, function_obj, command_type) {
  16265. var el_jq = (0, _jquery2.default)(el);
  16266. var command_parent = el_jq.data('command');
  16267. 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) {
  16268. // Se não tiver outro comando ainda no bloco, só adiciona:
  16269. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16270. command_parent.commands_block = [];
  16271. var recentComand = genericCreateCommand(command_type);
  16272. command_parent.commands_block.push(recentComand);
  16273. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16274. } else {
  16275. // Se já tem algum comando no bloco:
  16276. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16277. }
  16278. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16279. console.log('QQ9');
  16280. // no if ou no else?
  16281. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16282. var is_in_if = true;
  16283. if (correct_div.data('if')) {
  16284. is_in_if = true;
  16285. } else if (correct_div.data('else')) {
  16286. is_in_if = false;
  16287. } else {
  16288. var hier = correct_div.parentsUntil(".command_container");
  16289. for (var i = 0; i < hier.length; i++) {
  16290. var temp = (0, _jquery2.default)(hier[i]);
  16291. if (typeof temp.data('if') !== 'undefined') {
  16292. is_in_if = true;
  16293. break;
  16294. }
  16295. if (typeof temp.data('else') !== 'undefined') {
  16296. is_in_if = false;
  16297. break;
  16298. }
  16299. }
  16300. }
  16301. if (is_in_if) {
  16302. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16303. command_parent.commands_block = [];
  16304. var recentComand = genericCreateCommand(command_type);
  16305. command_parent.commands_block.push(recentComand);
  16306. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16307. } else {
  16308. // Se já tem algum comando no bloco:
  16309. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16310. }
  16311. } else {
  16312. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16313. command_parent.commands_else = [];
  16314. var recentComand = genericCreateCommand(command_type);
  16315. command_parent.commands_else.push(recentComand);
  16316. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16317. } else {
  16318. // Se já tem algum comando no bloco:
  16319. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16320. }
  16321. }
  16322. } else {
  16323. // é do tipo switch
  16324. console.log("está tentando inserir em um switch que está na raiz!");
  16325. addCommandToSwitchCase(event, function_obj, command_type);
  16326. }
  16327. }
  16328. function addCommandToSwitchCase(event, function_obj, command_type) {
  16329. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16330. var which_case = el.data('switchcase');
  16331. var case_div = el;
  16332. if (!which_case) {
  16333. var hier_find = el.parentsUntil(".all_cases_div");
  16334. for (var i = 0; i < hier_find.length; i++) {
  16335. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16336. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16337. case_div = (0, _jquery2.default)(hier_find[i]);
  16338. break;
  16339. }
  16340. }
  16341. }
  16342. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16343. which_case.commands_block = [];
  16344. var recentComand = genericCreateCommand(command_type);
  16345. which_case.commands_block.push(recentComand);
  16346. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16347. } else {
  16348. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16349. }
  16350. }
  16351. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16352. var all_sub = case_div.find('div.command_container');
  16353. var menor_distancia = 999999999;
  16354. var elemento_menor_distancia = null;
  16355. var antes = true;
  16356. var t_bot;
  16357. var t_top;
  16358. // Descobrindo o elemento mais próximo:
  16359. for (var i = 0; i < all_sub.length; i++) {
  16360. t_top = all_sub[i].getBoundingClientRect().top;
  16361. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16362. if (t_top - event.clientY < menor_distancia) {
  16363. menor_distancia = event.clientY - t_top;
  16364. elemento_menor_distancia = all_sub[i];
  16365. }
  16366. }
  16367. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16368. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16369. if (borda_inferior - event.clientY < menor_distancia) {
  16370. var recentComand = genericCreateCommand(command_type);
  16371. which_case.commands_block.push(recentComand);
  16372. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16373. } else {
  16374. var recentComand = genericCreateCommand(command_type);
  16375. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16376. if (index > -1) {
  16377. which_case.commands_block.splice(index, 0, recentComand);
  16378. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16379. }
  16380. }
  16381. }
  16382. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16383. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16384. var el_jq = (0, _jquery2.default)(el);
  16385. var all_sub = el_jq.find('div.command_container');
  16386. var menor_distancia = 999999999;
  16387. var elemento_menor_distancia = null;
  16388. var antes = true;
  16389. var t_bot;
  16390. var t_top;
  16391. // Descobrindo o elemento mais próximo:
  16392. for (var i = 0; i < all_sub.length; i++) {
  16393. t_top = all_sub[i].getBoundingClientRect().top;
  16394. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16395. if (t_top - event.clientY < menor_distancia) {
  16396. menor_distancia = event.clientY - t_top;
  16397. elemento_menor_distancia = all_sub[i];
  16398. }
  16399. }
  16400. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16401. console.log("menor_distancia: ");
  16402. console.log(elemento_menor_distancia);
  16403. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16404. if (borda_inferior - event.clientY < menor_distancia) {
  16405. console.log('QQ11');
  16406. var recentComand = genericCreateCommand(command_type);
  16407. var command_parent = el_jq.data('command');
  16408. if (is_in_else) {
  16409. console.log('QQ15');
  16410. command_parent.commands_else.push(recentComand);
  16411. console.log('el_jq');
  16412. console.log(el_jq);
  16413. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16414. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16415. renderCommand(recentComand, el_jq, 3, function_obj);
  16416. } else {
  16417. console.log('QQ16');
  16418. command_parent.commands_block.push(recentComand);
  16419. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16420. }
  16421. } else {
  16422. console.log('QQ12');
  16423. var recentComand = genericCreateCommand(command_type);
  16424. var command_parent = el_jq.data('command');
  16425. if (is_in_else) {
  16426. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16427. if (index > -1) {
  16428. command_parent.commands_else.splice(index, 0, recentComand);
  16429. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16430. }
  16431. } else {
  16432. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16433. if (index > -1) {
  16434. command_parent.commands_block.splice(index, 0, recentComand);
  16435. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16436. }
  16437. }
  16438. }
  16439. }
  16440. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16441. switch ((0, _jquery2.default)(el).data('command').type) {
  16442. case Models.COMMAND_TYPES.iftrue:
  16443. case Models.COMMAND_TYPES.switch:
  16444. case Models.COMMAND_TYPES.repeatNtimes:
  16445. case Models.COMMAND_TYPES.whiletrue:
  16446. case Models.COMMAND_TYPES.dowhiletrue:
  16447. insertCommandInBlock(el, event, function_obj, command_type);
  16448. return;
  16449. }
  16450. var menor_distancia = 999999999;
  16451. var antes = true;
  16452. var t_bot;
  16453. var t_top;
  16454. t_top = el.getBoundingClientRect().top;
  16455. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16456. var d_top = event.clientY - t_top; // distancia topo
  16457. var d_bot = t_bot - event.clientY; // distancia baixo
  16458. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16459. if (d_top < d_bot) {
  16460. var recentComand = genericCreateCommand(command_type);
  16461. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16462. if (index > -1) {
  16463. function_obj.commands.splice(index, 0, recentComand);
  16464. }
  16465. renderCommand(recentComand, el, 1, function_obj);
  16466. } else {
  16467. var recentComand = genericCreateCommand(command_type);
  16468. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16469. if (index > -1) {
  16470. function_obj.commands.splice(index + 1, 0, recentComand);
  16471. }
  16472. renderCommand(recentComand, el, 2, function_obj);
  16473. }
  16474. }
  16475. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16476. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16477. var menor_distancia = 999999999;
  16478. var elemento_menor_distancia = null;
  16479. var antes = true;
  16480. var t_bot;
  16481. var t_top;
  16482. // Descobrindo o elemento mais próximo:
  16483. for (var i = 0; i < all_sub.length; i++) {
  16484. t_top = all_sub[i].getBoundingClientRect().top;
  16485. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16486. if (t_top - event.clientY < menor_distancia) {
  16487. menor_distancia = event.clientY - t_top;
  16488. elemento_menor_distancia = all_sub[i];
  16489. }
  16490. }
  16491. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16492. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16493. if (borda_inferior - event.clientY < menor_distancia) {
  16494. var recentComand = genericCreateCommand(command_type);
  16495. function_obj.commands.push(recentComand);
  16496. //
  16497. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16498. } else {
  16499. var recentComand = genericCreateCommand(command_type);
  16500. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16501. if (index > -1) {
  16502. function_obj.commands.splice(index, 0, recentComand);
  16503. }
  16504. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16505. }
  16506. }
  16507. /***/ }),
  16508. /***/ "./js/visualUI/commands/attribution.js":
  16509. /*!*********************************************!*\
  16510. !*** ./js/visualUI/commands/attribution.js ***!
  16511. \*********************************************/
  16512. /*! no static exports found */
  16513. /***/ (function(module, exports, __webpack_require__) {
  16514. "use strict";
  16515. Object.defineProperty(exports, "__esModule", {
  16516. value: true
  16517. });
  16518. exports.createFloatingCommand = createFloatingCommand;
  16519. exports.renderCommand = renderCommand;
  16520. exports.manageExpressionElements = manageExpressionElements;
  16521. exports.renderMenuOperations = renderMenuOperations;
  16522. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16523. var _jquery2 = _interopRequireDefault(_jquery);
  16524. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16525. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16526. var Models = _interopRequireWildcard(_ivprog_elements);
  16527. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16528. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16529. var GlobalsManagement = _interopRequireWildcard(_globals);
  16530. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16531. var VariablesManagement = _interopRequireWildcard(_variables);
  16532. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16533. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16534. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16535. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16536. var CommandsManagement = _interopRequireWildcard(_commands);
  16537. 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; } }
  16538. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16539. function createFloatingCommand() {
  16540. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16541. }
  16542. function renderCommand(command, function_obj) {
  16543. 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>');
  16544. el.data('command', command);
  16545. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16546. if (!command.expression || command.expression.length < 1) {
  16547. 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)]);
  16548. command.expression.push(exp);
  16549. }
  16550. addHandlers(command, function_obj, el);
  16551. renderExpressionElements(command, function_obj, el);
  16552. return el;
  16553. }
  16554. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16555. var index_to_move = expression_element.itens.indexOf(ref_object);
  16556. switch (selectedItem.data('exp')) {
  16557. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16558. 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)]);
  16559. expression_element.itens[index_to_move] = exp;
  16560. break;
  16561. case Models.EXPRESSION_ELEMENTS.op_exp:
  16562. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16563. expression_element.itens[index_to_move] = exp;
  16564. break;
  16565. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16566. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16567. expression_element.itens[index_to_move] = exp;
  16568. break;
  16569. }
  16570. renderExpressionElements(command, function_obj, dom_object);
  16571. }
  16572. function renderExpressionElements(command, function_obj, el) {
  16573. var expression_div = el.find('.expression_elements');
  16574. var command_container;
  16575. if (el.hasClass("command_container") == false) {
  16576. var hier = el.parentsUntil(".command_container");
  16577. for (var i = 0; i < hier.length; i++) {
  16578. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16579. command_container = (0, _jquery2.default)(hier[i]);
  16580. break;
  16581. }
  16582. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16583. expression_div = (0, _jquery2.default)(hier[i]);
  16584. break;
  16585. }
  16586. }
  16587. }
  16588. if (command_container) {
  16589. expression_div = command_container.find('.expression_elements');
  16590. }
  16591. expression_div.text('');
  16592. for (var i = 0; i < command.expression.length; i++) {
  16593. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16594. temp.data('ref_element', command.expression[i]);
  16595. temp.data('ref_index', i);
  16596. expression_div.append(temp);
  16597. renderElement(command, function_obj, temp, command.expression[i]);
  16598. }
  16599. }
  16600. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16601. var context_menu = '<div class="ui dropdown"><div class="text">';
  16602. switch (expression_element.itens[index_op]) {
  16603. case Models.ARITHMETIC_TYPES.plus:
  16604. context_menu += '+';
  16605. break;
  16606. case Models.ARITHMETIC_TYPES.minus:
  16607. context_menu += '-';
  16608. break;
  16609. case Models.ARITHMETIC_TYPES.multiplication:
  16610. context_menu += '*';
  16611. break;
  16612. case Models.ARITHMETIC_TYPES.division:
  16613. context_menu += '/';
  16614. break;
  16615. case Models.ARITHMETIC_TYPES.module:
  16616. context_menu += '%';
  16617. break;
  16618. case Models.ARITHMETIC_TYPES.none:
  16619. context_menu += '...';
  16620. break;
  16621. }
  16622. context_menu += '</div><div class="menu">';
  16623. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16624. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16625. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16626. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16627. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16628. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16629. context_menu += '</div></div>';
  16630. context_menu = (0, _jquery2.default)(context_menu);
  16631. temp_op.append(context_menu);
  16632. context_menu.dropdown({
  16633. onChange: function onChange(value, text, $selectedItem) {
  16634. expression_element.itens[index_op] = value;
  16635. }
  16636. });
  16637. }
  16638. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16639. if (el.hasClass("command_container") == false) {
  16640. var hier = el.parentsUntil(".commands_list_div");
  16641. for (var i = 0; i < hier.length; i++) {
  16642. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16643. el = (0, _jquery2.default)(hier[i]);
  16644. break;
  16645. }
  16646. }
  16647. }
  16648. if (dom_append_menu.hasClass("expression_elements") == false) {
  16649. var hier = el.parentsUntil(".commands_list_div");
  16650. for (var i = 0; i < hier.length; i++) {
  16651. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16652. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16653. break;
  16654. }
  16655. }
  16656. }
  16657. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16658. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16659. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16660. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16661. context_menu += '</div></div>';
  16662. context_menu = (0, _jquery2.default)(context_menu);
  16663. dom_append_menu.append(context_menu);
  16664. context_menu.dropdown({
  16665. onChange: function onChange(value, text, $selectedItem) {
  16666. switch (value) {
  16667. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16668. 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)]);
  16669. expression_append_new_expression.push(exp);
  16670. break;
  16671. case Models.EXPRESSION_ELEMENTS.op_exp:
  16672. 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)]);
  16673. expression_append_new_expression.push(exp);
  16674. break;
  16675. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16676. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16677. expression_append_new_expression.push(exp);
  16678. break;
  16679. }
  16680. renderExpressionElements(command, function_obj, el);
  16681. }
  16682. });
  16683. }
  16684. function renderElement(command, function_obj, el, expression_element) {
  16685. switch (expression_element.type_exp) {
  16686. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16687. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16688. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16689. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16690. el.append(temp_exp_1);
  16691. el.append(temp_op);
  16692. el.append(temp_exp_2);
  16693. if (expression_element.itens[0].type) {
  16694. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16695. } else {
  16696. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16697. }
  16698. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16699. if (expression_element.itens[2].type) {
  16700. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16701. } else {
  16702. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16703. }
  16704. break;
  16705. case Models.EXPRESSION_ELEMENTS.op_exp:
  16706. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16707. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16708. el.append(temp_op);
  16709. el.append(temp_exp);
  16710. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16711. if (expression_element.itens[1].type) {
  16712. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16713. } else {
  16714. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16715. }
  16716. break;
  16717. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16718. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16719. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16720. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16721. el.append(temp_par_1);
  16722. el.append(temp_exp);
  16723. for (var j = 0; j < expression_element.itens.length; j++) {
  16724. if (expression_element.itens[j].type) {
  16725. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16726. } else {
  16727. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16728. }
  16729. }
  16730. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16731. el.append(temp_par_2);
  16732. break;
  16733. }
  16734. }
  16735. function renderExpression(command, function_obj, el) {
  16736. var expression_div = el.find('.expression_elements');
  16737. expression_div.text('');
  16738. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16739. menu_add_item.data('index_add', 0);
  16740. expression_div.append(menu_add_item);
  16741. for (var i = 0; i < command.expression.length; i++) {
  16742. if (command.expression[i].type) {
  16743. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16744. temp.data('ref_element', command.expression[i]);
  16745. temp.data('ref_index', i);
  16746. expression_div.append(temp);
  16747. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16748. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16749. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16750. temp.data('ref_element', command.expression[i]);
  16751. temp.data('ref_index', i);
  16752. expression_div.append(temp);
  16753. } else {
  16754. var temp = '<div class="expression_element">';
  16755. switch (command.expression[i]) {
  16756. case Models.ARITHMETIC_TYPES.plus:
  16757. temp += '+';
  16758. break;
  16759. case Models.ARITHMETIC_TYPES.minus:
  16760. temp += '-';
  16761. break;
  16762. case Models.ARITHMETIC_TYPES.multiplication:
  16763. temp += '*';
  16764. break;
  16765. case Models.ARITHMETIC_TYPES.division:
  16766. temp += '/';
  16767. break;
  16768. case Models.ARITHMETIC_TYPES.module:
  16769. temp += '%';
  16770. break;
  16771. }
  16772. temp += '</div>';
  16773. temp = (0, _jquery2.default)(temp);
  16774. temp.data('ref_element', command.expression[i]);
  16775. temp.data('ref_index', i);
  16776. expression_div.append(temp);
  16777. }
  16778. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16779. var index_temp = i + 1;
  16780. menu_add_item_seq.data('index_add', index_temp);
  16781. expression_div.append(menu_add_item_seq);
  16782. }
  16783. addMenuItens(command, function_obj, el);
  16784. }
  16785. function addMenuItens(command, function_obj, expression_div) {
  16786. var divs_expression = expression_div.find('.menu_add_item');
  16787. for (var i = 0; i < divs_expression.length; i++) {
  16788. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16789. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16790. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16791. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16792. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16793. context_menu += '</div></div>';
  16794. context_menu = (0, _jquery2.default)(context_menu);
  16795. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16796. context_menu.dropdown({
  16797. on: 'hover',
  16798. onChange: function onChange(value, text, $selectedItem) {
  16799. switch ($selectedItem.data('option')) {
  16800. case "value":
  16801. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16802. renderExpression(command, function_obj, expression_div);
  16803. break;
  16804. case "operator":
  16805. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16806. renderExpression(command, function_obj, expression_div);
  16807. break;
  16808. case "parentheses":
  16809. command.expression.splice($selectedItem.data('index'), 0, "(");
  16810. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16811. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16812. renderExpression(command, function_obj, expression_div);
  16813. break;
  16814. }
  16815. }
  16816. });
  16817. }
  16818. }
  16819. function addHandlers(command, function_obj, attribution_dom) {
  16820. attribution_dom.find('.button_remove_command').on('click', function () {
  16821. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16822. attribution_dom.fadeOut();
  16823. }
  16824. });
  16825. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16826. renderExpressionElements(command, function_obj, attribution_dom);
  16827. });
  16828. }
  16829. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16830. /*console.log("recebido o seguinte DOM: ");
  16831. console.log(dom_object);
  16832. if (dom_object.hasClass('var_attributed')) {
  16833. return;
  16834. } else {
  16835. var hier = dom_object.parentsUntil(".command_container");
  16836. for (var i = 0; i < hier.length; i++) {
  16837. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16838. return;
  16839. }
  16840. }
  16841. }
  16842. dom_object.find('.context_menu_clear').remove();
  16843. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16844. for (var tm in Models.ARITHMETIC_TYPES) {
  16845. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  16846. }
  16847. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  16848. menu_operations += '</div></div>';
  16849. menu_operations = $(menu_operations);
  16850. dom_object.append(menu_operations);
  16851. menu_operations.dropdown({
  16852. onChange: function(value, text, $selectedItem) {
  16853. switch ($($selectedItem).data('option')) {
  16854. case "clear":
  16855. $(dom_object).text('');
  16856. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  16857. break;
  16858. default:
  16859. createExpressionAround(command, ref_object, dom_object, function_obj);
  16860. menu_operations.find('.text').text('');
  16861. }
  16862. }
  16863. });*/
  16864. }
  16865. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  16866. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  16867. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  16868. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  16869. }
  16870. /***/ }),
  16871. /***/ "./js/visualUI/commands/break.js":
  16872. /*!***************************************!*\
  16873. !*** ./js/visualUI/commands/break.js ***!
  16874. \***************************************/
  16875. /*! no static exports found */
  16876. /***/ (function(module, exports, __webpack_require__) {
  16877. "use strict";
  16878. Object.defineProperty(exports, "__esModule", {
  16879. value: true
  16880. });
  16881. exports.createFloatingCommand = createFloatingCommand;
  16882. exports.renderCommand = renderCommand;
  16883. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16884. var _jquery2 = _interopRequireDefault(_jquery);
  16885. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16886. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16887. var Models = _interopRequireWildcard(_ivprog_elements);
  16888. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16889. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16890. var CommandsManagement = _interopRequireWildcard(_commands);
  16891. 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; } }
  16892. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16893. function createFloatingCommand() {
  16894. 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>');
  16895. }
  16896. function renderCommand(command, function_obj) {
  16897. 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>');
  16898. el.data('command', command);
  16899. addHandlers(command, function_obj, el);
  16900. return el;
  16901. }
  16902. function addHandlers(command, function_obj, break_dom) {
  16903. break_dom.find('.button_remove_command').on('click', function () {
  16904. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  16905. break_dom.fadeOut();
  16906. }
  16907. });
  16908. }
  16909. /***/ }),
  16910. /***/ "./js/visualUI/commands/comment.js":
  16911. /*!*****************************************!*\
  16912. !*** ./js/visualUI/commands/comment.js ***!
  16913. \*****************************************/
  16914. /*! no static exports found */
  16915. /***/ (function(module, exports, __webpack_require__) {
  16916. "use strict";
  16917. Object.defineProperty(exports, "__esModule", {
  16918. value: true
  16919. });
  16920. exports.createFloatingCommand = createFloatingCommand;
  16921. exports.renderCommand = renderCommand;
  16922. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16923. var _jquery2 = _interopRequireDefault(_jquery);
  16924. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16925. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16926. var Models = _interopRequireWildcard(_ivprog_elements);
  16927. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16928. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16929. var GlobalsManagement = _interopRequireWildcard(_globals);
  16930. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16931. var VariablesManagement = _interopRequireWildcard(_variables);
  16932. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16933. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16934. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16935. var CommandsManagement = _interopRequireWildcard(_commands);
  16936. 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; } }
  16937. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16938. function createFloatingCommand() {
  16939. 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>');
  16940. }
  16941. function renderCommand(command, function_obj) {
  16942. 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>');
  16943. el.data('command', command);
  16944. addHandlers(command, function_obj, el);
  16945. renderTextComment(command, function_obj, el);
  16946. return el;
  16947. }
  16948. function renderTextComment(command, function_obj, el) {
  16949. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  16950. }
  16951. function addHandlers(command, function_obj, comment_dom) {
  16952. comment_dom.find('.button_remove_command').on('click', function () {
  16953. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  16954. comment_dom.fadeOut();
  16955. }
  16956. });
  16957. }
  16958. /***/ }),
  16959. /***/ "./js/visualUI/commands/conditional_expression.js":
  16960. /*!********************************************************!*\
  16961. !*** ./js/visualUI/commands/conditional_expression.js ***!
  16962. \********************************************************/
  16963. /*! no static exports found */
  16964. /***/ (function(module, exports, __webpack_require__) {
  16965. "use strict";
  16966. Object.defineProperty(exports, "__esModule", {
  16967. value: true
  16968. });
  16969. exports.renderExpression = renderExpression;
  16970. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16971. var _jquery2 = _interopRequireDefault(_jquery);
  16972. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16973. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16974. var Models = _interopRequireWildcard(_ivprog_elements);
  16975. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16976. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16977. var GlobalsManagement = _interopRequireWildcard(_globals);
  16978. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16979. var VariablesManagement = _interopRequireWildcard(_variables);
  16980. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16981. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16982. 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; } }
  16983. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16984. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  16985. if (expression.expression == null || expression.expression.length < 1) {
  16986. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  16987. } else {
  16988. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  16989. switch (expression.expression.type) {
  16990. case Models.EXPRESSION_TYPES.exp_logic:
  16991. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  16992. break;
  16993. case Models.EXPRESSION_TYPES.exp_arithmetic:
  16994. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  16995. break;
  16996. }
  16997. initial_el_to_render.append(main_div);
  16998. }
  16999. }
  17000. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  17001. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17002. menu_operator.dropdown({
  17003. values: [{
  17004. name: '>',
  17005. value: Models.ARITHMETIC_COMPARISON.greater_than,
  17006. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  17007. }, {
  17008. name: '<',
  17009. value: Models.ARITHMETIC_COMPARISON.less_than,
  17010. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  17011. }, {
  17012. name: '==',
  17013. value: Models.ARITHMETIC_COMPARISON.equals_to,
  17014. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  17015. }, {
  17016. name: '!=',
  17017. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  17018. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  17019. }, {
  17020. name: '>=',
  17021. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  17022. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  17023. }, {
  17024. name: '<=',
  17025. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  17026. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  17027. }],
  17028. onChange: function onChange(value, text, $selectedItem) {
  17029. expression_arithmetic.operator = value;
  17030. }
  17031. });
  17032. element_to_append.append(menu_operator);
  17033. }
  17034. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17035. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17036. menu_operator.dropdown({
  17037. values: [{
  17038. name: '==',
  17039. value: Models.LOGIC_COMPARISON.equals_to,
  17040. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17041. }, {
  17042. name: '!=',
  17043. value: Models.LOGIC_COMPARISON.not_equals_to,
  17044. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17045. }, {
  17046. name: '&&',
  17047. value: Models.LOGIC_COMPARISON.and,
  17048. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17049. }, {
  17050. name: '||',
  17051. value: Models.LOGIC_COMPARISON.or,
  17052. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17053. }],
  17054. onChange: function onChange(value, text, $selectedItem) {
  17055. if ($selectedItem) {
  17056. expression_logic.operator = value;
  17057. if (expression_logic.second_operand == null) {
  17058. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17059. initial_el_to_render.empty();
  17060. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17061. }
  17062. }
  17063. }
  17064. });
  17065. element_to_append.append(menu_operator);
  17066. }
  17067. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17068. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17069. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17070. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17071. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17072. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17073. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17074. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17075. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17076. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17077. } else {
  17078. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17079. }
  17080. element_to_append.append(exp_el_par_1);
  17081. element_to_append.append(exp_el_expr_el_1);
  17082. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17083. element_to_append.append(exp_el_expr_operand);
  17084. if (expression_logic.second_operand) {
  17085. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17086. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17087. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17088. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17089. } else {
  17090. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17091. }
  17092. element_to_append.append(exp_el_expr_el_2);
  17093. }
  17094. element_to_append.append(exp_el_par_2);
  17095. }
  17096. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17097. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17098. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17099. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17100. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17101. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17102. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17103. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17104. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17105. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17106. } else {
  17107. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17108. }
  17109. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17110. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17111. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17112. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17113. } else {
  17114. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17115. }
  17116. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17117. element_to_append.append(exp_el_par_1);
  17118. element_to_append.append(exp_el_expr_el_1);
  17119. element_to_append.append(exp_el_expr_operand);
  17120. element_to_append.append(exp_el_expr_el_2);
  17121. element_to_append.append(exp_el_par_2);
  17122. }
  17123. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17124. var start_menu = '';
  17125. 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">';
  17126. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  17127. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  17128. start_menu += '</div></div>';
  17129. start_menu = (0, _jquery2.default)(start_menu);
  17130. start_menu.dropdown({
  17131. onChange: function onChange(value, text, $selectedItem) {
  17132. switch ($selectedItem.data('exp')) {
  17133. case Models.EXPRESSION_TYPES.exp_logic:
  17134. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17135. break;
  17136. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17137. 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);
  17138. break;
  17139. }
  17140. initial_el_to_render.html('');
  17141. renderExpression(command, expression, function_obj, initial_el_to_render);
  17142. }
  17143. });
  17144. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17145. initial_el_to_render.append(start_menu);
  17146. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17147. }
  17148. /***/ }),
  17149. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17150. /*!*****************************************************!*\
  17151. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17152. \*****************************************************/
  17153. /*! no static exports found */
  17154. /***/ (function(module, exports, __webpack_require__) {
  17155. "use strict";
  17156. Object.defineProperty(exports, "__esModule", {
  17157. value: true
  17158. });
  17159. exports.renderMenu = renderMenu;
  17160. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17161. var _jquery2 = _interopRequireDefault(_jquery);
  17162. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17163. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17164. var Models = _interopRequireWildcard(_ivprog_elements);
  17165. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17166. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17167. var CommandsManagement = _interopRequireWildcard(_commands);
  17168. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17169. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17170. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17171. var SwitchManagement = _interopRequireWildcard(_switch);
  17172. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17173. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17174. 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; } }
  17175. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17176. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17177. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17178. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17179. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17180. } else {
  17181. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17182. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17183. }
  17184. menu_div += '</div></div>';
  17185. menu_div = (0, _jquery2.default)(menu_div);
  17186. dom_where_render.append(menu_div);
  17187. addHandlers(command, dom_where_render, function_obj, dom_command);
  17188. }
  17189. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17190. dom_where_render.find('.menu_commands').dropdown({
  17191. on: 'hover'
  17192. });
  17193. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17194. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17195. if (command.commands_block == null || command.commands_block.length == 0) {
  17196. command.commands_block = [];
  17197. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17198. command.commands_block.push(new_cmd);
  17199. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17200. } else {
  17201. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17202. }
  17203. } else {
  17204. switch ((0, _jquery2.default)(this).data('command')) {
  17205. case Models.COMMAND_TYPES.break:
  17206. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  17207. break;
  17208. case Models.COMMAND_TYPES.switchcase:
  17209. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17210. break;
  17211. }
  17212. }
  17213. });
  17214. }
  17215. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17216. if (command.cases == null) {
  17217. command.cases = [];
  17218. }
  17219. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17220. command.cases.push(sc);
  17221. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17222. }
  17223. /***/ }),
  17224. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17225. /*!*********************************************!*\
  17226. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17227. \*********************************************/
  17228. /*! no static exports found */
  17229. /***/ (function(module, exports, __webpack_require__) {
  17230. "use strict";
  17231. Object.defineProperty(exports, "__esModule", {
  17232. value: true
  17233. });
  17234. exports.createFloatingCommand = createFloatingCommand;
  17235. exports.renderCommand = renderCommand;
  17236. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17237. var _jquery2 = _interopRequireDefault(_jquery);
  17238. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17239. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17240. var Models = _interopRequireWildcard(_ivprog_elements);
  17241. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17242. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17243. var GlobalsManagement = _interopRequireWildcard(_globals);
  17244. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17245. var VariablesManagement = _interopRequireWildcard(_variables);
  17246. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17247. var CommandsManagement = _interopRequireWildcard(_commands);
  17248. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17249. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17250. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17251. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17252. 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; } }
  17253. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17254. function createFloatingCommand() {
  17255. 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>');
  17256. }
  17257. function renderCommand(command, function_obj) {
  17258. var ret = '';
  17259. 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>';
  17260. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17261. ret += '</div>';
  17262. 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>';
  17263. ret += '</div>';
  17264. var el = (0, _jquery2.default)(ret);
  17265. el.data('command', command);
  17266. addHandlers(command, function_obj, el);
  17267. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17268. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17269. if (command.commands_block) {
  17270. for (var j = 0; j < command.commands_block.length; j++) {
  17271. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17272. }
  17273. }
  17274. return el;
  17275. }
  17276. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17277. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17278. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17279. dowhiletrue_dom.fadeOut();
  17280. }
  17281. });
  17282. }
  17283. /***/ }),
  17284. /***/ "./js/visualUI/commands/functioncall.js":
  17285. /*!**********************************************!*\
  17286. !*** ./js/visualUI/commands/functioncall.js ***!
  17287. \**********************************************/
  17288. /*! no static exports found */
  17289. /***/ (function(module, exports, __webpack_require__) {
  17290. "use strict";
  17291. Object.defineProperty(exports, "__esModule", {
  17292. value: true
  17293. });
  17294. exports.createFloatingCommand = createFloatingCommand;
  17295. exports.renderCommand = renderCommand;
  17296. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17297. var _jquery2 = _interopRequireDefault(_jquery);
  17298. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17299. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17300. var Models = _interopRequireWildcard(_ivprog_elements);
  17301. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17302. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17303. var GlobalsManagement = _interopRequireWildcard(_globals);
  17304. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17305. var VariablesManagement = _interopRequireWildcard(_variables);
  17306. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17307. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17308. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17309. var CommandsManagement = _interopRequireWildcard(_commands);
  17310. 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; } }
  17311. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17312. function createFloatingCommand() {
  17313. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17314. }
  17315. function renderCommand(command, function_obj) {
  17316. 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>');
  17317. el.data('command', command);
  17318. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17319. addHandlers(command, function_obj, el);
  17320. return el;
  17321. }
  17322. function addHandlers(command, function_obj, functioncall_dom) {
  17323. functioncall_dom.find('.button_remove_command').on('click', function () {
  17324. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17325. functioncall_dom.fadeOut();
  17326. }
  17327. });
  17328. }
  17329. /***/ }),
  17330. /***/ "./js/visualUI/commands/iftrue.js":
  17331. /*!****************************************!*\
  17332. !*** ./js/visualUI/commands/iftrue.js ***!
  17333. \****************************************/
  17334. /*! no static exports found */
  17335. /***/ (function(module, exports, __webpack_require__) {
  17336. "use strict";
  17337. Object.defineProperty(exports, "__esModule", {
  17338. value: true
  17339. });
  17340. exports.createFloatingCommand = createFloatingCommand;
  17341. exports.renderCommand = renderCommand;
  17342. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17343. var _jquery2 = _interopRequireDefault(_jquery);
  17344. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17345. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17346. var Models = _interopRequireWildcard(_ivprog_elements);
  17347. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17348. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17349. var GlobalsManagement = _interopRequireWildcard(_globals);
  17350. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17351. var VariablesManagement = _interopRequireWildcard(_variables);
  17352. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17353. var CommandsManagement = _interopRequireWildcard(_commands);
  17354. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17355. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17356. 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; } }
  17357. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17358. function createFloatingCommand() {
  17359. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17360. }
  17361. function renderCommand(command, function_obj) {
  17362. var ret = '';
  17363. 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>';
  17364. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17365. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17366. ret += '<span> </span> ';
  17367. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17368. ret += '</div></div>';
  17369. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17370. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17371. ret += '</div>';
  17372. ret += '<span></span></div>';
  17373. ret += '</div>';
  17374. var el = (0, _jquery2.default)(ret);
  17375. el.data('command', command);
  17376. el.find('.block_commands').data('command', command);
  17377. el.find('.data_block_if').data('command', command);
  17378. el.find('.data_block_else').data('command', command);
  17379. addHandlers(command, function_obj, el);
  17380. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17381. if (command.commands_block) {
  17382. for (var j = 0; j < command.commands_block.length; j++) {
  17383. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17384. }
  17385. }
  17386. if (command.commands_else) {
  17387. for (var j = 0; j < command.commands_else.length; j++) {
  17388. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17389. }
  17390. }
  17391. return el;
  17392. }
  17393. function addHandlers(command, function_obj, iftrue_dom) {
  17394. iftrue_dom.find('.button_remove_command').on('click', function () {
  17395. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17396. iftrue_dom.fadeOut();
  17397. }
  17398. });
  17399. }
  17400. /***/ }),
  17401. /***/ "./js/visualUI/commands/reader.js":
  17402. /*!****************************************!*\
  17403. !*** ./js/visualUI/commands/reader.js ***!
  17404. \****************************************/
  17405. /*! no static exports found */
  17406. /***/ (function(module, exports, __webpack_require__) {
  17407. "use strict";
  17408. Object.defineProperty(exports, "__esModule", {
  17409. value: true
  17410. });
  17411. exports.createFloatingCommand = createFloatingCommand;
  17412. exports.renderCommand = renderCommand;
  17413. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17414. var _jquery2 = _interopRequireDefault(_jquery);
  17415. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17416. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17417. var Models = _interopRequireWildcard(_ivprog_elements);
  17418. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17419. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17420. var GlobalsManagement = _interopRequireWildcard(_globals);
  17421. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17422. var VariablesManagement = _interopRequireWildcard(_variables);
  17423. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17424. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17425. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17426. var CommandsManagement = _interopRequireWildcard(_commands);
  17427. 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; } }
  17428. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17429. function createFloatingCommand() {
  17430. 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>');
  17431. }
  17432. function renderCommand(command, function_obj) {
  17433. 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>';
  17434. el = (0, _jquery2.default)(el);
  17435. el.data('command', command);
  17436. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17437. addHandlers(command, function_obj, el);
  17438. return el;
  17439. }
  17440. function addHandlers(command, function_obj, reader_dom) {
  17441. reader_dom.find('.button_remove_command').on('click', function () {
  17442. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17443. reader_dom.fadeOut();
  17444. }
  17445. });
  17446. }
  17447. /***/ }),
  17448. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17449. /*!**********************************************!*\
  17450. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17451. \**********************************************/
  17452. /*! no static exports found */
  17453. /***/ (function(module, exports, __webpack_require__) {
  17454. "use strict";
  17455. Object.defineProperty(exports, "__esModule", {
  17456. value: true
  17457. });
  17458. exports.createFloatingCommand = createFloatingCommand;
  17459. exports.renderCommand = renderCommand;
  17460. exports.manageExpressionElements = manageExpressionElements;
  17461. exports.manageClearExpressionElements = manageClearExpressionElements;
  17462. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17463. var _jquery2 = _interopRequireDefault(_jquery);
  17464. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17465. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17466. var Models = _interopRequireWildcard(_ivprog_elements);
  17467. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17468. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17469. var GlobalsManagement = _interopRequireWildcard(_globals);
  17470. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17471. var VariablesManagement = _interopRequireWildcard(_variables);
  17472. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17473. var CommandsManagement = _interopRequireWildcard(_commands);
  17474. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17475. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17476. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17477. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17478. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17479. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17480. 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; } }
  17481. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17482. function createFloatingCommand() {
  17483. 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>');
  17484. }
  17485. function renderCommand(command, function_obj) {
  17486. 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>';
  17487. ret += '<div class="ui block_commands">';
  17488. ret += '</div>';
  17489. ret += '<span> </span>';
  17490. ret += '</div>';
  17491. var el = (0, _jquery2.default)(ret);
  17492. el.data('command', command);
  17493. addHandlers(command, function_obj, el);
  17494. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17495. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17496. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17497. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17498. if (command.expression1) {
  17499. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17500. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17501. }
  17502. if (command.expression3) {
  17503. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17504. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17505. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17506. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17507. }
  17508. if (command.commands_block) {
  17509. for (var j = 0; j < command.commands_block.length; j++) {
  17510. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17511. }
  17512. }
  17513. return el;
  17514. }
  17515. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17516. if (dom_object.hasClass('variable_attribution')) {
  17517. if (!command.expression3) {
  17518. 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)]);
  17519. command.expression3 = exp;
  17520. command.var_incrementation = command.var_attribution;
  17521. 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);
  17522. command.expression2.expression = cond_exp;
  17523. }
  17524. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17525. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17526. dom_object.parent().find('.var_value_expression').empty();
  17527. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17528. renderAlgorithm();
  17529. }
  17530. if (dom_object.hasClass('incrementation_variable')) {
  17531. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17532. 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)]);
  17533. command.expression3 = exp;
  17534. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17535. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17536. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17537. }
  17538. }
  17539. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17540. if (dom_object.hasClass('variable_attribution')) {
  17541. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17542. command.expression1 = null;
  17543. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17544. }
  17545. if (dom_object.hasClass('incrementation_variable')) {
  17546. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17547. command.expression3 = null;
  17548. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17549. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17550. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17551. }
  17552. }
  17553. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17554. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17555. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17556. repeatNtimes_dom.fadeOut();
  17557. }
  17558. });
  17559. }
  17560. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17561. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17562. menu_operator.dropdown({
  17563. values: [{
  17564. name: '+',
  17565. value: Models.ARITHMETIC_TYPES.plus,
  17566. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17567. }, {
  17568. name: '-',
  17569. value: Models.ARITHMETIC_TYPES.minus,
  17570. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17571. }, {
  17572. name: '*',
  17573. value: Models.ARITHMETIC_TYPES.multiplication,
  17574. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17575. }, {
  17576. name: '/',
  17577. value: Models.ARITHMETIC_TYPES.division,
  17578. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17579. }, {
  17580. name: '%',
  17581. value: Models.ARITHMETIC_TYPES.module,
  17582. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17583. }],
  17584. onChange: function onChange(value, text, $selectedItem) {
  17585. expression_element.itens[index_op] = value;
  17586. }
  17587. });
  17588. temp_op.append(menu_operator);
  17589. }
  17590. /***/ }),
  17591. /***/ "./js/visualUI/commands/return.js":
  17592. /*!****************************************!*\
  17593. !*** ./js/visualUI/commands/return.js ***!
  17594. \****************************************/
  17595. /*! no static exports found */
  17596. /***/ (function(module, exports, __webpack_require__) {
  17597. "use strict";
  17598. Object.defineProperty(exports, "__esModule", {
  17599. value: true
  17600. });
  17601. exports.createFloatingCommand = createFloatingCommand;
  17602. exports.renderCommand = renderCommand;
  17603. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17604. var _jquery2 = _interopRequireDefault(_jquery);
  17605. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17606. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17607. var Models = _interopRequireWildcard(_ivprog_elements);
  17608. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17609. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17610. var GlobalsManagement = _interopRequireWildcard(_globals);
  17611. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17612. var VariablesManagement = _interopRequireWildcard(_variables);
  17613. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17614. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17615. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17616. var CommandsManagement = _interopRequireWildcard(_commands);
  17617. 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; } }
  17618. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17619. function createFloatingCommand() {
  17620. 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>');
  17621. }
  17622. function renderCommand(command, function_obj) {
  17623. 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>');
  17624. el.data('command', command);
  17625. addHandlers(command, function_obj, el);
  17626. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17627. return el;
  17628. }
  17629. function addHandlers(command, function_obj, return_dom) {
  17630. return_dom.find('.button_remove_command').on('click', function () {
  17631. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17632. return_dom.fadeOut();
  17633. }
  17634. });
  17635. }
  17636. /***/ }),
  17637. /***/ "./js/visualUI/commands/switch.js":
  17638. /*!****************************************!*\
  17639. !*** ./js/visualUI/commands/switch.js ***!
  17640. \****************************************/
  17641. /*! no static exports found */
  17642. /***/ (function(module, exports, __webpack_require__) {
  17643. "use strict";
  17644. Object.defineProperty(exports, "__esModule", {
  17645. value: true
  17646. });
  17647. exports.createFloatingCommand = createFloatingCommand;
  17648. exports.renderCommand = renderCommand;
  17649. exports.renderCase = renderCase;
  17650. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17651. var _jquery2 = _interopRequireDefault(_jquery);
  17652. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17653. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17654. var Models = _interopRequireWildcard(_ivprog_elements);
  17655. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17656. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17657. var GlobalsManagement = _interopRequireWildcard(_globals);
  17658. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17659. var VariablesManagement = _interopRequireWildcard(_variables);
  17660. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17661. var CommandsManagement = _interopRequireWildcard(_commands);
  17662. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17663. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17664. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17665. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17666. 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; } }
  17667. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17668. function createFloatingCommand() {
  17669. 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>');
  17670. }
  17671. function renderCommand(command, function_obj) {
  17672. var ret = '';
  17673. 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>';
  17674. ret += '</div>';
  17675. var el = (0, _jquery2.default)(ret);
  17676. el.data('command', command);
  17677. addHandlers(command, function_obj, el);
  17678. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17679. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17680. if (command.cases) {
  17681. for (var i = 0; i < command.cases.length; i++) {
  17682. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17683. }
  17684. }
  17685. return el;
  17686. }
  17687. function renderCase(switchcase, command, function_obj, el) {
  17688. 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>');
  17689. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17690. casediv.data('switchcase', switchcase);
  17691. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17692. el.append(casediv);
  17693. if (switchcase.commands_block) {
  17694. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17695. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17696. }
  17697. }
  17698. casediv.find('.button_remove_command').on('click', function () {
  17699. for (var i = 0; i < command.cases.length; i++) {
  17700. if (switchcase == command.cases[i]) {
  17701. delete command.cases[i];
  17702. command.cases.splice(i, 1);
  17703. casediv.remove();
  17704. break;
  17705. }
  17706. }
  17707. });
  17708. }
  17709. function addHandlers(command, function_obj, switch_dom) {
  17710. switch_dom.find('.button_remove_command').on('click', function () {
  17711. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17712. switch_dom.fadeOut();
  17713. }
  17714. });
  17715. }
  17716. /***/ }),
  17717. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17718. /*!*****************************************************!*\
  17719. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17720. \*****************************************************/
  17721. /*! no static exports found */
  17722. /***/ (function(module, exports, __webpack_require__) {
  17723. "use strict";
  17724. Object.defineProperty(exports, "__esModule", {
  17725. value: true
  17726. });
  17727. exports.VAR_OR_VALUE_TYPES = undefined;
  17728. exports.renderMenu = renderMenu;
  17729. exports.refreshMenu = refreshMenu;
  17730. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17731. var _jquery2 = _interopRequireDefault(_jquery);
  17732. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17733. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17734. var Models = _interopRequireWildcard(_ivprog_elements);
  17735. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17736. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17737. var GlobalsManagement = _interopRequireWildcard(_globals);
  17738. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17739. var VariablesManagement = _interopRequireWildcard(_variables);
  17740. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17741. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17742. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17743. var WritersManagement = _interopRequireWildcard(_writer);
  17744. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17745. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17746. 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; } }
  17747. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17748. 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,
  17749. value_and_function: 6, all: 7 });
  17750. function renderMenu(command, ref_object, dom_object, function_obj) {
  17751. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17752. var expression_element = arguments[5];
  17753. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17754. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17755. if (ref_object.function_called) {
  17756. if (ref_object.function_called.parameters_list) {
  17757. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17758. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17759. ref_object.parameters_list.pop();
  17760. } else {
  17761. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17762. }
  17763. }
  17764. }
  17765. }
  17766. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-algo="12"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17767. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17768. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  17769. menu_var_or_value += '</div>';
  17770. }
  17771. 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) {
  17772. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17773. menu_var_or_value += '<div class="menu menu_only_vars">';
  17774. menu_var_or_value += '</div></div>';
  17775. }
  17776. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17777. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17778. }
  17779. 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) {
  17780. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17781. }
  17782. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17783. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  17784. menu_var_or_value += '</div>';
  17785. }
  17786. 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) {
  17787. 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');
  17788. menu_var_or_value += '<div class="menu menu_only_functions">';
  17789. menu_var_or_value += '</div></div>';
  17790. if (command.type == Models.COMMAND_TYPES.attribution) {
  17791. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17792. menu_var_or_value += '<div class="menu">';
  17793. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17794. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17795. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17796. menu_var_or_value += '</div></div>';
  17797. }
  17798. }
  17799. menu_var_or_value += '</div></div>';
  17800. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17801. dom_object.append(menu_var_or_value);
  17802. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17803. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17804. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17805. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17806. if (ref_object.content || ref_object.function_called) {
  17807. if (ref_object.content) {
  17808. // Verificar se a variável ainda existe:
  17809. if (isVarInProgram(ref_object.content, function_obj)) {
  17810. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17811. } else {
  17812. if (ref_object.content && ref_object.content.type) {
  17813. ref_object.content = null;
  17814. appendSelectText(ref_object, menu_var_or_value);
  17815. } else {
  17816. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17817. }
  17818. }
  17819. } else if (ref_object.function_called) {
  17820. // Verificar se a função ainda existe:
  17821. if (isFunctionInProgram(ref_object.function_called)) {
  17822. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17823. } else {
  17824. ref_object.content = null;
  17825. ref_object.row = null;
  17826. ref_object.column = null;
  17827. delete ref_object.function_called;
  17828. delete ref_object.parameters_list;
  17829. appendSelectText(ref_object, menu_var_or_value);
  17830. }
  17831. }
  17832. } else {
  17833. appendSelectText(ref_object, menu_var_or_value);
  17834. }
  17835. }
  17836. function appendSelectText(ref_object, menu_var_or_value) {
  17837. switch (ref_object.variable_and_value) {
  17838. case VAR_OR_VALUE_TYPES.only_variable:
  17839. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  17840. break;
  17841. case VAR_OR_VALUE_TYPES.all:
  17842. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17843. break;
  17844. case VAR_OR_VALUE_TYPES.variable_and_function:
  17845. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17846. break;
  17847. case VAR_OR_VALUE_TYPES.only_function:
  17848. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  17849. break;
  17850. }
  17851. }
  17852. function isFunctionInProgram(function_called_obj) {
  17853. if (window.program_obj.functions) {
  17854. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17855. if (window.program_obj.functions[i] == function_called_obj) {
  17856. return true;
  17857. }
  17858. }
  17859. }
  17860. return false;
  17861. }
  17862. function isVarInProgram(var_obj, function_obj) {
  17863. // Verify in locals:
  17864. if (function_obj.variables_list) {
  17865. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17866. if (function_obj.variables_list[i] == var_obj) {
  17867. return true;
  17868. }
  17869. }
  17870. }
  17871. // Verify in parameters:
  17872. if (function_obj.parameters_list) {
  17873. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17874. if (function_obj.parameters_list[i] == var_obj) {
  17875. return true;
  17876. }
  17877. }
  17878. }
  17879. // Verify in globals:
  17880. if (window.program_obj.globals) {
  17881. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17882. if (window.program_obj.globals[i] == var_obj) {
  17883. return true;
  17884. }
  17885. }
  17886. }
  17887. return false;
  17888. }
  17889. function refreshMenu(menu_var_or_value_dom) {
  17890. console.log('\n\n');
  17891. console.log(menu_var_or_value_dom);
  17892. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  17893. console.log(menu_var_or_value_dom.data());
  17894. console.log('\n\n\n');
  17895. }
  17896. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  17897. if (ref_object.function_called) {
  17898. menu_var_or_value.remove();
  17899. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17900. } else if (ref_object.content.type) {
  17901. menu_var_or_value.remove();
  17902. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17903. } else {
  17904. menu_var_or_value.remove();
  17905. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17906. }
  17907. }
  17908. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  17909. if (variable_obj.content || variable_obj.function_called) {
  17910. // Verificar se a variável ainda existe:
  17911. if (isVarInProgram(variable_obj.content, function_obj)) {} else {
  17912. if (variable_obj.content && variable_obj.content.type) {
  17913. variable_obj.content = null;
  17914. appendSelectText(variable_obj, menu_var_or_value);
  17915. }
  17916. }
  17917. } else {
  17918. appendSelectText(variable_obj, menu_var_or_value);
  17919. }
  17920. if (variable_obj.content == null && variable_obj.function_called == null) {
  17921. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17922. return;
  17923. }
  17924. var ret = '';
  17925. if (variable_obj.function_called) {
  17926. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  17927. menu_var_or_value.find('.text').text(' ');
  17928. dom_object.find('.menu_var_or_value_dom').remove();
  17929. var parameters_menu;
  17930. if (variable_obj.function_called.name) {
  17931. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17932. } else {
  17933. 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>';
  17934. }
  17935. parameters_menu += '<span> ) </span></div>';
  17936. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17937. dom_object.append(parameters_menu);
  17938. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17939. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17940. if (command.type == Models.COMMAND_TYPES.attribution) {
  17941. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17942. context_menu += '<div class="menu">';
  17943. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17944. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17945. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17946. context_menu += '</div></div>';
  17947. }
  17948. context_menu += '</div></div>';
  17949. context_menu = (0, _jquery2.default)(context_menu);
  17950. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  17951. context_menu.dropdown({
  17952. onChange: function onChange(value, text, $selectedItem) {
  17953. console.log('S1');
  17954. if ($selectedItem.data('clear')) {
  17955. console.log('PP1');
  17956. dom_object.text('');
  17957. variable_obj.content = null;
  17958. variable_obj.row = null;
  17959. variable_obj.column = null;
  17960. delete variable_obj.function_called;
  17961. delete variable_obj.parameters_list;
  17962. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17963. }
  17964. if ($selectedItem.data('exp')) {
  17965. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  17966. }
  17967. }
  17968. });
  17969. } else {
  17970. menu_var_or_value.find('.text').text(' ');
  17971. dom_object.find('.menu_var_or_value_dom').remove();
  17972. var parameters_menu;
  17973. if (variable_obj.function_called.name) {
  17974. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17975. } else {
  17976. 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>';
  17977. }
  17978. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17979. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  17980. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  17981. parameters_menu += ' , ';
  17982. }
  17983. }
  17984. parameters_menu += '<span> ) </span></div>';
  17985. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17986. dom_object.append(parameters_menu);
  17987. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17988. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  17989. }
  17990. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17991. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17992. if (command.type == Models.COMMAND_TYPES.attribution) {
  17993. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17994. context_menu += '<div class="menu">';
  17995. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17996. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17997. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17998. context_menu += '</div></div>';
  17999. }
  18000. context_menu += '</div></div>';
  18001. context_menu = (0, _jquery2.default)(context_menu);
  18002. context_menu.insertAfter(parameters_menu);
  18003. context_menu.dropdown({
  18004. onChange: function onChange(value, text, $selectedItem) {
  18005. console.log('S2');
  18006. if ($selectedItem.data('clear')) {
  18007. console.log('PP2');
  18008. dom_object.text('');
  18009. variable_obj.content = null;
  18010. variable_obj.row = null;
  18011. variable_obj.column = null;
  18012. delete variable_obj.function_called;
  18013. delete variable_obj.parameters_list;
  18014. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18015. }
  18016. if ($selectedItem.data('exp')) {
  18017. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18018. }
  18019. }
  18020. });
  18021. }
  18022. } else if (variable_obj.content.type) {
  18023. var variable_render = "";
  18024. if (variable_obj.content.dimensions == 1) {
  18025. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18026. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18027. variable_render += '</div>';
  18028. variable_render = (0, _jquery2.default)(variable_render);
  18029. dom_object.append(variable_render);
  18030. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18031. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18032. if (command.type == Models.COMMAND_TYPES.attribution) {
  18033. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18034. context_menu += '<div class="menu">';
  18035. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18036. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18037. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18038. context_menu += '</div></div>';
  18039. }
  18040. context_menu += '</div></div>';
  18041. context_menu = (0, _jquery2.default)(context_menu);
  18042. variable_render.append(context_menu);
  18043. context_menu.dropdown({
  18044. onChange: function onChange(value, text, $selectedItem) {
  18045. console.log('S3');
  18046. if ($selectedItem.data('clear')) {
  18047. console.log('PP3');
  18048. dom_object.text('');
  18049. variable_obj.content = null;
  18050. variable_obj.row = null;
  18051. variable_obj.column = null;
  18052. delete variable_obj.function_called;
  18053. delete variable_obj.parameters_list;
  18054. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18055. }
  18056. if ($selectedItem.data('exp')) {
  18057. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18058. }
  18059. }
  18060. });
  18061. if (!variable_obj.column) {
  18062. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18063. }
  18064. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18065. } else if (variable_obj.content.dimensions == 2) {
  18066. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18067. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18068. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18069. variable_render += '</div>';
  18070. variable_render = (0, _jquery2.default)(variable_render);
  18071. dom_object.append(variable_render);
  18072. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18073. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18074. if (command.type == Models.COMMAND_TYPES.attribution) {
  18075. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18076. context_menu += '<div class="menu">';
  18077. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18078. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18079. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18080. context_menu += '</div></div>';
  18081. }
  18082. context_menu += '</div></div>';
  18083. context_menu = (0, _jquery2.default)(context_menu);
  18084. variable_render.append(context_menu);
  18085. context_menu.dropdown({
  18086. onChange: function onChange(value, text, $selectedItem) {
  18087. console.log('S4');
  18088. if ($selectedItem.data('clear')) {
  18089. console.log('PP4');
  18090. dom_object.text('');
  18091. variable_obj.content = null;
  18092. variable_obj.row = null;
  18093. variable_obj.column = null;
  18094. delete variable_obj.function_called;
  18095. delete variable_obj.parameters_list;
  18096. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18097. }
  18098. if ($selectedItem.data('exp')) {
  18099. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18100. }
  18101. }
  18102. });
  18103. if (!variable_obj.column) {
  18104. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18105. }
  18106. if (!variable_obj.row) {
  18107. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18108. }
  18109. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18110. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18111. } else {
  18112. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18113. variable_render += '</div>';
  18114. variable_render = (0, _jquery2.default)(variable_render);
  18115. dom_object.append(variable_render);
  18116. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18117. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18118. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18119. console.log('dom_object6');
  18120. console.log(dom_object);
  18121. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18122. context_menu += '<div class="menu">';
  18123. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18124. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18125. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18126. context_menu += '</div></div>';
  18127. }
  18128. context_menu += '</div></div>';
  18129. context_menu = (0, _jquery2.default)(context_menu);
  18130. variable_render.append(context_menu);
  18131. context_menu.dropdown({
  18132. onChange: function onChange(value, text, $selectedItem) {
  18133. console.log('S5');
  18134. if ($selectedItem.data('clear')) {
  18135. console.log('PP5');
  18136. dom_object.text('');
  18137. variable_obj.content = null;
  18138. variable_obj.row = null;
  18139. variable_obj.column = null;
  18140. delete variable_obj.function_called;
  18141. delete variable_obj.parameters_list;
  18142. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18143. }
  18144. if ($selectedItem.data('exp')) {
  18145. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18146. }
  18147. }
  18148. });
  18149. }
  18150. } else {
  18151. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18152. variable_render += '</div>';
  18153. variable_render = (0, _jquery2.default)(variable_render);
  18154. dom_object.append(variable_render);
  18155. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18156. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18157. if (command.type == Models.COMMAND_TYPES.attribution) {
  18158. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18159. context_menu += '<div class="menu">';
  18160. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18161. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18162. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18163. context_menu += '</div></div>';
  18164. }
  18165. context_menu += '</div></div>';
  18166. context_menu = (0, _jquery2.default)(context_menu);
  18167. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18168. context_menu.insertAfter(variable_render);
  18169. }
  18170. context_menu.dropdown({
  18171. onChange: function onChange(value, text, $selectedItem) {
  18172. console.log('S6');
  18173. if ($selectedItem.data('clear')) {
  18174. console.log('PP6');
  18175. dom_object.text('');
  18176. variable_obj.content = null;
  18177. variable_obj.row = null;
  18178. variable_obj.column = null;
  18179. delete variable_obj.function_called;
  18180. delete variable_obj.parameters_list;
  18181. dom_object.find('.value_rendered').remove();
  18182. dom_object.find('.context_menu_clear').remove();
  18183. dom_object.find('.width-dynamic-minus').remove();
  18184. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18185. }
  18186. if ($selectedItem.data('exp')) {
  18187. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18188. }
  18189. }
  18190. });
  18191. variable_render.on('click', function (e) {
  18192. variable_render.remove();
  18193. variable_render.empty();
  18194. variable_render.remove();
  18195. dom_object.empty();
  18196. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18197. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18198. });
  18199. }
  18200. }
  18201. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18202. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18203. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18204. 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>');
  18205. 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>');
  18206. 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>');
  18207. 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>');
  18208. // Insert Math functions:
  18209. for (var i = 0; i < window.system_functions.length; i++) {
  18210. var t = (0, _jquery2.default)('<div class="item"></div>');
  18211. t.data('function_reference', window.system_functions[i]);
  18212. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18213. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18214. switch (window.system_functions[i].category) {
  18215. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18216. sub_menu.find('.menu_math_functions').append(t);
  18217. break;
  18218. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18219. sub_menu.find('.menu_text_functions').append(t);
  18220. break;
  18221. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18222. sub_menu.find('.menu_arrangement_functions').append(t);
  18223. break;
  18224. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18225. sub_menu.find('.menu_conversion_functions').append(t);
  18226. break;
  18227. }
  18228. }
  18229. }
  18230. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18231. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18232. sub_menu.text('');
  18233. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18234. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18235. temp.data('function_reference', window.program_obj.functions[i]);
  18236. sub_menu.append(temp);
  18237. }
  18238. }
  18239. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18240. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18241. sub_menu.text('');
  18242. if (window.program_obj.globals) {
  18243. if (ref_object.include_constant) {
  18244. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18245. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18246. temp.data('variable_reference', window.program_obj.globals[i]);
  18247. sub_menu.append(temp);
  18248. }
  18249. } else {
  18250. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18251. if (!window.program_obj.globals[i].is_constant) {
  18252. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18253. temp.data('variable_reference', window.program_obj.globals[i]);
  18254. sub_menu.append(temp);
  18255. }
  18256. }
  18257. }
  18258. }
  18259. if (function_obj.parameters_list) {
  18260. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18261. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18262. temp.data('variable_reference', function_obj.parameters_list[i]);
  18263. sub_menu.append(temp);
  18264. }
  18265. }
  18266. if (function_obj.variables_list) {
  18267. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18268. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18269. temp.data('variable_reference', function_obj.variables_list[i]);
  18270. sub_menu.append(temp);
  18271. }
  18272. }
  18273. }
  18274. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18275. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18276. menu_var_or_value.dropdown({
  18277. onChange: function onChange(value, text, $selectedItem) {
  18278. console.log('S7');
  18279. dom_object.find('.var_name').remove();
  18280. switch ($selectedItem.data('option')) {
  18281. case VAR_OR_VALUE_TYPES.only_function:
  18282. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18283. break;
  18284. case VAR_OR_VALUE_TYPES.only_value:
  18285. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18286. break;
  18287. case VAR_OR_VALUE_TYPES.only_variable:
  18288. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18289. break;
  18290. }
  18291. if ($selectedItem.data('exp')) {
  18292. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18293. }
  18294. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18295. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18296. }
  18297. }
  18298. });
  18299. }
  18300. dom_object.find('.width-dynamic').on('input', function () {
  18301. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18302. (0, _jquery2.default)(this).focus();
  18303. var tmpStr = (0, _jquery2.default)(this).val();
  18304. (0, _jquery2.default)(this).val('');
  18305. (0, _jquery2.default)(this).val(tmpStr);
  18306. (0, _jquery2.default)(this).css({
  18307. width: inputWidth
  18308. });
  18309. }).trigger('input');
  18310. if (command.type == Models.COMMAND_TYPES.comment) {
  18311. dom_object.parent().on('click', function (e) {
  18312. dom_object.find('.value_rendered').remove();
  18313. dom_object.find('.value_rendered').empty();
  18314. dom_object.find('.value_rendered').remove();
  18315. dom_object.empty();
  18316. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18317. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18318. });
  18319. }
  18320. }
  18321. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18322. ref_object.function_called = function_selected;
  18323. ref_object.parameters_list = [];
  18324. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18325. menu_var_or_value.find('.text').text(' ');
  18326. dom_object.find('.menu_var_or_value_dom').remove();
  18327. var parameters_menu;
  18328. if (function_selected.name) {
  18329. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18330. } else {
  18331. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18332. }
  18333. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18334. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18335. if (j + 1 != function_selected.parameters_list.length) {
  18336. parameters_menu += ' , ';
  18337. }
  18338. }
  18339. parameters_menu += '<span> ) </span></div>';
  18340. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18341. dom_object.append(parameters_menu);
  18342. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18343. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18344. ref_object.parameters_list.push(temp);
  18345. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18346. }
  18347. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18348. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18349. if (command.type == Models.COMMAND_TYPES.attribution) {
  18350. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18351. context_menu += '<div class="menu">';
  18352. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18353. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18354. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18355. context_menu += '</div></div>';
  18356. }
  18357. context_menu += '</div></div>';
  18358. context_menu = (0, _jquery2.default)(context_menu);
  18359. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18360. context_menu.dropdown({
  18361. onChange: function onChange(value, text, $selectedItem) {
  18362. console.log('S8');
  18363. if ($selectedItem.data('clear')) {
  18364. console.log('PP7');
  18365. dom_object.text('');
  18366. ref_object.content = null;
  18367. ref_object.row = null;
  18368. ref_object.column = null;
  18369. delete ref_object.function_called;
  18370. delete ref_object.parameters_list;
  18371. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18372. }
  18373. if ($selectedItem.data('exp')) {
  18374. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18375. }
  18376. }
  18377. });
  18378. } else {
  18379. menu_var_or_value.find('.text').text(' ');
  18380. dom_object.find('.menu_var_or_value_dom').remove();
  18381. var parameters_menu;
  18382. if (function_selected.name) {
  18383. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18384. } else {
  18385. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18386. }
  18387. parameters_menu += '<span> ) </span></div>';
  18388. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18389. dom_object.append(parameters_menu);
  18390. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18391. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18392. if (command.type == Models.COMMAND_TYPES.attribution) {
  18393. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18394. context_menu += '<div class="menu">';
  18395. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18396. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18397. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18398. context_menu += '</div></div>';
  18399. }
  18400. context_menu += '</div></div>';
  18401. context_menu = (0, _jquery2.default)(context_menu);
  18402. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18403. context_menu.dropdown({
  18404. onChange: function onChange(value, text, $selectedItem) {
  18405. console.log('S9');
  18406. if ($selectedItem.data('clear')) {
  18407. console.log('PP8');
  18408. dom_object.text('');
  18409. ref_object.content = null;
  18410. ref_object.row = null;
  18411. ref_object.column = null;
  18412. delete ref_object.function_called;
  18413. delete ref_object.parameters_list;
  18414. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18415. }
  18416. if ($selectedItem.data('exp')) {
  18417. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18418. }
  18419. }
  18420. });
  18421. }
  18422. if (command.type == Models.COMMAND_TYPES.attribution) {
  18423. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18424. }
  18425. }
  18426. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18427. ref_object.content = variable_selected;
  18428. menu_var_or_value.find('.text').text(' ');
  18429. dom_object.find('.menu_var_or_value_dom').remove();
  18430. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18431. if (variable_selected.dimensions == 1) {
  18432. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18433. }
  18434. if (variable_selected.dimensions == 2) {
  18435. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18436. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18437. }
  18438. variable_render += '</div>';
  18439. variable_render = (0, _jquery2.default)(variable_render);
  18440. dom_object.append(variable_render);
  18441. if (variable_selected.dimensions == 1) {
  18442. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18443. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18444. }
  18445. if (variable_selected.dimensions == 2) {
  18446. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18447. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18448. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18449. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18450. }
  18451. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18452. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18453. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18454. console.log("dom_object 10: ");
  18455. console.log(dom_object);
  18456. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18457. context_menu += '<div class="menu">';
  18458. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18459. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18460. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18461. context_menu += '</div></div>';
  18462. }
  18463. context_menu += '</div></div>';
  18464. context_menu = (0, _jquery2.default)(context_menu);
  18465. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18466. context_menu.dropdown({
  18467. onChange: function onChange(value, text, $selectedItem) {
  18468. console.log('S10');
  18469. if ($selectedItem.data('clear')) {
  18470. console.log('PP9');
  18471. dom_object.text('');
  18472. ref_object.content = null;
  18473. ref_object.row = null;
  18474. ref_object.column = null;
  18475. delete ref_object.function_called;
  18476. delete ref_object.parameters_list;
  18477. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18478. }
  18479. if ($selectedItem.data('exp')) {
  18480. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18481. }
  18482. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18483. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18484. }
  18485. }
  18486. });
  18487. if (command.type == Models.COMMAND_TYPES.attribution) {
  18488. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18489. }
  18490. }
  18491. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18492. if (ref_object.content == null) {
  18493. ref_object.content = "";
  18494. }
  18495. menu_var_or_value.find('.text').text(' ');
  18496. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18497. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18498. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18499. rendered.insertBefore(field);
  18500. field.focus();
  18501. field.val(ref_object.content);
  18502. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18503. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18504. if (command.type == Models.COMMAND_TYPES.attribution) {
  18505. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18506. context_menu += '<div class="menu">';
  18507. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18508. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18509. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18510. context_menu += '</div></div>';
  18511. }
  18512. context_menu += '</div></div>';
  18513. context_menu = (0, _jquery2.default)(context_menu);
  18514. dom_object.find('.menu_var_or_value_dom').remove();
  18515. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18516. context_menu.insertAfter(field);
  18517. }
  18518. context_menu.dropdown({
  18519. onChange: function onChange(value, text, $selectedItem) {
  18520. console.log('S11');
  18521. if ($selectedItem.data('clear')) {
  18522. console.log('PP10');
  18523. dom_object.text('');
  18524. dom_object.find('.value_rendered').remove();
  18525. dom_object.find('.context_menu_clear').remove();
  18526. dom_object.find('.width-dynamic-minus').remove();
  18527. ref_object.content = null;
  18528. ref_object.row = null;
  18529. ref_object.column = null;
  18530. delete ref_object.function_called;
  18531. delete ref_object.parameters_list;
  18532. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18533. }
  18534. if ($selectedItem.data('exp')) {
  18535. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18536. }
  18537. }
  18538. });
  18539. dom_object.find('.width-dynamic-minus').focusout(function () {
  18540. if ((0, _jquery2.default)(this).val().trim()) {
  18541. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18542. }
  18543. rendered.text(ref_object.content);
  18544. (0, _jquery2.default)(this).remove();
  18545. });
  18546. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18547. var code = e.keyCode || e.which;
  18548. if (code == 13) {
  18549. if ((0, _jquery2.default)(this).val().trim()) {
  18550. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18551. }
  18552. rendered.text(ref_object.content);
  18553. (0, _jquery2.default)(this).remove();
  18554. }
  18555. if (code == 27) {
  18556. rendered.text(ref_object.content);
  18557. (0, _jquery2.default)(this).remove();
  18558. }
  18559. });
  18560. if (command.type == Models.COMMAND_TYPES.comment) {
  18561. rendered.parent().on('click', function (e) {
  18562. console.log("TTT14");
  18563. rendered.remove();
  18564. rendered.empty();
  18565. rendered.remove();
  18566. dom_object.empty();
  18567. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18568. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18569. });
  18570. }
  18571. rendered.on('click', function (e) {
  18572. console.log("TTT2");
  18573. rendered.remove();
  18574. rendered.empty();
  18575. rendered.remove();
  18576. dom_object.empty();
  18577. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18578. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18579. });
  18580. if (command.type == Models.COMMAND_TYPES.attribution) {
  18581. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18582. }
  18583. }
  18584. _jquery2.default.fn.textWidth = function (text, font) {
  18585. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18586. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18587. return _jquery2.default.fn.textWidth.fakeEl.width();
  18588. };
  18589. /***/ }),
  18590. /***/ "./js/visualUI/commands/whiletrue.js":
  18591. /*!*******************************************!*\
  18592. !*** ./js/visualUI/commands/whiletrue.js ***!
  18593. \*******************************************/
  18594. /*! no static exports found */
  18595. /***/ (function(module, exports, __webpack_require__) {
  18596. "use strict";
  18597. Object.defineProperty(exports, "__esModule", {
  18598. value: true
  18599. });
  18600. exports.createFloatingCommand = createFloatingCommand;
  18601. exports.renderCommand = renderCommand;
  18602. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18603. var _jquery2 = _interopRequireDefault(_jquery);
  18604. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18605. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18606. var Models = _interopRequireWildcard(_ivprog_elements);
  18607. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18608. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18609. var GlobalsManagement = _interopRequireWildcard(_globals);
  18610. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18611. var VariablesManagement = _interopRequireWildcard(_variables);
  18612. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18613. var CommandsManagement = _interopRequireWildcard(_commands);
  18614. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18615. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18616. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18617. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18618. 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; } }
  18619. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18620. function createFloatingCommand() {
  18621. 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>');
  18622. }
  18623. function renderCommand(command, function_obj) {
  18624. var ret = '';
  18625. 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>';
  18626. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18627. ret += ' </span>';
  18628. ret += '<div class="ui block_commands">';
  18629. ret += '</div>';
  18630. ret += '<span> </span>';
  18631. ret += '</div>';
  18632. var el = (0, _jquery2.default)(ret);
  18633. el.data('command', command);
  18634. addHandlers(command, function_obj, el);
  18635. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18636. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18637. if (command.commands_block) {
  18638. for (var j = 0; j < command.commands_block.length; j++) {
  18639. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18640. }
  18641. }
  18642. return el;
  18643. }
  18644. function addHandlers(command, function_obj, whiletrue_dom) {
  18645. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18646. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18647. whiletrue_dom.fadeOut();
  18648. }
  18649. });
  18650. }
  18651. /***/ }),
  18652. /***/ "./js/visualUI/commands/writer.js":
  18653. /*!****************************************!*\
  18654. !*** ./js/visualUI/commands/writer.js ***!
  18655. \****************************************/
  18656. /*! no static exports found */
  18657. /***/ (function(module, exports, __webpack_require__) {
  18658. "use strict";
  18659. Object.defineProperty(exports, "__esModule", {
  18660. value: true
  18661. });
  18662. exports.createFloatingCommand = createFloatingCommand;
  18663. exports.renderCommand = renderCommand;
  18664. exports.addContent = addContent;
  18665. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18666. var _jquery2 = _interopRequireDefault(_jquery);
  18667. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18668. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18669. var Models = _interopRequireWildcard(_ivprog_elements);
  18670. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18671. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18672. var GlobalsManagement = _interopRequireWildcard(_globals);
  18673. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18674. var VariablesManagement = _interopRequireWildcard(_variables);
  18675. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18676. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18677. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18678. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18679. var CommandsManagement = _interopRequireWildcard(_commands);
  18680. 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; } }
  18681. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18682. function createFloatingCommand() {
  18683. 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>');
  18684. }
  18685. function renderCommand(command, function_obj) {
  18686. var ret = '';
  18687. 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>';
  18688. var el = (0, _jquery2.default)(ret);
  18689. el.data('command', command);
  18690. for (var i = 0; i < command.content.length; i++) {
  18691. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18692. el.find('.all_elements_write').append(new_div_item);
  18693. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18694. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18695. }
  18696. addHandlers(command, function_obj, el);
  18697. return el;
  18698. }
  18699. function addHandlers(command, function_obj, writer_dom) {
  18700. writer_dom.find('.button_remove_command').on('click', function () {
  18701. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18702. writer_dom.fadeOut();
  18703. }
  18704. });
  18705. }
  18706. function addHandlerIconAdd(dom_object, command, function_obj) {
  18707. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18708. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18709. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18710. if (!insert_after) {
  18711. dom_object.append(icon_add_item);
  18712. } else {
  18713. icon_add_item.insertAfter(after_which);
  18714. }
  18715. icon_add_item.on('click', function (e) {
  18716. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div" style="display:none;"></div>');
  18717. new_div_item.insertAfter(icon_add_item);
  18718. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18719. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18720. addHandlerIconAdd(dom_object, command, function_obj, true, new_div_item);
  18721. var pos = 1;
  18722. dom_object.find('.icon_add_item_to_writer').each(function () {
  18723. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  18724. command.content.splice(pos, 0, new_related_menu);
  18725. } else {
  18726. pos++;
  18727. }
  18728. });
  18729. new_div_item.fadeIn();
  18730. });
  18731. }
  18732. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  18733. if (dom_object.hasClass('var_value_menu_div')) {
  18734. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18735. icon_add_item.insertAfter(dom_object);
  18736. icon_add_item.on('click', function (e) {
  18737. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18738. new_div_item.insertAfter(icon_add_item);
  18739. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18740. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18741. command.content.push(new_related_menu);
  18742. });
  18743. }
  18744. }
  18745. /***/ }),
  18746. /***/ "./js/visualUI/functions.js":
  18747. /*!**********************************!*\
  18748. !*** ./js/visualUI/functions.js ***!
  18749. \**********************************/
  18750. /*! no static exports found */
  18751. /***/ (function(module, exports, __webpack_require__) {
  18752. "use strict";
  18753. Object.defineProperty(exports, "__esModule", {
  18754. value: true
  18755. });
  18756. exports.renderFunction = renderFunction;
  18757. exports.initVisualUI = initVisualUI;
  18758. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18759. var _jquery2 = _interopRequireDefault(_jquery);
  18760. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18761. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18762. var Models = _interopRequireWildcard(_ivprog_elements);
  18763. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18764. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  18765. var GlobalsManagement = _interopRequireWildcard(_globals);
  18766. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  18767. var VariablesManagement = _interopRequireWildcard(_variables);
  18768. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  18769. var CommandsManagement = _interopRequireWildcard(_commands);
  18770. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  18771. var CodeManagement = _interopRequireWildcard(_code_generator);
  18772. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18773. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18774. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  18775. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  18776. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  18777. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18778. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18779. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  18780. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  18781. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18782. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18783. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  18784. 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; } }
  18785. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18786. var counter_new_functions = 0;
  18787. var counter_new_parameters = 0;
  18788. var studentTemp = null;
  18789. var domConsole = null;
  18790. window.studentGrade = null;
  18791. var program = new Models.Program();
  18792. window.system_functions = [];
  18793. // Adding math functions:
  18794. 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));
  18795. 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));
  18796. 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));
  18797. 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));
  18798. 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));
  18799. 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));
  18800. 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));
  18801. 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));
  18802. 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));
  18803. 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));
  18804. 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));
  18805. // Adding text functions:
  18806. 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));
  18807. 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));
  18808. 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));
  18809. 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));
  18810. 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));
  18811. // Adding arrangement functions:
  18812. window.system_functions.push(new Models.SystemFunction('$numElements', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18813. window.system_functions.push(new Models.SystemFunction('$matrixLines', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18814. window.system_functions.push(new Models.SystemFunction('$matrixColumns', _types.Types.INTEGER, 0, [new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, null, null, null, true)], null, Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement));
  18815. // Adding conversion functions:
  18816. 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));
  18817. 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));
  18818. 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));
  18819. 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));
  18820. 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));
  18821. 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));
  18822. 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));
  18823. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  18824. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  18825. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  18826. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  18827. program.addFunction(sumFunction);
  18828. */
  18829. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  18830. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  18831. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  18832. program.addFunction(mainFunction);
  18833. window.program_obj = program;
  18834. window.generator = CodeManagement.generate;
  18835. window.runCodeAssessment = runCodeAssessment;
  18836. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  18837. window.insertContext = false;
  18838. _melankeWatchjs2.default.watch(program.globals, function () {
  18839. if (window.insertContext) {
  18840. setTimeout(function () {
  18841. AlgorithmManagement.renderAlgorithm();
  18842. }, 300);
  18843. window.insertContext = false;
  18844. } else {
  18845. AlgorithmManagement.renderAlgorithm();
  18846. }
  18847. }, 1);
  18848. function addFunctionHandler() {
  18849. 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')));
  18850. program.addFunction(new_function);
  18851. counter_new_functions++;
  18852. var newe = renderFunction(new_function);
  18853. newe.css('display', 'none');
  18854. newe.fadeIn();
  18855. }
  18856. function addParameter(function_obj, function_container) {
  18857. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  18858. if (function_obj.parameters_list == null) {
  18859. function_obj.parameters_list = [];
  18860. }
  18861. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  18862. function_obj.parameters_list.push(new_parameter);
  18863. counter_new_parameters++;
  18864. var newe = renderParameter(function_obj, new_parameter, function_container);
  18865. if (is_from_click) {
  18866. newe.css('display', 'none');
  18867. newe.fadeIn();
  18868. }
  18869. }
  18870. function updateReturnType(function_obj, new_type) {
  18871. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18872. function_obj.return_type = new_type;
  18873. function_obj.return_dimensions = new_dimensions;
  18874. }
  18875. function removeFunction(function_obj) {
  18876. var index = program.functions.indexOf(function_obj);
  18877. if (index > -1) {
  18878. program.functions.splice(index, 1);
  18879. }
  18880. }
  18881. function minimizeFunction(function_obj) {
  18882. function_obj.is_hidden = !function_obj.is_hidden;
  18883. }
  18884. function addHandlers(function_obj, function_container) {
  18885. function_container.find('.ui.dropdown.function_return').dropdown({
  18886. onChange: function onChange(value, text, $selectedItem) {
  18887. if ($selectedItem.data('dimensions')) {
  18888. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18889. } else {
  18890. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  18891. }
  18892. }
  18893. });
  18894. function_container.find(".name_function_updated").on('click', function (e) {
  18895. enableNameFunctionUpdate(function_obj, function_container);
  18896. });
  18897. function_container.find(".add_parameter_button").on('click', function (e) {
  18898. window.insertContext = true;
  18899. addParameter(function_obj, function_container, true);
  18900. });
  18901. function_container.find('.menu_commands').dropdown({
  18902. on: 'hover'
  18903. });
  18904. function_container.find('.menu_commands a').on('click', function (evt) {
  18905. if (function_obj.commands == null || function_obj.commands.length == 0) {
  18906. function_obj.commands = [];
  18907. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  18908. function_obj.commands.push(new_cmd);
  18909. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  18910. } else {
  18911. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  18912. }
  18913. });
  18914. function_container.find('.add_var_button_function').on('click', function (e) {
  18915. window.insertContext = true;
  18916. VariablesManagement.addVariable(function_obj, function_container, true);
  18917. });
  18918. function_container.find('.remove_function_button').on('click', function (e) {
  18919. removeFunction(function_obj);
  18920. function_container.fadeOut();
  18921. });
  18922. function_container.find('.minimize_function_button').on('click', function (e) {
  18923. minimizeFunction(function_obj);
  18924. if (function_obj.is_hidden) {
  18925. function_container.find(".add_var_button_function").toggle();
  18926. function_container.find(".inline_add_command").toggle();
  18927. function_container.find(".function_area").slideToggle();
  18928. } else {
  18929. function_container.find(".function_area").slideToggle(function () {
  18930. function_container.find(".add_var_button_function").toggle();
  18931. function_container.find(".inline_add_command").toggle();
  18932. });
  18933. }
  18934. });
  18935. }
  18936. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  18937. function renderFunctionReturn(function_obj, function_element) {
  18938. var ret = '<div class="ui dropdown function_return">';
  18939. if (function_obj.return_dimensions > 0) {
  18940. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  18941. if (function_obj.return_dimensions == 1) {
  18942. ret += ' [ ] ';
  18943. } else {
  18944. ret += ' [ ] [ ] ';
  18945. }
  18946. ret += '</div>';
  18947. } else {
  18948. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  18949. }
  18950. ret += '<div class="menu">';
  18951. for (var tm in _types.Types) {
  18952. 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>';
  18953. }
  18954. for (var tm in _types.Types) {
  18955. if (tm == _types.Types.VOID.toUpperCase()) {
  18956. continue;
  18957. }
  18958. 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>';
  18959. }
  18960. ret += '</div></div>';
  18961. ret = (0, _jquery2.default)(ret);
  18962. function_element.find('.function_return').append(ret);
  18963. }
  18964. function renderFunction(function_obj) {
  18965. var appender = '<div class="ui secondary segment function_div list-group-item">';
  18966. if (function_obj.function_comment) {
  18967. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  18968. }
  18969. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  18970. 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>';
  18971. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  18972. if (function_obj.is_main) {
  18973. 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">';
  18974. } else {
  18975. appender += '<div class="ui function_return"></div>';
  18976. 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">';
  18977. }
  18978. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  18979. appender += '<div class="ui add_var_context add_var_button_function" style="float: left;"><i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button purple"><i class="icon superscript"></i></div></div>';
  18980. appender += '<div class="ui top attached segment variables_list_div"></div>';
  18981. appender += '<div class="ui inline_add_command"><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"> ';
  18982. 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>';
  18983. appender += '<div class="ui bottom attached segment commands_list_div"></div>';
  18984. appender += '</div></div>';
  18985. appender = (0, _jquery2.default)(appender);
  18986. (0, _jquery2.default)('.all_functions').append(appender);
  18987. appender.data('fun', function_obj);
  18988. appender.find('.commands_list_div').data('fun', function_obj);
  18989. renderFunctionReturn(function_obj, appender);
  18990. addHandlers(function_obj, appender);
  18991. // Rendering parameters:
  18992. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  18993. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  18994. }
  18995. // Rendering variables:
  18996. for (var j = 0; j < function_obj.variables_list.length; j++) {
  18997. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  18998. }
  18999. // Rendering commands:
  19000. for (var j = 0; j < function_obj.commands.length; j++) {
  19001. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  19002. }
  19003. (0, _jquery2.default)('.minimize_function_button').popup({
  19004. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  19005. delay: {
  19006. show: 750,
  19007. hide: 0
  19008. }
  19009. });
  19010. Sortable.create(appender.find(".variables_list_div")[0], {
  19011. handle: '.ellipsis',
  19012. animation: 100,
  19013. ghostClass: 'ghost',
  19014. group: 'local_vars_drag_' + program.functions.indexOf(function_obj),
  19015. onEnd: function onEnd(evt) {
  19016. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19017. }
  19018. });
  19019. Sortable.create(appender.find(".commands_list_div")[0], {
  19020. handle: '.command_drag',
  19021. animation: 100,
  19022. ghostClass: 'ghost',
  19023. group: 'commands_drag_' + program.functions.indexOf(function_obj),
  19024. onEnd: function onEnd(evt) {
  19025. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  19026. }
  19027. });
  19028. if (!function_obj.is_main) {
  19029. Sortable.create(appender.find(".container_parameters_list")[0], {
  19030. handle: '.ellipsis',
  19031. animation: 100,
  19032. ghostClass: 'ghost',
  19033. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  19034. onEnd: function onEnd(evt) {
  19035. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  19036. }
  19037. });
  19038. }
  19039. return appender;
  19040. }
  19041. function initVisualUI() {
  19042. // MUST USE CONST, LET, OR VAR !!!!!!
  19043. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  19044. // fill mainDiv with functions and globals...
  19045. // renderAlgorithm()...
  19046. (0, _jquery2.default)('.add_function_button').on('click', function () {
  19047. addFunctionHandler();
  19048. });
  19049. (0, _jquery2.default)('.add_global_button').on('click', function () {
  19050. window.insertContext = true;
  19051. GlobalsManagement.addGlobal(program, true);
  19052. });
  19053. (0, _jquery2.default)('.run_button').on('click', function () {
  19054. runCode();
  19055. });
  19056. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  19057. toggleVisualCoding();
  19058. });
  19059. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  19060. toggleTextualCoding();
  19061. });
  19062. (0, _jquery2.default)('.assessment').on('click', function () {
  19063. runCodeAssessment();
  19064. is_iassign = true;
  19065. });
  19066. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19067. toggleConsole();
  19068. });
  19069. }
  19070. var is_iassign = false;
  19071. (0, _jquery2.default)(document).ready(function () {
  19072. for (var i = 0; i < program.functions.length; i++) {
  19073. renderFunction(program.functions[i]);
  19074. }
  19075. var time_show = 750;
  19076. (0, _jquery2.default)('.visual_coding_button').popup({
  19077. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19078. delay: {
  19079. show: time_show,
  19080. hide: 0
  19081. }
  19082. });
  19083. (0, _jquery2.default)('.textual_coding_button').popup({
  19084. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19085. delay: {
  19086. show: time_show,
  19087. hide: 0
  19088. }
  19089. });
  19090. (0, _jquery2.default)('.upload_file_button').popup({
  19091. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19092. delay: {
  19093. show: time_show,
  19094. hide: 0
  19095. }
  19096. });
  19097. (0, _jquery2.default)('.download_file_button').popup({
  19098. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19099. delay: {
  19100. show: time_show,
  19101. hide: 0
  19102. }
  19103. });
  19104. (0, _jquery2.default)('.undo_button').popup({
  19105. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19106. delay: {
  19107. show: time_show,
  19108. hide: 0
  19109. }
  19110. });
  19111. (0, _jquery2.default)('.redo_button').popup({
  19112. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19113. delay: {
  19114. show: time_show,
  19115. hide: 0
  19116. }
  19117. });
  19118. (0, _jquery2.default)('.run_button').popup({
  19119. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19120. delay: {
  19121. show: time_show,
  19122. hide: 0
  19123. }
  19124. });
  19125. (0, _jquery2.default)('.assessment_button').popup({
  19126. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19127. delay: {
  19128. show: time_show,
  19129. hide: 0
  19130. }
  19131. });
  19132. (0, _jquery2.default)('.help_button').popup({
  19133. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  19134. delay: {
  19135. show: time_show,
  19136. hide: 0
  19137. }
  19138. });
  19139. (0, _jquery2.default)('.add_global_button').popup({
  19140. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19141. delay: {
  19142. show: time_show,
  19143. hide: 0
  19144. }
  19145. });
  19146. (0, _jquery2.default)('.div_toggle_console').popup({
  19147. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19148. delay: {
  19149. show: time_show,
  19150. hide: 0
  19151. }
  19152. });
  19153. Sortable.create(listWithHandle, {
  19154. handle: '.glyphicon-move',
  19155. animation: 100,
  19156. ghostClass: 'ghost',
  19157. group: 'functions_divs_drag',
  19158. onEnd: function onEnd(evt) {
  19159. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19160. }
  19161. });
  19162. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  19163. Sortable.create(listGlobalsHandle, {
  19164. handle: '.ellipsis',
  19165. animation: 100,
  19166. ghostClass: 'ghost',
  19167. group: 'globals_divs_drag',
  19168. onEnd: function onEnd(evt) {
  19169. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  19170. }
  19171. });
  19172. });
  19173. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  19174. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  19175. }
  19176. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  19177. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  19178. }
  19179. function updateSequenceGlobals(oldIndex, newIndex) {
  19180. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  19181. }
  19182. function updateSequenceFunction(oldIndex, newIndex) {
  19183. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19184. }
  19185. function runCodeAssessment() {
  19186. toggleConsole(true);
  19187. window.studentGrade = null;
  19188. studentTemp = null;
  19189. var strCode = CodeManagement.generate();
  19190. if (strCode == null) {
  19191. return;
  19192. }
  19193. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19194. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19195. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19196. runner.runTest().then(function (grade) {
  19197. if (!is_iassign) {
  19198. parent.getEvaluationCallback(grade);
  19199. } else {
  19200. is_iassign = false;
  19201. }
  19202. }).catch(function (err) {
  19203. return domConsole.err(err.message);
  19204. });
  19205. }
  19206. function runCode() {
  19207. toggleConsole(true);
  19208. var strCode = CodeManagement.generate();
  19209. if (strCode == null) {
  19210. return;
  19211. }
  19212. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19213. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19214. try {
  19215. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19216. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19217. var data = analyser.analyseTree();
  19218. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19219. proc.registerInput(domConsole);
  19220. proc.registerOutput(domConsole);
  19221. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19222. proc.interpretAST().then(function (_) {
  19223. domConsole.info("Programa executado com sucesso!");
  19224. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19225. }).catch(function (err) {
  19226. domConsole.err(err.message);
  19227. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19228. });
  19229. } catch (error) {
  19230. domConsole.err(error.message);
  19231. console.log(error);
  19232. }
  19233. }
  19234. function toggleConsole(is_running) {
  19235. if (is_running) {
  19236. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19237. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19238. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19239. return;
  19240. }
  19241. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19242. // esconder
  19243. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19244. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19245. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19246. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19247. } else {
  19248. // mostrar
  19249. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19250. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19251. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19252. }
  19253. }
  19254. function waitToCloseConsole() {
  19255. domConsole.info("Aperte qualquer tecla para fechar...");
  19256. var p = new Promise(function (resolve, _) {
  19257. domConsole.requestInput(resolve, true);
  19258. });
  19259. p.then(function (_) {
  19260. domConsole.dispose();
  19261. domConsole = null;
  19262. (0, _jquery2.default)("#ivprog-term").hide();
  19263. });
  19264. }
  19265. function toggleTextualCoding() {
  19266. var code = CodeManagement.generate();
  19267. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19268. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19269. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19270. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19271. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19272. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19273. }
  19274. function toggleVisualCoding() {
  19275. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19276. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19277. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19278. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19279. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19280. }
  19281. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19282. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19283. if (index > -1) {
  19284. window.insertContext = true;
  19285. function_obj.parameters_list.splice(index, 1);
  19286. }
  19287. (0, _jquery2.default)(parameter_container).fadeOut();
  19288. }
  19289. function updateParameterType(parameter_obj, new_type) {
  19290. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19291. parameter_obj.type = new_type;
  19292. parameter_obj.dimensions = new_dimensions;
  19293. if (new_dimensions > 0) {
  19294. parameter_obj.rows = new_dimensions;
  19295. parameter_obj.columns = 2;
  19296. }
  19297. }
  19298. function renderParameter(function_obj, parameter_obj, function_container) {
  19299. var ret = "";
  19300. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  19301. ret += '<div class="ui dropdown parameter_type">';
  19302. if (parameter_obj.dimensions > 0) {
  19303. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19304. if (parameter_obj.dimensions == 1) {
  19305. ret += ' [ ] ';
  19306. } else {
  19307. ret += ' [ ] [ ] ';
  19308. }
  19309. ret += '</div>';
  19310. } else {
  19311. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19312. }
  19313. ret += '<div class="menu">';
  19314. for (var tm in _types.Types) {
  19315. if (tm == _types.Types.VOID.toUpperCase()) {
  19316. continue;
  19317. }
  19318. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19319. }
  19320. for (var tm in _types.Types) {
  19321. if (tm == _types.Types.VOID.toUpperCase()) {
  19322. continue;
  19323. }
  19324. 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>';
  19325. }
  19326. ret += '</div></div>';
  19327. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19328. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  19329. ret = (0, _jquery2.default)(ret);
  19330. function_container.find('.container_parameters_list').append(ret);
  19331. ret.find('.remove_parameter').on('click', function (e) {
  19332. removeParameter(function_obj, parameter_obj, ret);
  19333. });
  19334. ret.find('.ui.dropdown.parameter_type').dropdown({
  19335. onChange: function onChange(value, text, $selectedItem) {
  19336. if ($selectedItem.data('dimensions')) {
  19337. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19338. } else {
  19339. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19340. }
  19341. }
  19342. });
  19343. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19344. enableNameParameterUpdate(parameter_obj, ret);
  19345. });
  19346. return ret;
  19347. }
  19348. var opened_name_parameter = false;
  19349. var opened_input_parameter = null;
  19350. function enableNameParameterUpdate(parameter_obj, parent_node) {
  19351. if (opened_name_parameter) {
  19352. opened_input_parameter.focus();
  19353. return;
  19354. }
  19355. opened_name_parameter = true;
  19356. parent_node = (0, _jquery2.default)(parent_node);
  19357. var input_field;
  19358. parent_node.find('.span_name_parameter').text('');
  19359. 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 + "' />");
  19360. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19361. input_field.on('input', function () {
  19362. var inputWidth = input_field.textWidth() + 10;
  19363. opened_input_parameter = input_field;
  19364. input_field.focus();
  19365. var tmpStr = input_field.val();
  19366. input_field.val('');
  19367. input_field.val(tmpStr);
  19368. input_field.css({
  19369. width: inputWidth
  19370. });
  19371. }).trigger('input');
  19372. input_field.focusout(function () {
  19373. /// update array:
  19374. if (input_field.val().trim()) {
  19375. parameter_obj.name = input_field.val().trim();
  19376. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19377. }
  19378. input_field.off();
  19379. input_field.remove();
  19380. /// update elements:
  19381. opened_name_parameter = false;
  19382. opened_input_parameter = false;
  19383. });
  19384. input_field.on('keydown', function (e) {
  19385. var code = e.keyCode || e.which;
  19386. if (code == 13) {
  19387. if (input_field.val().trim()) {
  19388. parameter_obj.name = input_field.val().trim();
  19389. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19390. }
  19391. input_field.off();
  19392. input_field.remove();
  19393. /// update elements:
  19394. opened_name_parameter = false;
  19395. opened_input_parameter = false;
  19396. }
  19397. if (code == 27) {
  19398. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19399. input_field.off();
  19400. input_field.remove();
  19401. /// update elements:
  19402. opened_name_parameter = false;
  19403. opened_input_parameter = false;
  19404. }
  19405. });
  19406. input_field.select();
  19407. }
  19408. var opened_name_function = false;
  19409. var opened_input = null;
  19410. var previousPadding = null;
  19411. function enableNameFunctionUpdate(function_obj, parent_node) {
  19412. if (opened_name_function) {
  19413. opened_input.focus();
  19414. return;
  19415. }
  19416. parent_node = (0, _jquery2.default)(parent_node);
  19417. parent_node.find('.span_name_function').text('');
  19418. var input_field;
  19419. if (!previousPadding) {
  19420. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19421. }
  19422. parent_node.find('.span_name_function').css('padding-left', '0');
  19423. parent_node.find('.span_name_function').css('padding-right', '0');
  19424. 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 + "' />");
  19425. input_field.insertBefore(parent_node.find('.span_name_function'));
  19426. input_field.on('input', function () {
  19427. var inputWidth = input_field.textWidth() + 10;
  19428. opened_input = input_field;
  19429. input_field.focus();
  19430. var tmpStr = input_field.val();
  19431. input_field.val('');
  19432. input_field.val(tmpStr);
  19433. input_field.css({
  19434. width: inputWidth
  19435. });
  19436. }).trigger('input');
  19437. input_field.focusout(function () {
  19438. /// update array:
  19439. if (input_field.val().trim()) {
  19440. function_obj.name = input_field.val().trim();
  19441. }
  19442. input_field.off();
  19443. input_field.remove();
  19444. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19445. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19446. parent_node.find('.span_name_function').text(function_obj.name);
  19447. /// update elements:
  19448. opened_name_function = false;
  19449. opened_input = false;
  19450. });
  19451. input_field.on('keydown', function (e) {
  19452. var code = e.keyCode || e.which;
  19453. if (code == 13) {
  19454. if (input_field.val().trim()) {
  19455. function_obj.name = input_field.val().trim();
  19456. }
  19457. input_field.off();
  19458. input_field.remove();
  19459. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19460. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19461. parent_node.find('.span_name_function').text(function_obj.name);
  19462. /// update elements:
  19463. opened_name_function = false;
  19464. opened_input = false;
  19465. }
  19466. if (code == 27) {
  19467. input_field.off();
  19468. input_field.remove();
  19469. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19470. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19471. parent_node.find('.span_name_function').text(function_obj.name);
  19472. /// update elements:
  19473. opened_name_function = false;
  19474. opened_input = false;
  19475. }
  19476. });
  19477. input_field.select();
  19478. }
  19479. /***/ }),
  19480. /***/ "./js/visualUI/globals.js":
  19481. /*!********************************!*\
  19482. !*** ./js/visualUI/globals.js ***!
  19483. \********************************/
  19484. /*! no static exports found */
  19485. /***/ (function(module, exports, __webpack_require__) {
  19486. "use strict";
  19487. Object.defineProperty(exports, "__esModule", {
  19488. value: true
  19489. });
  19490. exports.addGlobal = addGlobal;
  19491. exports.renderGlobal = renderGlobal;
  19492. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19493. var _jquery2 = _interopRequireDefault(_jquery);
  19494. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19495. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19496. var Models = _interopRequireWildcard(_ivprog_elements);
  19497. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19498. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19499. 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; } }
  19500. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19501. window.jQuery = _jquery2.default;
  19502. var counter_new_globals = 0;
  19503. function addGlobal(program) {
  19504. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19505. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19506. counter_new_globals++;
  19507. program.addGlobal(new_global);
  19508. var newe = renderGlobal(new_global);
  19509. if (is_from_click) {
  19510. newe.css('display', 'none');
  19511. newe.fadeIn();
  19512. }
  19513. }
  19514. function toggleConstant(global_var) {
  19515. global_var.is_constant = !global_var.is_constant;
  19516. }
  19517. function updateName(global_var, new_name) {
  19518. global_var.name = new_name;
  19519. }
  19520. function updateType(global_var, new_type) {
  19521. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19522. global_var.type = new_type;
  19523. global_var.dimensions = new_dimensions;
  19524. if (new_dimensions > 0) {
  19525. global_var.rows = new_dimensions;
  19526. global_var.columns = 2;
  19527. }
  19528. updateInitialValues(global_var);
  19529. }
  19530. function removeGlobal(global_var, global_container) {
  19531. var index = window.program_obj.globals.indexOf(global_var);
  19532. if (index > -1) {
  19533. window.insertContext = true;
  19534. window.program_obj.globals.splice(index, 1);
  19535. }
  19536. global_container.children().off();
  19537. global_container.off();
  19538. global_container.fadeOut();
  19539. }
  19540. function updateInitialValues(global_var) {
  19541. if (global_var.type == _types.Types.INTEGER) {
  19542. if (global_var.dimensions == 0) {
  19543. global_var.value = 1;
  19544. }
  19545. if (global_var.dimensions == 1) {
  19546. global_var.value = [1, 1];
  19547. }
  19548. if (global_var.dimensions == 2) {
  19549. global_var.value = [[1, 1], [1, 1]];
  19550. }
  19551. }
  19552. if (global_var.type == _types.Types.REAL) {
  19553. if (global_var.dimensions == 0) {
  19554. global_var.value = 1.0;
  19555. }
  19556. if (global_var.dimensions == 1) {
  19557. global_var.value = [1.0, 1.0];
  19558. }
  19559. if (global_var.dimensions == 2) {
  19560. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19561. }
  19562. }
  19563. if (global_var.type == _types.Types.TEXT) {
  19564. if (global_var.dimensions == 0) {
  19565. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19566. }
  19567. if (global_var.dimensions == 1) {
  19568. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19569. }
  19570. if (global_var.dimensions == 2) {
  19571. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19572. }
  19573. }
  19574. if (global_var.type == _types.Types.BOOLEAN) {
  19575. if (global_var.dimensions == 0) {
  19576. global_var.value = true;
  19577. }
  19578. if (global_var.dimensions == 1) {
  19579. global_var.value = [true, true];
  19580. }
  19581. if (global_var.dimensions == 2) {
  19582. global_var.value = [[true, true], [true, true]];
  19583. }
  19584. }
  19585. }
  19586. function alternateBooleanGlobalValue(global_var, value_container) {
  19587. global_var.value = !global_var.value;
  19588. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  19589. }
  19590. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  19591. global_var.value[index] = !global_var.value[index];
  19592. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  19593. }
  19594. function removeGlobalColumnVector(global_var) {
  19595. if (global_var.columns == 0) {
  19596. return;
  19597. }
  19598. global_var.columns--;
  19599. global_var.value.splice(global_var.value.length - 1, 1);
  19600. }
  19601. function addGlobalColumnVector(global_var) {
  19602. global_var.columns++;
  19603. if (global_var.type == _types.Types.INTEGER) {
  19604. global_var.value.push(1);
  19605. }
  19606. if (global_var.type == _types.Types.REAL) {
  19607. global_var.value.push(1.0);
  19608. }
  19609. if (global_var.type == _types.Types.TEXT) {
  19610. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19611. }
  19612. if (global_var.type == _types.Types.BOOLEAN) {
  19613. global_var.value.push(true);
  19614. }
  19615. }
  19616. function removeColumnGlobalMatrix(global_var) {
  19617. if (global_var.columns == 0) {
  19618. return;
  19619. }
  19620. global_var.columns--;
  19621. for (var i = 0; i < global_var.rows; i++) {
  19622. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  19623. }
  19624. }
  19625. function addColumnGlobalMatrix(global_var) {
  19626. global_var.columns++;
  19627. if (global_var.type == _types.Types.INTEGER) {
  19628. for (var i = 0; i < global_var.rows; i++) {
  19629. global_var.value[i].push(1);
  19630. }
  19631. }
  19632. if (global_var.type == _types.Types.REAL) {
  19633. for (var i = 0; i < global_var.rows; i++) {
  19634. global_var.value[i].push(1.0);
  19635. }
  19636. }
  19637. if (global_var.type == _types.Types.TEXT) {
  19638. for (var i = 0; i < global_var.rows; i++) {
  19639. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19640. }
  19641. }
  19642. if (global_var.type == _types.Types.BOOLEAN) {
  19643. for (var i = 0; i < global_var.rows; i++) {
  19644. global_var.value[i].push(true);
  19645. }
  19646. }
  19647. }
  19648. function removeLineGlobalMatrix(global_var) {
  19649. if (global_var.rows == 0) {
  19650. return;
  19651. }
  19652. global_var.rows--;
  19653. global_var.value.splice(global_var.value.length - 1, 1);
  19654. }
  19655. function addLineGlobalMatrix(global_var) {
  19656. global_var.rows++;
  19657. if (global_var.type == _types.Types.INTEGER) {
  19658. var n_l = [];
  19659. for (var i = 0; i < global_var.columns; i++) {
  19660. n_l.push(1);
  19661. }
  19662. global_var.value.push(n_l);
  19663. }
  19664. if (global_var.type == _types.Types.REAL) {
  19665. var n_l = [];
  19666. for (i = 0; i < global_var.columns; i++) {
  19667. n_l.push(1.0);
  19668. }
  19669. global_var.value.push(n_l);
  19670. }
  19671. if (global_var.type == _types.Types.TEXT) {
  19672. var n_l = [];
  19673. for (i = 0; i < global_var.columns; i++) {
  19674. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19675. }
  19676. global_var.value.push(n_l);
  19677. }
  19678. if (global_var.type == _types.Types.BOOLEAN) {
  19679. var n_l = [];
  19680. for (i = 0; i < global_var.columns; i++) {
  19681. n_l.push(true);
  19682. }
  19683. global_var.value.push(n_l);
  19684. }
  19685. }
  19686. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  19687. global_var.value[row][index] = !global_var.value[row][index];
  19688. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  19689. }
  19690. function renderValues(global_var, global_container) {
  19691. var ret = "";
  19692. var j = 0;
  19693. if (global_var.dimensions == 0) {
  19694. if (global_var.type == _types.Types.REAL) {
  19695. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  19696. } else {
  19697. if (global_var.type == _types.Types.BOOLEAN) {
  19698. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  19699. } else {
  19700. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  19701. }
  19702. }
  19703. } else {
  19704. ret += '<table class="tabela_var">';
  19705. if (global_var.dimensions == 1) {
  19706. ret += '<tr>';
  19707. if (global_var.type == _types.Types.REAL) {
  19708. for (var k = 0; k < global_var.columns; k++) {
  19709. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  19710. }
  19711. } else {
  19712. for (var k = 0; k < global_var.columns; k++) {
  19713. if (global_var.type == _types.Types.BOOLEAN) {
  19714. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  19715. } else {
  19716. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  19717. }
  19718. }
  19719. }
  19720. ret += '</tr>';
  19721. ret += '</table>';
  19722. 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>';
  19723. }
  19724. if (global_var.dimensions == 2) {
  19725. if (global_var.type == _types.Types.REAL) {
  19726. for (var l = 0; l < global_var.rows; l++) {
  19727. ret += '<tr>';
  19728. for (var k = 0; k < global_var.columns; k++) {
  19729. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  19730. }
  19731. ret += '</tr>';
  19732. }
  19733. } else {
  19734. for (var l = 0; l < global_var.rows; l++) {
  19735. ret += '<tr>';
  19736. for (var k = 0; k < global_var.columns; k++) {
  19737. if (global_var.type == _types.Types.BOOLEAN) {
  19738. 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>';
  19739. } else {
  19740. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  19741. }
  19742. }
  19743. ret += '</tr>';
  19744. }
  19745. }
  19746. if (global_var.rows == 0) {
  19747. ret += '<tr><td></td></tr>';
  19748. }
  19749. 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>';
  19750. ret += '</table>';
  19751. 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>';
  19752. }
  19753. }
  19754. global_container.find(".div_valor_var").html('');
  19755. ret = (0, _jquery2.default)(ret);
  19756. ret.find('.span_value_variable').data('associatedOject', global_var);
  19757. ret.find(".boolean_simple_type").on('click', function (e) {
  19758. alternateBooleanGlobalValue(global_var, this.parentNode);
  19759. });
  19760. ret.find(".simple_var").on('click', function (e) {
  19761. enableGlobalValueUpdate(global_var, this.parentNode);
  19762. });
  19763. ret.find(".boolean_vector_var").on('click', function (e) {
  19764. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19765. });
  19766. ret.find(".vector_var").on('click', function (e) {
  19767. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19768. });
  19769. ret.find(".remove_global_vector_column").on('click', function (e) {
  19770. removeGlobalColumnVector(global_var);
  19771. global_container.find(".div_valor_var").html('');
  19772. renderValues(global_var, global_container);
  19773. });
  19774. ret.find(".add_global_vector_column").on('click', function (e) {
  19775. addGlobalColumnVector(global_var);
  19776. global_container.find(".div_valor_var").html('');
  19777. renderValues(global_var, global_container);
  19778. });
  19779. ret.find(".remove_global_matrix_column").on('click', function (e) {
  19780. removeColumnGlobalMatrix(global_var);
  19781. global_container.find(".div_valor_var").html('');
  19782. renderValues(global_var, global_container);
  19783. });
  19784. ret.find(".add_global_matrix_column").on('click', function (e) {
  19785. addColumnGlobalMatrix(global_var);
  19786. global_container.find(".div_valor_var").html('');
  19787. renderValues(global_var, global_container);
  19788. });
  19789. ret.find(".remove_global_matrix_line").on('click', function (e) {
  19790. removeLineGlobalMatrix(global_var);
  19791. global_container.find(".div_valor_var").html('');
  19792. renderValues(global_var, global_container);
  19793. });
  19794. ret.find(".add_global_matrix_line").on('click', function (e) {
  19795. addLineGlobalMatrix(global_var);
  19796. global_container.find(".div_valor_var").html('');
  19797. renderValues(global_var, global_container);
  19798. });
  19799. ret.find(".boolean_matrix_var").on('click', function (e) {
  19800. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19801. });
  19802. ret.find(".matrix_var").on('click', function (e) {
  19803. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19804. });
  19805. global_container.find(".div_valor_var").append(ret);
  19806. updateColumnsAndRowsText(global_container, global_var);
  19807. }
  19808. function addHandlers(global_container) {
  19809. var global_var = global_container.data('associatedOject');
  19810. // Manage constant option:
  19811. global_container.find(".alternate_constant").on('click', function (e) {
  19812. toggleConstant(global_var);
  19813. (0, _jquery2.default)(this).removeClass("on off");
  19814. if (global_var.is_constant) {
  19815. (0, _jquery2.default)(this).addClass("on");
  19816. } else {
  19817. (0, _jquery2.default)(this).addClass("off");
  19818. }
  19819. });
  19820. // Manage global name:
  19821. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  19822. enableNameUpdate(global_container);
  19823. });
  19824. // Menu to change type:
  19825. global_container.find('.ui.dropdown.global_type').dropdown({
  19826. onChange: function onChange(value, text, $selectedItem) {
  19827. if ($selectedItem.data('dimensions')) {
  19828. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19829. } else {
  19830. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  19831. }
  19832. renderValues(global_var, global_container);
  19833. }
  19834. });
  19835. // Remove global:
  19836. global_container.find(".remove_global").on('click', function (e) {
  19837. removeGlobal(global_var, global_container);
  19838. });
  19839. }
  19840. function updateColumnsAndRowsText(global_container, global_var) {
  19841. var prev = global_container.find('.text').text().split('[');
  19842. if (prev.length == 2) {
  19843. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  19844. global_container.find('.text').empty();
  19845. global_container.find('.text').text(ff);
  19846. }
  19847. if (prev.length == 3) {
  19848. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  19849. global_container.find('.text').empty();
  19850. global_container.find('.text').text(ff);
  19851. }
  19852. }
  19853. function renderGlobal(global_var) {
  19854. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  19855. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  19856. element += '<div class="ui dropdown global_type">';
  19857. if (global_var.dimensions > 0) {
  19858. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  19859. for (var i = 0; i < global_var.dimensions; i++) {
  19860. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  19861. }
  19862. element += '</div>';
  19863. } else {
  19864. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  19865. }
  19866. element += '<div class="menu">';
  19867. for (var tm in _types.Types) {
  19868. if (tm == _types.Types.VOID.toUpperCase()) {
  19869. continue;
  19870. }
  19871. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19872. }
  19873. for (var tm in _types.Types) {
  19874. if (tm == _types.Types.VOID.toUpperCase()) {
  19875. continue;
  19876. }
  19877. 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>';
  19878. }
  19879. 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> ';
  19880. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  19881. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  19882. var complete_element = (0, _jquery2.default)(element);
  19883. complete_element.data('associatedOject', global_var);
  19884. (0, _jquery2.default)('.list_globals').append(complete_element);
  19885. addHandlers(complete_element);
  19886. renderValues(global_var, complete_element);
  19887. if (global_var.dimensions == 1) {
  19888. complete_element.find('.dimensions_0').text(global_var.columns);
  19889. }
  19890. if (global_var.dimensions == 2) {
  19891. complete_element.find('.dimensions_0').text(global_var.columns);
  19892. complete_element.find('.dimensions_1').text(global_var.rows);
  19893. }
  19894. return complete_element;
  19895. }
  19896. var opened_name_value_matrix_global_v = false;
  19897. var opened_input_value_matrix_global_v = null;
  19898. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  19899. if (opened_name_value_matrix_global_v) {
  19900. opened_input_value_matrix_global_v.focus();
  19901. return;
  19902. }
  19903. parent_node = (0, _jquery2.default)(parent_node);
  19904. opened_name_value_matrix_global_v = true;
  19905. parent_node.find('.span_value_variable').text('');
  19906. var input_field;
  19907. if (global_var.type == _types.Types.REAL) {
  19908. 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) + "' />");
  19909. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19910. } else {
  19911. 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] + "' />");
  19912. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19913. }
  19914. input_field.on('input', function () {
  19915. var inputWidth = input_field.textWidth() + 10;
  19916. opened_input_value_matrix_global_v = input_field;
  19917. input_field.focus();
  19918. var tmpStr = input_field.val();
  19919. input_field.val('');
  19920. input_field.val(tmpStr);
  19921. input_field.css({
  19922. width: inputWidth
  19923. });
  19924. }).trigger('input');
  19925. input_field.focusout(function () {
  19926. /// update array:
  19927. if (input_field.val().trim()) {
  19928. if (global_var.type == _types.Types.REAL) {
  19929. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19930. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19931. } else {
  19932. if (global_var.type == _types.Types.INTEGER) {
  19933. global_var.value[row][index] = parseInt(input_field.val().trim());
  19934. } else {
  19935. global_var.value[row][index] = input_field.val().trim();
  19936. }
  19937. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19938. }
  19939. } else {
  19940. if (global_var.type == _types.Types.REAL) {
  19941. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19942. } else {
  19943. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19944. }
  19945. }
  19946. if (global_var.type == _types.Types.TEXT) {
  19947. global_var.value[row][index] = input_field.val();
  19948. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19949. }
  19950. input_field.off();
  19951. input_field.remove();
  19952. /// update elements:
  19953. opened_name_value_matrix_global_v = false;
  19954. opened_input_value_matrix_global_v = false;
  19955. });
  19956. input_field.on('keydown', function (e) {
  19957. var code = e.keyCode || e.which;
  19958. if (code == 13) {
  19959. if (input_field.val().trim()) {
  19960. if (global_var.type == _types.Types.REAL) {
  19961. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19962. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19963. } else {
  19964. if (global_var.type == _types.Types.INTEGER) {
  19965. global_var.value[row][index] = parseInt(input_field.val().trim());
  19966. } else {
  19967. global_var.value[row][index] = input_field.val().trim();
  19968. }
  19969. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19970. }
  19971. } else {
  19972. if (global_var.type == _types.Types.REAL) {
  19973. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19974. } else {
  19975. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19976. }
  19977. }
  19978. if (global_var.type == _types.Types.TEXT) {
  19979. global_var.value[row][index] = input_field.val();
  19980. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19981. }
  19982. input_field.off();
  19983. input_field.remove();
  19984. /// update elements:
  19985. opened_name_value_matrix_global_v = false;
  19986. opened_input_value_matrix_global_v = false;
  19987. }
  19988. if (code == 27) {
  19989. if (global_var.type == _types.Types.REAL) {
  19990. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19991. } else {
  19992. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19993. }
  19994. input_field.off();
  19995. input_field.remove();
  19996. /// update elements:
  19997. opened_name_value_matrix_global_v = false;
  19998. opened_input_value_matrix_global_v = false;
  19999. }
  20000. });
  20001. input_field.select();
  20002. }
  20003. var opened_name_value_global_var = false;
  20004. var opened_input_value_global_ar = null;
  20005. function enableGlobalValueUpdate(global_var, parent_node) {
  20006. if (opened_name_value_global_var) {
  20007. opened_input_value_global_ar.focus();
  20008. return;
  20009. }
  20010. parent_node = (0, _jquery2.default)(parent_node);
  20011. opened_name_value_global_var = true;
  20012. parent_node.find('.span_value_variable').text('');
  20013. var input_field;
  20014. if (global_var.type == _types.Types.REAL) {
  20015. 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) + "' />");
  20016. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20017. } else {
  20018. 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 + "' />");
  20019. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20020. }
  20021. input_field.on('input', function () {
  20022. var inputWidth = input_field.textWidth() + 10;
  20023. opened_input_value_global_ar = input_field;
  20024. input_field.focus();
  20025. var tmpStr = input_field.val();
  20026. input_field.val('');
  20027. input_field.val(tmpStr);
  20028. input_field.css({
  20029. width: inputWidth
  20030. });
  20031. }).trigger('input');
  20032. input_field.focusout(function () {
  20033. /// update array:
  20034. if (input_field.val().trim()) {
  20035. if (global_var.type == _types.Types.REAL) {
  20036. global_var.value = parseFloat(input_field.val().trim());
  20037. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20038. } else {
  20039. if (global_var.type == _types.Types.INTEGER) {
  20040. global_var.value = parseInt(input_field.val().trim());
  20041. } else {
  20042. global_var.value = input_field.val().trim();
  20043. }
  20044. parent_node.find('.span_value_variable').text(global_var.value);
  20045. }
  20046. } else {
  20047. if (global_var.type == _types.Types.REAL) {
  20048. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20049. } else {
  20050. parent_node.find('.span_value_variable').text(global_var.value);
  20051. }
  20052. }
  20053. if (global_var.type == _types.Types.TEXT) {
  20054. global_var.value = input_field.val();
  20055. parent_node.find('.span_value_variable').text(global_var.value);
  20056. }
  20057. input_field.off();
  20058. input_field.remove();
  20059. /// update elements:
  20060. opened_name_value_global_var = false;
  20061. opened_input_value_global_ar = false;
  20062. });
  20063. input_field.on('keydown', function (e) {
  20064. var code = e.keyCode || e.which;
  20065. if (code == 13) {
  20066. if (input_field.val().trim()) {
  20067. if (global_var.type == _types.Types.REAL) {
  20068. global_var.value = parseFloat(input_field.val().trim());
  20069. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20070. } else {
  20071. if (global_var.type == _types.Types.INTEGER) {
  20072. global_var.value = parseInt(input_field.val().trim());
  20073. } else {
  20074. global_var.value = input_field.val().trim();
  20075. }
  20076. parent_node.find('.span_value_variable').text(global_var.value);
  20077. }
  20078. } else {
  20079. if (global_var.type == _types.Types.REAL) {
  20080. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20081. } else {
  20082. parent_node.find('.span_value_variable').text(global_var.value);
  20083. }
  20084. }
  20085. if (global_var.type == _types.Types.TEXT) {
  20086. global_var.value = input_field.val();
  20087. parent_node.find('.span_value_variable').text(global_var.value);
  20088. }
  20089. input_field.off();
  20090. input_field.remove();
  20091. /// update elements:
  20092. opened_name_value_global_var = false;
  20093. opened_input_value_global_ar = false;
  20094. }
  20095. if (code == 27) {
  20096. if (global_var.type == _types.Types.REAL) {
  20097. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20098. } else {
  20099. parent_node.find('.span_value_variable').text(global_var.value);
  20100. }
  20101. input_field.off();
  20102. input_field.remove();
  20103. /// update elements:
  20104. opened_name_value_global_var = false;
  20105. opened_input_value_global_ar = false;
  20106. }
  20107. });
  20108. input_field.select();
  20109. }
  20110. var opened_name_global = false;
  20111. var opened_input_global = null;
  20112. function enableNameUpdate(global_container) {
  20113. var global_var = global_container.data('associatedOject');
  20114. if (opened_name_global) {
  20115. opened_input_global.focus();
  20116. return;
  20117. }
  20118. opened_name_global = true;
  20119. global_container.find('.span_name_variable').text('');
  20120. 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 + "' />");
  20121. input_name.insertBefore(global_container.find('.span_name_variable'));
  20122. input_name.on('input', function () {
  20123. var inputWidth = input_name.textWidth() + 10;
  20124. opened_input_global = input_name;
  20125. opened_input_global.focus();
  20126. opened_input_global.css({
  20127. width: inputWidth
  20128. });
  20129. }).trigger('input');
  20130. input_name.focusout(function () {
  20131. /// update array:
  20132. if (input_name.val().trim().length > 0) {
  20133. updateName(global_var, input_name.val().trim());
  20134. global_container.find('.span_name_variable').text(global_var.name);
  20135. } else {
  20136. global_container.find('.span_name_variable').text(global_var.name);
  20137. }
  20138. input_name.off();
  20139. input_name.remove();
  20140. /// update elements:
  20141. opened_name_global = false;
  20142. opened_input_global = false;
  20143. });
  20144. input_name.on('keydown', function (e) {
  20145. var code = e.keyCode || e.which;
  20146. if (code == 13) {
  20147. if (input_name.val().trim()) {
  20148. updateName(global_var, input_name.val().trim());
  20149. global_container.find('.span_name_variable').text(global_var.name);
  20150. } else {
  20151. global_container.find('.span_name_variable').text(global_var.name);
  20152. }
  20153. input_name.off();
  20154. input_name.remove();
  20155. /// update elements:
  20156. opened_name_global = false;
  20157. opened_input_global = false;
  20158. }
  20159. if (code == 27) {
  20160. global_container.find('.span_name_variable').text(global_var.name);
  20161. input_name.off();
  20162. input_name.remove();
  20163. /// update elements:
  20164. opened_name_global = false;
  20165. opened_input_global = false;
  20166. }
  20167. });
  20168. input_name.select();
  20169. }
  20170. var opened_name_value_vector_global_ = false;
  20171. var opened_input_value_vector_global_ = null;
  20172. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20173. if (opened_name_value_vector_global_) {
  20174. opened_input_value_vector_global_.focus();
  20175. return;
  20176. }
  20177. parent_node = (0, _jquery2.default)(parent_node);
  20178. opened_name_value_vector_global_ = true;
  20179. parent_node.find('.span_value_variable').text('');
  20180. var input_field;
  20181. if (global_var.type == _types.Types.REAL) {
  20182. 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) + "' />");
  20183. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20184. } else {
  20185. 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] + "' />");
  20186. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20187. }
  20188. input_field.on('input', function () {
  20189. var inputWidth = input_field.textWidth() + 10;
  20190. opened_input_value_vector_global_ = input_field;
  20191. input_field.focus();
  20192. var tmpStr = input_field.val();
  20193. input_field.val('');
  20194. input_field.val(tmpStr);
  20195. input_field.css({
  20196. width: inputWidth
  20197. });
  20198. }).trigger('input');
  20199. input_field.focusout(function () {
  20200. /// update array:
  20201. if (input_field.val().trim()) {
  20202. if (global_var.type == _types.Types.REAL) {
  20203. global_var.value[index] = parseFloat(input_field.val().trim());
  20204. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20205. } else {
  20206. if (global_var.type == _types.Types.INTEGER) {
  20207. global_var.value[index] = parseInt(input_field.val().trim());
  20208. } else {
  20209. global_var.value[index] = input_field.val().trim();
  20210. }
  20211. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20212. }
  20213. } else {
  20214. if (global_var.type == _types.Types.REAL) {
  20215. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20216. } else {
  20217. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20218. }
  20219. }
  20220. if (global_var.type == _types.Types.TEXT) {
  20221. global_var.value[index] = input_field.val();
  20222. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20223. }
  20224. input_field.off();
  20225. input_field.remove();
  20226. /// update elements:
  20227. opened_name_value_vector_global_ = false;
  20228. opened_input_value_vector_global_ = false;
  20229. });
  20230. input_field.on('keydown', function (e) {
  20231. var code = e.keyCode || e.which;
  20232. if (code == 13) {
  20233. if (input_field.val().trim()) {
  20234. if (global_var.type == _types.Types.REAL) {
  20235. global_var.value[index] = parseFloat(input_field.val().trim());
  20236. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20237. } else {
  20238. if (global_var.type == _types.Types.INTEGER) {
  20239. global_var.value[index] = parseInt(input_field.val().trim());
  20240. } else {
  20241. global_var.value[index] = input_field.val().trim();
  20242. }
  20243. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20244. }
  20245. } else {
  20246. if (global_var.type == _types.Types.REAL) {
  20247. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20248. } else {
  20249. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20250. }
  20251. }
  20252. if (global_var.type == _types.Types.TEXT) {
  20253. global_var.value[index] = input_field.val();
  20254. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20255. }
  20256. input_field.off();
  20257. input_field.remove();
  20258. /// update elements:
  20259. opened_name_value_vector_global_ = false;
  20260. opened_input_value_vector_global_ = false;
  20261. }
  20262. if (code == 27) {
  20263. if (global_var.type == _types.Types.REAL) {
  20264. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20265. } else {
  20266. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20267. }
  20268. input_field.off();
  20269. input_field.remove();
  20270. /// update elements:
  20271. opened_name_value_vector_global_ = false;
  20272. opened_input_value_vector_global_ = false;
  20273. }
  20274. });
  20275. input_field.select();
  20276. }
  20277. _jquery2.default.fn.textWidth = function (text, font) {
  20278. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20279. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20280. return _jquery2.default.fn.textWidth.fakeEl.width();
  20281. };
  20282. /***/ }),
  20283. /***/ "./js/visualUI/ivprog_elements.js":
  20284. /*!****************************************!*\
  20285. !*** ./js/visualUI/ivprog_elements.js ***!
  20286. \****************************************/
  20287. /*! no static exports found */
  20288. /***/ (function(module, exports, __webpack_require__) {
  20289. "use strict";
  20290. Object.defineProperty(exports, "__esModule", {
  20291. value: true
  20292. });
  20293. 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;
  20294. 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; }; }();
  20295. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20296. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20297. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20298. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20299. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20300. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20301. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20302. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20303. 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; } }
  20304. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20305. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20306. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20307. return: "return" });
  20308. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20309. 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" });
  20310. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20311. 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" });
  20312. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20313. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20314. var Variable = exports.Variable = function Variable(type, name, value) {
  20315. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20316. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20317. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20318. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20319. _classCallCheck(this, Variable);
  20320. this.type = type;
  20321. this.name = name;
  20322. this.value = value;
  20323. this.dimensions = dimensions;
  20324. this.is_constant = is_constant;
  20325. this.rows = rows;
  20326. this.columns = columns;
  20327. };
  20328. var Function = exports.Function = function Function(name) {
  20329. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20330. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20331. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20332. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20333. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20334. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20335. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20336. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20337. _classCallCheck(this, Function);
  20338. this.type = COMMAND_TYPES.function;
  20339. this.name = name;
  20340. this.return_type = return_type;
  20341. this.return_dimensions = return_dimensions;
  20342. this.parameters_list = parameters_list;
  20343. this.is_main = is_main;
  20344. this.is_hidden = is_hidden;
  20345. this.variables_list = variables_list;
  20346. this.function_comment = function_comment;
  20347. this.commands = commands;
  20348. };
  20349. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20350. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20351. var category = arguments[5];
  20352. _classCallCheck(this, SystemFunction);
  20353. this.type = COMMAND_TYPES.function;
  20354. this.identifier = identifier;
  20355. this.return_type = return_type;
  20356. this.return_dimensions = return_dimensions;
  20357. this.parameters_list = parameters_list;
  20358. this.function_comment = function_comment;
  20359. this.category = category;
  20360. };
  20361. var Comment = exports.Comment = function Comment(comment_text) {
  20362. _classCallCheck(this, Comment);
  20363. this.type = COMMAND_TYPES.comment;
  20364. this.comment_text = comment_text;
  20365. };
  20366. var Break = exports.Break = function Break() {
  20367. _classCallCheck(this, Break);
  20368. this.type = COMMAND_TYPES.break;
  20369. };
  20370. var Reader = exports.Reader = function Reader() {
  20371. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20372. _classCallCheck(this, Reader);
  20373. this.type = COMMAND_TYPES.reader;
  20374. this.variable_value_menu = variable_value_menu;
  20375. };
  20376. var Writer = exports.Writer = function Writer(content) {
  20377. _classCallCheck(this, Writer);
  20378. this.type = COMMAND_TYPES.writer;
  20379. this.content = content;
  20380. };
  20381. var Attribution = exports.Attribution = function Attribution(variable) {
  20382. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20383. _classCallCheck(this, Attribution);
  20384. this.type = COMMAND_TYPES.attribution;
  20385. this.variable = variable;
  20386. this.expression = expression;
  20387. };
  20388. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20389. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20390. _classCallCheck(this, ExpressionElement);
  20391. this.type_exp = type_exp;
  20392. this.itens = itens;
  20393. };
  20394. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20395. _classCallCheck(this, ConditionalExpression);
  20396. this.type = EXPRESSION_TYPES.exp_conditional;
  20397. this.expression = expression;
  20398. };
  20399. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20400. _classCallCheck(this, LogicExpression);
  20401. this.type = EXPRESSION_TYPES.exp_logic;
  20402. this.has_neg = has_neg;
  20403. this.first_operand = first_operand;
  20404. this.second_operand = second_operand;
  20405. this.operator = operator;
  20406. };
  20407. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20408. _classCallCheck(this, ArithmeticExpression);
  20409. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20410. this.first_operand = first_operand;
  20411. this.second_operand = second_operand;
  20412. this.operator = operator;
  20413. };
  20414. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20415. _classCallCheck(this, IfTrue);
  20416. this.type = COMMAND_TYPES.iftrue;
  20417. this.expression = expression;
  20418. this.commands_block = commands_block;
  20419. this.commands_else = commands_else;
  20420. };
  20421. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20422. _classCallCheck(this, RepeatNTimes);
  20423. this.type = COMMAND_TYPES.repeatNtimes;
  20424. this.var_attribution = var_attribution;
  20425. this.var_incrementation = var_incrementation;
  20426. this.expression1 = expression1;
  20427. this.expression2 = expression2;
  20428. this.expression3 = expression3;
  20429. this.commands_block = commands_block;
  20430. };
  20431. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20432. _classCallCheck(this, WhileTrue);
  20433. this.type = COMMAND_TYPES.whiletrue;
  20434. this.expression = expression;
  20435. this.commands_block = commands_block;
  20436. };
  20437. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20438. _classCallCheck(this, DoWhileTrue);
  20439. this.type = COMMAND_TYPES.dowhiletrue;
  20440. this.expression = expression;
  20441. this.commands_block = commands_block;
  20442. };
  20443. var Switch = exports.Switch = function Switch(variable) {
  20444. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20445. _classCallCheck(this, Switch);
  20446. this.type = COMMAND_TYPES.switch;
  20447. this.variable = variable;
  20448. this.cases = cases;
  20449. };
  20450. var Return = exports.Return = function Return(variable_value_menu) {
  20451. _classCallCheck(this, Return);
  20452. this.type = COMMAND_TYPES.return;
  20453. this.variable_value_menu = variable_value_menu;
  20454. };
  20455. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20456. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20457. _classCallCheck(this, SwitchCase);
  20458. this.type = COMMAND_TYPES.switchcase;
  20459. this.variable_value_menu = variable_value_menu;
  20460. this.commands_block = commands_block;
  20461. };
  20462. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20463. _classCallCheck(this, FunctionCall);
  20464. this.type = COMMAND_TYPES.functioncall;
  20465. this.function_called = function_called;
  20466. this.parameters_list = parameters_list;
  20467. };
  20468. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20469. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20470. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20471. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20472. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20473. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20474. _classCallCheck(this, VariableValueMenu);
  20475. this.type = "var_value";
  20476. this.variable_and_value = variable_and_value;
  20477. this.content = content;
  20478. this.row = row;
  20479. this.column = column;
  20480. this.include_constant = include_constant;
  20481. };
  20482. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20483. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20484. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20485. _classCallCheck(this, FunctionCallMenu);
  20486. this.type = "function_call";
  20487. this.function_called = function_called;
  20488. this.parameters_list = parameters_list;
  20489. };
  20490. var Program = exports.Program = function () {
  20491. function Program() {
  20492. _classCallCheck(this, Program);
  20493. this.functions = [];
  20494. this.globals = [];
  20495. }
  20496. _createClass(Program, [{
  20497. key: 'addFunction',
  20498. value: function addFunction(function_to_add) {
  20499. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20500. if (window.insertContext) {
  20501. setTimeout(function () {
  20502. AlgorithmManagement.renderAlgorithm();
  20503. }, 300);
  20504. window.insertContext = false;
  20505. } else {
  20506. AlgorithmManagement.renderAlgorithm();
  20507. }
  20508. }, 1);
  20509. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20510. if (window.insertContext) {
  20511. setTimeout(function () {
  20512. AlgorithmManagement.renderAlgorithm();
  20513. }, 300);
  20514. window.insertContext = false;
  20515. } else {
  20516. AlgorithmManagement.renderAlgorithm();
  20517. }
  20518. }, 1);
  20519. this.functions.push(function_to_add);
  20520. }
  20521. }, {
  20522. key: 'addVariable',
  20523. value: function addVariable(function_to_receive, variable) {
  20524. if (this.functions[function_to_receive].variable === null) {
  20525. this.functions[function_to_receive].variables_list = [];
  20526. }
  20527. this.functions[function_to_receive].variables_list.push(variable);
  20528. }
  20529. }, {
  20530. key: 'addGlobal',
  20531. value: function addGlobal(variable) {
  20532. this.globals.push(variable);
  20533. }
  20534. }]);
  20535. return Program;
  20536. }();
  20537. /***/ }),
  20538. /***/ "./js/visualUI/types.js":
  20539. /*!******************************!*\
  20540. !*** ./js/visualUI/types.js ***!
  20541. \******************************/
  20542. /*! no static exports found */
  20543. /***/ (function(module, exports, __webpack_require__) {
  20544. "use strict";
  20545. Object.defineProperty(exports, "__esModule", {
  20546. value: true
  20547. });
  20548. var Types = exports.Types = Object.freeze({
  20549. INTEGER: "integer",
  20550. REAL: "real",
  20551. TEXT: "text",
  20552. BOOLEAN: "boolean",
  20553. VOID: "void"
  20554. });
  20555. /***/ }),
  20556. /***/ "./js/visualUI/variables.js":
  20557. /*!**********************************!*\
  20558. !*** ./js/visualUI/variables.js ***!
  20559. \**********************************/
  20560. /*! no static exports found */
  20561. /***/ (function(module, exports, __webpack_require__) {
  20562. "use strict";
  20563. Object.defineProperty(exports, "__esModule", {
  20564. value: true
  20565. });
  20566. exports.addVariable = addVariable;
  20567. exports.renderVariable = renderVariable;
  20568. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20569. var _jquery2 = _interopRequireDefault(_jquery);
  20570. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20571. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20572. var Models = _interopRequireWildcard(_ivprog_elements);
  20573. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20574. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20575. 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; } }
  20576. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20577. window.jQuery = _jquery2.default;
  20578. var counter_new_variables = 0;
  20579. function addVariable(function_obj, function_container) {
  20580. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20581. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  20582. if (function_obj.variables_list == null) {
  20583. function_obj.variables_list = [];
  20584. }
  20585. function_obj.variables_list.push(new_var);
  20586. counter_new_variables++;
  20587. var newe = renderVariable(function_container, new_var, function_obj);
  20588. if (is_in_click) {
  20589. newe.css('display', 'none');
  20590. newe.fadeIn();
  20591. }
  20592. }
  20593. function updateName(variable_obj, new_name) {
  20594. variable_obj.name = new_name;
  20595. }
  20596. function removeVariable(variable_obj, variable_container) {
  20597. var function_associated = variable_container.data('associatedFunction');
  20598. var index = function_associated.variables_list.indexOf(variable_obj);
  20599. if (index > -1) {
  20600. window.insertContext = true;
  20601. delete function_associated.variables_list[index];
  20602. function_associated.variables_list.splice(index, 1);
  20603. }
  20604. variable_container.children().off();
  20605. variable_container.off();
  20606. variable_container.fadeOut();
  20607. }
  20608. function updateType(variable_obj, new_type) {
  20609. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20610. variable_obj.type = new_type;
  20611. variable_obj.dimensions = new_dimensions;
  20612. if (new_dimensions > 0) {
  20613. variable_obj.rows = new_dimensions;
  20614. variable_obj.columns = 2;
  20615. }
  20616. updateInitialValues(variable_obj);
  20617. }
  20618. function addHandlers(variable_obj, variable_container) {
  20619. // Manage variable name:
  20620. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  20621. enableNameUpdate(variable_obj, variable_container);
  20622. });
  20623. // Menu to change type:
  20624. variable_container.find('.ui.dropdown.variable_type').dropdown({
  20625. onChange: function onChange(value, text, $selectedItem) {
  20626. if ($selectedItem.data('dimensions')) {
  20627. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20628. } else {
  20629. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  20630. }
  20631. renderValues(variable_obj, variable_container);
  20632. }
  20633. });
  20634. // Remove variable:
  20635. variable_container.find(".remove_variable").on('click', function (e) {
  20636. removeVariable(variable_obj, variable_container);
  20637. });
  20638. }
  20639. function renderVariable(function_container, new_var, function_obj) {
  20640. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  20641. element += '<div class="ui dropdown variable_type">';
  20642. if (new_var.dimensions > 0) {
  20643. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  20644. for (var i = 0; i < new_var.dimensions; i++) {
  20645. element += ' [ ] ';
  20646. }
  20647. element += '</div>';
  20648. } else {
  20649. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  20650. }
  20651. element += '<div class="menu">';
  20652. for (var tm in _types.Types) {
  20653. if (tm == _types.Types.VOID.toUpperCase()) {
  20654. continue;
  20655. }
  20656. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20657. }
  20658. for (var tm in _types.Types) {
  20659. if (tm == _types.Types.VOID.toUpperCase()) {
  20660. continue;
  20661. }
  20662. 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>';
  20663. }
  20664. element += '</div></div> ';
  20665. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  20666. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  20667. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  20668. element = (0, _jquery2.default)(element);
  20669. element.data('associatedFunction', function_obj);
  20670. function_container.find('.variables_list_div').append(element);
  20671. addHandlers(new_var, element);
  20672. renderValues(new_var, element);
  20673. return element;
  20674. }
  20675. function updateColumnsAndRowsText(variable_container, variable_var) {
  20676. var prev = variable_container.find('.text').text().split('[');
  20677. if (prev.length == 2) {
  20678. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  20679. variable_container.find('.text').empty();
  20680. variable_container.find('.text').text(ff);
  20681. }
  20682. if (prev.length == 3) {
  20683. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  20684. variable_container.find('.text').empty();
  20685. variable_container.find('.text').text(ff);
  20686. }
  20687. }
  20688. function renderValues(new_var, variable_container) {
  20689. var ret = "";
  20690. var j = 0;
  20691. if (new_var.dimensions == 0) {
  20692. if (new_var.type == _types.Types.REAL) {
  20693. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  20694. } else {
  20695. if (new_var.type == _types.Types.BOOLEAN) {
  20696. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  20697. } else {
  20698. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  20699. }
  20700. }
  20701. } else {
  20702. ret += '<table class="tabela_var">';
  20703. if (new_var.dimensions == 1) {
  20704. ret += '<tr>';
  20705. if (new_var.type == _types.Types.REAL) {
  20706. for (var k = 0; k < new_var.columns; k++) {
  20707. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  20708. }
  20709. } else {
  20710. for (var k = 0; k < new_var.columns; k++) {
  20711. if (new_var.type == _types.Types.BOOLEAN) {
  20712. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  20713. } else {
  20714. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  20715. }
  20716. }
  20717. }
  20718. ret += '</tr>';
  20719. ret += '</table>';
  20720. 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>';
  20721. }
  20722. if (new_var.dimensions == 2) {
  20723. if (new_var.type == _types.Types.REAL) {
  20724. for (var l = 0; l < new_var.rows; l++) {
  20725. ret += '<tr>';
  20726. for (var k = 0; k < new_var.columns; k++) {
  20727. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20728. }
  20729. ret += '</tr>';
  20730. }
  20731. } else {
  20732. for (var l = 0; l < new_var.rows; l++) {
  20733. ret += '<tr>';
  20734. for (var k = 0; k < new_var.columns; k++) {
  20735. if (new_var.type == _types.Types.BOOLEAN) {
  20736. 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>';
  20737. } else {
  20738. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  20739. }
  20740. }
  20741. ret += '</tr>';
  20742. }
  20743. }
  20744. if (new_var.rows == 0) {
  20745. ret += '<tr><td></td></tr>';
  20746. }
  20747. 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>';
  20748. ret += '</table>';
  20749. 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>';
  20750. }
  20751. }
  20752. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20753. ret = (0, _jquery2.default)(ret);
  20754. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  20755. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  20756. alternateBooleanValue(new_var, this.parentNode);
  20757. });
  20758. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  20759. enableValueUpdate(new_var, this.parentNode);
  20760. });
  20761. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  20762. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20763. });
  20764. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  20765. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20766. });
  20767. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  20768. removeColumnVector(new_var);
  20769. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20770. renderValues(new_var, variable_container);
  20771. });
  20772. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  20773. addColumnVector(new_var);
  20774. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20775. renderValues(new_var, variable_container);
  20776. });
  20777. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  20778. removeColumnMatrix(new_var);
  20779. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20780. renderValues(new_var, variable_container);
  20781. });
  20782. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  20783. addColumnMatrix(new_var);
  20784. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20785. renderValues(new_var, variable_container);
  20786. });
  20787. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  20788. removeLineMatrix(new_var);
  20789. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20790. renderValues(new_var, variable_container);
  20791. });
  20792. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  20793. addLineMatrix(new_var);
  20794. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20795. renderValues(new_var, variable_container);
  20796. });
  20797. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  20798. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20799. });
  20800. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  20801. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20802. });
  20803. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  20804. updateColumnsAndRowsText(variable_container, new_var);
  20805. }
  20806. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  20807. var_obj.value[row][index] = !var_obj.value[row][index];
  20808. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  20809. }
  20810. function addLineMatrix(var_obj) {
  20811. var_obj.rows++;
  20812. if (var_obj.type == _types.Types.INTEGER) {
  20813. var n_l = [];
  20814. for (var i = 0; i < var_obj.columns; i++) {
  20815. n_l.push(1);
  20816. }
  20817. var_obj.value.push(n_l);
  20818. }
  20819. if (var_obj.type == _types.Types.REAL) {
  20820. var n_l = [];
  20821. for (i = 0; i < var_obj.columns; i++) {
  20822. n_l.push(1.0);
  20823. }
  20824. var_obj.value.push(n_l);
  20825. }
  20826. if (var_obj.type == _types.Types.TEXT) {
  20827. var n_l = [];
  20828. for (i = 0; i < var_obj.columns; i++) {
  20829. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20830. }
  20831. var_obj.value.push(n_l);
  20832. }
  20833. if (var_obj.type == _types.Types.BOOLEAN) {
  20834. var n_l = [];
  20835. for (i = 0; i < var_obj.columns; i++) {
  20836. n_l.push(true);
  20837. }
  20838. var_obj.value.push(n_l);
  20839. }
  20840. }
  20841. function removeLineMatrix(var_obj) {
  20842. if (var_obj.rows == 0) {
  20843. return;
  20844. }
  20845. var_obj.rows--;
  20846. var_obj.value.splice(var_obj.value.length - 1, 1);
  20847. }
  20848. function addColumnMatrix(var_obj) {
  20849. var_obj.columns++;
  20850. if (var_obj.type == _types.Types.INTEGER) {
  20851. for (var i = 0; i < var_obj.rows; i++) {
  20852. var_obj.value[i].push(1);
  20853. }
  20854. }
  20855. if (var_obj.type == _types.Types.REAL) {
  20856. for (var i = 0; i < var_obj.rows; i++) {
  20857. var_obj.value[i].push(1.0);
  20858. }
  20859. }
  20860. if (var_obj.type == _types.Types.TEXT) {
  20861. for (var i = 0; i < var_obj.rows; i++) {
  20862. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20863. }
  20864. }
  20865. if (var_obj.type == _types.Types.BOOLEAN) {
  20866. for (var i = 0; i < var_obj.rows; i++) {
  20867. var_obj.value[i].push(true);
  20868. }
  20869. }
  20870. }
  20871. function removeColumnMatrix(var_obj) {
  20872. if (var_obj.columns == 0) {
  20873. return;
  20874. }
  20875. var_obj.columns--;
  20876. for (var i = 0; i < var_obj.rows; i++) {
  20877. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  20878. }
  20879. }
  20880. function addColumnVector(var_obj) {
  20881. var_obj.columns++;
  20882. if (var_obj.type == _types.Types.INTEGER) {
  20883. var_obj.value.push(1);
  20884. }
  20885. if (var_obj.type == _types.Types.REAL) {
  20886. var_obj.value.push(1.0);
  20887. }
  20888. if (var_obj.type == _types.Types.TEXT) {
  20889. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20890. }
  20891. if (var_obj.type == _types.Types.BOOLEAN) {
  20892. var_obj.value.push(true);
  20893. }
  20894. }
  20895. function removeColumnVector(var_obj) {
  20896. if (var_obj.columns == 0) {
  20897. return;
  20898. }
  20899. var_obj.columns--;
  20900. var_obj.value.splice(var_obj.value.length - 1, 1);
  20901. }
  20902. function alternateBooleanValue(var_obj, value_container) {
  20903. var_obj.value = !var_obj.value;
  20904. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  20905. }
  20906. function alternateBooleanVectorValue(var_obj, index, value_container) {
  20907. var_obj.value[index] = !var_obj.value[index];
  20908. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  20909. }
  20910. function updateInitialValues(variable_obj) {
  20911. if (variable_obj.type == _types.Types.INTEGER) {
  20912. if (variable_obj.dimensions == 0) {
  20913. variable_obj.value = 1;
  20914. }
  20915. if (variable_obj.dimensions == 1) {
  20916. variable_obj.value = [1, 1];
  20917. }
  20918. if (variable_obj.dimensions == 2) {
  20919. variable_obj.value = [[1, 1], [1, 1]];
  20920. }
  20921. }
  20922. if (variable_obj.type == _types.Types.REAL) {
  20923. if (variable_obj.dimensions == 0) {
  20924. variable_obj.value = 1.0;
  20925. }
  20926. if (variable_obj.dimensions == 1) {
  20927. variable_obj.value = [1.0, 1.0];
  20928. }
  20929. if (variable_obj.dimensions == 2) {
  20930. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  20931. }
  20932. }
  20933. if (variable_obj.type == _types.Types.TEXT) {
  20934. if (variable_obj.dimensions == 0) {
  20935. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  20936. }
  20937. if (variable_obj.dimensions == 1) {
  20938. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  20939. }
  20940. if (variable_obj.dimensions == 2) {
  20941. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  20942. }
  20943. }
  20944. if (variable_obj.type == _types.Types.BOOLEAN) {
  20945. if (variable_obj.dimensions == 0) {
  20946. variable_obj.value = true;
  20947. }
  20948. if (variable_obj.dimensions == 1) {
  20949. variable_obj.value = [true, true];
  20950. }
  20951. if (variable_obj.dimensions == 2) {
  20952. variable_obj.value = [[true, true], [true, true]];
  20953. }
  20954. }
  20955. }
  20956. var opened_name_value_vector_global_ = false;
  20957. var opened_input_value_vector_global_ = null;
  20958. function enableVectorValueUpdate(var_obj, index, parent_node) {
  20959. if (opened_name_value_vector_global_) {
  20960. opened_input_value_vector_global_.focus();
  20961. return;
  20962. }
  20963. parent_node = (0, _jquery2.default)(parent_node);
  20964. opened_name_value_vector_global_ = true;
  20965. parent_node.find('.span_value_variable').text('');
  20966. var input_field;
  20967. if (var_obj.type == _types.Types.REAL) {
  20968. 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) + "' />");
  20969. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20970. } else {
  20971. 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] + "' />");
  20972. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20973. }
  20974. input_field.on('input', function () {
  20975. var inputWidth = input_field.textWidth() + 10;
  20976. opened_input_value_vector_global_ = input_field;
  20977. input_field.focus();
  20978. var tmpStr = input_field.val();
  20979. input_field.val('');
  20980. input_field.val(tmpStr);
  20981. input_field.css({
  20982. width: inputWidth
  20983. });
  20984. }).trigger('input');
  20985. input_field.focusout(function () {
  20986. /// update array:
  20987. if (input_field.val().trim()) {
  20988. if (var_obj.type == _types.Types.REAL) {
  20989. var_obj.value[index] = parseFloat(input_field.val().trim());
  20990. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20991. } else {
  20992. if (var_obj.type == _types.Types.INTEGER) {
  20993. var_obj.value[index] = parseInt(input_field.val().trim());
  20994. } else {
  20995. var_obj.value[index] = input_field.val().trim();
  20996. }
  20997. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20998. }
  20999. } else {
  21000. if (var_obj.type == _types.Types.REAL) {
  21001. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21002. } else {
  21003. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21004. }
  21005. }
  21006. if (var_obj.type == _types.Types.TEXT) {
  21007. var_obj.value[index] = input_field.val();
  21008. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21009. }
  21010. input_field.off();
  21011. input_field.remove();
  21012. /// update elements:
  21013. opened_name_value_vector_global_ = false;
  21014. opened_input_value_vector_global_ = false;
  21015. });
  21016. input_field.on('keydown', function (e) {
  21017. var code = e.keyCode || e.which;
  21018. if (code == 13) {
  21019. if (input_field.val().trim()) {
  21020. if (var_obj.type == _types.Types.REAL) {
  21021. var_obj.value[index] = parseFloat(input_field.val().trim());
  21022. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21023. } else {
  21024. if (var_obj.type == _types.Types.INTEGER) {
  21025. var_obj.value[index] = parseInt(input_field.val().trim());
  21026. } else {
  21027. var_obj.value[index] = input_field.val().trim();
  21028. }
  21029. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21030. }
  21031. } else {
  21032. if (var_obj.type == _types.Types.REAL) {
  21033. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21034. } else {
  21035. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21036. }
  21037. }
  21038. if (var_obj.type == _types.Types.TEXT) {
  21039. var_obj.value[index] = input_field.val();
  21040. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21041. }
  21042. input_field.off();
  21043. input_field.remove();
  21044. /// update elements:
  21045. opened_name_value_vector_global_ = false;
  21046. opened_input_value_vector_global_ = false;
  21047. }
  21048. if (code == 27) {
  21049. if (var_obj.type == _types.Types.REAL) {
  21050. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  21051. } else {
  21052. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  21053. }
  21054. input_field.off();
  21055. input_field.remove();
  21056. /// update elements:
  21057. opened_name_value_vector_global_ = false;
  21058. opened_input_value_vector_global_ = false;
  21059. }
  21060. });
  21061. input_field.select();
  21062. }
  21063. var opened_name_value_global_var = false;
  21064. var opened_input_value_global_ar = null;
  21065. function enableValueUpdate(var_obj, parent_node) {
  21066. if (opened_name_value_global_var) {
  21067. opened_input_value_global_ar.focus();
  21068. return;
  21069. }
  21070. parent_node = (0, _jquery2.default)(parent_node);
  21071. opened_name_value_global_var = true;
  21072. var input_field;
  21073. parent_node.find('.span_value_variable').text('');
  21074. if (var_obj.type == _types.Types.REAL) {
  21075. 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) + "' />");
  21076. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21077. } else {
  21078. 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 + "' />");
  21079. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21080. }
  21081. input_field.on('input', function () {
  21082. var inputWidth = input_field.textWidth() + 10;
  21083. opened_input_value_global_ar = input_field;
  21084. input_field.focus();
  21085. var tmpStr = input_field.val();
  21086. input_field.val('');
  21087. input_field.val(tmpStr);
  21088. input_field.css({
  21089. width: inputWidth
  21090. });
  21091. }).trigger('input');
  21092. input_field.focusout(function () {
  21093. /// update array:
  21094. if (input_field.val().trim()) {
  21095. if (var_obj.type == _types.Types.REAL) {
  21096. var_obj.value = parseFloat(input_field.val().trim());
  21097. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21098. } else {
  21099. if (var_obj.type == _types.Types.INTEGER) {
  21100. var_obj.value = parseInt(input_field.val().trim());
  21101. } else {
  21102. var_obj.value = input_field.val().trim();
  21103. }
  21104. parent_node.find('.span_value_variable').text(var_obj.value);
  21105. }
  21106. } else {
  21107. if (var_obj.type == _types.Types.REAL) {
  21108. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21109. } else {
  21110. parent_node.find('.span_value_variable').text(var_obj.value);
  21111. }
  21112. }
  21113. if (var_obj.type == _types.Types.TEXT) {
  21114. var_obj.value = input_field.val();
  21115. parent_node.find('.span_value_variable').text(var_obj.value);
  21116. }
  21117. input_field.off();
  21118. input_field.remove();
  21119. /// update elements:
  21120. opened_name_value_global_var = false;
  21121. opened_input_value_global_ar = false;
  21122. });
  21123. input_field.on('keydown', function (e) {
  21124. var code = e.keyCode || e.which;
  21125. if (code == 13) {
  21126. if (input_field.val().trim()) {
  21127. if (var_obj.type == _types.Types.REAL) {
  21128. var_obj.value = parseFloat(input_field.val().trim());
  21129. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21130. } else {
  21131. if (var_obj.type == _types.Types.INTEGER) {
  21132. var_obj.value = parseInt(input_field.val().trim());
  21133. } else {
  21134. var_obj.value = input_field.val().trim();
  21135. }
  21136. parent_node.find('.span_value_variable').text(var_obj.value);
  21137. }
  21138. } else {
  21139. if (var_obj.type == _types.Types.REAL) {
  21140. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21141. } else {
  21142. parent_node.find('.span_value_variable').text(var_obj.value);
  21143. }
  21144. }
  21145. if (var_obj.type == _types.Types.TEXT) {
  21146. var_obj.value = input_field.val();
  21147. parent_node.find('.span_value_variable').text(var_obj.value);
  21148. }
  21149. input_field.off();
  21150. input_field.remove();
  21151. /// update elements:
  21152. opened_name_value_global_var = false;
  21153. opened_input_value_global_ar = false;
  21154. }
  21155. if (code == 27) {
  21156. if (var_obj.type == _types.Types.REAL) {
  21157. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21158. } else {
  21159. parent_node.find('.span_value_variable').text(var_obj.value);
  21160. }
  21161. input_field.off();
  21162. input_field.remove();
  21163. /// update elements:
  21164. opened_name_value_global_var = false;
  21165. opened_input_value_global_ar = false;
  21166. }
  21167. });
  21168. input_field.select();
  21169. }
  21170. var opened_name_global = false;
  21171. var opened_input_global = null;
  21172. function enableNameUpdate(variable_obj, variable_container) {
  21173. if (opened_name_global) {
  21174. opened_input_global.focus();
  21175. return;
  21176. }
  21177. opened_name_global = true;
  21178. variable_container.find('.span_name_variable').text('');
  21179. var input_name;
  21180. 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 + "' />");
  21181. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21182. input_name.on('input', function () {
  21183. var inputWidth = input_name.textWidth() + 10;
  21184. opened_input_global = input_name;
  21185. input_name.focus();
  21186. var tmpStr = input_name.val();
  21187. input_name.val('');
  21188. input_name.val(tmpStr);
  21189. input_name.css({
  21190. width: inputWidth
  21191. });
  21192. }).trigger('input');
  21193. input_name.focusout(function () {
  21194. /// update array:
  21195. if (input_name.val().trim().length > 0) {
  21196. updateName(variable_obj, input_name.val().trim());
  21197. variable_container.find('.span_name_variable').text(variable_obj.name);
  21198. } else {
  21199. variable_container.find('.span_name_variable').text(variable_obj.name);
  21200. }
  21201. input_name.off();
  21202. input_name.remove();
  21203. /// update elements:
  21204. opened_name_global = false;
  21205. opened_input_global = false;
  21206. });
  21207. input_name.on('keydown', function (e) {
  21208. var code = e.keyCode || e.which;
  21209. if (code == 13) {
  21210. if (input_name.val().trim().length > 0) {
  21211. updateName(variable_obj, input_name.val().trim());
  21212. variable_container.find('.span_name_variable').text(variable_obj.name);
  21213. } else {
  21214. variable_container.find('.span_name_variable').text(variable_obj.name);
  21215. }
  21216. input_name.off();
  21217. input_name.remove();
  21218. /// update elements:
  21219. opened_name_global = false;
  21220. opened_input_global = false;
  21221. }
  21222. if (code == 27) {
  21223. variable_container.find('.span_name_variable').text(variable_obj.name);
  21224. input_name.off();
  21225. input_name.remove();
  21226. /// update elements:
  21227. opened_name_global = false;
  21228. opened_input_global = false;
  21229. }
  21230. });
  21231. input_name.select();
  21232. }
  21233. var opened_name_value_matrix_global_v = false;
  21234. var opened_input_value_matrix_global_v = null;
  21235. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21236. if (opened_name_value_matrix_global_v) {
  21237. opened_input_value_matrix_global_v.focus();
  21238. return;
  21239. }
  21240. parent_node = (0, _jquery2.default)(parent_node);
  21241. opened_name_value_matrix_global_v = true;
  21242. parent_node.find('.span_value_variable').text('');
  21243. var input_field;
  21244. if (var_obj.type == _types.Types.REAL) {
  21245. 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) + "' />");
  21246. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21247. } else {
  21248. 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] + "' />");
  21249. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21250. }
  21251. input_field.on('input', function () {
  21252. var inputWidth = input_field.textWidth() + 10;
  21253. opened_input_value_matrix_global_v = input_field;
  21254. input_field.focus();
  21255. var tmpStr = input_field.val();
  21256. input_field.val('');
  21257. input_field.val(tmpStr);
  21258. input_field.css({
  21259. width: inputWidth
  21260. });
  21261. }).trigger('input');
  21262. input_field.focusout(function () {
  21263. /// update array:
  21264. if (input_field.val().trim()) {
  21265. if (var_obj.type == _types.Types.REAL) {
  21266. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21267. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21268. } else {
  21269. if (var_obj.type == _types.Types.INTEGER) {
  21270. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21271. } else {
  21272. var_obj.value[row][index] = input_field.val().trim();
  21273. }
  21274. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21275. }
  21276. } else {
  21277. if (var_obj.type == _types.Types.REAL) {
  21278. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21279. } else {
  21280. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21281. }
  21282. }
  21283. if (var_obj.type == _types.Types.TEXT) {
  21284. var_obj.value[row][index] = input_field.val();
  21285. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21286. }
  21287. input_field.off();
  21288. input_field.remove();
  21289. /// update elements:
  21290. opened_name_value_matrix_global_v = false;
  21291. opened_input_value_matrix_global_v = false;
  21292. });
  21293. input_field.on('keydown', function (e) {
  21294. var code = e.keyCode || e.which;
  21295. if (code == 13) {
  21296. if (input_field.val().trim()) {
  21297. if (var_obj.type == _types.Types.REAL) {
  21298. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21299. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21300. } else {
  21301. if (var_obj.type == _types.Types.INTEGER) {
  21302. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21303. } else {
  21304. var_obj.value[row][index] = input_field.val().trim();
  21305. }
  21306. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21307. }
  21308. } else {
  21309. if (var_obj.type == _types.Types.REAL) {
  21310. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21311. } else {
  21312. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21313. }
  21314. }
  21315. if (var_obj.type == _types.Types.TEXT) {
  21316. var_obj.value[row][index] = input_field.val();
  21317. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21318. }
  21319. input_field.off();
  21320. input_field.remove();
  21321. /// update elements:
  21322. opened_name_value_matrix_global_v = false;
  21323. opened_input_value_matrix_global_v = false;
  21324. }
  21325. if (code == 27) {
  21326. if (var_obj.type == _types.Types.REAL) {
  21327. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21328. } else {
  21329. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21330. }
  21331. input_field.off();
  21332. input_field.remove();
  21333. /// update elements:
  21334. opened_name_value_matrix_global_v = false;
  21335. opened_input_value_matrix_global_v = false;
  21336. }
  21337. });
  21338. input_field.select();
  21339. }
  21340. /***/ }),
  21341. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21342. /*!****************************************************!*\
  21343. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21344. \****************************************************/
  21345. /*! no static exports found */
  21346. /***/ (function(module, exports, __webpack_require__) {
  21347. "use strict";
  21348. //
  21349. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21350. * Use of this file is governed by the BSD 3-clause license that
  21351. * can be found in the LICENSE.txt file in the project root.
  21352. */
  21353. // This implementation of {@link TokenStream} loads tokens from a
  21354. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21355. // access to any previous token by index.
  21356. //
  21357. // <p>
  21358. // This token stream ignores the value of {@link Token//getChannel}. If your
  21359. // parser requires the token stream filter tokens to only those on a particular
  21360. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21361. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21362. // {@link CommonTokenStream}.</p>
  21363. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21364. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21365. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21366. // this is just to keep meaningful parameter types to Parser
  21367. function TokenStream() {
  21368. return this;
  21369. }
  21370. function BufferedTokenStream(tokenSource) {
  21371. TokenStream.call(this);
  21372. // The {@link TokenSource} from which tokens for this stream are fetched.
  21373. this.tokenSource = tokenSource;
  21374. // A collection of all tokens fetched from the token source. The list is
  21375. // considered a complete view of the input once {@link //fetchedEOF} is set
  21376. // to {@code true}.
  21377. this.tokens = [];
  21378. // The index into {@link //tokens} of the current token (next token to
  21379. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21380. // be
  21381. // {@link //LT LT(1)}.
  21382. //
  21383. // <p>This field is set to -1 when the stream is first constructed or when
  21384. // {@link //setTokenSource} is called, indicating that the first token has
  21385. // not yet been fetched from the token source. For additional information,
  21386. // see the documentation of {@link IntStream} for a description of
  21387. // Initializing Methods.</p>
  21388. this.index = -1;
  21389. // Indicates whether the {@link Token//EOF} token has been fetched from
  21390. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21391. // performance for the following cases:
  21392. //
  21393. // <ul>
  21394. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21395. // prevent
  21396. // consuming the EOF symbol is optimized by checking the values of
  21397. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21398. // //LA}.</li>
  21399. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21400. // into
  21401. // {@link //tokens} is trivial with this field.</li>
  21402. // <ul>
  21403. this.fetchedEOF = false;
  21404. return this;
  21405. }
  21406. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21407. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21408. BufferedTokenStream.prototype.mark = function () {
  21409. return 0;
  21410. };
  21411. BufferedTokenStream.prototype.release = function (marker) {
  21412. // no resources to release
  21413. };
  21414. BufferedTokenStream.prototype.reset = function () {
  21415. this.seek(0);
  21416. };
  21417. BufferedTokenStream.prototype.seek = function (index) {
  21418. this.lazyInit();
  21419. this.index = this.adjustSeekIndex(index);
  21420. };
  21421. BufferedTokenStream.prototype.get = function (index) {
  21422. this.lazyInit();
  21423. return this.tokens[index];
  21424. };
  21425. BufferedTokenStream.prototype.consume = function () {
  21426. var skipEofCheck = false;
  21427. if (this.index >= 0) {
  21428. if (this.fetchedEOF) {
  21429. // the last token in tokens is EOF. skip check if p indexes any
  21430. // fetched token except the last.
  21431. skipEofCheck = this.index < this.tokens.length - 1;
  21432. } else {
  21433. // no EOF token in tokens. skip check if p indexes a fetched token.
  21434. skipEofCheck = this.index < this.tokens.length;
  21435. }
  21436. } else {
  21437. // not yet initialized
  21438. skipEofCheck = false;
  21439. }
  21440. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21441. throw "cannot consume EOF";
  21442. }
  21443. if (this.sync(this.index + 1)) {
  21444. this.index = this.adjustSeekIndex(this.index + 1);
  21445. }
  21446. };
  21447. // Make sure index {@code i} in tokens has a token.
  21448. //
  21449. // @return {@code true} if a token is located at index {@code i}, otherwise
  21450. // {@code false}.
  21451. // @see //get(int i)
  21452. // /
  21453. BufferedTokenStream.prototype.sync = function (i) {
  21454. var n = i - this.tokens.length + 1; // how many more elements we need?
  21455. if (n > 0) {
  21456. var fetched = this.fetch(n);
  21457. return fetched >= n;
  21458. }
  21459. return true;
  21460. };
  21461. // Add {@code n} elements to buffer.
  21462. //
  21463. // @return The actual number of elements added to the buffer.
  21464. // /
  21465. BufferedTokenStream.prototype.fetch = function (n) {
  21466. if (this.fetchedEOF) {
  21467. return 0;
  21468. }
  21469. for (var i = 0; i < n; i++) {
  21470. var t = this.tokenSource.nextToken();
  21471. t.tokenIndex = this.tokens.length;
  21472. this.tokens.push(t);
  21473. if (t.type === Token.EOF) {
  21474. this.fetchedEOF = true;
  21475. return i + 1;
  21476. }
  21477. }
  21478. return n;
  21479. };
  21480. // Get all tokens from start..stop inclusively///
  21481. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21482. if (types === undefined) {
  21483. types = null;
  21484. }
  21485. if (start < 0 || stop < 0) {
  21486. return null;
  21487. }
  21488. this.lazyInit();
  21489. var subset = [];
  21490. if (stop >= this.tokens.length) {
  21491. stop = this.tokens.length - 1;
  21492. }
  21493. for (var i = start; i < stop; i++) {
  21494. var t = this.tokens[i];
  21495. if (t.type === Token.EOF) {
  21496. break;
  21497. }
  21498. if (types === null || types.contains(t.type)) {
  21499. subset.push(t);
  21500. }
  21501. }
  21502. return subset;
  21503. };
  21504. BufferedTokenStream.prototype.LA = function (i) {
  21505. return this.LT(i).type;
  21506. };
  21507. BufferedTokenStream.prototype.LB = function (k) {
  21508. if (this.index - k < 0) {
  21509. return null;
  21510. }
  21511. return this.tokens[this.index - k];
  21512. };
  21513. BufferedTokenStream.prototype.LT = function (k) {
  21514. this.lazyInit();
  21515. if (k === 0) {
  21516. return null;
  21517. }
  21518. if (k < 0) {
  21519. return this.LB(-k);
  21520. }
  21521. var i = this.index + k - 1;
  21522. this.sync(i);
  21523. if (i >= this.tokens.length) {
  21524. // return EOF token
  21525. // EOF must be last token
  21526. return this.tokens[this.tokens.length - 1];
  21527. }
  21528. return this.tokens[i];
  21529. };
  21530. // Allowed derived classes to modify the behavior of operations which change
  21531. // the current stream position by adjusting the target token index of a seek
  21532. // operation. The default implementation simply returns {@code i}. If an
  21533. // exception is thrown in this method, the current stream index should not be
  21534. // changed.
  21535. //
  21536. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  21537. // that
  21538. // the seek target is always an on-channel token.</p>
  21539. //
  21540. // @param i The target token index.
  21541. // @return The adjusted target token index.
  21542. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  21543. return i;
  21544. };
  21545. BufferedTokenStream.prototype.lazyInit = function () {
  21546. if (this.index === -1) {
  21547. this.setup();
  21548. }
  21549. };
  21550. BufferedTokenStream.prototype.setup = function () {
  21551. this.sync(0);
  21552. this.index = this.adjustSeekIndex(0);
  21553. };
  21554. // Reset this token stream by setting its token source.///
  21555. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  21556. this.tokenSource = tokenSource;
  21557. this.tokens = [];
  21558. this.index = -1;
  21559. this.fetchedEOF = false;
  21560. };
  21561. // Given a starting index, return the index of the next token on channel.
  21562. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21563. // on channel between i and EOF.
  21564. // /
  21565. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  21566. this.sync(i);
  21567. if (i >= this.tokens.length) {
  21568. return -1;
  21569. }
  21570. var token = this.tokens[i];
  21571. while (token.channel !== this.channel) {
  21572. if (token.type === Token.EOF) {
  21573. return -1;
  21574. }
  21575. i += 1;
  21576. this.sync(i);
  21577. token = this.tokens[i];
  21578. }
  21579. return i;
  21580. };
  21581. // Given a starting index, return the index of the previous token on channel.
  21582. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21583. // on channel between i and 0.
  21584. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  21585. while (i >= 0 && this.tokens[i].channel !== channel) {
  21586. i -= 1;
  21587. }
  21588. return i;
  21589. };
  21590. // Collect all tokens on specified channel to the right of
  21591. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  21592. // EOF. If channel is -1, find any non default channel token.
  21593. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  21594. if (channel === undefined) {
  21595. channel = -1;
  21596. }
  21597. this.lazyInit();
  21598. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21599. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21600. }
  21601. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21602. var from_ = tokenIndex + 1;
  21603. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  21604. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  21605. return this.filterForChannel(from_, to, channel);
  21606. };
  21607. // Collect all tokens on specified channel to the left of
  21608. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  21609. // If channel is -1, find any non default channel token.
  21610. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  21611. if (channel === undefined) {
  21612. channel = -1;
  21613. }
  21614. this.lazyInit();
  21615. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21616. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21617. }
  21618. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21619. if (prevOnChannel === tokenIndex - 1) {
  21620. return null;
  21621. }
  21622. // if none on channel to left, prevOnChannel=-1 then from=0
  21623. var from_ = prevOnChannel + 1;
  21624. var to = tokenIndex - 1;
  21625. return this.filterForChannel(from_, to, channel);
  21626. };
  21627. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  21628. var hidden = [];
  21629. for (var i = left; i < right + 1; i++) {
  21630. var t = this.tokens[i];
  21631. if (channel === -1) {
  21632. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  21633. hidden.push(t);
  21634. }
  21635. } else if (t.channel === channel) {
  21636. hidden.push(t);
  21637. }
  21638. }
  21639. if (hidden.length === 0) {
  21640. return null;
  21641. }
  21642. return hidden;
  21643. };
  21644. BufferedTokenStream.prototype.getSourceName = function () {
  21645. return this.tokenSource.getSourceName();
  21646. };
  21647. // Get the text of all tokens in this buffer.///
  21648. BufferedTokenStream.prototype.getText = function (interval) {
  21649. this.lazyInit();
  21650. this.fill();
  21651. if (interval === undefined || interval === null) {
  21652. interval = new Interval(0, this.tokens.length - 1);
  21653. }
  21654. var start = interval.start;
  21655. if (start instanceof Token) {
  21656. start = start.tokenIndex;
  21657. }
  21658. var stop = interval.stop;
  21659. if (stop instanceof Token) {
  21660. stop = stop.tokenIndex;
  21661. }
  21662. if (start === null || stop === null || start < 0 || stop < 0) {
  21663. return "";
  21664. }
  21665. if (stop >= this.tokens.length) {
  21666. stop = this.tokens.length - 1;
  21667. }
  21668. var s = "";
  21669. for (var i = start; i < stop + 1; i++) {
  21670. var t = this.tokens[i];
  21671. if (t.type === Token.EOF) {
  21672. break;
  21673. }
  21674. s = s + t.text;
  21675. }
  21676. return s;
  21677. };
  21678. // Get all tokens from lexer until EOF///
  21679. BufferedTokenStream.prototype.fill = function () {
  21680. this.lazyInit();
  21681. while (this.fetch(1000) === 1000) {
  21682. continue;
  21683. }
  21684. };
  21685. exports.BufferedTokenStream = BufferedTokenStream;
  21686. /***/ }),
  21687. /***/ "./node_modules/antlr4/CharStreams.js":
  21688. /*!********************************************!*\
  21689. !*** ./node_modules/antlr4/CharStreams.js ***!
  21690. \********************************************/
  21691. /*! no static exports found */
  21692. /***/ (function(module, exports, __webpack_require__) {
  21693. "use strict";
  21694. //
  21695. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21696. * Use of this file is governed by the BSD 3-clause license that
  21697. * can be found in the LICENSE.txt file in the project root.
  21698. */
  21699. //
  21700. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21701. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21702. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21703. // Utility functions to create InputStreams from various sources.
  21704. //
  21705. // All returned InputStreams support the full range of Unicode
  21706. // up to U+10FFFF (the default behavior of InputStream only supports
  21707. // code points up to U+FFFF).
  21708. var CharStreams = {
  21709. // Creates an InputStream from a string.
  21710. fromString: function fromString(str) {
  21711. return new InputStream(str, true);
  21712. },
  21713. // Asynchronously creates an InputStream from a blob given the
  21714. // encoding of the bytes in that blob (defaults to 'utf8' if
  21715. // encoding is null).
  21716. //
  21717. // Invokes onLoad(result) on success, onError(error) on
  21718. // failure.
  21719. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  21720. var reader = FileReader();
  21721. reader.onload = function (e) {
  21722. var is = new InputStream(e.target.result, true);
  21723. onLoad(is);
  21724. };
  21725. reader.onerror = onError;
  21726. reader.readAsText(blob, encoding);
  21727. },
  21728. // Creates an InputStream from a Buffer given the
  21729. // encoding of the bytes in that buffer (defaults to 'utf8' if
  21730. // encoding is null).
  21731. fromBuffer: function fromBuffer(buffer, encoding) {
  21732. return new InputStream(buffer.toString(encoding), true);
  21733. },
  21734. // Asynchronously creates an InputStream from a file on disk given
  21735. // the encoding of the bytes in that file (defaults to 'utf8' if
  21736. // encoding is null).
  21737. //
  21738. // Invokes callback(error, result) on completion.
  21739. fromPath: function fromPath(path, encoding, callback) {
  21740. fs.readFile(path, encoding, function (err, data) {
  21741. var is = null;
  21742. if (data !== null) {
  21743. is = new InputStream(data, true);
  21744. }
  21745. callback(err, is);
  21746. });
  21747. },
  21748. // Synchronously creates an InputStream given a path to a file
  21749. // on disk and the encoding of the bytes in that file (defaults to
  21750. // 'utf8' if encoding is null).
  21751. fromPathSync: function fromPathSync(path, encoding) {
  21752. var data = fs.readFileSync(path, encoding);
  21753. return new InputStream(data, true);
  21754. }
  21755. };
  21756. exports.CharStreams = CharStreams;
  21757. /***/ }),
  21758. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  21759. /*!***************************************************!*\
  21760. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  21761. \***************************************************/
  21762. /*! no static exports found */
  21763. /***/ (function(module, exports, __webpack_require__) {
  21764. "use strict";
  21765. //
  21766. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21767. * Use of this file is governed by the BSD 3-clause license that
  21768. * can be found in the LICENSE.txt file in the project root.
  21769. */
  21770. //
  21771. //
  21772. // This default implementation of {@link TokenFactory} creates
  21773. // {@link CommonToken} objects.
  21774. //
  21775. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  21776. function TokenFactory() {
  21777. return this;
  21778. }
  21779. function CommonTokenFactory(copyText) {
  21780. TokenFactory.call(this);
  21781. // Indicates whether {@link CommonToken//setText} should be called after
  21782. // constructing tokens to explicitly set the text. This is useful for cases
  21783. // where the input stream might not be able to provide arbitrary substrings
  21784. // of text from the input after the lexer creates a token (e.g. the
  21785. // implementation of {@link CharStream//getText} in
  21786. // {@link UnbufferedCharStream} throws an
  21787. // {@link UnsupportedOperationException}). Explicitly setting the token text
  21788. // allows {@link Token//getText} to be called at any time regardless of the
  21789. // input stream implementation.
  21790. //
  21791. // <p>
  21792. // The default value is {@code false} to avoid the performance and memory
  21793. // overhead of copying text for every token unless explicitly requested.</p>
  21794. //
  21795. this.copyText = copyText === undefined ? false : copyText;
  21796. return this;
  21797. }
  21798. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  21799. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  21800. //
  21801. // The default {@link CommonTokenFactory} instance.
  21802. //
  21803. // <p>
  21804. // This token factory does not explicitly copy token text when constructing
  21805. // tokens.</p>
  21806. //
  21807. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  21808. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  21809. var t = new CommonToken(source, type, channel, start, stop);
  21810. t.line = line;
  21811. t.column = column;
  21812. if (text !== null) {
  21813. t.text = text;
  21814. } else if (this.copyText && source[1] !== null) {
  21815. t.text = source[1].getText(start, stop);
  21816. }
  21817. return t;
  21818. };
  21819. CommonTokenFactory.prototype.createThin = function (type, text) {
  21820. var t = new CommonToken(null, type);
  21821. t.text = text;
  21822. return t;
  21823. };
  21824. exports.CommonTokenFactory = CommonTokenFactory;
  21825. /***/ }),
  21826. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  21827. /*!**************************************************!*\
  21828. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  21829. \**************************************************/
  21830. /*! no static exports found */
  21831. /***/ (function(module, exports, __webpack_require__) {
  21832. "use strict";
  21833. //
  21834. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21835. * Use of this file is governed by the BSD 3-clause license that
  21836. * can be found in the LICENSE.txt file in the project root.
  21837. */
  21838. ///
  21839. //
  21840. // This class extends {@link BufferedTokenStream} with functionality to filter
  21841. // token streams to tokens on a particular channel (tokens where
  21842. // {@link Token//getChannel} returns a particular value).
  21843. //
  21844. // <p>
  21845. // This token stream provides access to all tokens by index or when calling
  21846. // methods like {@link //getText}. The channel filtering is only used for code
  21847. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  21848. // {@link //LB}.</p>
  21849. //
  21850. // <p>
  21851. // By default, tokens are placed on the default channel
  21852. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  21853. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  21854. // call {@link Lexer//setChannel}.
  21855. // </p>
  21856. //
  21857. // <p>
  21858. // Note: lexer rules which use the {@code ->skip} lexer command or call
  21859. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  21860. // such a rule will not be available as part of the token stream, regardless of
  21861. // channel.</p>
  21862. ///
  21863. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21864. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  21865. function CommonTokenStream(lexer, channel) {
  21866. BufferedTokenStream.call(this, lexer);
  21867. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  21868. return this;
  21869. }
  21870. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  21871. CommonTokenStream.prototype.constructor = CommonTokenStream;
  21872. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  21873. return this.nextTokenOnChannel(i, this.channel);
  21874. };
  21875. CommonTokenStream.prototype.LB = function (k) {
  21876. if (k === 0 || this.index - k < 0) {
  21877. return null;
  21878. }
  21879. var i = this.index;
  21880. var n = 1;
  21881. // find k good tokens looking backwards
  21882. while (n <= k) {
  21883. // skip off-channel tokens
  21884. i = this.previousTokenOnChannel(i - 1, this.channel);
  21885. n += 1;
  21886. }
  21887. if (i < 0) {
  21888. return null;
  21889. }
  21890. return this.tokens[i];
  21891. };
  21892. CommonTokenStream.prototype.LT = function (k) {
  21893. this.lazyInit();
  21894. if (k === 0) {
  21895. return null;
  21896. }
  21897. if (k < 0) {
  21898. return this.LB(-k);
  21899. }
  21900. var i = this.index;
  21901. var n = 1; // we know tokens[pos] is a good one
  21902. // find k good tokens
  21903. while (n < k) {
  21904. // skip off-channel tokens, but make sure to not look past EOF
  21905. if (this.sync(i + 1)) {
  21906. i = this.nextTokenOnChannel(i + 1, this.channel);
  21907. }
  21908. n += 1;
  21909. }
  21910. return this.tokens[i];
  21911. };
  21912. // Count EOF just once.///
  21913. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  21914. var n = 0;
  21915. this.fill();
  21916. for (var i = 0; i < this.tokens.length; i++) {
  21917. var t = this.tokens[i];
  21918. if (t.channel === this.channel) {
  21919. n += 1;
  21920. }
  21921. if (t.type === Token.EOF) {
  21922. break;
  21923. }
  21924. }
  21925. return n;
  21926. };
  21927. exports.CommonTokenStream = CommonTokenStream;
  21928. /***/ }),
  21929. /***/ "./node_modules/antlr4/FileStream.js":
  21930. /*!*******************************************!*\
  21931. !*** ./node_modules/antlr4/FileStream.js ***!
  21932. \*******************************************/
  21933. /*! no static exports found */
  21934. /***/ (function(module, exports, __webpack_require__) {
  21935. "use strict";
  21936. //
  21937. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21938. * Use of this file is governed by the BSD 3-clause license that
  21939. * can be found in the LICENSE.txt file in the project root.
  21940. */
  21941. //
  21942. //
  21943. // This is an InputStream that is loaded from a file all at once
  21944. // when you construct the object.
  21945. //
  21946. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21947. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21948. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21949. function FileStream(fileName, decodeToUnicodeCodePoints) {
  21950. var data = fs.readFileSync(fileName, "utf8");
  21951. InputStream.call(this, data, decodeToUnicodeCodePoints);
  21952. this.fileName = fileName;
  21953. return this;
  21954. }
  21955. FileStream.prototype = Object.create(InputStream.prototype);
  21956. FileStream.prototype.constructor = FileStream;
  21957. exports.FileStream = FileStream;
  21958. /***/ }),
  21959. /***/ "./node_modules/antlr4/InputStream.js":
  21960. /*!********************************************!*\
  21961. !*** ./node_modules/antlr4/InputStream.js ***!
  21962. \********************************************/
  21963. /*! no static exports found */
  21964. /***/ (function(module, exports, __webpack_require__) {
  21965. "use strict";
  21966. //
  21967. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21968. * Use of this file is governed by the BSD 3-clause license that
  21969. * can be found in the LICENSE.txt file in the project root.
  21970. */
  21971. //
  21972. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21973. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  21974. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  21975. // Vacuum all input from a string and then treat it like a buffer.
  21976. function _loadString(stream, decodeToUnicodeCodePoints) {
  21977. stream._index = 0;
  21978. stream.data = [];
  21979. if (stream.decodeToUnicodeCodePoints) {
  21980. for (var i = 0; i < stream.strdata.length;) {
  21981. var codePoint = stream.strdata.codePointAt(i);
  21982. stream.data.push(codePoint);
  21983. i += codePoint <= 0xFFFF ? 1 : 2;
  21984. }
  21985. } else {
  21986. for (var i = 0; i < stream.strdata.length; i++) {
  21987. var codeUnit = stream.strdata.charCodeAt(i);
  21988. stream.data.push(codeUnit);
  21989. }
  21990. }
  21991. stream._size = stream.data.length;
  21992. }
  21993. // If decodeToUnicodeCodePoints is true, the input is treated
  21994. // as a series of Unicode code points.
  21995. //
  21996. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  21997. // units.
  21998. function InputStream(data, decodeToUnicodeCodePoints) {
  21999. this.name = "<empty>";
  22000. this.strdata = data;
  22001. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  22002. _loadString(this);
  22003. return this;
  22004. }
  22005. Object.defineProperty(InputStream.prototype, "index", {
  22006. get: function get() {
  22007. return this._index;
  22008. }
  22009. });
  22010. Object.defineProperty(InputStream.prototype, "size", {
  22011. get: function get() {
  22012. return this._size;
  22013. }
  22014. });
  22015. // Reset the stream so that it's in the same state it was
  22016. // when the object was created *except* the data array is not
  22017. // touched.
  22018. //
  22019. InputStream.prototype.reset = function () {
  22020. this._index = 0;
  22021. };
  22022. InputStream.prototype.consume = function () {
  22023. if (this._index >= this._size) {
  22024. // assert this.LA(1) == Token.EOF
  22025. throw "cannot consume EOF";
  22026. }
  22027. this._index += 1;
  22028. };
  22029. InputStream.prototype.LA = function (offset) {
  22030. if (offset === 0) {
  22031. return 0; // undefined
  22032. }
  22033. if (offset < 0) {
  22034. offset += 1; // e.g., translate LA(-1) to use offset=0
  22035. }
  22036. var pos = this._index + offset - 1;
  22037. if (pos < 0 || pos >= this._size) {
  22038. // invalid
  22039. return Token.EOF;
  22040. }
  22041. return this.data[pos];
  22042. };
  22043. InputStream.prototype.LT = function (offset) {
  22044. return this.LA(offset);
  22045. };
  22046. // mark/release do nothing; we have entire buffer
  22047. InputStream.prototype.mark = function () {
  22048. return -1;
  22049. };
  22050. InputStream.prototype.release = function (marker) {};
  22051. // consume() ahead until p==_index; can't just set p=_index as we must
  22052. // update line and column. If we seek backwards, just set p
  22053. //
  22054. InputStream.prototype.seek = function (_index) {
  22055. if (_index <= this._index) {
  22056. this._index = _index; // just jump; don't update stream state (line,
  22057. // ...)
  22058. return;
  22059. }
  22060. // seek forward
  22061. this._index = Math.min(_index, this._size);
  22062. };
  22063. InputStream.prototype.getText = function (start, stop) {
  22064. if (stop >= this._size) {
  22065. stop = this._size - 1;
  22066. }
  22067. if (start >= this._size) {
  22068. return "";
  22069. } else {
  22070. if (this.decodeToUnicodeCodePoints) {
  22071. var result = "";
  22072. for (var i = start; i <= stop; i++) {
  22073. result += String.fromCodePoint(this.data[i]);
  22074. }
  22075. return result;
  22076. } else {
  22077. return this.strdata.slice(start, stop + 1);
  22078. }
  22079. }
  22080. };
  22081. InputStream.prototype.toString = function () {
  22082. return this.strdata;
  22083. };
  22084. exports.InputStream = InputStream;
  22085. /***/ }),
  22086. /***/ "./node_modules/antlr4/IntervalSet.js":
  22087. /*!********************************************!*\
  22088. !*** ./node_modules/antlr4/IntervalSet.js ***!
  22089. \********************************************/
  22090. /*! no static exports found */
  22091. /***/ (function(module, exports, __webpack_require__) {
  22092. "use strict";
  22093. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22094. * Use of this file is governed by the BSD 3-clause license that
  22095. * can be found in the LICENSE.txt file in the project root.
  22096. */
  22097. /*jslint smarttabs:true */
  22098. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22099. /* stop is not included! */
  22100. function Interval(start, stop) {
  22101. this.start = start;
  22102. this.stop = stop;
  22103. return this;
  22104. }
  22105. Interval.prototype.contains = function (item) {
  22106. return item >= this.start && item < this.stop;
  22107. };
  22108. Interval.prototype.toString = function () {
  22109. if (this.start === this.stop - 1) {
  22110. return this.start.toString();
  22111. } else {
  22112. return this.start.toString() + ".." + (this.stop - 1).toString();
  22113. }
  22114. };
  22115. Object.defineProperty(Interval.prototype, "length", {
  22116. get: function get() {
  22117. return this.stop - this.start;
  22118. }
  22119. });
  22120. function IntervalSet() {
  22121. this.intervals = null;
  22122. this.readOnly = false;
  22123. }
  22124. IntervalSet.prototype.first = function (v) {
  22125. if (this.intervals === null || this.intervals.length === 0) {
  22126. return Token.INVALID_TYPE;
  22127. } else {
  22128. return this.intervals[0].start;
  22129. }
  22130. };
  22131. IntervalSet.prototype.addOne = function (v) {
  22132. this.addInterval(new Interval(v, v + 1));
  22133. };
  22134. IntervalSet.prototype.addRange = function (l, h) {
  22135. this.addInterval(new Interval(l, h + 1));
  22136. };
  22137. IntervalSet.prototype.addInterval = function (v) {
  22138. if (this.intervals === null) {
  22139. this.intervals = [];
  22140. this.intervals.push(v);
  22141. } else {
  22142. // find insert pos
  22143. for (var k = 0; k < this.intervals.length; k++) {
  22144. var i = this.intervals[k];
  22145. // distinct range -> insert
  22146. if (v.stop < i.start) {
  22147. this.intervals.splice(k, 0, v);
  22148. return;
  22149. }
  22150. // contiguous range -> adjust
  22151. else if (v.stop === i.start) {
  22152. this.intervals[k].start = v.start;
  22153. return;
  22154. }
  22155. // overlapping range -> adjust and reduce
  22156. else if (v.start <= i.stop) {
  22157. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22158. this.reduce(k);
  22159. return;
  22160. }
  22161. }
  22162. // greater than any existing
  22163. this.intervals.push(v);
  22164. }
  22165. };
  22166. IntervalSet.prototype.addSet = function (other) {
  22167. if (other.intervals !== null) {
  22168. for (var k = 0; k < other.intervals.length; k++) {
  22169. var i = other.intervals[k];
  22170. this.addInterval(new Interval(i.start, i.stop));
  22171. }
  22172. }
  22173. return this;
  22174. };
  22175. IntervalSet.prototype.reduce = function (k) {
  22176. // only need to reduce if k is not the last
  22177. if (k < this.intervalslength - 1) {
  22178. var l = this.intervals[k];
  22179. var r = this.intervals[k + 1];
  22180. // if r contained in l
  22181. if (l.stop >= r.stop) {
  22182. this.intervals.pop(k + 1);
  22183. this.reduce(k);
  22184. } else if (l.stop >= r.start) {
  22185. this.intervals[k] = new Interval(l.start, r.stop);
  22186. this.intervals.pop(k + 1);
  22187. }
  22188. }
  22189. };
  22190. IntervalSet.prototype.complement = function (start, stop) {
  22191. var result = new IntervalSet();
  22192. result.addInterval(new Interval(start, stop + 1));
  22193. for (var i = 0; i < this.intervals.length; i++) {
  22194. result.removeRange(this.intervals[i]);
  22195. }
  22196. return result;
  22197. };
  22198. IntervalSet.prototype.contains = function (item) {
  22199. if (this.intervals === null) {
  22200. return false;
  22201. } else {
  22202. for (var k = 0; k < this.intervals.length; k++) {
  22203. if (this.intervals[k].contains(item)) {
  22204. return true;
  22205. }
  22206. }
  22207. return false;
  22208. }
  22209. };
  22210. Object.defineProperty(IntervalSet.prototype, "length", {
  22211. get: function get() {
  22212. var len = 0;
  22213. this.intervals.map(function (i) {
  22214. len += i.length;
  22215. });
  22216. return len;
  22217. }
  22218. });
  22219. IntervalSet.prototype.removeRange = function (v) {
  22220. if (v.start === v.stop - 1) {
  22221. this.removeOne(v.start);
  22222. } else if (this.intervals !== null) {
  22223. var k = 0;
  22224. for (var n = 0; n < this.intervals.length; n++) {
  22225. var i = this.intervals[k];
  22226. // intervals are ordered
  22227. if (v.stop <= i.start) {
  22228. return;
  22229. }
  22230. // check for including range, split it
  22231. else if (v.start > i.start && v.stop < i.stop) {
  22232. this.intervals[k] = new Interval(i.start, v.start);
  22233. var x = new Interval(v.stop, i.stop);
  22234. this.intervals.splice(k, 0, x);
  22235. return;
  22236. }
  22237. // check for included range, remove it
  22238. else if (v.start <= i.start && v.stop >= i.stop) {
  22239. this.intervals.splice(k, 1);
  22240. k = k - 1; // need another pass
  22241. }
  22242. // check for lower boundary
  22243. else if (v.start < i.stop) {
  22244. this.intervals[k] = new Interval(i.start, v.start);
  22245. }
  22246. // check for upper boundary
  22247. else if (v.stop < i.stop) {
  22248. this.intervals[k] = new Interval(v.stop, i.stop);
  22249. }
  22250. k += 1;
  22251. }
  22252. }
  22253. };
  22254. IntervalSet.prototype.removeOne = function (v) {
  22255. if (this.intervals !== null) {
  22256. for (var k = 0; k < this.intervals.length; k++) {
  22257. var i = this.intervals[k];
  22258. // intervals is ordered
  22259. if (v < i.start) {
  22260. return;
  22261. }
  22262. // check for single value range
  22263. else if (v === i.start && v === i.stop - 1) {
  22264. this.intervals.splice(k, 1);
  22265. return;
  22266. }
  22267. // check for lower boundary
  22268. else if (v === i.start) {
  22269. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22270. return;
  22271. }
  22272. // check for upper boundary
  22273. else if (v === i.stop - 1) {
  22274. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22275. return;
  22276. }
  22277. // split existing range
  22278. else if (v < i.stop - 1) {
  22279. var x = new Interval(i.start, v);
  22280. i.start = v + 1;
  22281. this.intervals.splice(k, 0, x);
  22282. return;
  22283. }
  22284. }
  22285. }
  22286. };
  22287. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22288. literalNames = literalNames || null;
  22289. symbolicNames = symbolicNames || null;
  22290. elemsAreChar = elemsAreChar || false;
  22291. if (this.intervals === null) {
  22292. return "{}";
  22293. } else if (literalNames !== null || symbolicNames !== null) {
  22294. return this.toTokenString(literalNames, symbolicNames);
  22295. } else if (elemsAreChar) {
  22296. return this.toCharString();
  22297. } else {
  22298. return this.toIndexString();
  22299. }
  22300. };
  22301. IntervalSet.prototype.toCharString = function () {
  22302. var names = [];
  22303. for (var i = 0; i < this.intervals.length; i++) {
  22304. var v = this.intervals[i];
  22305. if (v.stop === v.start + 1) {
  22306. if (v.start === Token.EOF) {
  22307. names.push("<EOF>");
  22308. } else {
  22309. names.push("'" + String.fromCharCode(v.start) + "'");
  22310. }
  22311. } else {
  22312. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22313. }
  22314. }
  22315. if (names.length > 1) {
  22316. return "{" + names.join(", ") + "}";
  22317. } else {
  22318. return names[0];
  22319. }
  22320. };
  22321. IntervalSet.prototype.toIndexString = function () {
  22322. var names = [];
  22323. for (var i = 0; i < this.intervals.length; i++) {
  22324. var v = this.intervals[i];
  22325. if (v.stop === v.start + 1) {
  22326. if (v.start === Token.EOF) {
  22327. names.push("<EOF>");
  22328. } else {
  22329. names.push(v.start.toString());
  22330. }
  22331. } else {
  22332. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22333. }
  22334. }
  22335. if (names.length > 1) {
  22336. return "{" + names.join(", ") + "}";
  22337. } else {
  22338. return names[0];
  22339. }
  22340. };
  22341. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22342. var names = [];
  22343. for (var i = 0; i < this.intervals.length; i++) {
  22344. var v = this.intervals[i];
  22345. for (var j = v.start; j < v.stop; j++) {
  22346. names.push(this.elementName(literalNames, symbolicNames, j));
  22347. }
  22348. }
  22349. if (names.length > 1) {
  22350. return "{" + names.join(", ") + "}";
  22351. } else {
  22352. return names[0];
  22353. }
  22354. };
  22355. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22356. if (a === Token.EOF) {
  22357. return "<EOF>";
  22358. } else if (a === Token.EPSILON) {
  22359. return "<EPSILON>";
  22360. } else {
  22361. return literalNames[a] || symbolicNames[a];
  22362. }
  22363. };
  22364. exports.Interval = Interval;
  22365. exports.IntervalSet = IntervalSet;
  22366. /***/ }),
  22367. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22368. /*!********************************************!*\
  22369. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22370. \********************************************/
  22371. /*! no static exports found */
  22372. /***/ (function(module, exports, __webpack_require__) {
  22373. "use strict";
  22374. //
  22375. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22376. * Use of this file is governed by the BSD 3-clause license that
  22377. * can be found in the LICENSE.txt file in the project root.
  22378. */
  22379. ///
  22380. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22381. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22382. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22383. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22384. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22385. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22386. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22387. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22388. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22389. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22390. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22391. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22392. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22393. var PredictionContext = pc.PredictionContext;
  22394. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22395. function LL1Analyzer(atn) {
  22396. this.atn = atn;
  22397. }
  22398. //* Special value added to the lookahead sets to indicate that we hit
  22399. // a predicate during analysis if {@code seeThruPreds==false}.
  22400. ///
  22401. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22402. //*
  22403. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22404. // of an {@link ATNState}. The returned array has one element for each
  22405. // outgoing transition in {@code s}. If the closure from transition
  22406. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22407. // element at index <em>i</em> of the result will be {@code null}.
  22408. //
  22409. // @param s the ATN state
  22410. // @return the expected symbols for each outgoing transition of {@code s}.
  22411. ///
  22412. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22413. if (s === null) {
  22414. return null;
  22415. }
  22416. var count = s.transitions.length;
  22417. var look = [];
  22418. for (var alt = 0; alt < count; alt++) {
  22419. look[alt] = new IntervalSet();
  22420. var lookBusy = new Set();
  22421. var seeThruPreds = false; // fail to get lookahead upon pred
  22422. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22423. // Wipe out lookahead for this alternative if we found nothing
  22424. // or we had a predicate when we !seeThruPreds
  22425. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22426. look[alt] = null;
  22427. }
  22428. }
  22429. return look;
  22430. };
  22431. //*
  22432. // Compute set of tokens that can follow {@code s} in the ATN in the
  22433. // specified {@code ctx}.
  22434. //
  22435. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22436. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22437. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22438. // reached, {@link Token//EOF} is added to the result set.</p>
  22439. //
  22440. // @param s the ATN state
  22441. // @param stopState the ATN state to stop at. This can be a
  22442. // {@link BlockEndState} to detect epsilon paths through a closure.
  22443. // @param ctx the complete parser context, or {@code null} if the context
  22444. // should be ignored
  22445. //
  22446. // @return The set of tokens that can follow {@code s} in the ATN in the
  22447. // specified {@code ctx}.
  22448. ///
  22449. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22450. var r = new IntervalSet();
  22451. var seeThruPreds = true; // ignore preds; get all lookahead
  22452. ctx = ctx || null;
  22453. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22454. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22455. return r;
  22456. };
  22457. //*
  22458. // Compute set of tokens that can follow {@code s} in the ATN in the
  22459. // specified {@code ctx}.
  22460. //
  22461. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22462. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22463. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22464. // {@code true} and {@code stopState} or the end of the outermost rule is
  22465. // reached, {@link Token//EOF} is added to the result set.</p>
  22466. //
  22467. // @param s the ATN state.
  22468. // @param stopState the ATN state to stop at. This can be a
  22469. // {@link BlockEndState} to detect epsilon paths through a closure.
  22470. // @param ctx The outer context, or {@code null} if the outer context should
  22471. // not be used.
  22472. // @param look The result lookahead set.
  22473. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22474. // from causing a stack overflow. Outside code should pass
  22475. // {@code new Set<ATNConfig>} for this argument.
  22476. // @param calledRuleStack A set used for preventing left recursion in the
  22477. // ATN from causing a stack overflow. Outside code should pass
  22478. // {@code new BitSet()} for this argument.
  22479. // @param seeThruPreds {@code true} to true semantic predicates as
  22480. // implicitly {@code true} and "see through them", otherwise {@code false}
  22481. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22482. // result if one is encountered.
  22483. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22484. // outermost context is reached. This parameter has no effect if {@code ctx}
  22485. // is {@code null}.
  22486. ///
  22487. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22488. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22489. if (lookBusy.contains(c)) {
  22490. return;
  22491. }
  22492. lookBusy.add(c);
  22493. if (s === stopState) {
  22494. if (ctx === null) {
  22495. look.addOne(Token.EPSILON);
  22496. return;
  22497. } else if (ctx.isEmpty() && addEOF) {
  22498. look.addOne(Token.EOF);
  22499. return;
  22500. }
  22501. }
  22502. if (s instanceof RuleStopState) {
  22503. if (ctx === null) {
  22504. look.addOne(Token.EPSILON);
  22505. return;
  22506. } else if (ctx.isEmpty() && addEOF) {
  22507. look.addOne(Token.EOF);
  22508. return;
  22509. }
  22510. if (ctx !== PredictionContext.EMPTY) {
  22511. // run thru all possible stack tops in ctx
  22512. for (var i = 0; i < ctx.length; i++) {
  22513. var returnState = this.atn.states[ctx.getReturnState(i)];
  22514. var removed = calledRuleStack.contains(returnState.ruleIndex);
  22515. try {
  22516. calledRuleStack.remove(returnState.ruleIndex);
  22517. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22518. } finally {
  22519. if (removed) {
  22520. calledRuleStack.add(returnState.ruleIndex);
  22521. }
  22522. }
  22523. }
  22524. return;
  22525. }
  22526. }
  22527. for (var j = 0; j < s.transitions.length; j++) {
  22528. var t = s.transitions[j];
  22529. if (t.constructor === RuleTransition) {
  22530. if (calledRuleStack.contains(t.target.ruleIndex)) {
  22531. continue;
  22532. }
  22533. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  22534. try {
  22535. calledRuleStack.add(t.target.ruleIndex);
  22536. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22537. } finally {
  22538. calledRuleStack.remove(t.target.ruleIndex);
  22539. }
  22540. } else if (t instanceof AbstractPredicateTransition) {
  22541. if (seeThruPreds) {
  22542. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22543. } else {
  22544. look.addOne(LL1Analyzer.HIT_PRED);
  22545. }
  22546. } else if (t.isEpsilon) {
  22547. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22548. } else if (t.constructor === WildcardTransition) {
  22549. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22550. } else {
  22551. var set = t.label;
  22552. if (set !== null) {
  22553. if (t instanceof NotSetTransition) {
  22554. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22555. }
  22556. look.addSet(set);
  22557. }
  22558. }
  22559. }
  22560. };
  22561. exports.LL1Analyzer = LL1Analyzer;
  22562. /***/ }),
  22563. /***/ "./node_modules/antlr4/Lexer.js":
  22564. /*!**************************************!*\
  22565. !*** ./node_modules/antlr4/Lexer.js ***!
  22566. \**************************************/
  22567. /*! no static exports found */
  22568. /***/ (function(module, exports, __webpack_require__) {
  22569. "use strict";
  22570. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22571. * Use of this file is governed by the BSD 3-clause license that
  22572. * can be found in the LICENSE.txt file in the project root.
  22573. */
  22574. ///
  22575. // A lexer is recognizer that draws input symbols from a character stream.
  22576. // lexer grammars result in a subclass of this object. A Lexer object
  22577. // uses simplified match() and error recovery mechanisms in the interest of speed.
  22578. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22579. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22580. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  22581. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  22582. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  22583. function TokenSource() {
  22584. return this;
  22585. }
  22586. function Lexer(input) {
  22587. Recognizer.call(this);
  22588. this._input = input;
  22589. this._factory = CommonTokenFactory.DEFAULT;
  22590. this._tokenFactorySourcePair = [this, input];
  22591. this._interp = null; // child classes must populate this
  22592. // The goal of all lexer rules/methods is to create a token object.
  22593. // this is an instance variable as multiple rules may collaborate to
  22594. // create a single token. nextToken will return this object after
  22595. // matching lexer rule(s). If you subclass to allow multiple token
  22596. // emissions, then set this to the last token to be matched or
  22597. // something nonnull so that the auto token emit mechanism will not
  22598. // emit another token.
  22599. this._token = null;
  22600. // What character index in the stream did the current token start at?
  22601. // Needed, for example, to get the text for current token. Set at
  22602. // the start of nextToken.
  22603. this._tokenStartCharIndex = -1;
  22604. // The line on which the first character of the token resides///
  22605. this._tokenStartLine = -1;
  22606. // The character position of first character within the line///
  22607. this._tokenStartColumn = -1;
  22608. // Once we see EOF on char stream, next token will be EOF.
  22609. // If you have DONE : EOF ; then you see DONE EOF.
  22610. this._hitEOF = false;
  22611. // The channel number for the current token///
  22612. this._channel = Token.DEFAULT_CHANNEL;
  22613. // The token type for the current token///
  22614. this._type = Token.INVALID_TYPE;
  22615. this._modeStack = [];
  22616. this._mode = Lexer.DEFAULT_MODE;
  22617. // You can set the text for the current token to override what is in
  22618. // the input char buffer. Use setText() or can set this instance var.
  22619. // /
  22620. this._text = null;
  22621. return this;
  22622. }
  22623. Lexer.prototype = Object.create(Recognizer.prototype);
  22624. Lexer.prototype.constructor = Lexer;
  22625. Lexer.DEFAULT_MODE = 0;
  22626. Lexer.MORE = -2;
  22627. Lexer.SKIP = -3;
  22628. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  22629. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  22630. Lexer.MIN_CHAR_VALUE = 0x0000;
  22631. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  22632. Lexer.prototype.reset = function () {
  22633. // wack Lexer state variables
  22634. if (this._input !== null) {
  22635. this._input.seek(0); // rewind the input
  22636. }
  22637. this._token = null;
  22638. this._type = Token.INVALID_TYPE;
  22639. this._channel = Token.DEFAULT_CHANNEL;
  22640. this._tokenStartCharIndex = -1;
  22641. this._tokenStartColumn = -1;
  22642. this._tokenStartLine = -1;
  22643. this._text = null;
  22644. this._hitEOF = false;
  22645. this._mode = Lexer.DEFAULT_MODE;
  22646. this._modeStack = [];
  22647. this._interp.reset();
  22648. };
  22649. // Return a token from this source; i.e., match a token on the char stream.
  22650. Lexer.prototype.nextToken = function () {
  22651. if (this._input === null) {
  22652. throw "nextToken requires a non-null input stream.";
  22653. }
  22654. // Mark start location in char stream so unbuffered streams are
  22655. // guaranteed at least have text of current token
  22656. var tokenStartMarker = this._input.mark();
  22657. try {
  22658. while (true) {
  22659. if (this._hitEOF) {
  22660. this.emitEOF();
  22661. return this._token;
  22662. }
  22663. this._token = null;
  22664. this._channel = Token.DEFAULT_CHANNEL;
  22665. this._tokenStartCharIndex = this._input.index;
  22666. this._tokenStartColumn = this._interp.column;
  22667. this._tokenStartLine = this._interp.line;
  22668. this._text = null;
  22669. var continueOuter = false;
  22670. while (true) {
  22671. this._type = Token.INVALID_TYPE;
  22672. var ttype = Lexer.SKIP;
  22673. try {
  22674. ttype = this._interp.match(this._input, this._mode);
  22675. } catch (e) {
  22676. if (e instanceof RecognitionException) {
  22677. this.notifyListeners(e); // report error
  22678. this.recover(e);
  22679. } else {
  22680. console.log(e.stack);
  22681. throw e;
  22682. }
  22683. }
  22684. if (this._input.LA(1) === Token.EOF) {
  22685. this._hitEOF = true;
  22686. }
  22687. if (this._type === Token.INVALID_TYPE) {
  22688. this._type = ttype;
  22689. }
  22690. if (this._type === Lexer.SKIP) {
  22691. continueOuter = true;
  22692. break;
  22693. }
  22694. if (this._type !== Lexer.MORE) {
  22695. break;
  22696. }
  22697. }
  22698. if (continueOuter) {
  22699. continue;
  22700. }
  22701. if (this._token === null) {
  22702. this.emit();
  22703. }
  22704. return this._token;
  22705. }
  22706. } finally {
  22707. // make sure we release marker after match or
  22708. // unbuffered char stream will keep buffering
  22709. this._input.release(tokenStartMarker);
  22710. }
  22711. };
  22712. // Instruct the lexer to skip creating a token for current lexer rule
  22713. // and look for another token. nextToken() knows to keep looking when
  22714. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  22715. // if token==null at end of any token rule, it creates one for you
  22716. // and emits it.
  22717. // /
  22718. Lexer.prototype.skip = function () {
  22719. this._type = Lexer.SKIP;
  22720. };
  22721. Lexer.prototype.more = function () {
  22722. this._type = Lexer.MORE;
  22723. };
  22724. Lexer.prototype.mode = function (m) {
  22725. this._mode = m;
  22726. };
  22727. Lexer.prototype.pushMode = function (m) {
  22728. if (this._interp.debug) {
  22729. console.log("pushMode " + m);
  22730. }
  22731. this._modeStack.push(this._mode);
  22732. this.mode(m);
  22733. };
  22734. Lexer.prototype.popMode = function () {
  22735. if (this._modeStack.length === 0) {
  22736. throw "Empty Stack";
  22737. }
  22738. if (this._interp.debug) {
  22739. console.log("popMode back to " + this._modeStack.slice(0, -1));
  22740. }
  22741. this.mode(this._modeStack.pop());
  22742. return this._mode;
  22743. };
  22744. // Set the char stream and reset the lexer
  22745. Object.defineProperty(Lexer.prototype, "inputStream", {
  22746. get: function get() {
  22747. return this._input;
  22748. },
  22749. set: function set(input) {
  22750. this._input = null;
  22751. this._tokenFactorySourcePair = [this, this._input];
  22752. this.reset();
  22753. this._input = input;
  22754. this._tokenFactorySourcePair = [this, this._input];
  22755. }
  22756. });
  22757. Object.defineProperty(Lexer.prototype, "sourceName", {
  22758. get: function sourceName() {
  22759. return this._input.sourceName;
  22760. }
  22761. });
  22762. // By default does not support multiple emits per nextToken invocation
  22763. // for efficiency reasons. Subclass and override this method, nextToken,
  22764. // and getToken (to push tokens into a list and pull from that list
  22765. // rather than a single variable as this implementation does).
  22766. // /
  22767. Lexer.prototype.emitToken = function (token) {
  22768. this._token = token;
  22769. };
  22770. // The standard method called to automatically emit a token at the
  22771. // outermost lexical rule. The token object should point into the
  22772. // char buffer start..stop. If there is a text override in 'text',
  22773. // use that to set the token's text. Override this method to emit
  22774. // custom Token objects or provide a new factory.
  22775. // /
  22776. Lexer.prototype.emit = function () {
  22777. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  22778. this.emitToken(t);
  22779. return t;
  22780. };
  22781. Lexer.prototype.emitEOF = function () {
  22782. var cpos = this.column;
  22783. var lpos = this.line;
  22784. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  22785. this.emitToken(eof);
  22786. return eof;
  22787. };
  22788. Object.defineProperty(Lexer.prototype, "type", {
  22789. get: function get() {
  22790. return this.type;
  22791. },
  22792. set: function set(type) {
  22793. this._type = type;
  22794. }
  22795. });
  22796. Object.defineProperty(Lexer.prototype, "line", {
  22797. get: function get() {
  22798. return this._interp.line;
  22799. },
  22800. set: function set(line) {
  22801. this._interp.line = line;
  22802. }
  22803. });
  22804. Object.defineProperty(Lexer.prototype, "column", {
  22805. get: function get() {
  22806. return this._interp.column;
  22807. },
  22808. set: function set(column) {
  22809. this._interp.column = column;
  22810. }
  22811. });
  22812. // What is the index of the current character of lookahead?///
  22813. Lexer.prototype.getCharIndex = function () {
  22814. return this._input.index;
  22815. };
  22816. // Return the text matched so far for the current token or any text override.
  22817. //Set the complete text of this token; it wipes any previous changes to the text.
  22818. Object.defineProperty(Lexer.prototype, "text", {
  22819. get: function get() {
  22820. if (this._text !== null) {
  22821. return this._text;
  22822. } else {
  22823. return this._interp.getText(this._input);
  22824. }
  22825. },
  22826. set: function set(text) {
  22827. this._text = text;
  22828. }
  22829. });
  22830. // Return a list of all Token objects in input char stream.
  22831. // Forces load of all tokens. Does not include EOF token.
  22832. // /
  22833. Lexer.prototype.getAllTokens = function () {
  22834. var tokens = [];
  22835. var t = this.nextToken();
  22836. while (t.type !== Token.EOF) {
  22837. tokens.push(t);
  22838. t = this.nextToken();
  22839. }
  22840. return tokens;
  22841. };
  22842. Lexer.prototype.notifyListeners = function (e) {
  22843. var start = this._tokenStartCharIndex;
  22844. var stop = this._input.index;
  22845. var text = this._input.getText(start, stop);
  22846. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  22847. var listener = this.getErrorListenerDispatch();
  22848. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  22849. };
  22850. Lexer.prototype.getErrorDisplay = function (s) {
  22851. var d = [];
  22852. for (var i = 0; i < s.length; i++) {
  22853. d.push(s[i]);
  22854. }
  22855. return d.join('');
  22856. };
  22857. Lexer.prototype.getErrorDisplayForChar = function (c) {
  22858. if (c.charCodeAt(0) === Token.EOF) {
  22859. return "<EOF>";
  22860. } else if (c === '\n') {
  22861. return "\\n";
  22862. } else if (c === '\t') {
  22863. return "\\t";
  22864. } else if (c === '\r') {
  22865. return "\\r";
  22866. } else {
  22867. return c;
  22868. }
  22869. };
  22870. Lexer.prototype.getCharErrorDisplay = function (c) {
  22871. return "'" + this.getErrorDisplayForChar(c) + "'";
  22872. };
  22873. // Lexers can normally match any char in it's vocabulary after matching
  22874. // a token, so do the easy thing and just kill a character and hope
  22875. // it all works out. You can instead use the rule invocation stack
  22876. // to do sophisticated error recovery if you are in a fragment rule.
  22877. // /
  22878. Lexer.prototype.recover = function (re) {
  22879. if (this._input.LA(1) !== Token.EOF) {
  22880. if (re instanceof LexerNoViableAltException) {
  22881. // skip a char and try again
  22882. this._interp.consume(this._input);
  22883. } else {
  22884. // TODO: Do we lose character or line position information?
  22885. this._input.consume();
  22886. }
  22887. }
  22888. };
  22889. exports.Lexer = Lexer;
  22890. /***/ }),
  22891. /***/ "./node_modules/antlr4/Parser.js":
  22892. /*!***************************************!*\
  22893. !*** ./node_modules/antlr4/Parser.js ***!
  22894. \***************************************/
  22895. /*! no static exports found */
  22896. /***/ (function(module, exports, __webpack_require__) {
  22897. "use strict";
  22898. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22899. * Use of this file is governed by the BSD 3-clause license that
  22900. * can be found in the LICENSE.txt file in the project root.
  22901. */
  22902. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22903. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  22904. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22905. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  22906. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  22907. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  22908. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  22909. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  22910. function TraceListener(parser) {
  22911. ParseTreeListener.call(this);
  22912. this.parser = parser;
  22913. return this;
  22914. }
  22915. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  22916. TraceListener.prototype.constructor = TraceListener;
  22917. TraceListener.prototype.enterEveryRule = function (ctx) {
  22918. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22919. };
  22920. TraceListener.prototype.visitTerminal = function (node) {
  22921. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  22922. };
  22923. TraceListener.prototype.exitEveryRule = function (ctx) {
  22924. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22925. };
  22926. // this is all the parsing support code essentially; most of it is error
  22927. // recovery stuff.//
  22928. function Parser(input) {
  22929. Recognizer.call(this);
  22930. // The input stream.
  22931. this._input = null;
  22932. // The error handling strategy for the parser. The default value is a new
  22933. // instance of {@link DefaultErrorStrategy}.
  22934. this._errHandler = new DefaultErrorStrategy();
  22935. this._precedenceStack = [];
  22936. this._precedenceStack.push(0);
  22937. // The {@link ParserRuleContext} object for the currently executing rule.
  22938. // this is always non-null during the parsing process.
  22939. this._ctx = null;
  22940. // Specifies whether or not the parser should construct a parse tree during
  22941. // the parsing process. The default value is {@code true}.
  22942. this.buildParseTrees = true;
  22943. // When {@link //setTrace}{@code (true)} is called, a reference to the
  22944. // {@link TraceListener} is stored here so it can be easily removed in a
  22945. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  22946. // implemented as a parser listener so this field is not directly used by
  22947. // other parser methods.
  22948. this._tracer = null;
  22949. // The list of {@link ParseTreeListener} listeners registered to receive
  22950. // events during the parse.
  22951. this._parseListeners = null;
  22952. // The number of syntax errors reported during parsing. this value is
  22953. // incremented each time {@link //notifyErrorListeners} is called.
  22954. this._syntaxErrors = 0;
  22955. this.setInputStream(input);
  22956. return this;
  22957. }
  22958. Parser.prototype = Object.create(Recognizer.prototype);
  22959. Parser.prototype.contructor = Parser;
  22960. // this field maps from the serialized ATN string to the deserialized {@link
  22961. // ATN} with
  22962. // bypass alternatives.
  22963. //
  22964. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  22965. //
  22966. Parser.bypassAltsAtnCache = {};
  22967. // reset the parser's state//
  22968. Parser.prototype.reset = function () {
  22969. if (this._input !== null) {
  22970. this._input.seek(0);
  22971. }
  22972. this._errHandler.reset(this);
  22973. this._ctx = null;
  22974. this._syntaxErrors = 0;
  22975. this.setTrace(false);
  22976. this._precedenceStack = [];
  22977. this._precedenceStack.push(0);
  22978. if (this._interp !== null) {
  22979. this._interp.reset();
  22980. }
  22981. };
  22982. // Match current input symbol against {@code ttype}. If the symbol type
  22983. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  22984. // called to complete the match process.
  22985. //
  22986. // <p>If the symbol type does not match,
  22987. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  22988. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  22989. // {@code true} and the token index of the symbol returned by
  22990. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  22991. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  22992. //
  22993. // @param ttype the token type to match
  22994. // @return the matched symbol
  22995. // @throws RecognitionException if the current input symbol did not match
  22996. // {@code ttype} and the error strategy could not recover from the
  22997. // mismatched symbol
  22998. Parser.prototype.match = function (ttype) {
  22999. var t = this.getCurrentToken();
  23000. if (t.type === ttype) {
  23001. this._errHandler.reportMatch(this);
  23002. this.consume();
  23003. } else {
  23004. t = this._errHandler.recoverInline(this);
  23005. if (this.buildParseTrees && t.tokenIndex === -1) {
  23006. // we must have conjured up a new token during single token
  23007. // insertion
  23008. // if it's not the current symbol
  23009. this._ctx.addErrorNode(t);
  23010. }
  23011. }
  23012. return t;
  23013. };
  23014. // Match current input symbol as a wildcard. If the symbol type matches
  23015. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  23016. // and {@link //consume} are called to complete the match process.
  23017. //
  23018. // <p>If the symbol type does not match,
  23019. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  23020. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  23021. // {@code true} and the token index of the symbol returned by
  23022. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  23023. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  23024. //
  23025. // @return the matched symbol
  23026. // @throws RecognitionException if the current input symbol did not match
  23027. // a wildcard and the error strategy could not recover from the mismatched
  23028. // symbol
  23029. Parser.prototype.matchWildcard = function () {
  23030. var t = this.getCurrentToken();
  23031. if (t.type > 0) {
  23032. this._errHandler.reportMatch(this);
  23033. this.consume();
  23034. } else {
  23035. t = this._errHandler.recoverInline(this);
  23036. if (this._buildParseTrees && t.tokenIndex === -1) {
  23037. // we must have conjured up a new token during single token
  23038. // insertion
  23039. // if it's not the current symbol
  23040. this._ctx.addErrorNode(t);
  23041. }
  23042. }
  23043. return t;
  23044. };
  23045. Parser.prototype.getParseListeners = function () {
  23046. return this._parseListeners || [];
  23047. };
  23048. // Registers {@code listener} to receive events during the parsing process.
  23049. //
  23050. // <p>To support output-preserving grammar transformations (including but not
  23051. // limited to left-recursion removal, automated left-factoring, and
  23052. // optimized code generation), calls to listener methods during the parse
  23053. // may differ substantially from calls made by
  23054. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  23055. // particular, rule entry and exit events may occur in a different order
  23056. // during the parse than after the parser. In addition, calls to certain
  23057. // rule entry methods may be omitted.</p>
  23058. //
  23059. // <p>With the following specific exceptions, calls to listener events are
  23060. // <em>deterministic</em>, i.e. for identical input the calls to listener
  23061. // methods will be the same.</p>
  23062. //
  23063. // <ul>
  23064. // <li>Alterations to the grammar used to generate code may change the
  23065. // behavior of the listener calls.</li>
  23066. // <li>Alterations to the command line options passed to ANTLR 4 when
  23067. // generating the parser may change the behavior of the listener calls.</li>
  23068. // <li>Changing the version of the ANTLR Tool used to generate the parser
  23069. // may change the behavior of the listener calls.</li>
  23070. // </ul>
  23071. //
  23072. // @param listener the listener to add
  23073. //
  23074. // @throws NullPointerException if {@code} listener is {@code null}
  23075. //
  23076. Parser.prototype.addParseListener = function (listener) {
  23077. if (listener === null) {
  23078. throw "listener";
  23079. }
  23080. if (this._parseListeners === null) {
  23081. this._parseListeners = [];
  23082. }
  23083. this._parseListeners.push(listener);
  23084. };
  23085. //
  23086. // Remove {@code listener} from the list of parse listeners.
  23087. //
  23088. // <p>If {@code listener} is {@code null} or has not been added as a parse
  23089. // listener, this method does nothing.</p>
  23090. // @param listener the listener to remove
  23091. //
  23092. Parser.prototype.removeParseListener = function (listener) {
  23093. if (this._parseListeners !== null) {
  23094. var idx = this._parseListeners.indexOf(listener);
  23095. if (idx >= 0) {
  23096. this._parseListeners.splice(idx, 1);
  23097. }
  23098. if (this._parseListeners.length === 0) {
  23099. this._parseListeners = null;
  23100. }
  23101. }
  23102. };
  23103. // Remove all parse listeners.
  23104. Parser.prototype.removeParseListeners = function () {
  23105. this._parseListeners = null;
  23106. };
  23107. // Notify any parse listeners of an enter rule event.
  23108. Parser.prototype.triggerEnterRuleEvent = function () {
  23109. if (this._parseListeners !== null) {
  23110. var ctx = this._ctx;
  23111. this._parseListeners.map(function (listener) {
  23112. listener.enterEveryRule(ctx);
  23113. ctx.enterRule(listener);
  23114. });
  23115. }
  23116. };
  23117. //
  23118. // Notify any parse listeners of an exit rule event.
  23119. //
  23120. // @see //addParseListener
  23121. //
  23122. Parser.prototype.triggerExitRuleEvent = function () {
  23123. if (this._parseListeners !== null) {
  23124. // reverse order walk of listeners
  23125. var ctx = this._ctx;
  23126. this._parseListeners.slice(0).reverse().map(function (listener) {
  23127. ctx.exitRule(listener);
  23128. listener.exitEveryRule(ctx);
  23129. });
  23130. }
  23131. };
  23132. Parser.prototype.getTokenFactory = function () {
  23133. return this._input.tokenSource._factory;
  23134. };
  23135. // Tell our token source and error strategy about a new way to create tokens.//
  23136. Parser.prototype.setTokenFactory = function (factory) {
  23137. this._input.tokenSource._factory = factory;
  23138. };
  23139. // The ATN with bypass alternatives is expensive to create so we create it
  23140. // lazily.
  23141. //
  23142. // @throws UnsupportedOperationException if the current parser does not
  23143. // implement the {@link //getSerializedATN()} method.
  23144. //
  23145. Parser.prototype.getATNWithBypassAlts = function () {
  23146. var serializedAtn = this.getSerializedATN();
  23147. if (serializedAtn === null) {
  23148. throw "The current parser does not support an ATN with bypass alternatives.";
  23149. }
  23150. var result = this.bypassAltsAtnCache[serializedAtn];
  23151. if (result === null) {
  23152. var deserializationOptions = new ATNDeserializationOptions();
  23153. deserializationOptions.generateRuleBypassTransitions = true;
  23154. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23155. this.bypassAltsAtnCache[serializedAtn] = result;
  23156. }
  23157. return result;
  23158. };
  23159. // The preferred method of getting a tree pattern. For example, here's a
  23160. // sample use:
  23161. //
  23162. // <pre>
  23163. // ParseTree t = parser.expr();
  23164. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23165. // MyParser.RULE_expr);
  23166. // ParseTreeMatch m = p.match(t);
  23167. // String id = m.get("ID");
  23168. // </pre>
  23169. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23170. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23171. lexer = lexer || null;
  23172. if (lexer === null) {
  23173. if (this.getTokenStream() !== null) {
  23174. var tokenSource = this.getTokenStream().tokenSource;
  23175. if (tokenSource instanceof Lexer) {
  23176. lexer = tokenSource;
  23177. }
  23178. }
  23179. }
  23180. if (lexer === null) {
  23181. throw "Parser can't discover a lexer to use";
  23182. }
  23183. var m = new ParseTreePatternMatcher(lexer, this);
  23184. return m.compile(pattern, patternRuleIndex);
  23185. };
  23186. Parser.prototype.getInputStream = function () {
  23187. return this.getTokenStream();
  23188. };
  23189. Parser.prototype.setInputStream = function (input) {
  23190. this.setTokenStream(input);
  23191. };
  23192. Parser.prototype.getTokenStream = function () {
  23193. return this._input;
  23194. };
  23195. // Set the token stream and reset the parser.//
  23196. Parser.prototype.setTokenStream = function (input) {
  23197. this._input = null;
  23198. this.reset();
  23199. this._input = input;
  23200. };
  23201. // Match needs to return the current input symbol, which gets put
  23202. // into the label for the associated token ref; e.g., x=ID.
  23203. //
  23204. Parser.prototype.getCurrentToken = function () {
  23205. return this._input.LT(1);
  23206. };
  23207. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23208. offendingToken = offendingToken || null;
  23209. err = err || null;
  23210. if (offendingToken === null) {
  23211. offendingToken = this.getCurrentToken();
  23212. }
  23213. this._syntaxErrors += 1;
  23214. var line = offendingToken.line;
  23215. var column = offendingToken.column;
  23216. var listener = this.getErrorListenerDispatch();
  23217. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23218. };
  23219. //
  23220. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23221. //
  23222. // <p>E.g., given the following input with {@code A} being the current
  23223. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23224. // {@code A}.</p>
  23225. //
  23226. // <pre>
  23227. // A B
  23228. // ^
  23229. // </pre>
  23230. //
  23231. // If the parser is not in error recovery mode, the consumed symbol is added
  23232. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23233. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23234. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23235. // added to the parse tree using
  23236. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23237. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23238. // listeners.
  23239. //
  23240. Parser.prototype.consume = function () {
  23241. var o = this.getCurrentToken();
  23242. if (o.type !== Token.EOF) {
  23243. this.getInputStream().consume();
  23244. }
  23245. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23246. if (this.buildParseTrees || hasListener) {
  23247. var node;
  23248. if (this._errHandler.inErrorRecoveryMode(this)) {
  23249. node = this._ctx.addErrorNode(o);
  23250. } else {
  23251. node = this._ctx.addTokenNode(o);
  23252. }
  23253. node.invokingState = this.state;
  23254. if (hasListener) {
  23255. this._parseListeners.map(function (listener) {
  23256. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23257. listener.visitErrorNode(node);
  23258. } else if (node instanceof TerminalNode) {
  23259. listener.visitTerminal(node);
  23260. }
  23261. });
  23262. }
  23263. }
  23264. return o;
  23265. };
  23266. Parser.prototype.addContextToParseTree = function () {
  23267. // add current context to parent if we have a parent
  23268. if (this._ctx.parentCtx !== null) {
  23269. this._ctx.parentCtx.addChild(this._ctx);
  23270. }
  23271. };
  23272. // Always called by generated parsers upon entry to a rule. Access field
  23273. // {@link //_ctx} get the current context.
  23274. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23275. this.state = state;
  23276. this._ctx = localctx;
  23277. this._ctx.start = this._input.LT(1);
  23278. if (this.buildParseTrees) {
  23279. this.addContextToParseTree();
  23280. }
  23281. if (this._parseListeners !== null) {
  23282. this.triggerEnterRuleEvent();
  23283. }
  23284. };
  23285. Parser.prototype.exitRule = function () {
  23286. this._ctx.stop = this._input.LT(-1);
  23287. // trigger event on _ctx, before it reverts to parent
  23288. if (this._parseListeners !== null) {
  23289. this.triggerExitRuleEvent();
  23290. }
  23291. this.state = this._ctx.invokingState;
  23292. this._ctx = this._ctx.parentCtx;
  23293. };
  23294. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23295. localctx.setAltNumber(altNum);
  23296. // if we have new localctx, make sure we replace existing ctx
  23297. // that is previous child of parse tree
  23298. if (this.buildParseTrees && this._ctx !== localctx) {
  23299. if (this._ctx.parentCtx !== null) {
  23300. this._ctx.parentCtx.removeLastChild();
  23301. this._ctx.parentCtx.addChild(localctx);
  23302. }
  23303. }
  23304. this._ctx = localctx;
  23305. };
  23306. // Get the precedence level for the top-most precedence rule.
  23307. //
  23308. // @return The precedence level for the top-most precedence rule, or -1 if
  23309. // the parser context is not nested within a precedence rule.
  23310. Parser.prototype.getPrecedence = function () {
  23311. if (this._precedenceStack.length === 0) {
  23312. return -1;
  23313. } else {
  23314. return this._precedenceStack[this._precedenceStack.length - 1];
  23315. }
  23316. };
  23317. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23318. this.state = state;
  23319. this._precedenceStack.push(precedence);
  23320. this._ctx = localctx;
  23321. this._ctx.start = this._input.LT(1);
  23322. if (this._parseListeners !== null) {
  23323. this.triggerEnterRuleEvent(); // simulates rule entry for
  23324. // left-recursive rules
  23325. }
  23326. };
  23327. //
  23328. // Like {@link //enterRule} but for recursive rules.
  23329. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23330. var previous = this._ctx;
  23331. previous.parentCtx = localctx;
  23332. previous.invokingState = state;
  23333. previous.stop = this._input.LT(-1);
  23334. this._ctx = localctx;
  23335. this._ctx.start = previous.start;
  23336. if (this.buildParseTrees) {
  23337. this._ctx.addChild(previous);
  23338. }
  23339. if (this._parseListeners !== null) {
  23340. this.triggerEnterRuleEvent(); // simulates rule entry for
  23341. // left-recursive rules
  23342. }
  23343. };
  23344. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23345. this._precedenceStack.pop();
  23346. this._ctx.stop = this._input.LT(-1);
  23347. var retCtx = this._ctx; // save current ctx (return value)
  23348. // unroll so _ctx is as it was before call to recursive method
  23349. if (this._parseListeners !== null) {
  23350. while (this._ctx !== parentCtx) {
  23351. this.triggerExitRuleEvent();
  23352. this._ctx = this._ctx.parentCtx;
  23353. }
  23354. } else {
  23355. this._ctx = parentCtx;
  23356. }
  23357. // hook into tree
  23358. retCtx.parentCtx = parentCtx;
  23359. if (this.buildParseTrees && parentCtx !== null) {
  23360. // add return ctx into invoking rule's tree
  23361. parentCtx.addChild(retCtx);
  23362. }
  23363. };
  23364. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23365. var ctx = this._ctx;
  23366. while (ctx !== null) {
  23367. if (ctx.ruleIndex === ruleIndex) {
  23368. return ctx;
  23369. }
  23370. ctx = ctx.parentCtx;
  23371. }
  23372. return null;
  23373. };
  23374. Parser.prototype.precpred = function (localctx, precedence) {
  23375. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23376. };
  23377. Parser.prototype.inContext = function (context) {
  23378. // TODO: useful in parser?
  23379. return false;
  23380. };
  23381. //
  23382. // Checks whether or not {@code symbol} can follow the current state in the
  23383. // ATN. The behavior of this method is equivalent to the following, but is
  23384. // implemented such that the complete context-sensitive follow set does not
  23385. // need to be explicitly constructed.
  23386. //
  23387. // <pre>
  23388. // return getExpectedTokens().contains(symbol);
  23389. // </pre>
  23390. //
  23391. // @param symbol the symbol type to check
  23392. // @return {@code true} if {@code symbol} can follow the current state in
  23393. // the ATN, otherwise {@code false}.
  23394. Parser.prototype.isExpectedToken = function (symbol) {
  23395. var atn = this._interp.atn;
  23396. var ctx = this._ctx;
  23397. var s = atn.states[this.state];
  23398. var following = atn.nextTokens(s);
  23399. if (following.contains(symbol)) {
  23400. return true;
  23401. }
  23402. if (!following.contains(Token.EPSILON)) {
  23403. return false;
  23404. }
  23405. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23406. var invokingState = atn.states[ctx.invokingState];
  23407. var rt = invokingState.transitions[0];
  23408. following = atn.nextTokens(rt.followState);
  23409. if (following.contains(symbol)) {
  23410. return true;
  23411. }
  23412. ctx = ctx.parentCtx;
  23413. }
  23414. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23415. return true;
  23416. } else {
  23417. return false;
  23418. }
  23419. };
  23420. // Computes the set of input symbols which could follow the current parser
  23421. // state and context, as given by {@link //getState} and {@link //getContext},
  23422. // respectively.
  23423. //
  23424. // @see ATN//getExpectedTokens(int, RuleContext)
  23425. //
  23426. Parser.prototype.getExpectedTokens = function () {
  23427. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23428. };
  23429. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23430. var atn = this._interp.atn;
  23431. var s = atn.states[this.state];
  23432. return atn.nextTokens(s);
  23433. };
  23434. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23435. Parser.prototype.getRuleIndex = function (ruleName) {
  23436. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23437. if (ruleIndex !== null) {
  23438. return ruleIndex;
  23439. } else {
  23440. return -1;
  23441. }
  23442. };
  23443. // Return List&lt;String&gt; of the rule names in your parser instance
  23444. // leading up to a call to the current rule. You could override if
  23445. // you want more details such as the file/line info of where
  23446. // in the ATN a rule is invoked.
  23447. //
  23448. // this is very useful for error messages.
  23449. //
  23450. Parser.prototype.getRuleInvocationStack = function (p) {
  23451. p = p || null;
  23452. if (p === null) {
  23453. p = this._ctx;
  23454. }
  23455. var stack = [];
  23456. while (p !== null) {
  23457. // compute what follows who invoked us
  23458. var ruleIndex = p.ruleIndex;
  23459. if (ruleIndex < 0) {
  23460. stack.push("n/a");
  23461. } else {
  23462. stack.push(this.ruleNames[ruleIndex]);
  23463. }
  23464. p = p.parentCtx;
  23465. }
  23466. return stack;
  23467. };
  23468. // For debugging and other purposes.//
  23469. Parser.prototype.getDFAStrings = function () {
  23470. return this._interp.decisionToDFA.toString();
  23471. };
  23472. // For debugging and other purposes.//
  23473. Parser.prototype.dumpDFA = function () {
  23474. var seenOne = false;
  23475. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23476. var dfa = this._interp.decisionToDFA[i];
  23477. if (dfa.states.length > 0) {
  23478. if (seenOne) {
  23479. console.log();
  23480. }
  23481. this.printer.println("Decision " + dfa.decision + ":");
  23482. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23483. seenOne = true;
  23484. }
  23485. }
  23486. };
  23487. /*
  23488. " printer = function() {\r\n" +
  23489. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23490. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23491. " };\r\n" +
  23492. */
  23493. Parser.prototype.getSourceName = function () {
  23494. return this._input.sourceName;
  23495. };
  23496. // During a parse is sometimes useful to listen in on the rule entry and exit
  23497. // events as well as token matches. this is for quick and dirty debugging.
  23498. //
  23499. Parser.prototype.setTrace = function (trace) {
  23500. if (!trace) {
  23501. this.removeParseListener(this._tracer);
  23502. this._tracer = null;
  23503. } else {
  23504. if (this._tracer !== null) {
  23505. this.removeParseListener(this._tracer);
  23506. }
  23507. this._tracer = new TraceListener(this);
  23508. this.addParseListener(this._tracer);
  23509. }
  23510. };
  23511. exports.Parser = Parser;
  23512. /***/ }),
  23513. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  23514. /*!**************************************************!*\
  23515. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  23516. \**************************************************/
  23517. /*! no static exports found */
  23518. /***/ (function(module, exports, __webpack_require__) {
  23519. "use strict";
  23520. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23521. * Use of this file is governed by the BSD 3-clause license that
  23522. * can be found in the LICENSE.txt file in the project root.
  23523. */
  23524. //* A rule invocation record for parsing.
  23525. //
  23526. // Contains all of the information about the current rule not stored in the
  23527. // RuleContext. It handles parse tree children list, Any ATN state
  23528. // tracing, and the default values available for rule indications:
  23529. // start, stop, rule index, current alt number, current
  23530. // ATN state.
  23531. //
  23532. // Subclasses made for each rule and grammar track the parameters,
  23533. // return values, locals, and labels specific to that rule. These
  23534. // are the objects that are returned from rules.
  23535. //
  23536. // Note text is not an actual field of a rule return value; it is computed
  23537. // from start and stop using the input stream's toString() method. I
  23538. // could add a ctor to this so that we can pass in and store the input
  23539. // stream, but I'm not sure we want to do that. It would seem to be undefined
  23540. // to get the .text property anyway if the rule matches tokens from multiple
  23541. // input streams.
  23542. //
  23543. // I do not use getters for fields of objects that are used simply to
  23544. // group values such as this aggregate. The getters/setters are there to
  23545. // satisfy the superclass interface.
  23546. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23547. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  23548. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  23549. var TerminalNode = Tree.TerminalNode;
  23550. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  23551. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  23552. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23553. function ParserRuleContext(parent, invokingStateNumber) {
  23554. parent = parent || null;
  23555. invokingStateNumber = invokingStateNumber || null;
  23556. RuleContext.call(this, parent, invokingStateNumber);
  23557. this.ruleIndex = -1;
  23558. // * If we are debugging or building a parse tree for a visitor,
  23559. // we need to track all of the tokens and rule invocations associated
  23560. // with this rule's context. This is empty for parsing w/o tree constr.
  23561. // operation because we don't the need to track the details about
  23562. // how we parse this rule.
  23563. // /
  23564. this.children = null;
  23565. this.start = null;
  23566. this.stop = null;
  23567. // The exception that forced this rule to return. If the rule successfully
  23568. // completed, this is {@code null}.
  23569. this.exception = null;
  23570. }
  23571. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  23572. ParserRuleContext.prototype.constructor = ParserRuleContext;
  23573. // * COPY a ctx (I'm deliberately not using copy constructor)///
  23574. ParserRuleContext.prototype.copyFrom = function (ctx) {
  23575. // from RuleContext
  23576. this.parentCtx = ctx.parentCtx;
  23577. this.invokingState = ctx.invokingState;
  23578. this.children = null;
  23579. this.start = ctx.start;
  23580. this.stop = ctx.stop;
  23581. // copy any error nodes to alt label node
  23582. if (ctx.children) {
  23583. this.children = [];
  23584. // reset parent pointer for any error nodes
  23585. ctx.children.map(function (child) {
  23586. if (child instanceof ErrorNodeImpl) {
  23587. this.children.push(child);
  23588. child.parentCtx = this;
  23589. }
  23590. }, this);
  23591. }
  23592. };
  23593. // Double dispatch methods for listeners
  23594. ParserRuleContext.prototype.enterRule = function (listener) {};
  23595. ParserRuleContext.prototype.exitRule = function (listener) {};
  23596. // * Does not set parent link; other add methods do that///
  23597. ParserRuleContext.prototype.addChild = function (child) {
  23598. if (this.children === null) {
  23599. this.children = [];
  23600. }
  23601. this.children.push(child);
  23602. return child;
  23603. };
  23604. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  23605. // we entered a rule. If we have // label, we will need to remove
  23606. // generic ruleContext object.
  23607. // /
  23608. ParserRuleContext.prototype.removeLastChild = function () {
  23609. if (this.children !== null) {
  23610. this.children.pop();
  23611. }
  23612. };
  23613. ParserRuleContext.prototype.addTokenNode = function (token) {
  23614. var node = new TerminalNodeImpl(token);
  23615. this.addChild(node);
  23616. node.parentCtx = this;
  23617. return node;
  23618. };
  23619. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  23620. var node = new ErrorNodeImpl(badToken);
  23621. this.addChild(node);
  23622. node.parentCtx = this;
  23623. return node;
  23624. };
  23625. ParserRuleContext.prototype.getChild = function (i, type) {
  23626. type = type || null;
  23627. if (this.children === null || i < 0 || i >= this.children.length) {
  23628. return null;
  23629. }
  23630. if (type === null) {
  23631. return this.children[i];
  23632. } else {
  23633. for (var j = 0; j < this.children.length; j++) {
  23634. var child = this.children[j];
  23635. if (child instanceof type) {
  23636. if (i === 0) {
  23637. return child;
  23638. } else {
  23639. i -= 1;
  23640. }
  23641. }
  23642. }
  23643. return null;
  23644. }
  23645. };
  23646. ParserRuleContext.prototype.getToken = function (ttype, i) {
  23647. if (this.children === null || i < 0 || i >= this.children.length) {
  23648. return null;
  23649. }
  23650. for (var j = 0; j < this.children.length; j++) {
  23651. var child = this.children[j];
  23652. if (child instanceof TerminalNode) {
  23653. if (child.symbol.type === ttype) {
  23654. if (i === 0) {
  23655. return child;
  23656. } else {
  23657. i -= 1;
  23658. }
  23659. }
  23660. }
  23661. }
  23662. return null;
  23663. };
  23664. ParserRuleContext.prototype.getTokens = function (ttype) {
  23665. if (this.children === null) {
  23666. return [];
  23667. } else {
  23668. var tokens = [];
  23669. for (var j = 0; j < this.children.length; j++) {
  23670. var child = this.children[j];
  23671. if (child instanceof TerminalNode) {
  23672. if (child.symbol.type === ttype) {
  23673. tokens.push(child);
  23674. }
  23675. }
  23676. }
  23677. return tokens;
  23678. }
  23679. };
  23680. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  23681. return this.getChild(i, ctxType);
  23682. };
  23683. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  23684. if (this.children === null) {
  23685. return [];
  23686. } else {
  23687. var contexts = [];
  23688. for (var j = 0; j < this.children.length; j++) {
  23689. var child = this.children[j];
  23690. if (child instanceof ctxType) {
  23691. contexts.push(child);
  23692. }
  23693. }
  23694. return contexts;
  23695. }
  23696. };
  23697. ParserRuleContext.prototype.getChildCount = function () {
  23698. if (this.children === null) {
  23699. return 0;
  23700. } else {
  23701. return this.children.length;
  23702. }
  23703. };
  23704. ParserRuleContext.prototype.getSourceInterval = function () {
  23705. if (this.start === null || this.stop === null) {
  23706. return INVALID_INTERVAL;
  23707. } else {
  23708. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  23709. }
  23710. };
  23711. RuleContext.EMPTY = new ParserRuleContext();
  23712. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  23713. ParserRuleContext.call(parent, invokingStateNumber);
  23714. this.ruleIndex = ruleIndex;
  23715. return this;
  23716. }
  23717. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  23718. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  23719. exports.ParserRuleContext = ParserRuleContext;
  23720. /***/ }),
  23721. /***/ "./node_modules/antlr4/PredictionContext.js":
  23722. /*!**************************************************!*\
  23723. !*** ./node_modules/antlr4/PredictionContext.js ***!
  23724. \**************************************************/
  23725. /*! no static exports found */
  23726. /***/ (function(module, exports, __webpack_require__) {
  23727. "use strict";
  23728. //
  23729. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23730. * Use of this file is governed by the BSD 3-clause license that
  23731. * can be found in the LICENSE.txt file in the project root.
  23732. */
  23733. ///
  23734. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23735. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23736. function PredictionContext(cachedHashCode) {
  23737. this.cachedHashCode = cachedHashCode;
  23738. }
  23739. // Represents {@code $} in local context prediction, which means wildcard.
  23740. // {@code//+x =//}.
  23741. // /
  23742. PredictionContext.EMPTY = null;
  23743. // Represents {@code $} in an array in full context mode, when {@code $}
  23744. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  23745. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  23746. // /
  23747. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  23748. PredictionContext.globalNodeCount = 1;
  23749. PredictionContext.id = PredictionContext.globalNodeCount;
  23750. // Stores the computed hash code of this {@link PredictionContext}. The hash
  23751. // code is computed in parts to match the following reference algorithm.
  23752. //
  23753. // <pre>
  23754. // private int referenceHashCode() {
  23755. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  23756. // //INITIAL_HASH});
  23757. //
  23758. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23759. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  23760. // getParent}(i));
  23761. // }
  23762. //
  23763. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23764. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  23765. // //getReturnState getReturnState}(i));
  23766. // }
  23767. //
  23768. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  23769. // //size()});
  23770. // return hash;
  23771. // }
  23772. // </pre>
  23773. // /
  23774. // This means only the {@link //EMPTY} context is in set.
  23775. PredictionContext.prototype.isEmpty = function () {
  23776. return this === PredictionContext.EMPTY;
  23777. };
  23778. PredictionContext.prototype.hasEmptyPath = function () {
  23779. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  23780. };
  23781. PredictionContext.prototype.hashCode = function () {
  23782. return this.cachedHashCode;
  23783. };
  23784. PredictionContext.prototype.updateHashCode = function (hash) {
  23785. hash.update(this.cachedHashCode);
  23786. };
  23787. /*
  23788. function calculateHashString(parent, returnState) {
  23789. return "" + parent + returnState;
  23790. }
  23791. */
  23792. // Used to cache {@link PredictionContext} objects. Its used for the shared
  23793. // context cash associated with contexts in DFA states. This cache
  23794. // can be used for both lexers and parsers.
  23795. function PredictionContextCache() {
  23796. this.cache = {};
  23797. return this;
  23798. }
  23799. // Add a context to the cache and return it. If the context already exists,
  23800. // return that one instead and do not add a new context to the cache.
  23801. // Protect shared cache from unsafe thread access.
  23802. //
  23803. PredictionContextCache.prototype.add = function (ctx) {
  23804. if (ctx === PredictionContext.EMPTY) {
  23805. return PredictionContext.EMPTY;
  23806. }
  23807. var existing = this.cache[ctx] || null;
  23808. if (existing !== null) {
  23809. return existing;
  23810. }
  23811. this.cache[ctx] = ctx;
  23812. return ctx;
  23813. };
  23814. PredictionContextCache.prototype.get = function (ctx) {
  23815. return this.cache[ctx] || null;
  23816. };
  23817. Object.defineProperty(PredictionContextCache.prototype, "length", {
  23818. get: function get() {
  23819. return this.cache.length;
  23820. }
  23821. });
  23822. function SingletonPredictionContext(parent, returnState) {
  23823. var hashCode = 0;
  23824. if (parent !== null) {
  23825. var hash = new Hash();
  23826. hash.update(parent, returnState);
  23827. hashCode = hash.finish();
  23828. }
  23829. PredictionContext.call(this, hashCode);
  23830. this.parentCtx = parent;
  23831. this.returnState = returnState;
  23832. }
  23833. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23834. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  23835. SingletonPredictionContext.create = function (parent, returnState) {
  23836. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  23837. // someone can pass in the bits of an array ctx that mean $
  23838. return PredictionContext.EMPTY;
  23839. } else {
  23840. return new SingletonPredictionContext(parent, returnState);
  23841. }
  23842. };
  23843. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  23844. get: function get() {
  23845. return 1;
  23846. }
  23847. });
  23848. SingletonPredictionContext.prototype.getParent = function (index) {
  23849. return this.parentCtx;
  23850. };
  23851. SingletonPredictionContext.prototype.getReturnState = function (index) {
  23852. return this.returnState;
  23853. };
  23854. SingletonPredictionContext.prototype.equals = function (other) {
  23855. if (this === other) {
  23856. return true;
  23857. } else if (!(other instanceof SingletonPredictionContext)) {
  23858. return false;
  23859. } else if (this.hashCode() !== other.hashCode()) {
  23860. return false; // can't be same if hash is different
  23861. } else {
  23862. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  23863. }
  23864. };
  23865. SingletonPredictionContext.prototype.toString = function () {
  23866. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  23867. if (up.length === 0) {
  23868. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  23869. return "$";
  23870. } else {
  23871. return "" + this.returnState;
  23872. }
  23873. } else {
  23874. return "" + this.returnState + " " + up;
  23875. }
  23876. };
  23877. function EmptyPredictionContext() {
  23878. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  23879. return this;
  23880. }
  23881. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  23882. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  23883. EmptyPredictionContext.prototype.isEmpty = function () {
  23884. return true;
  23885. };
  23886. EmptyPredictionContext.prototype.getParent = function (index) {
  23887. return null;
  23888. };
  23889. EmptyPredictionContext.prototype.getReturnState = function (index) {
  23890. return this.returnState;
  23891. };
  23892. EmptyPredictionContext.prototype.equals = function (other) {
  23893. return this === other;
  23894. };
  23895. EmptyPredictionContext.prototype.toString = function () {
  23896. return "$";
  23897. };
  23898. PredictionContext.EMPTY = new EmptyPredictionContext();
  23899. function ArrayPredictionContext(parents, returnStates) {
  23900. // Parent can be null only if full ctx mode and we make an array
  23901. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  23902. // null parent and
  23903. // returnState == {@link //EMPTY_RETURN_STATE}.
  23904. var h = new Hash();
  23905. h.update(parents, returnStates);
  23906. var hashCode = h.finish();
  23907. PredictionContext.call(this, hashCode);
  23908. this.parents = parents;
  23909. this.returnStates = returnStates;
  23910. return this;
  23911. }
  23912. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23913. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  23914. ArrayPredictionContext.prototype.isEmpty = function () {
  23915. // since EMPTY_RETURN_STATE can only appear in the last position, we
  23916. // don't need to verify that size==1
  23917. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  23918. };
  23919. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  23920. get: function get() {
  23921. return this.returnStates.length;
  23922. }
  23923. });
  23924. ArrayPredictionContext.prototype.getParent = function (index) {
  23925. return this.parents[index];
  23926. };
  23927. ArrayPredictionContext.prototype.getReturnState = function (index) {
  23928. return this.returnStates[index];
  23929. };
  23930. ArrayPredictionContext.prototype.equals = function (other) {
  23931. if (this === other) {
  23932. return true;
  23933. } else if (!(other instanceof ArrayPredictionContext)) {
  23934. return false;
  23935. } else if (this.hashCode() !== other.hashCode()) {
  23936. return false; // can't be same if hash is different
  23937. } else {
  23938. return this.returnStates === other.returnStates && this.parents === other.parents;
  23939. }
  23940. };
  23941. ArrayPredictionContext.prototype.toString = function () {
  23942. if (this.isEmpty()) {
  23943. return "[]";
  23944. } else {
  23945. var s = "[";
  23946. for (var i = 0; i < this.returnStates.length; i++) {
  23947. if (i > 0) {
  23948. s = s + ", ";
  23949. }
  23950. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  23951. s = s + "$";
  23952. continue;
  23953. }
  23954. s = s + this.returnStates[i];
  23955. if (this.parents[i] !== null) {
  23956. s = s + " " + this.parents[i];
  23957. } else {
  23958. s = s + "null";
  23959. }
  23960. }
  23961. return s + "]";
  23962. }
  23963. };
  23964. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  23965. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  23966. // /
  23967. function predictionContextFromRuleContext(atn, outerContext) {
  23968. if (outerContext === undefined || outerContext === null) {
  23969. outerContext = RuleContext.EMPTY;
  23970. }
  23971. // if we are in RuleContext of start rule, s, then PredictionContext
  23972. // is EMPTY. Nobody called us. (if we are empty, return empty)
  23973. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  23974. return PredictionContext.EMPTY;
  23975. }
  23976. // If we have a parent, convert it to a PredictionContext graph
  23977. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  23978. var state = atn.states[outerContext.invokingState];
  23979. var transition = state.transitions[0];
  23980. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  23981. }
  23982. /*
  23983. function calculateListsHashString(parents, returnStates) {
  23984. var s = "";
  23985. parents.map(function(p) {
  23986. s = s + p;
  23987. });
  23988. returnStates.map(function(r) {
  23989. s = s + r;
  23990. });
  23991. return s;
  23992. }
  23993. */
  23994. function merge(a, b, rootIsWildcard, mergeCache) {
  23995. // share same graph if both same
  23996. if (a === b) {
  23997. return a;
  23998. }
  23999. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  24000. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  24001. }
  24002. // At least one of a or b is array
  24003. // If one is $ and rootIsWildcard, return $ as// wildcard
  24004. if (rootIsWildcard) {
  24005. if (a instanceof EmptyPredictionContext) {
  24006. return a;
  24007. }
  24008. if (b instanceof EmptyPredictionContext) {
  24009. return b;
  24010. }
  24011. }
  24012. // convert singleton so both are arrays to normalize
  24013. if (a instanceof SingletonPredictionContext) {
  24014. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  24015. }
  24016. if (b instanceof SingletonPredictionContext) {
  24017. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  24018. }
  24019. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  24020. }
  24021. //
  24022. // Merge two {@link SingletonPredictionContext} instances.
  24023. //
  24024. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  24025. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  24026. // type="image/svg+xml"/></p>
  24027. //
  24028. // <p>Same stack top, parents differ; merge parents giving array node, then
  24029. // remainders of those graphs. A new root node is created to point to the
  24030. // merged parents.<br>
  24031. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  24032. // type="image/svg+xml"/></p>
  24033. //
  24034. // <p>Different stack tops pointing to same parent. Make array node for the
  24035. // root where both element in the root point to the same (original)
  24036. // parent.<br>
  24037. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  24038. // type="image/svg+xml"/></p>
  24039. //
  24040. // <p>Different stack tops pointing to different parents. Make array node for
  24041. // the root where each element points to the corresponding original
  24042. // parent.<br>
  24043. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  24044. // type="image/svg+xml"/></p>
  24045. //
  24046. // @param a the first {@link SingletonPredictionContext}
  24047. // @param b the second {@link SingletonPredictionContext}
  24048. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24049. // otherwise false to indicate a full-context merge
  24050. // @param mergeCache
  24051. // /
  24052. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  24053. if (mergeCache !== null) {
  24054. var previous = mergeCache.get(a, b);
  24055. if (previous !== null) {
  24056. return previous;
  24057. }
  24058. previous = mergeCache.get(b, a);
  24059. if (previous !== null) {
  24060. return previous;
  24061. }
  24062. }
  24063. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  24064. if (rootMerge !== null) {
  24065. if (mergeCache !== null) {
  24066. mergeCache.set(a, b, rootMerge);
  24067. }
  24068. return rootMerge;
  24069. }
  24070. if (a.returnState === b.returnState) {
  24071. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  24072. // if parent is same as existing a or b parent or reduced to a parent,
  24073. // return it
  24074. if (parent === a.parentCtx) {
  24075. return a; // ax + bx = ax, if a=b
  24076. }
  24077. if (parent === b.parentCtx) {
  24078. return b; // ax + bx = bx, if a=b
  24079. }
  24080. // else: ax + ay = a'[x,y]
  24081. // merge parents x and y, giving array node with x,y then remainders
  24082. // of those graphs. dup a, a' points at merged array
  24083. // new joined parent so create new singleton pointing to it, a'
  24084. var spc = SingletonPredictionContext.create(parent, a.returnState);
  24085. if (mergeCache !== null) {
  24086. mergeCache.set(a, b, spc);
  24087. }
  24088. return spc;
  24089. } else {
  24090. // a != b payloads differ
  24091. // see if we can collapse parents due to $+x parents if local ctx
  24092. var singleParent = null;
  24093. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  24094. // ax +
  24095. // bx =
  24096. // [a,b]x
  24097. singleParent = a.parentCtx;
  24098. }
  24099. if (singleParent !== null) {
  24100. // parents are same
  24101. // sort payloads and use same parent
  24102. var payloads = [a.returnState, b.returnState];
  24103. if (a.returnState > b.returnState) {
  24104. payloads[0] = b.returnState;
  24105. payloads[1] = a.returnState;
  24106. }
  24107. var parents = [singleParent, singleParent];
  24108. var apc = new ArrayPredictionContext(parents, payloads);
  24109. if (mergeCache !== null) {
  24110. mergeCache.set(a, b, apc);
  24111. }
  24112. return apc;
  24113. }
  24114. // parents differ and can't merge them. Just pack together
  24115. // into array; can't merge.
  24116. // ax + by = [ax,by]
  24117. var payloads = [a.returnState, b.returnState];
  24118. var parents = [a.parentCtx, b.parentCtx];
  24119. if (a.returnState > b.returnState) {
  24120. // sort by payload
  24121. payloads[0] = b.returnState;
  24122. payloads[1] = a.returnState;
  24123. parents = [b.parentCtx, a.parentCtx];
  24124. }
  24125. var a_ = new ArrayPredictionContext(parents, payloads);
  24126. if (mergeCache !== null) {
  24127. mergeCache.set(a, b, a_);
  24128. }
  24129. return a_;
  24130. }
  24131. }
  24132. //
  24133. // Handle case where at least one of {@code a} or {@code b} is
  24134. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24135. // to represent {@link //EMPTY}.
  24136. //
  24137. // <h2>Local-Context Merges</h2>
  24138. //
  24139. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24140. // is true.</p>
  24141. //
  24142. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24143. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24144. //
  24145. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24146. // {@code //EMPTY}; return left graph.<br>
  24147. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24148. //
  24149. // <p>Special case of last merge if local context.<br>
  24150. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24151. //
  24152. // <h2>Full-Context Merges</h2>
  24153. //
  24154. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24155. // is false.</p>
  24156. //
  24157. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24158. //
  24159. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24160. // null parent).<br>
  24161. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24162. //
  24163. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24164. //
  24165. // @param a the first {@link SingletonPredictionContext}
  24166. // @param b the second {@link SingletonPredictionContext}
  24167. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24168. // otherwise false to indicate a full-context merge
  24169. // /
  24170. function mergeRoot(a, b, rootIsWildcard) {
  24171. if (rootIsWildcard) {
  24172. if (a === PredictionContext.EMPTY) {
  24173. return PredictionContext.EMPTY; // // + b =//
  24174. }
  24175. if (b === PredictionContext.EMPTY) {
  24176. return PredictionContext.EMPTY; // a +// =//
  24177. }
  24178. } else {
  24179. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24180. return PredictionContext.EMPTY; // $ + $ = $
  24181. } else if (a === PredictionContext.EMPTY) {
  24182. // $ + x = [$,x]
  24183. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24184. var parents = [b.parentCtx, null];
  24185. return new ArrayPredictionContext(parents, payloads);
  24186. } else if (b === PredictionContext.EMPTY) {
  24187. // x + $ = [$,x] ($ is always first if present)
  24188. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24189. var parents = [a.parentCtx, null];
  24190. return new ArrayPredictionContext(parents, payloads);
  24191. }
  24192. }
  24193. return null;
  24194. }
  24195. //
  24196. // Merge two {@link ArrayPredictionContext} instances.
  24197. //
  24198. // <p>Different tops, different parents.<br>
  24199. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24200. //
  24201. // <p>Shared top, same parents.<br>
  24202. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24203. //
  24204. // <p>Shared top, different parents.<br>
  24205. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24206. //
  24207. // <p>Shared top, all shared parents.<br>
  24208. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24209. // type="image/svg+xml"/></p>
  24210. //
  24211. // <p>Equal tops, merge parents and reduce top to
  24212. // {@link SingletonPredictionContext}.<br>
  24213. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24214. // /
  24215. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24216. if (mergeCache !== null) {
  24217. var previous = mergeCache.get(a, b);
  24218. if (previous !== null) {
  24219. return previous;
  24220. }
  24221. previous = mergeCache.get(b, a);
  24222. if (previous !== null) {
  24223. return previous;
  24224. }
  24225. }
  24226. // merge sorted payloads a + b => M
  24227. var i = 0; // walks a
  24228. var j = 0; // walks b
  24229. var k = 0; // walks target M array
  24230. var mergedReturnStates = [];
  24231. var mergedParents = [];
  24232. // walk and merge to yield mergedParents, mergedReturnStates
  24233. while (i < a.returnStates.length && j < b.returnStates.length) {
  24234. var a_parent = a.parents[i];
  24235. var b_parent = b.parents[j];
  24236. if (a.returnStates[i] === b.returnStates[j]) {
  24237. // same payload (stack tops are equal), must yield merged singleton
  24238. var payload = a.returnStates[i];
  24239. // $+$ = $
  24240. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24241. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24242. // ->
  24243. // ax
  24244. if (bothDollars || ax_ax) {
  24245. mergedParents[k] = a_parent; // choose left
  24246. mergedReturnStates[k] = payload;
  24247. } else {
  24248. // ax+ay -> a'[x,y]
  24249. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24250. mergedParents[k] = mergedParent;
  24251. mergedReturnStates[k] = payload;
  24252. }
  24253. i += 1; // hop over left one as usual
  24254. j += 1; // but also skip one in right side since we merge
  24255. } else if (a.returnStates[i] < b.returnStates[j]) {
  24256. // copy a[i] to M
  24257. mergedParents[k] = a_parent;
  24258. mergedReturnStates[k] = a.returnStates[i];
  24259. i += 1;
  24260. } else {
  24261. // b > a, copy b[j] to M
  24262. mergedParents[k] = b_parent;
  24263. mergedReturnStates[k] = b.returnStates[j];
  24264. j += 1;
  24265. }
  24266. k += 1;
  24267. }
  24268. // copy over any payloads remaining in either array
  24269. if (i < a.returnStates.length) {
  24270. for (var p = i; p < a.returnStates.length; p++) {
  24271. mergedParents[k] = a.parents[p];
  24272. mergedReturnStates[k] = a.returnStates[p];
  24273. k += 1;
  24274. }
  24275. } else {
  24276. for (var p = j; p < b.returnStates.length; p++) {
  24277. mergedParents[k] = b.parents[p];
  24278. mergedReturnStates[k] = b.returnStates[p];
  24279. k += 1;
  24280. }
  24281. }
  24282. // trim merged if we combined a few that had same stack tops
  24283. if (k < mergedParents.length) {
  24284. // write index < last position; trim
  24285. if (k === 1) {
  24286. // for just one merged element, return singleton top
  24287. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24288. if (mergeCache !== null) {
  24289. mergeCache.set(a, b, a_);
  24290. }
  24291. return a_;
  24292. }
  24293. mergedParents = mergedParents.slice(0, k);
  24294. mergedReturnStates = mergedReturnStates.slice(0, k);
  24295. }
  24296. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24297. // if we created same array as a or b, return that instead
  24298. // TODO: track whether this is possible above during merge sort for speed
  24299. if (M === a) {
  24300. if (mergeCache !== null) {
  24301. mergeCache.set(a, b, a);
  24302. }
  24303. return a;
  24304. }
  24305. if (M === b) {
  24306. if (mergeCache !== null) {
  24307. mergeCache.set(a, b, b);
  24308. }
  24309. return b;
  24310. }
  24311. combineCommonParents(mergedParents);
  24312. if (mergeCache !== null) {
  24313. mergeCache.set(a, b, M);
  24314. }
  24315. return M;
  24316. }
  24317. //
  24318. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24319. // ones.
  24320. // /
  24321. function combineCommonParents(parents) {
  24322. var uniqueParents = {};
  24323. for (var p = 0; p < parents.length; p++) {
  24324. var parent = parents[p];
  24325. if (!(parent in uniqueParents)) {
  24326. uniqueParents[parent] = parent;
  24327. }
  24328. }
  24329. for (var q = 0; q < parents.length; q++) {
  24330. parents[q] = uniqueParents[parents[q]];
  24331. }
  24332. }
  24333. function getCachedPredictionContext(context, contextCache, visited) {
  24334. if (context.isEmpty()) {
  24335. return context;
  24336. }
  24337. var existing = visited[context] || null;
  24338. if (existing !== null) {
  24339. return existing;
  24340. }
  24341. existing = contextCache.get(context);
  24342. if (existing !== null) {
  24343. visited[context] = existing;
  24344. return existing;
  24345. }
  24346. var changed = false;
  24347. var parents = [];
  24348. for (var i = 0; i < parents.length; i++) {
  24349. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24350. if (changed || parent !== context.getParent(i)) {
  24351. if (!changed) {
  24352. parents = [];
  24353. for (var j = 0; j < context.length; j++) {
  24354. parents[j] = context.getParent(j);
  24355. }
  24356. changed = true;
  24357. }
  24358. parents[i] = parent;
  24359. }
  24360. }
  24361. if (!changed) {
  24362. contextCache.add(context);
  24363. visited[context] = context;
  24364. return context;
  24365. }
  24366. var updated = null;
  24367. if (parents.length === 0) {
  24368. updated = PredictionContext.EMPTY;
  24369. } else if (parents.length === 1) {
  24370. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24371. } else {
  24372. updated = new ArrayPredictionContext(parents, context.returnStates);
  24373. }
  24374. contextCache.add(updated);
  24375. visited[updated] = updated;
  24376. visited[context] = updated;
  24377. return updated;
  24378. }
  24379. // ter's recursive version of Sam's getAllNodes()
  24380. function getAllContextNodes(context, nodes, visited) {
  24381. if (nodes === null) {
  24382. nodes = [];
  24383. return getAllContextNodes(context, nodes, visited);
  24384. } else if (visited === null) {
  24385. visited = {};
  24386. return getAllContextNodes(context, nodes, visited);
  24387. } else {
  24388. if (context === null || visited[context] !== null) {
  24389. return nodes;
  24390. }
  24391. visited[context] = context;
  24392. nodes.push(context);
  24393. for (var i = 0; i < context.length; i++) {
  24394. getAllContextNodes(context.getParent(i), nodes, visited);
  24395. }
  24396. return nodes;
  24397. }
  24398. }
  24399. exports.merge = merge;
  24400. exports.PredictionContext = PredictionContext;
  24401. exports.PredictionContextCache = PredictionContextCache;
  24402. exports.SingletonPredictionContext = SingletonPredictionContext;
  24403. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24404. exports.getCachedPredictionContext = getCachedPredictionContext;
  24405. /***/ }),
  24406. /***/ "./node_modules/antlr4/Recognizer.js":
  24407. /*!*******************************************!*\
  24408. !*** ./node_modules/antlr4/Recognizer.js ***!
  24409. \*******************************************/
  24410. /*! no static exports found */
  24411. /***/ (function(module, exports, __webpack_require__) {
  24412. "use strict";
  24413. //
  24414. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24415. * Use of this file is governed by the BSD 3-clause license that
  24416. * can be found in the LICENSE.txt file in the project root.
  24417. */
  24418. //
  24419. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24420. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24421. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24422. function Recognizer() {
  24423. this._listeners = [ConsoleErrorListener.INSTANCE];
  24424. this._interp = null;
  24425. this._stateNumber = -1;
  24426. return this;
  24427. }
  24428. Recognizer.tokenTypeMapCache = {};
  24429. Recognizer.ruleIndexMapCache = {};
  24430. Recognizer.prototype.checkVersion = function (toolVersion) {
  24431. var runtimeVersion = "4.7.1";
  24432. if (runtimeVersion !== toolVersion) {
  24433. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24434. }
  24435. };
  24436. Recognizer.prototype.addErrorListener = function (listener) {
  24437. this._listeners.push(listener);
  24438. };
  24439. Recognizer.prototype.removeErrorListeners = function () {
  24440. this._listeners = [];
  24441. };
  24442. Recognizer.prototype.getTokenTypeMap = function () {
  24443. var tokenNames = this.getTokenNames();
  24444. if (tokenNames === null) {
  24445. throw "The current recognizer does not provide a list of token names.";
  24446. }
  24447. var result = this.tokenTypeMapCache[tokenNames];
  24448. if (result === undefined) {
  24449. result = tokenNames.reduce(function (o, k, i) {
  24450. o[k] = i;
  24451. });
  24452. result.EOF = Token.EOF;
  24453. this.tokenTypeMapCache[tokenNames] = result;
  24454. }
  24455. return result;
  24456. };
  24457. // Get a map from rule names to rule indexes.
  24458. //
  24459. // <p>Used for XPath and tree pattern compilation.</p>
  24460. //
  24461. Recognizer.prototype.getRuleIndexMap = function () {
  24462. var ruleNames = this.ruleNames;
  24463. if (ruleNames === null) {
  24464. throw "The current recognizer does not provide a list of rule names.";
  24465. }
  24466. var result = this.ruleIndexMapCache[ruleNames];
  24467. if (result === undefined) {
  24468. result = ruleNames.reduce(function (o, k, i) {
  24469. o[k] = i;
  24470. });
  24471. this.ruleIndexMapCache[ruleNames] = result;
  24472. }
  24473. return result;
  24474. };
  24475. Recognizer.prototype.getTokenType = function (tokenName) {
  24476. var ttype = this.getTokenTypeMap()[tokenName];
  24477. if (ttype !== undefined) {
  24478. return ttype;
  24479. } else {
  24480. return Token.INVALID_TYPE;
  24481. }
  24482. };
  24483. // What is the error header, normally line/character position information?//
  24484. Recognizer.prototype.getErrorHeader = function (e) {
  24485. var line = e.getOffendingToken().line;
  24486. var column = e.getOffendingToken().column;
  24487. return "line " + line + ":" + column;
  24488. };
  24489. // How should a token be displayed in an error message? The default
  24490. // is to display just the text, but during development you might
  24491. // want to have a lot of information spit out. Override in that case
  24492. // to use t.toString() (which, for CommonToken, dumps everything about
  24493. // the token). This is better than forcing you to override a method in
  24494. // your token objects because you don't have to go modify your lexer
  24495. // so that it creates a new Java type.
  24496. //
  24497. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24498. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24499. // feature when necessary. For example, see
  24500. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24501. //
  24502. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  24503. if (t === null) {
  24504. return "<no token>";
  24505. }
  24506. var s = t.text;
  24507. if (s === null) {
  24508. if (t.type === Token.EOF) {
  24509. s = "<EOF>";
  24510. } else {
  24511. s = "<" + t.type + ">";
  24512. }
  24513. }
  24514. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  24515. return "'" + s + "'";
  24516. };
  24517. Recognizer.prototype.getErrorListenerDispatch = function () {
  24518. return new ProxyErrorListener(this._listeners);
  24519. };
  24520. // subclass needs to override these if there are sempreds or actions
  24521. // that the ATN interp needs to execute
  24522. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  24523. return true;
  24524. };
  24525. Recognizer.prototype.precpred = function (localctx, precedence) {
  24526. return true;
  24527. };
  24528. //Indicate that the recognizer has changed internal state that is
  24529. //consistent with the ATN state passed in. This way we always know
  24530. //where we are in the ATN as the parser goes along. The rule
  24531. //context objects form a stack that lets us see the stack of
  24532. //invoking rules. Combine this and we have complete ATN
  24533. //configuration information.
  24534. Object.defineProperty(Recognizer.prototype, "state", {
  24535. get: function get() {
  24536. return this._stateNumber;
  24537. },
  24538. set: function set(state) {
  24539. this._stateNumber = state;
  24540. }
  24541. });
  24542. exports.Recognizer = Recognizer;
  24543. /***/ }),
  24544. /***/ "./node_modules/antlr4/RuleContext.js":
  24545. /*!********************************************!*\
  24546. !*** ./node_modules/antlr4/RuleContext.js ***!
  24547. \********************************************/
  24548. /*! no static exports found */
  24549. /***/ (function(module, exports, __webpack_require__) {
  24550. "use strict";
  24551. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24552. * Use of this file is governed by the BSD 3-clause license that
  24553. * can be found in the LICENSE.txt file in the project root.
  24554. */
  24555. ///
  24556. // A rule context is a record of a single rule invocation. It knows
  24557. // which context invoked it, if any. If there is no parent context, then
  24558. // naturally the invoking state is not valid. The parent link
  24559. // provides a chain upwards from the current rule invocation to the root
  24560. // of the invocation tree, forming a stack. We actually carry no
  24561. // information about the rule associated with this context (except
  24562. // when parsing). We keep only the state number of the invoking state from
  24563. // the ATN submachine that invoked this. Contrast this with the s
  24564. // pointer inside ParserRuleContext that tracks the current state
  24565. // being "executed" for the current rule.
  24566. //
  24567. // The parent contexts are useful for computing lookahead sets and
  24568. // getting error information.
  24569. //
  24570. // These objects are used during parsing and prediction.
  24571. // For the special case of parsers, we use the subclass
  24572. // ParserRuleContext.
  24573. //
  24574. // @see ParserRuleContext
  24575. ///
  24576. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  24577. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  24578. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  24579. function RuleContext(parent, invokingState) {
  24580. RuleNode.call(this);
  24581. // What context invoked this rule?
  24582. this.parentCtx = parent || null;
  24583. // What state invoked the rule associated with this context?
  24584. // The "return address" is the followState of invokingState
  24585. // If parent is null, this should be -1.
  24586. this.invokingState = invokingState || -1;
  24587. return this;
  24588. }
  24589. RuleContext.prototype = Object.create(RuleNode.prototype);
  24590. RuleContext.prototype.constructor = RuleContext;
  24591. RuleContext.prototype.depth = function () {
  24592. var n = 0;
  24593. var p = this;
  24594. while (p !== null) {
  24595. p = p.parentCtx;
  24596. n += 1;
  24597. }
  24598. return n;
  24599. };
  24600. // A context is empty if there is no invoking state; meaning nobody call
  24601. // current context.
  24602. RuleContext.prototype.isEmpty = function () {
  24603. return this.invokingState === -1;
  24604. };
  24605. // satisfy the ParseTree / SyntaxTree interface
  24606. RuleContext.prototype.getSourceInterval = function () {
  24607. return INVALID_INTERVAL;
  24608. };
  24609. RuleContext.prototype.getRuleContext = function () {
  24610. return this;
  24611. };
  24612. RuleContext.prototype.getPayload = function () {
  24613. return this;
  24614. };
  24615. // Return the combined text of all child nodes. This method only considers
  24616. // tokens which have been added to the parse tree.
  24617. // <p>
  24618. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  24619. // added to the parse trees, they will not appear in the output of this
  24620. // method.
  24621. // /
  24622. RuleContext.prototype.getText = function () {
  24623. if (this.getChildCount() === 0) {
  24624. return "";
  24625. } else {
  24626. return this.children.map(function (child) {
  24627. return child.getText();
  24628. }).join("");
  24629. }
  24630. };
  24631. // For rule associated with this parse tree internal node, return
  24632. // the outer alternative number used to match the input. Default
  24633. // implementation does not compute nor store this alt num. Create
  24634. // a subclass of ParserRuleContext with backing field and set
  24635. // option contextSuperClass.
  24636. // to set it.
  24637. RuleContext.prototype.getAltNumber = function () {
  24638. return INVALID_ALT_NUMBER;
  24639. };
  24640. // Set the outer alternative number for this context node. Default
  24641. // implementation does nothing to avoid backing field overhead for
  24642. // trees that don't need it. Create
  24643. // a subclass of ParserRuleContext with backing field and set
  24644. // option contextSuperClass.
  24645. RuleContext.prototype.setAltNumber = function (altNumber) {};
  24646. RuleContext.prototype.getChild = function (i) {
  24647. return null;
  24648. };
  24649. RuleContext.prototype.getChildCount = function () {
  24650. return 0;
  24651. };
  24652. RuleContext.prototype.accept = function (visitor) {
  24653. return visitor.visitChildren(this);
  24654. };
  24655. //need to manage circular dependencies, so export now
  24656. exports.RuleContext = RuleContext;
  24657. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  24658. // Print out a whole tree, not just a node, in LISP format
  24659. // (root child1 .. childN). Print just a node if this is a leaf.
  24660. //
  24661. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  24662. return Trees.toStringTree(this, ruleNames, recog);
  24663. };
  24664. RuleContext.prototype.toString = function (ruleNames, stop) {
  24665. ruleNames = ruleNames || null;
  24666. stop = stop || null;
  24667. var p = this;
  24668. var s = "[";
  24669. while (p !== null && p !== stop) {
  24670. if (ruleNames === null) {
  24671. if (!p.isEmpty()) {
  24672. s += p.invokingState;
  24673. }
  24674. } else {
  24675. var ri = p.ruleIndex;
  24676. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  24677. s += ruleName;
  24678. }
  24679. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  24680. s += " ";
  24681. }
  24682. p = p.parentCtx;
  24683. }
  24684. s += "]";
  24685. return s;
  24686. };
  24687. /***/ }),
  24688. /***/ "./node_modules/antlr4/Token.js":
  24689. /*!**************************************!*\
  24690. !*** ./node_modules/antlr4/Token.js ***!
  24691. \**************************************/
  24692. /*! no static exports found */
  24693. /***/ (function(module, exports, __webpack_require__) {
  24694. "use strict";
  24695. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24696. * Use of this file is governed by the BSD 3-clause license that
  24697. * can be found in the LICENSE.txt file in the project root.
  24698. */
  24699. //
  24700. // A token has properties: text, type, line, character position in the line
  24701. // (so we can ignore tabs), token channel, index, and source from which
  24702. // we obtained this token.
  24703. function Token() {
  24704. this.source = null;
  24705. this.type = null; // token type of the token
  24706. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  24707. this.start = null; // optional; return -1 if not implemented.
  24708. this.stop = null; // optional; return -1 if not implemented.
  24709. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  24710. this.line = null; // line=1..n of the 1st character
  24711. this.column = null; // beginning of the line at which it occurs, 0..n-1
  24712. this._text = null; // text of the token.
  24713. return this;
  24714. }
  24715. Token.INVALID_TYPE = 0;
  24716. // During lookahead operations, this "token" signifies we hit rule end ATN state
  24717. // and did not follow it despite needing to.
  24718. Token.EPSILON = -2;
  24719. Token.MIN_USER_TOKEN_TYPE = 1;
  24720. Token.EOF = -1;
  24721. // All tokens go to the parser (unless skip() is called in that rule)
  24722. // on a particular "channel". The parser tunes to a particular channel
  24723. // so that whitespace etc... can go to the parser on a "hidden" channel.
  24724. Token.DEFAULT_CHANNEL = 0;
  24725. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  24726. // by parser.
  24727. Token.HIDDEN_CHANNEL = 1;
  24728. // Explicitly set the text for this token. If {code text} is not
  24729. // {@code null}, then {@link //getText} will return this value rather than
  24730. // extracting the text from the input.
  24731. //
  24732. // @param text The explicit text of the token, or {@code null} if the text
  24733. // should be obtained from the input along with the start and stop indexes
  24734. // of the token.
  24735. Object.defineProperty(Token.prototype, "text", {
  24736. get: function get() {
  24737. return this._text;
  24738. },
  24739. set: function set(text) {
  24740. this._text = text;
  24741. }
  24742. });
  24743. Token.prototype.getTokenSource = function () {
  24744. return this.source[0];
  24745. };
  24746. Token.prototype.getInputStream = function () {
  24747. return this.source[1];
  24748. };
  24749. function CommonToken(source, type, channel, start, stop) {
  24750. Token.call(this);
  24751. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  24752. this.type = type !== undefined ? type : null;
  24753. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  24754. this.start = start !== undefined ? start : -1;
  24755. this.stop = stop !== undefined ? stop : -1;
  24756. this.tokenIndex = -1;
  24757. if (this.source[0] !== null) {
  24758. this.line = source[0].line;
  24759. this.column = source[0].column;
  24760. } else {
  24761. this.column = -1;
  24762. }
  24763. return this;
  24764. }
  24765. CommonToken.prototype = Object.create(Token.prototype);
  24766. CommonToken.prototype.constructor = CommonToken;
  24767. // An empty {@link Pair} which is used as the default value of
  24768. // {@link //source} for tokens that do not have a source.
  24769. CommonToken.EMPTY_SOURCE = [null, null];
  24770. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  24771. //
  24772. // <p>
  24773. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  24774. // constructed token will share a reference to the {@link //text} field and
  24775. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  24776. // be assigned the result of calling {@link //getText}, and {@link //source}
  24777. // will be constructed from the result of {@link Token//getTokenSource} and
  24778. // {@link Token//getInputStream}.</p>
  24779. //
  24780. // @param oldToken The token to copy.
  24781. //
  24782. CommonToken.prototype.clone = function () {
  24783. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  24784. t.tokenIndex = this.tokenIndex;
  24785. t.line = this.line;
  24786. t.column = this.column;
  24787. t.text = this.text;
  24788. return t;
  24789. };
  24790. Object.defineProperty(CommonToken.prototype, "text", {
  24791. get: function get() {
  24792. if (this._text !== null) {
  24793. return this._text;
  24794. }
  24795. var input = this.getInputStream();
  24796. if (input === null) {
  24797. return null;
  24798. }
  24799. var n = input.size;
  24800. if (this.start < n && this.stop < n) {
  24801. return input.getText(this.start, this.stop);
  24802. } else {
  24803. return "<EOF>";
  24804. }
  24805. },
  24806. set: function set(text) {
  24807. this._text = text;
  24808. }
  24809. });
  24810. CommonToken.prototype.toString = function () {
  24811. var txt = this.text;
  24812. if (txt !== null) {
  24813. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  24814. } else {
  24815. txt = "<no text>";
  24816. }
  24817. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  24818. };
  24819. exports.Token = Token;
  24820. exports.CommonToken = CommonToken;
  24821. /***/ }),
  24822. /***/ "./node_modules/antlr4/Utils.js":
  24823. /*!**************************************!*\
  24824. !*** ./node_modules/antlr4/Utils.js ***!
  24825. \**************************************/
  24826. /*! no static exports found */
  24827. /***/ (function(module, exports, __webpack_require__) {
  24828. "use strict";
  24829. 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; };
  24830. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24831. * Use of this file is governed by the BSD 3-clause license that
  24832. * can be found in the LICENSE.txt file in the project root.
  24833. */
  24834. function arrayToString(a) {
  24835. return "[" + a.join(", ") + "]";
  24836. }
  24837. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  24838. String.prototype.hashCode = function () {
  24839. var remainder,
  24840. bytes,
  24841. h1,
  24842. h1b,
  24843. c1,
  24844. c1b,
  24845. c2,
  24846. c2b,
  24847. k1,
  24848. i,
  24849. key = this.toString();
  24850. remainder = key.length & 3; // key.length % 4
  24851. bytes = key.length - remainder;
  24852. h1 = String.prototype.seed;
  24853. c1 = 0xcc9e2d51;
  24854. c2 = 0x1b873593;
  24855. i = 0;
  24856. while (i < bytes) {
  24857. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  24858. ++i;
  24859. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24860. k1 = k1 << 15 | k1 >>> 17;
  24861. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24862. h1 ^= k1;
  24863. h1 = h1 << 13 | h1 >>> 19;
  24864. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  24865. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  24866. }
  24867. k1 = 0;
  24868. switch (remainder) {
  24869. case 3:
  24870. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  24871. case 2:
  24872. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  24873. case 1:
  24874. k1 ^= key.charCodeAt(i) & 0xff;
  24875. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24876. k1 = k1 << 15 | k1 >>> 17;
  24877. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24878. h1 ^= k1;
  24879. }
  24880. h1 ^= key.length;
  24881. h1 ^= h1 >>> 16;
  24882. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  24883. h1 ^= h1 >>> 13;
  24884. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  24885. h1 ^= h1 >>> 16;
  24886. return h1 >>> 0;
  24887. };
  24888. function standardEqualsFunction(a, b) {
  24889. return a.equals(b);
  24890. }
  24891. function standardHashCodeFunction(a) {
  24892. return a.hashCode();
  24893. }
  24894. function Set(hashFunction, equalsFunction) {
  24895. this.data = {};
  24896. this.hashFunction = hashFunction || standardHashCodeFunction;
  24897. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24898. return this;
  24899. }
  24900. Object.defineProperty(Set.prototype, "length", {
  24901. get: function get() {
  24902. var l = 0;
  24903. for (var key in this.data) {
  24904. if (key.indexOf("hash_") === 0) {
  24905. l = l + this.data[key].length;
  24906. }
  24907. }
  24908. return l;
  24909. }
  24910. });
  24911. Set.prototype.add = function (value) {
  24912. var hash = this.hashFunction(value);
  24913. var key = "hash_" + hash;
  24914. if (key in this.data) {
  24915. var values = this.data[key];
  24916. for (var i = 0; i < values.length; i++) {
  24917. if (this.equalsFunction(value, values[i])) {
  24918. return values[i];
  24919. }
  24920. }
  24921. values.push(value);
  24922. return value;
  24923. } else {
  24924. this.data[key] = [value];
  24925. return value;
  24926. }
  24927. };
  24928. Set.prototype.contains = function (value) {
  24929. return this.get(value) != null;
  24930. };
  24931. Set.prototype.get = function (value) {
  24932. var hash = this.hashFunction(value);
  24933. var key = "hash_" + hash;
  24934. if (key in this.data) {
  24935. var values = this.data[key];
  24936. for (var i = 0; i < values.length; i++) {
  24937. if (this.equalsFunction(value, values[i])) {
  24938. return values[i];
  24939. }
  24940. }
  24941. }
  24942. return null;
  24943. };
  24944. Set.prototype.values = function () {
  24945. var l = [];
  24946. for (var key in this.data) {
  24947. if (key.indexOf("hash_") === 0) {
  24948. l = l.concat(this.data[key]);
  24949. }
  24950. }
  24951. return l;
  24952. };
  24953. Set.prototype.toString = function () {
  24954. return arrayToString(this.values());
  24955. };
  24956. function BitSet() {
  24957. this.data = [];
  24958. return this;
  24959. }
  24960. BitSet.prototype.add = function (value) {
  24961. this.data[value] = true;
  24962. };
  24963. BitSet.prototype.or = function (set) {
  24964. var bits = this;
  24965. Object.keys(set.data).map(function (alt) {
  24966. bits.add(alt);
  24967. });
  24968. };
  24969. BitSet.prototype.remove = function (value) {
  24970. delete this.data[value];
  24971. };
  24972. BitSet.prototype.contains = function (value) {
  24973. return this.data[value] === true;
  24974. };
  24975. BitSet.prototype.values = function () {
  24976. return Object.keys(this.data);
  24977. };
  24978. BitSet.prototype.minValue = function () {
  24979. return Math.min.apply(null, this.values());
  24980. };
  24981. BitSet.prototype.hashCode = function () {
  24982. var hash = new Hash();
  24983. hash.update(this.values());
  24984. return hash.finish();
  24985. };
  24986. BitSet.prototype.equals = function (other) {
  24987. if (!(other instanceof BitSet)) {
  24988. return false;
  24989. }
  24990. return this.hashCode() === other.hashCode();
  24991. };
  24992. Object.defineProperty(BitSet.prototype, "length", {
  24993. get: function get() {
  24994. return this.values().length;
  24995. }
  24996. });
  24997. BitSet.prototype.toString = function () {
  24998. return "{" + this.values().join(", ") + "}";
  24999. };
  25000. function Map(hashFunction, equalsFunction) {
  25001. this.data = {};
  25002. this.hashFunction = hashFunction || standardHashCodeFunction;
  25003. this.equalsFunction = equalsFunction || standardEqualsFunction;
  25004. return this;
  25005. }
  25006. Object.defineProperty(Map.prototype, "length", {
  25007. get: function get() {
  25008. var l = 0;
  25009. for (var hashKey in this.data) {
  25010. if (hashKey.indexOf("hash_") === 0) {
  25011. l = l + this.data[hashKey].length;
  25012. }
  25013. }
  25014. return l;
  25015. }
  25016. });
  25017. Map.prototype.put = function (key, value) {
  25018. var hashKey = "hash_" + this.hashFunction(key);
  25019. if (hashKey in this.data) {
  25020. var entries = this.data[hashKey];
  25021. for (var i = 0; i < entries.length; i++) {
  25022. var entry = entries[i];
  25023. if (this.equalsFunction(key, entry.key)) {
  25024. var oldValue = entry.value;
  25025. entry.value = value;
  25026. return oldValue;
  25027. }
  25028. }
  25029. entries.push({ key: key, value: value });
  25030. return value;
  25031. } else {
  25032. this.data[hashKey] = [{ key: key, value: value }];
  25033. return value;
  25034. }
  25035. };
  25036. Map.prototype.containsKey = function (key) {
  25037. var hashKey = "hash_" + this.hashFunction(key);
  25038. if (hashKey in this.data) {
  25039. var entries = this.data[hashKey];
  25040. for (var i = 0; i < entries.length; i++) {
  25041. var entry = entries[i];
  25042. if (this.equalsFunction(key, entry.key)) return true;
  25043. }
  25044. }
  25045. return false;
  25046. };
  25047. Map.prototype.get = function (key) {
  25048. var hashKey = "hash_" + this.hashFunction(key);
  25049. if (hashKey in this.data) {
  25050. var entries = this.data[hashKey];
  25051. for (var i = 0; i < entries.length; i++) {
  25052. var entry = entries[i];
  25053. if (this.equalsFunction(key, entry.key)) return entry.value;
  25054. }
  25055. }
  25056. return null;
  25057. };
  25058. Map.prototype.entries = function () {
  25059. var l = [];
  25060. for (var key in this.data) {
  25061. if (key.indexOf("hash_") === 0) {
  25062. l = l.concat(this.data[key]);
  25063. }
  25064. }
  25065. return l;
  25066. };
  25067. Map.prototype.getKeys = function () {
  25068. return this.entries().map(function (e) {
  25069. return e.key;
  25070. });
  25071. };
  25072. Map.prototype.getValues = function () {
  25073. return this.entries().map(function (e) {
  25074. return e.value;
  25075. });
  25076. };
  25077. Map.prototype.toString = function () {
  25078. var ss = this.entries().map(function (entry) {
  25079. return '{' + entry.key + ':' + entry.value + '}';
  25080. });
  25081. return '[' + ss.join(", ") + ']';
  25082. };
  25083. function AltDict() {
  25084. this.data = {};
  25085. return this;
  25086. }
  25087. AltDict.prototype.get = function (key) {
  25088. key = "k-" + key;
  25089. if (key in this.data) {
  25090. return this.data[key];
  25091. } else {
  25092. return null;
  25093. }
  25094. };
  25095. AltDict.prototype.put = function (key, value) {
  25096. key = "k-" + key;
  25097. this.data[key] = value;
  25098. };
  25099. AltDict.prototype.values = function () {
  25100. var data = this.data;
  25101. var keys = Object.keys(this.data);
  25102. return keys.map(function (key) {
  25103. return data[key];
  25104. });
  25105. };
  25106. function DoubleDict() {
  25107. return this;
  25108. }
  25109. function Hash() {
  25110. this.count = 0;
  25111. this.hash = 0;
  25112. return this;
  25113. }
  25114. Hash.prototype.update = function () {
  25115. for (var i = 0; i < arguments.length; i++) {
  25116. var value = arguments[i];
  25117. if (value == null) continue;
  25118. if (Array.isArray(value)) this.update.apply(value);else {
  25119. var k = 0;
  25120. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25121. case 'undefined':
  25122. case 'function':
  25123. continue;
  25124. case 'number':
  25125. case 'boolean':
  25126. k = value;
  25127. break;
  25128. case 'string':
  25129. k = value.hashCode();
  25130. break;
  25131. default:
  25132. value.updateHashCode(this);
  25133. continue;
  25134. }
  25135. k = k * 0xCC9E2D51;
  25136. k = k << 15 | k >>> 32 - 15;
  25137. k = k * 0x1B873593;
  25138. this.count = this.count + 1;
  25139. var hash = this.hash ^ k;
  25140. hash = hash << 13 | hash >>> 32 - 13;
  25141. hash = hash * 5 + 0xE6546B64;
  25142. this.hash = hash;
  25143. }
  25144. }
  25145. };
  25146. Hash.prototype.finish = function () {
  25147. var hash = this.hash ^ this.count * 4;
  25148. hash = hash ^ hash >>> 16;
  25149. hash = hash * 0x85EBCA6B;
  25150. hash = hash ^ hash >>> 13;
  25151. hash = hash * 0xC2B2AE35;
  25152. hash = hash ^ hash >>> 16;
  25153. return hash;
  25154. };
  25155. function hashStuff() {
  25156. var hash = new Hash();
  25157. hash.update.apply(arguments);
  25158. return hash.finish();
  25159. }
  25160. DoubleDict.prototype.get = function (a, b) {
  25161. var d = this[a] || null;
  25162. return d === null ? null : d[b] || null;
  25163. };
  25164. DoubleDict.prototype.set = function (a, b, o) {
  25165. var d = this[a] || null;
  25166. if (d === null) {
  25167. d = {};
  25168. this[a] = d;
  25169. }
  25170. d[b] = o;
  25171. };
  25172. function escapeWhitespace(s, escapeSpaces) {
  25173. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25174. if (escapeSpaces) {
  25175. s = s.replace(/ /g, "\xB7");
  25176. }
  25177. return s;
  25178. }
  25179. function titleCase(str) {
  25180. return str.replace(/\w\S*/g, function (txt) {
  25181. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25182. });
  25183. };
  25184. function equalArrays(a, b) {
  25185. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25186. if (a == b) return true;
  25187. if (a.length != b.length) return false;
  25188. for (var i = 0; i < a.length; i++) {
  25189. if (a[i] == b[i]) continue;
  25190. if (!a[i].equals(b[i])) return false;
  25191. }
  25192. return true;
  25193. };
  25194. exports.Hash = Hash;
  25195. exports.Set = Set;
  25196. exports.Map = Map;
  25197. exports.BitSet = BitSet;
  25198. exports.AltDict = AltDict;
  25199. exports.DoubleDict = DoubleDict;
  25200. exports.hashStuff = hashStuff;
  25201. exports.escapeWhitespace = escapeWhitespace;
  25202. exports.arrayToString = arrayToString;
  25203. exports.titleCase = titleCase;
  25204. exports.equalArrays = equalArrays;
  25205. /***/ }),
  25206. /***/ "./node_modules/antlr4/atn/ATN.js":
  25207. /*!****************************************!*\
  25208. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25209. \****************************************/
  25210. /*! no static exports found */
  25211. /***/ (function(module, exports, __webpack_require__) {
  25212. "use strict";
  25213. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25214. * Use of this file is governed by the BSD 3-clause license that
  25215. * can be found in the LICENSE.txt file in the project root.
  25216. */
  25217. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25218. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25219. function ATN(grammarType, maxTokenType) {
  25220. // Used for runtime deserialization of ATNs from strings///
  25221. // The type of the ATN.
  25222. this.grammarType = grammarType;
  25223. // The maximum value for any symbol recognized by a transition in the ATN.
  25224. this.maxTokenType = maxTokenType;
  25225. this.states = [];
  25226. // Each subrule/rule is a decision point and we must track them so we
  25227. // can go back later and build DFA predictors for them. This includes
  25228. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25229. this.decisionToState = [];
  25230. // Maps from rule index to starting state number.
  25231. this.ruleToStartState = [];
  25232. // Maps from rule index to stop state number.
  25233. this.ruleToStopState = null;
  25234. this.modeNameToStartState = {};
  25235. // For lexer ATNs, this maps the rule index to the resulting token type.
  25236. // For parser ATNs, this maps the rule index to the generated bypass token
  25237. // type if the
  25238. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25239. // deserialization option was specified; otherwise, this is {@code null}.
  25240. this.ruleToTokenType = null;
  25241. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25242. // be referenced by action transitions in the ATN.
  25243. this.lexerActions = null;
  25244. this.modeToStartState = [];
  25245. return this;
  25246. }
  25247. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25248. // If {@code ctx} is null, the set of tokens will not include what can follow
  25249. // the rule surrounding {@code s}. In other words, the set will be
  25250. // restricted to tokens reachable staying within {@code s}'s rule.
  25251. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25252. var anal = new LL1Analyzer(this);
  25253. return anal.LOOK(s, null, ctx);
  25254. };
  25255. // Compute the set of valid tokens that can occur starting in {@code s} and
  25256. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25257. // rule.
  25258. ATN.prototype.nextTokensNoContext = function (s) {
  25259. if (s.nextTokenWithinRule !== null) {
  25260. return s.nextTokenWithinRule;
  25261. }
  25262. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25263. s.nextTokenWithinRule.readOnly = true;
  25264. return s.nextTokenWithinRule;
  25265. };
  25266. ATN.prototype.nextTokens = function (s, ctx) {
  25267. if (ctx === undefined) {
  25268. return this.nextTokensNoContext(s);
  25269. } else {
  25270. return this.nextTokensInContext(s, ctx);
  25271. }
  25272. };
  25273. ATN.prototype.addState = function (state) {
  25274. if (state !== null) {
  25275. state.atn = this;
  25276. state.stateNumber = this.states.length;
  25277. }
  25278. this.states.push(state);
  25279. };
  25280. ATN.prototype.removeState = function (state) {
  25281. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25282. };
  25283. ATN.prototype.defineDecisionState = function (s) {
  25284. this.decisionToState.push(s);
  25285. s.decision = this.decisionToState.length - 1;
  25286. return s.decision;
  25287. };
  25288. ATN.prototype.getDecisionState = function (decision) {
  25289. if (this.decisionToState.length === 0) {
  25290. return null;
  25291. } else {
  25292. return this.decisionToState[decision];
  25293. }
  25294. };
  25295. // Computes the set of input symbols which could follow ATN state number
  25296. // {@code stateNumber} in the specified full {@code context}. This method
  25297. // considers the complete parser context, but does not evaluate semantic
  25298. // predicates (i.e. all predicates encountered during the calculation are
  25299. // assumed true). If a path in the ATN exists from the starting state to the
  25300. // {@link RuleStopState} of the outermost context without matching any
  25301. // symbols, {@link Token//EOF} is added to the returned set.
  25302. //
  25303. // <p>If {@code context} is {@code null}, it is treated as
  25304. // {@link ParserRuleContext//EMPTY}.</p>
  25305. //
  25306. // @param stateNumber the ATN state number
  25307. // @param context the full parse context
  25308. // @return The set of potentially valid input symbols which could follow the
  25309. // specified state in the specified context.
  25310. // @throws IllegalArgumentException if the ATN does not contain a state with
  25311. // number {@code stateNumber}
  25312. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25313. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25314. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25315. throw "Invalid state number.";
  25316. }
  25317. var s = this.states[stateNumber];
  25318. var following = this.nextTokens(s);
  25319. if (!following.contains(Token.EPSILON)) {
  25320. return following;
  25321. }
  25322. var expected = new IntervalSet();
  25323. expected.addSet(following);
  25324. expected.removeOne(Token.EPSILON);
  25325. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25326. var invokingState = this.states[ctx.invokingState];
  25327. var rt = invokingState.transitions[0];
  25328. following = this.nextTokens(rt.followState);
  25329. expected.addSet(following);
  25330. expected.removeOne(Token.EPSILON);
  25331. ctx = ctx.parentCtx;
  25332. }
  25333. if (following.contains(Token.EPSILON)) {
  25334. expected.addOne(Token.EOF);
  25335. }
  25336. return expected;
  25337. };
  25338. ATN.INVALID_ALT_NUMBER = 0;
  25339. exports.ATN = ATN;
  25340. /***/ }),
  25341. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25342. /*!**********************************************!*\
  25343. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25344. \**********************************************/
  25345. /*! no static exports found */
  25346. /***/ (function(module, exports, __webpack_require__) {
  25347. "use strict";
  25348. //
  25349. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25350. * Use of this file is governed by the BSD 3-clause license that
  25351. * can be found in the LICENSE.txt file in the project root.
  25352. */
  25353. ///
  25354. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25355. // The syntactic context is a graph-structured stack node whose
  25356. // path(s) to the root is the rule invocation(s)
  25357. // chain used to arrive at the state. The semantic context is
  25358. // the tree of semantic predicates encountered before reaching
  25359. // an ATN state.
  25360. ///
  25361. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25362. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25363. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25364. function checkParams(params, isCfg) {
  25365. if (params === null) {
  25366. var result = { state: null, alt: null, context: null, semanticContext: null };
  25367. if (isCfg) {
  25368. result.reachesIntoOuterContext = 0;
  25369. }
  25370. return result;
  25371. } else {
  25372. var props = {};
  25373. props.state = params.state || null;
  25374. props.alt = params.alt === undefined ? null : params.alt;
  25375. props.context = params.context || null;
  25376. props.semanticContext = params.semanticContext || null;
  25377. if (isCfg) {
  25378. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25379. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25380. }
  25381. return props;
  25382. }
  25383. }
  25384. function ATNConfig(params, config) {
  25385. this.checkContext(params, config);
  25386. params = checkParams(params);
  25387. config = checkParams(config, true);
  25388. // The ATN state associated with this configuration///
  25389. this.state = params.state !== null ? params.state : config.state;
  25390. // What alt (or lexer rule) is predicted by this configuration///
  25391. this.alt = params.alt !== null ? params.alt : config.alt;
  25392. // The stack of invoking states leading to the rule/states associated
  25393. // with this config. We track only those contexts pushed during
  25394. // execution of the ATN simulator.
  25395. this.context = params.context !== null ? params.context : config.context;
  25396. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25397. // We cannot execute predicates dependent upon local context unless
  25398. // we know for sure we are in the correct context. Because there is
  25399. // no way to do this efficiently, we simply cannot evaluate
  25400. // dependent predicates unless we are in the rule that initially
  25401. // invokes the ATN simulator.
  25402. //
  25403. // closure() tracks the depth of how far we dip into the
  25404. // outer context: depth &gt; 0. Note that it may not be totally
  25405. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25406. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25407. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25408. return this;
  25409. }
  25410. ATNConfig.prototype.checkContext = function (params, config) {
  25411. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25412. this.context = null;
  25413. }
  25414. };
  25415. ATNConfig.prototype.hashCode = function () {
  25416. var hash = new Hash();
  25417. this.updateHashCode(hash);
  25418. return hash.finish();
  25419. };
  25420. ATNConfig.prototype.updateHashCode = function (hash) {
  25421. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25422. };
  25423. // An ATN configuration is equal to another if both have
  25424. // the same state, they predict the same alternative, and
  25425. // syntactic/semantic contexts are the same.
  25426. ATNConfig.prototype.equals = function (other) {
  25427. if (this === other) {
  25428. return true;
  25429. } else if (!(other instanceof ATNConfig)) {
  25430. return false;
  25431. } else {
  25432. 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;
  25433. }
  25434. };
  25435. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25436. var hash = new Hash();
  25437. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25438. return hash.finish();
  25439. };
  25440. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25441. if (this === other) {
  25442. return true;
  25443. } else if (!(other instanceof ATNConfig)) {
  25444. return false;
  25445. } else {
  25446. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25447. }
  25448. };
  25449. ATNConfig.prototype.toString = function () {
  25450. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25451. };
  25452. function LexerATNConfig(params, config) {
  25453. ATNConfig.call(this, params, config);
  25454. // This is the backing field for {@link //getLexerActionExecutor}.
  25455. var lexerActionExecutor = params.lexerActionExecutor || null;
  25456. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25457. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25458. return this;
  25459. }
  25460. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25461. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25462. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25463. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25464. };
  25465. LexerATNConfig.prototype.equals = function (other) {
  25466. 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);
  25467. };
  25468. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25469. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25470. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25471. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25472. };
  25473. exports.ATNConfig = ATNConfig;
  25474. exports.LexerATNConfig = LexerATNConfig;
  25475. /***/ }),
  25476. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25477. /*!*************************************************!*\
  25478. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25479. \*************************************************/
  25480. /*! no static exports found */
  25481. /***/ (function(module, exports, __webpack_require__) {
  25482. "use strict";
  25483. //
  25484. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25485. * Use of this file is governed by the BSD 3-clause license that
  25486. * can be found in the LICENSE.txt file in the project root.
  25487. */
  25488. //
  25489. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25490. // info about the set, with support for combining similar configurations using a
  25491. // graph-structured stack.
  25492. ///
  25493. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25494. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25495. var Hash = Utils.Hash;
  25496. var Set = Utils.Set;
  25497. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25498. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25499. function hashATNConfig(c) {
  25500. return c.hashCodeForConfigSet();
  25501. }
  25502. function equalATNConfigs(a, b) {
  25503. if (a === b) {
  25504. return true;
  25505. } else if (a === null || b === null) {
  25506. return false;
  25507. } else return a.equalsForConfigSet(b);
  25508. }
  25509. function ATNConfigSet(fullCtx) {
  25510. //
  25511. // The reason that we need this is because we don't want the hash map to use
  25512. // the standard hash code and equals. We need all configurations with the
  25513. // same
  25514. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  25515. // doubles
  25516. // the number of objects associated with ATNConfigs. The other solution is
  25517. // to
  25518. // use a hash table that lets us specify the equals/hashcode operation.
  25519. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  25520. // when we go readonly as this set becomes a DFA state.
  25521. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  25522. // Indicates that this configuration set is part of a full context
  25523. // LL prediction. It will be used to determine how to merge $. With SLL
  25524. // it's a wildcard whereas it is not for LL context merge.
  25525. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  25526. // Indicates that the set of configurations is read-only. Do not
  25527. // allow any code to manipulate the set; DFA states will point at
  25528. // the sets and they must not change. This does not protect the other
  25529. // fields; in particular, conflictingAlts is set after
  25530. // we've made this readonly.
  25531. this.readOnly = false;
  25532. // Track the elements as they are added to the set; supports get(i)///
  25533. this.configs = [];
  25534. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  25535. // together, saves recomputation
  25536. // TODO: can we track conflicts as they are added to save scanning configs
  25537. // later?
  25538. this.uniqueAlt = 0;
  25539. this.conflictingAlts = null;
  25540. // Used in parser and lexer. In lexer, it indicates we hit a pred
  25541. // while computing a closure operation. Don't make a DFA state from this.
  25542. this.hasSemanticContext = false;
  25543. this.dipsIntoOuterContext = false;
  25544. this.cachedHashCode = -1;
  25545. return this;
  25546. }
  25547. // Adding a new config means merging contexts with existing configs for
  25548. // {@code (s, i, pi, _)}, where {@code s} is the
  25549. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  25550. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  25551. // {@code (s,i,pi)} as key.
  25552. //
  25553. // <p>This method updates {@link //dipsIntoOuterContext} and
  25554. // {@link //hasSemanticContext} when necessary.</p>
  25555. // /
  25556. ATNConfigSet.prototype.add = function (config, mergeCache) {
  25557. if (mergeCache === undefined) {
  25558. mergeCache = null;
  25559. }
  25560. if (this.readOnly) {
  25561. throw "This set is readonly";
  25562. }
  25563. if (config.semanticContext !== SemanticContext.NONE) {
  25564. this.hasSemanticContext = true;
  25565. }
  25566. if (config.reachesIntoOuterContext > 0) {
  25567. this.dipsIntoOuterContext = true;
  25568. }
  25569. var existing = this.configLookup.add(config);
  25570. if (existing === config) {
  25571. this.cachedHashCode = -1;
  25572. this.configs.push(config); // track order here
  25573. return true;
  25574. }
  25575. // a previous (s,i,pi,_), merge with it and save result
  25576. var rootIsWildcard = !this.fullCtx;
  25577. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  25578. // no need to check for existing.context, config.context in cache
  25579. // since only way to create new graphs is "call rule" and here. We
  25580. // cache at both places.
  25581. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  25582. // make sure to preserve the precedence filter suppression during the merge
  25583. if (config.precedenceFilterSuppressed) {
  25584. existing.precedenceFilterSuppressed = true;
  25585. }
  25586. existing.context = merged; // replace context; no need to alt mapping
  25587. return true;
  25588. };
  25589. ATNConfigSet.prototype.getStates = function () {
  25590. var states = new Set();
  25591. for (var i = 0; i < this.configs.length; i++) {
  25592. states.add(this.configs[i].state);
  25593. }
  25594. return states;
  25595. };
  25596. ATNConfigSet.prototype.getPredicates = function () {
  25597. var preds = [];
  25598. for (var i = 0; i < this.configs.length; i++) {
  25599. var c = this.configs[i].semanticContext;
  25600. if (c !== SemanticContext.NONE) {
  25601. preds.push(c.semanticContext);
  25602. }
  25603. }
  25604. return preds;
  25605. };
  25606. Object.defineProperty(ATNConfigSet.prototype, "items", {
  25607. get: function get() {
  25608. return this.configs;
  25609. }
  25610. });
  25611. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  25612. if (this.readOnly) {
  25613. throw "This set is readonly";
  25614. }
  25615. if (this.configLookup.length === 0) {
  25616. return;
  25617. }
  25618. for (var i = 0; i < this.configs.length; i++) {
  25619. var config = this.configs[i];
  25620. config.context = interpreter.getCachedContext(config.context);
  25621. }
  25622. };
  25623. ATNConfigSet.prototype.addAll = function (coll) {
  25624. for (var i = 0; i < coll.length; i++) {
  25625. this.add(coll[i]);
  25626. }
  25627. return false;
  25628. };
  25629. ATNConfigSet.prototype.equals = function (other) {
  25630. 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;
  25631. };
  25632. ATNConfigSet.prototype.hashCode = function () {
  25633. var hash = new Hash();
  25634. this.updateHashCode(hash);
  25635. return hash.finish();
  25636. };
  25637. ATNConfigSet.prototype.updateHashCode = function (hash) {
  25638. if (this.readOnly) {
  25639. if (this.cachedHashCode === -1) {
  25640. var hash = new Hash();
  25641. hash.update(this.configs);
  25642. this.cachedHashCode = hash.finish();
  25643. }
  25644. hash.update(this.cachedHashCode);
  25645. } else {
  25646. hash.update(this.configs);
  25647. }
  25648. };
  25649. Object.defineProperty(ATNConfigSet.prototype, "length", {
  25650. get: function get() {
  25651. return this.configs.length;
  25652. }
  25653. });
  25654. ATNConfigSet.prototype.isEmpty = function () {
  25655. return this.configs.length === 0;
  25656. };
  25657. ATNConfigSet.prototype.contains = function (item) {
  25658. if (this.configLookup === null) {
  25659. throw "This method is not implemented for readonly sets.";
  25660. }
  25661. return this.configLookup.contains(item);
  25662. };
  25663. ATNConfigSet.prototype.containsFast = function (item) {
  25664. if (this.configLookup === null) {
  25665. throw "This method is not implemented for readonly sets.";
  25666. }
  25667. return this.configLookup.containsFast(item);
  25668. };
  25669. ATNConfigSet.prototype.clear = function () {
  25670. if (this.readOnly) {
  25671. throw "This set is readonly";
  25672. }
  25673. this.configs = [];
  25674. this.cachedHashCode = -1;
  25675. this.configLookup = new Set();
  25676. };
  25677. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  25678. this.readOnly = readOnly;
  25679. if (readOnly) {
  25680. this.configLookup = null; // can't mod, no need for lookup cache
  25681. }
  25682. };
  25683. ATNConfigSet.prototype.toString = function () {
  25684. 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" : "");
  25685. };
  25686. function OrderedATNConfigSet() {
  25687. ATNConfigSet.call(this);
  25688. this.configLookup = new Set();
  25689. return this;
  25690. }
  25691. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  25692. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  25693. exports.ATNConfigSet = ATNConfigSet;
  25694. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  25695. /***/ }),
  25696. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  25697. /*!**************************************************************!*\
  25698. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  25699. \**************************************************************/
  25700. /*! no static exports found */
  25701. /***/ (function(module, exports, __webpack_require__) {
  25702. "use strict";
  25703. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25704. * Use of this file is governed by the BSD 3-clause license that
  25705. * can be found in the LICENSE.txt file in the project root.
  25706. */
  25707. function ATNDeserializationOptions(copyFrom) {
  25708. if (copyFrom === undefined) {
  25709. copyFrom = null;
  25710. }
  25711. this.readOnly = false;
  25712. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  25713. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  25714. return this;
  25715. }
  25716. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  25717. ATNDeserializationOptions.defaultOptions.readOnly = true;
  25718. // def __setattr__(self, key, value):
  25719. // if key!="readOnly" and self.readOnly:
  25720. // raise Exception("The object is read only.")
  25721. // super(type(self), self).__setattr__(key,value)
  25722. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  25723. /***/ }),
  25724. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  25725. /*!****************************************************!*\
  25726. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  25727. \****************************************************/
  25728. /*! no static exports found */
  25729. /***/ (function(module, exports, __webpack_require__) {
  25730. "use strict";
  25731. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25732. * Use of this file is governed by the BSD 3-clause license that
  25733. * can be found in the LICENSE.txt file in the project root.
  25734. */
  25735. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25736. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25737. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  25738. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  25739. var ATNState = ATNStates.ATNState;
  25740. var BasicState = ATNStates.BasicState;
  25741. var DecisionState = ATNStates.DecisionState;
  25742. var BlockStartState = ATNStates.BlockStartState;
  25743. var BlockEndState = ATNStates.BlockEndState;
  25744. var LoopEndState = ATNStates.LoopEndState;
  25745. var RuleStartState = ATNStates.RuleStartState;
  25746. var RuleStopState = ATNStates.RuleStopState;
  25747. var TokensStartState = ATNStates.TokensStartState;
  25748. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  25749. var StarLoopbackState = ATNStates.StarLoopbackState;
  25750. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  25751. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  25752. var StarBlockStartState = ATNStates.StarBlockStartState;
  25753. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  25754. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25755. var Transition = Transitions.Transition;
  25756. var AtomTransition = Transitions.AtomTransition;
  25757. var SetTransition = Transitions.SetTransition;
  25758. var NotSetTransition = Transitions.NotSetTransition;
  25759. var RuleTransition = Transitions.RuleTransition;
  25760. var RangeTransition = Transitions.RangeTransition;
  25761. var ActionTransition = Transitions.ActionTransition;
  25762. var EpsilonTransition = Transitions.EpsilonTransition;
  25763. var WildcardTransition = Transitions.WildcardTransition;
  25764. var PredicateTransition = Transitions.PredicateTransition;
  25765. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  25766. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25767. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25768. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25769. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  25770. var LexerActionType = LexerActions.LexerActionType;
  25771. var LexerSkipAction = LexerActions.LexerSkipAction;
  25772. var LexerChannelAction = LexerActions.LexerChannelAction;
  25773. var LexerCustomAction = LexerActions.LexerCustomAction;
  25774. var LexerMoreAction = LexerActions.LexerMoreAction;
  25775. var LexerTypeAction = LexerActions.LexerTypeAction;
  25776. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  25777. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  25778. var LexerModeAction = LexerActions.LexerModeAction;
  25779. // This is the earliest supported serialized UUID.
  25780. // stick to serialized version for now, we don't need a UUID instance
  25781. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  25782. //
  25783. // This UUID indicates the serialized ATN contains two sets of
  25784. // IntervalSets, where the second set's values are encoded as
  25785. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  25786. //
  25787. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  25788. // This list contains all of the currently supported UUIDs, ordered by when
  25789. // the feature first appeared in this branch.
  25790. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  25791. var SERIALIZED_VERSION = 3;
  25792. // This is the current serialized UUID.
  25793. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  25794. function initArray(length, value) {
  25795. var tmp = [];
  25796. tmp[length - 1] = value;
  25797. return tmp.map(function (i) {
  25798. return value;
  25799. });
  25800. }
  25801. function ATNDeserializer(options) {
  25802. if (options === undefined || options === null) {
  25803. options = ATNDeserializationOptions.defaultOptions;
  25804. }
  25805. this.deserializationOptions = options;
  25806. this.stateFactories = null;
  25807. this.actionFactories = null;
  25808. return this;
  25809. }
  25810. // Determines if a particular serialized representation of an ATN supports
  25811. // a particular feature, identified by the {@link UUID} used for serializing
  25812. // the ATN at the time the feature was first introduced.
  25813. //
  25814. // @param feature The {@link UUID} marking the first time the feature was
  25815. // supported in the serialized ATN.
  25816. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  25817. // currently being deserialized.
  25818. // @return {@code true} if the {@code actualUuid} value represents a
  25819. // serialized ATN at or after the feature identified by {@code feature} was
  25820. // introduced; otherwise, {@code false}.
  25821. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  25822. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  25823. if (idx1 < 0) {
  25824. return false;
  25825. }
  25826. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  25827. return idx2 >= idx1;
  25828. };
  25829. ATNDeserializer.prototype.deserialize = function (data) {
  25830. this.reset(data);
  25831. this.checkVersion();
  25832. this.checkUUID();
  25833. var atn = this.readATN();
  25834. this.readStates(atn);
  25835. this.readRules(atn);
  25836. this.readModes(atn);
  25837. var sets = [];
  25838. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  25839. this.readSets(atn, sets, this.readInt.bind(this));
  25840. // Next, if the ATN was serialized with the Unicode SMP feature,
  25841. // deserialize sets with 32-bit arguments <= U+10FFFF.
  25842. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  25843. this.readSets(atn, sets, this.readInt32.bind(this));
  25844. }
  25845. this.readEdges(atn, sets);
  25846. this.readDecisions(atn);
  25847. this.readLexerActions(atn);
  25848. this.markPrecedenceDecisions(atn);
  25849. this.verifyATN(atn);
  25850. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  25851. this.generateRuleBypassTransitions(atn);
  25852. // re-verify after modification
  25853. this.verifyATN(atn);
  25854. }
  25855. return atn;
  25856. };
  25857. ATNDeserializer.prototype.reset = function (data) {
  25858. var adjust = function adjust(c) {
  25859. var v = c.charCodeAt(0);
  25860. return v > 1 ? v - 2 : v + 65533;
  25861. };
  25862. var temp = data.split("").map(adjust);
  25863. // don't adjust the first value since that's the version number
  25864. temp[0] = data.charCodeAt(0);
  25865. this.data = temp;
  25866. this.pos = 0;
  25867. };
  25868. ATNDeserializer.prototype.checkVersion = function () {
  25869. var version = this.readInt();
  25870. if (version !== SERIALIZED_VERSION) {
  25871. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  25872. }
  25873. };
  25874. ATNDeserializer.prototype.checkUUID = function () {
  25875. var uuid = this.readUUID();
  25876. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  25877. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  25878. }
  25879. this.uuid = uuid;
  25880. };
  25881. ATNDeserializer.prototype.readATN = function () {
  25882. var grammarType = this.readInt();
  25883. var maxTokenType = this.readInt();
  25884. return new ATN(grammarType, maxTokenType);
  25885. };
  25886. ATNDeserializer.prototype.readStates = function (atn) {
  25887. var j, pair, stateNumber;
  25888. var loopBackStateNumbers = [];
  25889. var endStateNumbers = [];
  25890. var nstates = this.readInt();
  25891. for (var i = 0; i < nstates; i++) {
  25892. var stype = this.readInt();
  25893. // ignore bad type of states
  25894. if (stype === ATNState.INVALID_TYPE) {
  25895. atn.addState(null);
  25896. continue;
  25897. }
  25898. var ruleIndex = this.readInt();
  25899. if (ruleIndex === 0xFFFF) {
  25900. ruleIndex = -1;
  25901. }
  25902. var s = this.stateFactory(stype, ruleIndex);
  25903. if (stype === ATNState.LOOP_END) {
  25904. // special case
  25905. var loopBackStateNumber = this.readInt();
  25906. loopBackStateNumbers.push([s, loopBackStateNumber]);
  25907. } else if (s instanceof BlockStartState) {
  25908. var endStateNumber = this.readInt();
  25909. endStateNumbers.push([s, endStateNumber]);
  25910. }
  25911. atn.addState(s);
  25912. }
  25913. // delay the assignment of loop back and end states until we know all the
  25914. // state instances have been initialized
  25915. for (j = 0; j < loopBackStateNumbers.length; j++) {
  25916. pair = loopBackStateNumbers[j];
  25917. pair[0].loopBackState = atn.states[pair[1]];
  25918. }
  25919. for (j = 0; j < endStateNumbers.length; j++) {
  25920. pair = endStateNumbers[j];
  25921. pair[0].endState = atn.states[pair[1]];
  25922. }
  25923. var numNonGreedyStates = this.readInt();
  25924. for (j = 0; j < numNonGreedyStates; j++) {
  25925. stateNumber = this.readInt();
  25926. atn.states[stateNumber].nonGreedy = true;
  25927. }
  25928. var numPrecedenceStates = this.readInt();
  25929. for (j = 0; j < numPrecedenceStates; j++) {
  25930. stateNumber = this.readInt();
  25931. atn.states[stateNumber].isPrecedenceRule = true;
  25932. }
  25933. };
  25934. ATNDeserializer.prototype.readRules = function (atn) {
  25935. var i;
  25936. var nrules = this.readInt();
  25937. if (atn.grammarType === ATNType.LEXER) {
  25938. atn.ruleToTokenType = initArray(nrules, 0);
  25939. }
  25940. atn.ruleToStartState = initArray(nrules, 0);
  25941. for (i = 0; i < nrules; i++) {
  25942. var s = this.readInt();
  25943. var startState = atn.states[s];
  25944. atn.ruleToStartState[i] = startState;
  25945. if (atn.grammarType === ATNType.LEXER) {
  25946. var tokenType = this.readInt();
  25947. if (tokenType === 0xFFFF) {
  25948. tokenType = Token.EOF;
  25949. }
  25950. atn.ruleToTokenType[i] = tokenType;
  25951. }
  25952. }
  25953. atn.ruleToStopState = initArray(nrules, 0);
  25954. for (i = 0; i < atn.states.length; i++) {
  25955. var state = atn.states[i];
  25956. if (!(state instanceof RuleStopState)) {
  25957. continue;
  25958. }
  25959. atn.ruleToStopState[state.ruleIndex] = state;
  25960. atn.ruleToStartState[state.ruleIndex].stopState = state;
  25961. }
  25962. };
  25963. ATNDeserializer.prototype.readModes = function (atn) {
  25964. var nmodes = this.readInt();
  25965. for (var i = 0; i < nmodes; i++) {
  25966. var s = this.readInt();
  25967. atn.modeToStartState.push(atn.states[s]);
  25968. }
  25969. };
  25970. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  25971. var m = this.readInt();
  25972. for (var i = 0; i < m; i++) {
  25973. var iset = new IntervalSet();
  25974. sets.push(iset);
  25975. var n = this.readInt();
  25976. var containsEof = this.readInt();
  25977. if (containsEof !== 0) {
  25978. iset.addOne(-1);
  25979. }
  25980. for (var j = 0; j < n; j++) {
  25981. var i1 = readUnicode();
  25982. var i2 = readUnicode();
  25983. iset.addRange(i1, i2);
  25984. }
  25985. }
  25986. };
  25987. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  25988. var i, j, state, trans, target;
  25989. var nedges = this.readInt();
  25990. for (i = 0; i < nedges; i++) {
  25991. var src = this.readInt();
  25992. var trg = this.readInt();
  25993. var ttype = this.readInt();
  25994. var arg1 = this.readInt();
  25995. var arg2 = this.readInt();
  25996. var arg3 = this.readInt();
  25997. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  25998. var srcState = atn.states[src];
  25999. srcState.addTransition(trans);
  26000. }
  26001. // edges for rule stop states can be derived, so they aren't serialized
  26002. for (i = 0; i < atn.states.length; i++) {
  26003. state = atn.states[i];
  26004. for (j = 0; j < state.transitions.length; j++) {
  26005. var t = state.transitions[j];
  26006. if (!(t instanceof RuleTransition)) {
  26007. continue;
  26008. }
  26009. var outermostPrecedenceReturn = -1;
  26010. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  26011. if (t.precedence === 0) {
  26012. outermostPrecedenceReturn = t.target.ruleIndex;
  26013. }
  26014. }
  26015. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  26016. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  26017. }
  26018. }
  26019. for (i = 0; i < atn.states.length; i++) {
  26020. state = atn.states[i];
  26021. if (state instanceof BlockStartState) {
  26022. // we need to know the end state to set its start state
  26023. if (state.endState === null) {
  26024. throw "IllegalState";
  26025. }
  26026. // block end states can only be associated to a single block start
  26027. // state
  26028. if (state.endState.startState !== null) {
  26029. throw "IllegalState";
  26030. }
  26031. state.endState.startState = state;
  26032. }
  26033. if (state instanceof PlusLoopbackState) {
  26034. for (j = 0; j < state.transitions.length; j++) {
  26035. target = state.transitions[j].target;
  26036. if (target instanceof PlusBlockStartState) {
  26037. target.loopBackState = state;
  26038. }
  26039. }
  26040. } else if (state instanceof StarLoopbackState) {
  26041. for (j = 0; j < state.transitions.length; j++) {
  26042. target = state.transitions[j].target;
  26043. if (target instanceof StarLoopEntryState) {
  26044. target.loopBackState = state;
  26045. }
  26046. }
  26047. }
  26048. }
  26049. };
  26050. ATNDeserializer.prototype.readDecisions = function (atn) {
  26051. var ndecisions = this.readInt();
  26052. for (var i = 0; i < ndecisions; i++) {
  26053. var s = this.readInt();
  26054. var decState = atn.states[s];
  26055. atn.decisionToState.push(decState);
  26056. decState.decision = i;
  26057. }
  26058. };
  26059. ATNDeserializer.prototype.readLexerActions = function (atn) {
  26060. if (atn.grammarType === ATNType.LEXER) {
  26061. var count = this.readInt();
  26062. atn.lexerActions = initArray(count, null);
  26063. for (var i = 0; i < count; i++) {
  26064. var actionType = this.readInt();
  26065. var data1 = this.readInt();
  26066. if (data1 === 0xFFFF) {
  26067. data1 = -1;
  26068. }
  26069. var data2 = this.readInt();
  26070. if (data2 === 0xFFFF) {
  26071. data2 = -1;
  26072. }
  26073. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  26074. atn.lexerActions[i] = lexerAction;
  26075. }
  26076. }
  26077. };
  26078. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  26079. var i;
  26080. var count = atn.ruleToStartState.length;
  26081. for (i = 0; i < count; i++) {
  26082. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  26083. }
  26084. for (i = 0; i < count; i++) {
  26085. this.generateRuleBypassTransition(atn, i);
  26086. }
  26087. };
  26088. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  26089. var i, state;
  26090. var bypassStart = new BasicBlockStartState();
  26091. bypassStart.ruleIndex = idx;
  26092. atn.addState(bypassStart);
  26093. var bypassStop = new BlockEndState();
  26094. bypassStop.ruleIndex = idx;
  26095. atn.addState(bypassStop);
  26096. bypassStart.endState = bypassStop;
  26097. atn.defineDecisionState(bypassStart);
  26098. bypassStop.startState = bypassStart;
  26099. var excludeTransition = null;
  26100. var endState = null;
  26101. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26102. // wrap from the beginning of the rule to the StarLoopEntryState
  26103. endState = null;
  26104. for (i = 0; i < atn.states.length; i++) {
  26105. state = atn.states[i];
  26106. if (this.stateIsEndStateFor(state, idx)) {
  26107. endState = state;
  26108. excludeTransition = state.loopBackState.transitions[0];
  26109. break;
  26110. }
  26111. }
  26112. if (excludeTransition === null) {
  26113. throw "Couldn't identify final state of the precedence rule prefix section.";
  26114. }
  26115. } else {
  26116. endState = atn.ruleToStopState[idx];
  26117. }
  26118. // all non-excluded transitions that currently target end state need to
  26119. // target blockEnd instead
  26120. for (i = 0; i < atn.states.length; i++) {
  26121. state = atn.states[i];
  26122. for (var j = 0; j < state.transitions.length; j++) {
  26123. var transition = state.transitions[j];
  26124. if (transition === excludeTransition) {
  26125. continue;
  26126. }
  26127. if (transition.target === endState) {
  26128. transition.target = bypassStop;
  26129. }
  26130. }
  26131. }
  26132. // all transitions leaving the rule start state need to leave blockStart
  26133. // instead
  26134. var ruleToStartState = atn.ruleToStartState[idx];
  26135. var count = ruleToStartState.transitions.length;
  26136. while (count > 0) {
  26137. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26138. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26139. }
  26140. // link the new states
  26141. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26142. bypassStop.addTransition(new EpsilonTransition(endState));
  26143. var matchState = new BasicState();
  26144. atn.addState(matchState);
  26145. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26146. bypassStart.addTransition(new EpsilonTransition(matchState));
  26147. };
  26148. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26149. if (state.ruleIndex !== idx) {
  26150. return null;
  26151. }
  26152. if (!(state instanceof StarLoopEntryState)) {
  26153. return null;
  26154. }
  26155. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26156. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26157. return null;
  26158. }
  26159. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26160. return state;
  26161. } else {
  26162. return null;
  26163. }
  26164. };
  26165. //
  26166. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26167. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26168. // correct value.
  26169. //
  26170. // @param atn The ATN.
  26171. //
  26172. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26173. for (var i = 0; i < atn.states.length; i++) {
  26174. var state = atn.states[i];
  26175. if (!(state instanceof StarLoopEntryState)) {
  26176. continue;
  26177. }
  26178. // We analyze the ATN to determine if this ATN decision state is the
  26179. // decision for the closure block that determines whether a
  26180. // precedence rule should continue or complete.
  26181. //
  26182. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26183. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26184. if (maybeLoopEndState instanceof LoopEndState) {
  26185. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26186. state.isPrecedenceDecision = true;
  26187. }
  26188. }
  26189. }
  26190. }
  26191. };
  26192. ATNDeserializer.prototype.verifyATN = function (atn) {
  26193. if (!this.deserializationOptions.verifyATN) {
  26194. return;
  26195. }
  26196. // verify assumptions
  26197. for (var i = 0; i < atn.states.length; i++) {
  26198. var state = atn.states[i];
  26199. if (state === null) {
  26200. continue;
  26201. }
  26202. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26203. if (state instanceof PlusBlockStartState) {
  26204. this.checkCondition(state.loopBackState !== null);
  26205. } else if (state instanceof StarLoopEntryState) {
  26206. this.checkCondition(state.loopBackState !== null);
  26207. this.checkCondition(state.transitions.length === 2);
  26208. if (state.transitions[0].target instanceof StarBlockStartState) {
  26209. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26210. this.checkCondition(!state.nonGreedy);
  26211. } else if (state.transitions[0].target instanceof LoopEndState) {
  26212. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26213. this.checkCondition(state.nonGreedy);
  26214. } else {
  26215. throw "IllegalState";
  26216. }
  26217. } else if (state instanceof StarLoopbackState) {
  26218. this.checkCondition(state.transitions.length === 1);
  26219. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26220. } else if (state instanceof LoopEndState) {
  26221. this.checkCondition(state.loopBackState !== null);
  26222. } else if (state instanceof RuleStartState) {
  26223. this.checkCondition(state.stopState !== null);
  26224. } else if (state instanceof BlockStartState) {
  26225. this.checkCondition(state.endState !== null);
  26226. } else if (state instanceof BlockEndState) {
  26227. this.checkCondition(state.startState !== null);
  26228. } else if (state instanceof DecisionState) {
  26229. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26230. } else {
  26231. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26232. }
  26233. }
  26234. };
  26235. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26236. if (!condition) {
  26237. if (message === undefined || message === null) {
  26238. message = "IllegalState";
  26239. }
  26240. throw message;
  26241. }
  26242. };
  26243. ATNDeserializer.prototype.readInt = function () {
  26244. return this.data[this.pos++];
  26245. };
  26246. ATNDeserializer.prototype.readInt32 = function () {
  26247. var low = this.readInt();
  26248. var high = this.readInt();
  26249. return low | high << 16;
  26250. };
  26251. ATNDeserializer.prototype.readLong = function () {
  26252. var low = this.readInt32();
  26253. var high = this.readInt32();
  26254. return low & 0x00000000FFFFFFFF | high << 32;
  26255. };
  26256. function createByteToHex() {
  26257. var bth = [];
  26258. for (var i = 0; i < 256; i++) {
  26259. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26260. }
  26261. return bth;
  26262. }
  26263. var byteToHex = createByteToHex();
  26264. ATNDeserializer.prototype.readUUID = function () {
  26265. var bb = [];
  26266. for (var i = 7; i >= 0; i--) {
  26267. var int = this.readInt();
  26268. /* jshint bitwise: false */
  26269. bb[2 * i + 1] = int & 0xFF;
  26270. bb[2 * i] = int >> 8 & 0xFF;
  26271. }
  26272. 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]];
  26273. };
  26274. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26275. var target = atn.states[trg];
  26276. switch (type) {
  26277. case Transition.EPSILON:
  26278. return new EpsilonTransition(target);
  26279. case Transition.RANGE:
  26280. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26281. case Transition.RULE:
  26282. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26283. case Transition.PREDICATE:
  26284. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26285. case Transition.PRECEDENCE:
  26286. return new PrecedencePredicateTransition(target, arg1);
  26287. case Transition.ATOM:
  26288. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26289. case Transition.ACTION:
  26290. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26291. case Transition.SET:
  26292. return new SetTransition(target, sets[arg1]);
  26293. case Transition.NOT_SET:
  26294. return new NotSetTransition(target, sets[arg1]);
  26295. case Transition.WILDCARD:
  26296. return new WildcardTransition(target);
  26297. default:
  26298. throw "The specified transition type: " + type + " is not valid.";
  26299. }
  26300. };
  26301. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26302. if (this.stateFactories === null) {
  26303. var sf = [];
  26304. sf[ATNState.INVALID_TYPE] = null;
  26305. sf[ATNState.BASIC] = function () {
  26306. return new BasicState();
  26307. };
  26308. sf[ATNState.RULE_START] = function () {
  26309. return new RuleStartState();
  26310. };
  26311. sf[ATNState.BLOCK_START] = function () {
  26312. return new BasicBlockStartState();
  26313. };
  26314. sf[ATNState.PLUS_BLOCK_START] = function () {
  26315. return new PlusBlockStartState();
  26316. };
  26317. sf[ATNState.STAR_BLOCK_START] = function () {
  26318. return new StarBlockStartState();
  26319. };
  26320. sf[ATNState.TOKEN_START] = function () {
  26321. return new TokensStartState();
  26322. };
  26323. sf[ATNState.RULE_STOP] = function () {
  26324. return new RuleStopState();
  26325. };
  26326. sf[ATNState.BLOCK_END] = function () {
  26327. return new BlockEndState();
  26328. };
  26329. sf[ATNState.STAR_LOOP_BACK] = function () {
  26330. return new StarLoopbackState();
  26331. };
  26332. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26333. return new StarLoopEntryState();
  26334. };
  26335. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26336. return new PlusLoopbackState();
  26337. };
  26338. sf[ATNState.LOOP_END] = function () {
  26339. return new LoopEndState();
  26340. };
  26341. this.stateFactories = sf;
  26342. }
  26343. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26344. throw "The specified state type " + type + " is not valid.";
  26345. } else {
  26346. var s = this.stateFactories[type]();
  26347. if (s !== null) {
  26348. s.ruleIndex = ruleIndex;
  26349. return s;
  26350. }
  26351. }
  26352. };
  26353. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26354. if (this.actionFactories === null) {
  26355. var af = [];
  26356. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26357. return new LexerChannelAction(data1);
  26358. };
  26359. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26360. return new LexerCustomAction(data1, data2);
  26361. };
  26362. af[LexerActionType.MODE] = function (data1, data2) {
  26363. return new LexerModeAction(data1);
  26364. };
  26365. af[LexerActionType.MORE] = function (data1, data2) {
  26366. return LexerMoreAction.INSTANCE;
  26367. };
  26368. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26369. return LexerPopModeAction.INSTANCE;
  26370. };
  26371. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26372. return new LexerPushModeAction(data1);
  26373. };
  26374. af[LexerActionType.SKIP] = function (data1, data2) {
  26375. return LexerSkipAction.INSTANCE;
  26376. };
  26377. af[LexerActionType.TYPE] = function (data1, data2) {
  26378. return new LexerTypeAction(data1);
  26379. };
  26380. this.actionFactories = af;
  26381. }
  26382. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26383. throw "The specified lexer action type " + type + " is not valid.";
  26384. } else {
  26385. return this.actionFactories[type](data1, data2);
  26386. }
  26387. };
  26388. exports.ATNDeserializer = ATNDeserializer;
  26389. /***/ }),
  26390. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26391. /*!*************************************************!*\
  26392. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26393. \*************************************************/
  26394. /*! no static exports found */
  26395. /***/ (function(module, exports, __webpack_require__) {
  26396. "use strict";
  26397. //
  26398. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26399. * Use of this file is governed by the BSD 3-clause license that
  26400. * can be found in the LICENSE.txt file in the project root.
  26401. */
  26402. ///
  26403. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26404. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26405. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26406. function ATNSimulator(atn, sharedContextCache) {
  26407. // The context cache maps all PredictionContext objects that are ==
  26408. // to a single cached copy. This cache is shared across all contexts
  26409. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26410. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26411. // fill this during closure() since there are lots of contexts that
  26412. // pop up but are not used ever again. It also greatly slows down closure().
  26413. //
  26414. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26415. // For the Java grammar on java.*, it dropped the memory requirements
  26416. // at the end from 25M to 16M. We don't store any of the full context
  26417. // graphs in the DFA because they are limited to local context only,
  26418. // but apparently there's a lot of repetition there as well. We optimize
  26419. // the config contexts before storing the config set in the DFA states
  26420. // by literally rebuilding them with cached subgraphs only.</p>
  26421. //
  26422. // <p>I tried a cache for use during closure operations, that was
  26423. // whacked after each adaptivePredict(). It cost a little bit
  26424. // more time I think and doesn't save on the overall footprint
  26425. // so it's not worth the complexity.</p>
  26426. ///
  26427. this.atn = atn;
  26428. this.sharedContextCache = sharedContextCache;
  26429. return this;
  26430. }
  26431. // Must distinguish between missing edge and edge we know leads nowhere///
  26432. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26433. ATNSimulator.prototype.getCachedContext = function (context) {
  26434. if (this.sharedContextCache === null) {
  26435. return context;
  26436. }
  26437. var visited = {};
  26438. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26439. };
  26440. exports.ATNSimulator = ATNSimulator;
  26441. /***/ }),
  26442. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26443. /*!*********************************************!*\
  26444. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26445. \*********************************************/
  26446. /*! no static exports found */
  26447. /***/ (function(module, exports, __webpack_require__) {
  26448. "use strict";
  26449. //
  26450. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26451. * Use of this file is governed by the BSD 3-clause license that
  26452. * can be found in the LICENSE.txt file in the project root.
  26453. */
  26454. //
  26455. // The following images show the relation of states and
  26456. // {@link ATNState//transitions} for various grammar constructs.
  26457. //
  26458. // <ul>
  26459. //
  26460. // <li>Solid edges marked with an &//0949; indicate a required
  26461. // {@link EpsilonTransition}.</li>
  26462. //
  26463. // <li>Dashed edges indicate locations where any transition derived from
  26464. // {@link Transition} might appear.</li>
  26465. //
  26466. // <li>Dashed nodes are place holders for either a sequence of linked
  26467. // {@link BasicState} states or the inclusion of a block representing a nested
  26468. // construct in one of the forms below.</li>
  26469. //
  26470. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26471. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26472. // support the exact number of alternatives shown in the diagram.</li>
  26473. //
  26474. // </ul>
  26475. //
  26476. // <h2>Basic Blocks</h2>
  26477. //
  26478. // <h3>Rule</h3>
  26479. //
  26480. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26481. //
  26482. // <h3>Block of 1 or more alternatives</h3>
  26483. //
  26484. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26485. //
  26486. // <h2>Greedy Loops</h2>
  26487. //
  26488. // <h3>Greedy Closure: {@code (...)*}</h3>
  26489. //
  26490. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26491. //
  26492. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26493. //
  26494. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26495. //
  26496. // <h3>Greedy Optional: {@code (...)?}</h3>
  26497. //
  26498. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26499. //
  26500. // <h2>Non-Greedy Loops</h2>
  26501. //
  26502. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  26503. //
  26504. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  26505. //
  26506. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  26507. //
  26508. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  26509. //
  26510. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  26511. //
  26512. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  26513. //
  26514. var INITIAL_NUM_TRANSITIONS = 4;
  26515. function ATNState() {
  26516. // Which ATN are we in?
  26517. this.atn = null;
  26518. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  26519. this.stateType = null;
  26520. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  26521. this.epsilonOnlyTransitions = false;
  26522. // Track the transitions emanating from this ATN state.
  26523. this.transitions = [];
  26524. // Used to cache lookahead during parsing, not used during construction
  26525. this.nextTokenWithinRule = null;
  26526. return this;
  26527. }
  26528. // constants for serialization
  26529. ATNState.INVALID_TYPE = 0;
  26530. ATNState.BASIC = 1;
  26531. ATNState.RULE_START = 2;
  26532. ATNState.BLOCK_START = 3;
  26533. ATNState.PLUS_BLOCK_START = 4;
  26534. ATNState.STAR_BLOCK_START = 5;
  26535. ATNState.TOKEN_START = 6;
  26536. ATNState.RULE_STOP = 7;
  26537. ATNState.BLOCK_END = 8;
  26538. ATNState.STAR_LOOP_BACK = 9;
  26539. ATNState.STAR_LOOP_ENTRY = 10;
  26540. ATNState.PLUS_LOOP_BACK = 11;
  26541. ATNState.LOOP_END = 12;
  26542. 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"];
  26543. ATNState.INVALID_STATE_NUMBER = -1;
  26544. ATNState.prototype.toString = function () {
  26545. return this.stateNumber;
  26546. };
  26547. ATNState.prototype.equals = function (other) {
  26548. if (other instanceof ATNState) {
  26549. return this.stateNumber === other.stateNumber;
  26550. } else {
  26551. return false;
  26552. }
  26553. };
  26554. ATNState.prototype.isNonGreedyExitState = function () {
  26555. return false;
  26556. };
  26557. ATNState.prototype.addTransition = function (trans, index) {
  26558. if (index === undefined) {
  26559. index = -1;
  26560. }
  26561. if (this.transitions.length === 0) {
  26562. this.epsilonOnlyTransitions = trans.isEpsilon;
  26563. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  26564. this.epsilonOnlyTransitions = false;
  26565. }
  26566. if (index === -1) {
  26567. this.transitions.push(trans);
  26568. } else {
  26569. this.transitions.splice(index, 1, trans);
  26570. }
  26571. };
  26572. function BasicState() {
  26573. ATNState.call(this);
  26574. this.stateType = ATNState.BASIC;
  26575. return this;
  26576. }
  26577. BasicState.prototype = Object.create(ATNState.prototype);
  26578. BasicState.prototype.constructor = BasicState;
  26579. function DecisionState() {
  26580. ATNState.call(this);
  26581. this.decision = -1;
  26582. this.nonGreedy = false;
  26583. return this;
  26584. }
  26585. DecisionState.prototype = Object.create(ATNState.prototype);
  26586. DecisionState.prototype.constructor = DecisionState;
  26587. // The start of a regular {@code (...)} block.
  26588. function BlockStartState() {
  26589. DecisionState.call(this);
  26590. this.endState = null;
  26591. return this;
  26592. }
  26593. BlockStartState.prototype = Object.create(DecisionState.prototype);
  26594. BlockStartState.prototype.constructor = BlockStartState;
  26595. function BasicBlockStartState() {
  26596. BlockStartState.call(this);
  26597. this.stateType = ATNState.BLOCK_START;
  26598. return this;
  26599. }
  26600. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26601. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  26602. // Terminal node of a simple {@code (a|b|c)} block.
  26603. function BlockEndState() {
  26604. ATNState.call(this);
  26605. this.stateType = ATNState.BLOCK_END;
  26606. this.startState = null;
  26607. return this;
  26608. }
  26609. BlockEndState.prototype = Object.create(ATNState.prototype);
  26610. BlockEndState.prototype.constructor = BlockEndState;
  26611. // The last node in the ATN for a rule, unless that rule is the start symbol.
  26612. // In that case, there is one transition to EOF. Later, we might encode
  26613. // references to all calls to this rule to compute FOLLOW sets for
  26614. // error handling.
  26615. //
  26616. function RuleStopState() {
  26617. ATNState.call(this);
  26618. this.stateType = ATNState.RULE_STOP;
  26619. return this;
  26620. }
  26621. RuleStopState.prototype = Object.create(ATNState.prototype);
  26622. RuleStopState.prototype.constructor = RuleStopState;
  26623. function RuleStartState() {
  26624. ATNState.call(this);
  26625. this.stateType = ATNState.RULE_START;
  26626. this.stopState = null;
  26627. this.isPrecedenceRule = false;
  26628. return this;
  26629. }
  26630. RuleStartState.prototype = Object.create(ATNState.prototype);
  26631. RuleStartState.prototype.constructor = RuleStartState;
  26632. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  26633. // one to the loop back to start of the block and one to exit.
  26634. //
  26635. function PlusLoopbackState() {
  26636. DecisionState.call(this);
  26637. this.stateType = ATNState.PLUS_LOOP_BACK;
  26638. return this;
  26639. }
  26640. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  26641. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  26642. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  26643. // we don't use for code generation; somebody might need it, so I'm defining
  26644. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  26645. // real decision-making note for {@code A+}.
  26646. //
  26647. function PlusBlockStartState() {
  26648. BlockStartState.call(this);
  26649. this.stateType = ATNState.PLUS_BLOCK_START;
  26650. this.loopBackState = null;
  26651. return this;
  26652. }
  26653. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26654. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  26655. // The block that begins a closure loop.
  26656. function StarBlockStartState() {
  26657. BlockStartState.call(this);
  26658. this.stateType = ATNState.STAR_BLOCK_START;
  26659. return this;
  26660. }
  26661. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26662. StarBlockStartState.prototype.constructor = StarBlockStartState;
  26663. function StarLoopbackState() {
  26664. ATNState.call(this);
  26665. this.stateType = ATNState.STAR_LOOP_BACK;
  26666. return this;
  26667. }
  26668. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  26669. StarLoopbackState.prototype.constructor = StarLoopbackState;
  26670. function StarLoopEntryState() {
  26671. DecisionState.call(this);
  26672. this.stateType = ATNState.STAR_LOOP_ENTRY;
  26673. this.loopBackState = null;
  26674. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  26675. this.isPrecedenceDecision = null;
  26676. return this;
  26677. }
  26678. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  26679. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  26680. // Mark the end of a * or + loop.
  26681. function LoopEndState() {
  26682. ATNState.call(this);
  26683. this.stateType = ATNState.LOOP_END;
  26684. this.loopBackState = null;
  26685. return this;
  26686. }
  26687. LoopEndState.prototype = Object.create(ATNState.prototype);
  26688. LoopEndState.prototype.constructor = LoopEndState;
  26689. // The Tokens rule start state linking to each lexer rule start state */
  26690. function TokensStartState() {
  26691. DecisionState.call(this);
  26692. this.stateType = ATNState.TOKEN_START;
  26693. return this;
  26694. }
  26695. TokensStartState.prototype = Object.create(DecisionState.prototype);
  26696. TokensStartState.prototype.constructor = TokensStartState;
  26697. exports.ATNState = ATNState;
  26698. exports.BasicState = BasicState;
  26699. exports.DecisionState = DecisionState;
  26700. exports.BlockStartState = BlockStartState;
  26701. exports.BlockEndState = BlockEndState;
  26702. exports.LoopEndState = LoopEndState;
  26703. exports.RuleStartState = RuleStartState;
  26704. exports.RuleStopState = RuleStopState;
  26705. exports.TokensStartState = TokensStartState;
  26706. exports.PlusLoopbackState = PlusLoopbackState;
  26707. exports.StarLoopbackState = StarLoopbackState;
  26708. exports.StarLoopEntryState = StarLoopEntryState;
  26709. exports.PlusBlockStartState = PlusBlockStartState;
  26710. exports.StarBlockStartState = StarBlockStartState;
  26711. exports.BasicBlockStartState = BasicBlockStartState;
  26712. /***/ }),
  26713. /***/ "./node_modules/antlr4/atn/ATNType.js":
  26714. /*!********************************************!*\
  26715. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  26716. \********************************************/
  26717. /*! no static exports found */
  26718. /***/ (function(module, exports, __webpack_require__) {
  26719. "use strict";
  26720. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26721. * Use of this file is governed by the BSD 3-clause license that
  26722. * can be found in the LICENSE.txt file in the project root.
  26723. */
  26724. ///
  26725. // Represents the type of recognizer an ATN applies to.
  26726. function ATNType() {}
  26727. ATNType.LEXER = 0;
  26728. ATNType.PARSER = 1;
  26729. exports.ATNType = ATNType;
  26730. /***/ }),
  26731. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  26732. /*!******************************************************!*\
  26733. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  26734. \******************************************************/
  26735. /*! no static exports found */
  26736. /***/ (function(module, exports, __webpack_require__) {
  26737. "use strict";
  26738. //
  26739. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26740. * Use of this file is governed by the BSD 3-clause license that
  26741. * can be found in the LICENSE.txt file in the project root.
  26742. */
  26743. ///
  26744. // When we hit an accept state in either the DFA or the ATN, we
  26745. // have to notify the character stream to start buffering characters
  26746. // via {@link IntStream//mark} and record the current state. The current sim state
  26747. // includes the current index into the input, the current line,
  26748. // and current character position in that line. Note that the Lexer is
  26749. // tracking the starting line and characterization of the token. These
  26750. // variables track the "state" of the simulator when it hits an accept state.
  26751. //
  26752. // <p>We track these variables separately for the DFA and ATN simulation
  26753. // because the DFA simulation often has to fail over to the ATN
  26754. // simulation. If the ATN simulation fails, we need the DFA to fall
  26755. // back to its previously accepted state, if any. If the ATN succeeds,
  26756. // then the ATN does the accept and the DFA simulator that invoked it
  26757. // can simply return the predicted token type.</p>
  26758. ///
  26759. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26760. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26761. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26762. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  26763. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26764. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26765. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  26766. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  26767. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  26768. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26769. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  26770. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  26771. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  26772. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  26773. function resetSimState(sim) {
  26774. sim.index = -1;
  26775. sim.line = 0;
  26776. sim.column = -1;
  26777. sim.dfaState = null;
  26778. }
  26779. function SimState() {
  26780. resetSimState(this);
  26781. return this;
  26782. }
  26783. SimState.prototype.reset = function () {
  26784. resetSimState(this);
  26785. };
  26786. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  26787. ATNSimulator.call(this, atn, sharedContextCache);
  26788. this.decisionToDFA = decisionToDFA;
  26789. this.recog = recog;
  26790. // The current token's starting index into the character stream.
  26791. // Shared across DFA to ATN simulation in case the ATN fails and the
  26792. // DFA did not have a previous accept state. In this case, we use the
  26793. // ATN-generated exception object.
  26794. this.startIndex = -1;
  26795. // line number 1..n within the input///
  26796. this.line = 1;
  26797. // The index of the character relative to the beginning of the line
  26798. // 0..n-1///
  26799. this.column = 0;
  26800. this.mode = Lexer.DEFAULT_MODE;
  26801. // Used during DFA/ATN exec to record the most recent accept configuration
  26802. // info
  26803. this.prevAccept = new SimState();
  26804. // done
  26805. return this;
  26806. }
  26807. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  26808. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  26809. LexerATNSimulator.debug = false;
  26810. LexerATNSimulator.dfa_debug = false;
  26811. LexerATNSimulator.MIN_DFA_EDGE = 0;
  26812. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  26813. LexerATNSimulator.match_calls = 0;
  26814. LexerATNSimulator.prototype.copyState = function (simulator) {
  26815. this.column = simulator.column;
  26816. this.line = simulator.line;
  26817. this.mode = simulator.mode;
  26818. this.startIndex = simulator.startIndex;
  26819. };
  26820. LexerATNSimulator.prototype.match = function (input, mode) {
  26821. this.match_calls += 1;
  26822. this.mode = mode;
  26823. var mark = input.mark();
  26824. try {
  26825. this.startIndex = input.index;
  26826. this.prevAccept.reset();
  26827. var dfa = this.decisionToDFA[mode];
  26828. if (dfa.s0 === null) {
  26829. return this.matchATN(input);
  26830. } else {
  26831. return this.execATN(input, dfa.s0);
  26832. }
  26833. } finally {
  26834. input.release(mark);
  26835. }
  26836. };
  26837. LexerATNSimulator.prototype.reset = function () {
  26838. this.prevAccept.reset();
  26839. this.startIndex = -1;
  26840. this.line = 1;
  26841. this.column = 0;
  26842. this.mode = Lexer.DEFAULT_MODE;
  26843. };
  26844. LexerATNSimulator.prototype.matchATN = function (input) {
  26845. var startState = this.atn.modeToStartState[this.mode];
  26846. if (LexerATNSimulator.debug) {
  26847. console.log("matchATN mode " + this.mode + " start: " + startState);
  26848. }
  26849. var old_mode = this.mode;
  26850. var s0_closure = this.computeStartState(input, startState);
  26851. var suppressEdge = s0_closure.hasSemanticContext;
  26852. s0_closure.hasSemanticContext = false;
  26853. var next = this.addDFAState(s0_closure);
  26854. if (!suppressEdge) {
  26855. this.decisionToDFA[this.mode].s0 = next;
  26856. }
  26857. var predict = this.execATN(input, next);
  26858. if (LexerATNSimulator.debug) {
  26859. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  26860. }
  26861. return predict;
  26862. };
  26863. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  26864. if (LexerATNSimulator.debug) {
  26865. console.log("start state closure=" + ds0.configs);
  26866. }
  26867. if (ds0.isAcceptState) {
  26868. // allow zero-length tokens
  26869. this.captureSimState(this.prevAccept, input, ds0);
  26870. }
  26871. var t = input.LA(1);
  26872. var s = ds0; // s is current/from DFA state
  26873. while (true) {
  26874. // while more work
  26875. if (LexerATNSimulator.debug) {
  26876. console.log("execATN loop starting closure: " + s.configs);
  26877. }
  26878. // As we move src->trg, src->trg, we keep track of the previous trg to
  26879. // avoid looking up the DFA state again, which is expensive.
  26880. // If the previous target was already part of the DFA, we might
  26881. // be able to avoid doing a reach operation upon t. If s!=null,
  26882. // it means that semantic predicates didn't prevent us from
  26883. // creating a DFA state. Once we know s!=null, we check to see if
  26884. // the DFA state has an edge already for t. If so, we can just reuse
  26885. // it's configuration set; there's no point in re-computing it.
  26886. // This is kind of like doing DFA simulation within the ATN
  26887. // simulation because DFA simulation is really just a way to avoid
  26888. // computing reach/closure sets. Technically, once we know that
  26889. // we have a previously added DFA state, we could jump over to
  26890. // the DFA simulator. But, that would mean popping back and forth
  26891. // a lot and making things more complicated algorithmically.
  26892. // This optimization makes a lot of sense for loops within DFA.
  26893. // A character will take us back to an existing DFA state
  26894. // that already has lots of edges out of it. e.g., .* in comments.
  26895. // print("Target for:" + str(s) + " and:" + str(t))
  26896. var target = this.getExistingTargetState(s, t);
  26897. // print("Existing:" + str(target))
  26898. if (target === null) {
  26899. target = this.computeTargetState(input, s, t);
  26900. // print("Computed:" + str(target))
  26901. }
  26902. if (target === ATNSimulator.ERROR) {
  26903. break;
  26904. }
  26905. // If this is a consumable input element, make sure to consume before
  26906. // capturing the accept state so the input index, line, and char
  26907. // position accurately reflect the state of the interpreter at the
  26908. // end of the token.
  26909. if (t !== Token.EOF) {
  26910. this.consume(input);
  26911. }
  26912. if (target.isAcceptState) {
  26913. this.captureSimState(this.prevAccept, input, target);
  26914. if (t === Token.EOF) {
  26915. break;
  26916. }
  26917. }
  26918. t = input.LA(1);
  26919. s = target; // flip; current DFA target becomes new src/from state
  26920. }
  26921. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  26922. };
  26923. // Get an existing target state for an edge in the DFA. If the target state
  26924. // for the edge has not yet been computed or is otherwise not available,
  26925. // this method returns {@code null}.
  26926. //
  26927. // @param s The current DFA state
  26928. // @param t The next input symbol
  26929. // @return The existing target DFA state for the given input symbol
  26930. // {@code t}, or {@code null} if the target state for this edge is not
  26931. // already cached
  26932. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  26933. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  26934. return null;
  26935. }
  26936. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  26937. if (target === undefined) {
  26938. target = null;
  26939. }
  26940. if (LexerATNSimulator.debug && target !== null) {
  26941. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  26942. }
  26943. return target;
  26944. };
  26945. // Compute a target state for an edge in the DFA, and attempt to add the
  26946. // computed state and corresponding edge to the DFA.
  26947. //
  26948. // @param input The input stream
  26949. // @param s The current DFA state
  26950. // @param t The next input symbol
  26951. //
  26952. // @return The computed target DFA state for the given input symbol
  26953. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  26954. // returns {@link //ERROR}.
  26955. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  26956. var reach = new OrderedATNConfigSet();
  26957. // if we don't find an existing DFA state
  26958. // Fill reach starting from closure, following t transitions
  26959. this.getReachableConfigSet(input, s.configs, reach, t);
  26960. if (reach.items.length === 0) {
  26961. // we got nowhere on t from s
  26962. if (!reach.hasSemanticContext) {
  26963. // we got nowhere on t, don't throw out this knowledge; it'd
  26964. // cause a failover from DFA later.
  26965. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  26966. }
  26967. // stop when we can't match any more char
  26968. return ATNSimulator.ERROR;
  26969. }
  26970. // Add an edge from s to target DFA found/created for reach
  26971. return this.addDFAEdge(s, t, null, reach);
  26972. };
  26973. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  26974. if (this.prevAccept.dfaState !== null) {
  26975. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  26976. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  26977. return prevAccept.dfaState.prediction;
  26978. } else {
  26979. // if no accept and EOF is first char, return EOF
  26980. if (t === Token.EOF && input.index === this.startIndex) {
  26981. return Token.EOF;
  26982. }
  26983. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  26984. }
  26985. };
  26986. // Given a starting configuration set, figure out all ATN configurations
  26987. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  26988. // parameter.
  26989. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  26990. // this is used to skip processing for configs which have a lower priority
  26991. // than a config that already reached an accept state for the same rule
  26992. var skipAlt = ATN.INVALID_ALT_NUMBER;
  26993. for (var i = 0; i < closure.items.length; i++) {
  26994. var cfg = closure.items[i];
  26995. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  26996. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  26997. continue;
  26998. }
  26999. if (LexerATNSimulator.debug) {
  27000. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  27001. }
  27002. for (var j = 0; j < cfg.state.transitions.length; j++) {
  27003. var trans = cfg.state.transitions[j]; // for each transition
  27004. var target = this.getReachableTarget(trans, t);
  27005. if (target !== null) {
  27006. var lexerActionExecutor = cfg.lexerActionExecutor;
  27007. if (lexerActionExecutor !== null) {
  27008. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  27009. }
  27010. var treatEofAsEpsilon = t === Token.EOF;
  27011. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  27012. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  27013. // any remaining configs for this alt have a lower priority
  27014. // than the one that just reached an accept state.
  27015. skipAlt = cfg.alt;
  27016. }
  27017. }
  27018. }
  27019. }
  27020. };
  27021. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  27022. if (LexerATNSimulator.debug) {
  27023. console.log("ACTION %s\n", lexerActionExecutor);
  27024. }
  27025. // seek to after last char in token
  27026. input.seek(index);
  27027. this.line = line;
  27028. this.column = charPos;
  27029. if (lexerActionExecutor !== null && this.recog !== null) {
  27030. lexerActionExecutor.execute(this.recog, input, startIndex);
  27031. }
  27032. };
  27033. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  27034. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  27035. return trans.target;
  27036. } else {
  27037. return null;
  27038. }
  27039. };
  27040. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  27041. var initialContext = PredictionContext.EMPTY;
  27042. var configs = new OrderedATNConfigSet();
  27043. for (var i = 0; i < p.transitions.length; i++) {
  27044. var target = p.transitions[i].target;
  27045. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  27046. this.closure(input, cfg, configs, false, false, false);
  27047. }
  27048. return configs;
  27049. };
  27050. // Since the alternatives within any lexer decision are ordered by
  27051. // preference, this method stops pursuing the closure as soon as an accept
  27052. // state is reached. After the first accept state is reached by depth-first
  27053. // search from {@code config}, all other (potentially reachable) states for
  27054. // this rule would have a lower priority.
  27055. //
  27056. // @return {@code true} if an accept state is reached, otherwise
  27057. // {@code false}.
  27058. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  27059. var cfg = null;
  27060. if (LexerATNSimulator.debug) {
  27061. console.log("closure(" + config.toString(this.recog, true) + ")");
  27062. }
  27063. if (config.state instanceof RuleStopState) {
  27064. if (LexerATNSimulator.debug) {
  27065. if (this.recog !== null) {
  27066. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  27067. } else {
  27068. console.log("closure at rule stop %s\n", config);
  27069. }
  27070. }
  27071. if (config.context === null || config.context.hasEmptyPath()) {
  27072. if (config.context === null || config.context.isEmpty()) {
  27073. configs.add(config);
  27074. return true;
  27075. } else {
  27076. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  27077. currentAltReachedAcceptState = true;
  27078. }
  27079. }
  27080. if (config.context !== null && !config.context.isEmpty()) {
  27081. for (var i = 0; i < config.context.length; i++) {
  27082. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  27083. var newContext = config.context.getParent(i); // "pop" return state
  27084. var returnState = this.atn.states[config.context.getReturnState(i)];
  27085. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  27086. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27087. }
  27088. }
  27089. }
  27090. return currentAltReachedAcceptState;
  27091. }
  27092. // optimization
  27093. if (!config.state.epsilonOnlyTransitions) {
  27094. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27095. configs.add(config);
  27096. }
  27097. }
  27098. for (var j = 0; j < config.state.transitions.length; j++) {
  27099. var trans = config.state.transitions[j];
  27100. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27101. if (cfg !== null) {
  27102. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27103. }
  27104. }
  27105. return currentAltReachedAcceptState;
  27106. };
  27107. // side-effect: can alter configs.hasSemanticContext
  27108. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27109. var cfg = null;
  27110. if (trans.serializationType === Transition.RULE) {
  27111. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27112. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27113. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27114. throw "Precedence predicates are not supported in lexers.";
  27115. } else if (trans.serializationType === Transition.PREDICATE) {
  27116. // Track traversing semantic predicates. If we traverse,
  27117. // we cannot add a DFA state for this "reach" computation
  27118. // because the DFA would not test the predicate again in the
  27119. // future. Rather than creating collections of semantic predicates
  27120. // like v3 and testing them on prediction, v4 will test them on the
  27121. // fly all the time using the ATN not the DFA. This is slower but
  27122. // semantically it's not used that often. One of the key elements to
  27123. // this predicate mechanism is not adding DFA states that see
  27124. // predicates immediately afterwards in the ATN. For example,
  27125. // a : ID {p1}? | ID {p2}? ;
  27126. // should create the start state for rule 'a' (to save start state
  27127. // competition), but should not create target of ID state. The
  27128. // collection of ATN states the following ID references includes
  27129. // states reached by traversing predicates. Since this is when we
  27130. // test them, we cannot cash the DFA state target of ID.
  27131. if (LexerATNSimulator.debug) {
  27132. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27133. }
  27134. configs.hasSemanticContext = true;
  27135. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27136. cfg = new LexerATNConfig({ state: trans.target }, config);
  27137. }
  27138. } else if (trans.serializationType === Transition.ACTION) {
  27139. if (config.context === null || config.context.hasEmptyPath()) {
  27140. // execute actions anywhere in the start rule for a token.
  27141. //
  27142. // TODO: if the entry rule is invoked recursively, some
  27143. // actions may be executed during the recursive call. The
  27144. // problem can appear when hasEmptyPath() is true but
  27145. // isEmpty() is false. In this case, the config needs to be
  27146. // split into two contexts - one with just the empty path
  27147. // and another with everything but the empty path.
  27148. // Unfortunately, the current algorithm does not allow
  27149. // getEpsilonTarget to return two configurations, so
  27150. // additional modifications are needed before we can support
  27151. // the split operation.
  27152. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27153. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27154. } else {
  27155. // ignore actions in referenced rules
  27156. cfg = new LexerATNConfig({ state: trans.target }, config);
  27157. }
  27158. } else if (trans.serializationType === Transition.EPSILON) {
  27159. cfg = new LexerATNConfig({ state: trans.target }, config);
  27160. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27161. if (treatEofAsEpsilon) {
  27162. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27163. cfg = new LexerATNConfig({ state: trans.target }, config);
  27164. }
  27165. }
  27166. }
  27167. return cfg;
  27168. };
  27169. // Evaluate a predicate specified in the lexer.
  27170. //
  27171. // <p>If {@code speculative} is {@code true}, this method was called before
  27172. // {@link //consume} for the matched character. This method should call
  27173. // {@link //consume} before evaluating the predicate to ensure position
  27174. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27175. // and {@link Lexer//getcolumn}, properly reflect the current
  27176. // lexer state. This method should restore {@code input} and the simulator
  27177. // to the original state before returning (i.e. undo the actions made by the
  27178. // call to {@link //consume}.</p>
  27179. //
  27180. // @param input The input stream.
  27181. // @param ruleIndex The rule containing the predicate.
  27182. // @param predIndex The index of the predicate within the rule.
  27183. // @param speculative {@code true} if the current index in {@code input} is
  27184. // one character before the predicate's location.
  27185. //
  27186. // @return {@code true} if the specified predicate evaluates to
  27187. // {@code true}.
  27188. // /
  27189. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27190. // assume true if no recognizer was provided
  27191. if (this.recog === null) {
  27192. return true;
  27193. }
  27194. if (!speculative) {
  27195. return this.recog.sempred(null, ruleIndex, predIndex);
  27196. }
  27197. var savedcolumn = this.column;
  27198. var savedLine = this.line;
  27199. var index = input.index;
  27200. var marker = input.mark();
  27201. try {
  27202. this.consume(input);
  27203. return this.recog.sempred(null, ruleIndex, predIndex);
  27204. } finally {
  27205. this.column = savedcolumn;
  27206. this.line = savedLine;
  27207. input.seek(index);
  27208. input.release(marker);
  27209. }
  27210. };
  27211. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27212. settings.index = input.index;
  27213. settings.line = this.line;
  27214. settings.column = this.column;
  27215. settings.dfaState = dfaState;
  27216. };
  27217. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27218. if (to === undefined) {
  27219. to = null;
  27220. }
  27221. if (cfgs === undefined) {
  27222. cfgs = null;
  27223. }
  27224. if (to === null && cfgs !== null) {
  27225. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27226. // marker indicating dynamic predicate evaluation makes this edge
  27227. // dependent on the specific input sequence, so the static edge in the
  27228. // DFA should be omitted. The target DFAState is still created since
  27229. // execATN has the ability to resynchronize with the DFA state cache
  27230. // following the predicate evaluation step.
  27231. //
  27232. // TJP notes: next time through the DFA, we see a pred again and eval.
  27233. // If that gets us to a previously created (but dangling) DFA
  27234. // state, we can continue in pure DFA mode from there.
  27235. // /
  27236. var suppressEdge = cfgs.hasSemanticContext;
  27237. cfgs.hasSemanticContext = false;
  27238. to = this.addDFAState(cfgs);
  27239. if (suppressEdge) {
  27240. return to;
  27241. }
  27242. }
  27243. // add the edge
  27244. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27245. // Only track edges within the DFA bounds
  27246. return to;
  27247. }
  27248. if (LexerATNSimulator.debug) {
  27249. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27250. }
  27251. if (from_.edges === null) {
  27252. // make room for tokens 1..n and -1 masquerading as index 0
  27253. from_.edges = [];
  27254. }
  27255. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27256. return to;
  27257. };
  27258. // Add a new DFA state if there isn't one with this set of
  27259. // configurations already. This method also detects the first
  27260. // configuration containing an ATN rule stop state. Later, when
  27261. // traversing the DFA, we will know which rule to accept.
  27262. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27263. var proposed = new DFAState(null, configs);
  27264. var firstConfigWithRuleStopState = null;
  27265. for (var i = 0; i < configs.items.length; i++) {
  27266. var cfg = configs.items[i];
  27267. if (cfg.state instanceof RuleStopState) {
  27268. firstConfigWithRuleStopState = cfg;
  27269. break;
  27270. }
  27271. }
  27272. if (firstConfigWithRuleStopState !== null) {
  27273. proposed.isAcceptState = true;
  27274. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27275. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27276. }
  27277. var dfa = this.decisionToDFA[this.mode];
  27278. var existing = dfa.states.get(proposed);
  27279. if (existing !== null) {
  27280. return existing;
  27281. }
  27282. var newState = proposed;
  27283. newState.stateNumber = dfa.states.length;
  27284. configs.setReadonly(true);
  27285. newState.configs = configs;
  27286. dfa.states.add(newState);
  27287. return newState;
  27288. };
  27289. LexerATNSimulator.prototype.getDFA = function (mode) {
  27290. return this.decisionToDFA[mode];
  27291. };
  27292. // Get the text matched so far for the current token.
  27293. LexerATNSimulator.prototype.getText = function (input) {
  27294. // index is first lookahead char, don't include.
  27295. return input.getText(this.startIndex, input.index - 1);
  27296. };
  27297. LexerATNSimulator.prototype.consume = function (input) {
  27298. var curChar = input.LA(1);
  27299. if (curChar === "\n".charCodeAt(0)) {
  27300. this.line += 1;
  27301. this.column = 0;
  27302. } else {
  27303. this.column += 1;
  27304. }
  27305. input.consume();
  27306. };
  27307. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27308. if (tt === -1) {
  27309. return "EOF";
  27310. } else {
  27311. return "'" + String.fromCharCode(tt) + "'";
  27312. }
  27313. };
  27314. exports.LexerATNSimulator = LexerATNSimulator;
  27315. /***/ }),
  27316. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27317. /*!************************************************!*\
  27318. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27319. \************************************************/
  27320. /*! no static exports found */
  27321. /***/ (function(module, exports, __webpack_require__) {
  27322. "use strict";
  27323. //
  27324. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27325. * Use of this file is governed by the BSD 3-clause license that
  27326. * can be found in the LICENSE.txt file in the project root.
  27327. */
  27328. //
  27329. function LexerActionType() {}
  27330. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27331. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27332. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27333. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27334. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27335. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27336. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27337. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27338. function LexerAction(action) {
  27339. this.actionType = action;
  27340. this.isPositionDependent = false;
  27341. return this;
  27342. }
  27343. LexerAction.prototype.hashCode = function () {
  27344. var hash = new Hash();
  27345. this.updateHashCode(hash);
  27346. return hash.finish();
  27347. };
  27348. LexerAction.prototype.updateHashCode = function (hash) {
  27349. hash.update(this.actionType);
  27350. };
  27351. LexerAction.prototype.equals = function (other) {
  27352. return this === other;
  27353. };
  27354. //
  27355. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27356. //
  27357. // <p>The {@code skip} command does not have any parameters, so this action is
  27358. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27359. function LexerSkipAction() {
  27360. LexerAction.call(this, LexerActionType.SKIP);
  27361. return this;
  27362. }
  27363. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27364. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27365. // Provides a singleton instance of this parameterless lexer action.
  27366. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27367. LexerSkipAction.prototype.execute = function (lexer) {
  27368. lexer.skip();
  27369. };
  27370. LexerSkipAction.prototype.toString = function () {
  27371. return "skip";
  27372. };
  27373. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27374. // with the assigned type.
  27375. function LexerTypeAction(type) {
  27376. LexerAction.call(this, LexerActionType.TYPE);
  27377. this.type = type;
  27378. return this;
  27379. }
  27380. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27381. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27382. LexerTypeAction.prototype.execute = function (lexer) {
  27383. lexer.type = this.type;
  27384. };
  27385. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27386. hash.update(this.actionType, this.type);
  27387. };
  27388. LexerTypeAction.prototype.equals = function (other) {
  27389. if (this === other) {
  27390. return true;
  27391. } else if (!(other instanceof LexerTypeAction)) {
  27392. return false;
  27393. } else {
  27394. return this.type === other.type;
  27395. }
  27396. };
  27397. LexerTypeAction.prototype.toString = function () {
  27398. return "type(" + this.type + ")";
  27399. };
  27400. // Implements the {@code pushMode} lexer action by calling
  27401. // {@link Lexer//pushMode} with the assigned mode.
  27402. function LexerPushModeAction(mode) {
  27403. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27404. this.mode = mode;
  27405. return this;
  27406. }
  27407. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27408. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27409. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27410. // value provided by {@link //getMode}.</p>
  27411. LexerPushModeAction.prototype.execute = function (lexer) {
  27412. lexer.pushMode(this.mode);
  27413. };
  27414. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27415. hash.update(this.actionType, this.mode);
  27416. };
  27417. LexerPushModeAction.prototype.equals = function (other) {
  27418. if (this === other) {
  27419. return true;
  27420. } else if (!(other instanceof LexerPushModeAction)) {
  27421. return false;
  27422. } else {
  27423. return this.mode === other.mode;
  27424. }
  27425. };
  27426. LexerPushModeAction.prototype.toString = function () {
  27427. return "pushMode(" + this.mode + ")";
  27428. };
  27429. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27430. //
  27431. // <p>The {@code popMode} command does not have any parameters, so this action is
  27432. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27433. function LexerPopModeAction() {
  27434. LexerAction.call(this, LexerActionType.POP_MODE);
  27435. return this;
  27436. }
  27437. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27438. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27439. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27440. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27441. LexerPopModeAction.prototype.execute = function (lexer) {
  27442. lexer.popMode();
  27443. };
  27444. LexerPopModeAction.prototype.toString = function () {
  27445. return "popMode";
  27446. };
  27447. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27448. //
  27449. // <p>The {@code more} command does not have any parameters, so this action is
  27450. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27451. function LexerMoreAction() {
  27452. LexerAction.call(this, LexerActionType.MORE);
  27453. return this;
  27454. }
  27455. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27456. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27457. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27458. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27459. LexerMoreAction.prototype.execute = function (lexer) {
  27460. lexer.more();
  27461. };
  27462. LexerMoreAction.prototype.toString = function () {
  27463. return "more";
  27464. };
  27465. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27466. // the assigned mode.
  27467. function LexerModeAction(mode) {
  27468. LexerAction.call(this, LexerActionType.MODE);
  27469. this.mode = mode;
  27470. return this;
  27471. }
  27472. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27473. LexerModeAction.prototype.constructor = LexerModeAction;
  27474. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27475. // value provided by {@link //getMode}.</p>
  27476. LexerModeAction.prototype.execute = function (lexer) {
  27477. lexer.mode(this.mode);
  27478. };
  27479. LexerModeAction.prototype.updateHashCode = function (hash) {
  27480. hash.update(this.actionType, this.mode);
  27481. };
  27482. LexerModeAction.prototype.equals = function (other) {
  27483. if (this === other) {
  27484. return true;
  27485. } else if (!(other instanceof LexerModeAction)) {
  27486. return false;
  27487. } else {
  27488. return this.mode === other.mode;
  27489. }
  27490. };
  27491. LexerModeAction.prototype.toString = function () {
  27492. return "mode(" + this.mode + ")";
  27493. };
  27494. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27495. // rule and action indexes assigned to the custom action. The implementation of
  27496. // a custom action is added to the generated code for the lexer in an override
  27497. // of {@link Recognizer//action} when the grammar is compiled.
  27498. //
  27499. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27500. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27501. // command argument could not be evaluated when the grammar was compiled.</p>
  27502. // Constructs a custom lexer action with the specified rule and action
  27503. // indexes.
  27504. //
  27505. // @param ruleIndex The rule index to use for calls to
  27506. // {@link Recognizer//action}.
  27507. // @param actionIndex The action index to use for calls to
  27508. // {@link Recognizer//action}.
  27509. function LexerCustomAction(ruleIndex, actionIndex) {
  27510. LexerAction.call(this, LexerActionType.CUSTOM);
  27511. this.ruleIndex = ruleIndex;
  27512. this.actionIndex = actionIndex;
  27513. this.isPositionDependent = true;
  27514. return this;
  27515. }
  27516. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  27517. LexerCustomAction.prototype.constructor = LexerCustomAction;
  27518. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  27519. // appropriate rule and action indexes.</p>
  27520. LexerCustomAction.prototype.execute = function (lexer) {
  27521. lexer.action(null, this.ruleIndex, this.actionIndex);
  27522. };
  27523. LexerCustomAction.prototype.updateHashCode = function (hash) {
  27524. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  27525. };
  27526. LexerCustomAction.prototype.equals = function (other) {
  27527. if (this === other) {
  27528. return true;
  27529. } else if (!(other instanceof LexerCustomAction)) {
  27530. return false;
  27531. } else {
  27532. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  27533. }
  27534. };
  27535. // Implements the {@code channel} lexer action by calling
  27536. // {@link Lexer//setChannel} with the assigned channel.
  27537. // Constructs a new {@code channel} action with the specified channel value.
  27538. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  27539. function LexerChannelAction(channel) {
  27540. LexerAction.call(this, LexerActionType.CHANNEL);
  27541. this.channel = channel;
  27542. return this;
  27543. }
  27544. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  27545. LexerChannelAction.prototype.constructor = LexerChannelAction;
  27546. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  27547. // value provided by {@link //getChannel}.</p>
  27548. LexerChannelAction.prototype.execute = function (lexer) {
  27549. lexer._channel = this.channel;
  27550. };
  27551. LexerChannelAction.prototype.updateHashCode = function (hash) {
  27552. hash.update(this.actionType, this.channel);
  27553. };
  27554. LexerChannelAction.prototype.equals = function (other) {
  27555. if (this === other) {
  27556. return true;
  27557. } else if (!(other instanceof LexerChannelAction)) {
  27558. return false;
  27559. } else {
  27560. return this.channel === other.channel;
  27561. }
  27562. };
  27563. LexerChannelAction.prototype.toString = function () {
  27564. return "channel(" + this.channel + ")";
  27565. };
  27566. // This implementation of {@link LexerAction} is used for tracking input offsets
  27567. // for position-dependent actions within a {@link LexerActionExecutor}.
  27568. //
  27569. // <p>This action is not serialized as part of the ATN, and is only required for
  27570. // position-dependent lexer actions which appear at a location other than the
  27571. // end of a rule. For more information about DFA optimizations employed for
  27572. // lexer actions, see {@link LexerActionExecutor//append} and
  27573. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  27574. // Constructs a new indexed custom action by associating a character offset
  27575. // with a {@link LexerAction}.
  27576. //
  27577. // <p>Note: This class is only required for lexer actions for which
  27578. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  27579. //
  27580. // @param offset The offset into the input {@link CharStream}, relative to
  27581. // the token start index, at which the specified lexer action should be
  27582. // executed.
  27583. // @param action The lexer action to execute at a particular offset in the
  27584. // input {@link CharStream}.
  27585. function LexerIndexedCustomAction(offset, action) {
  27586. LexerAction.call(this, action.actionType);
  27587. this.offset = offset;
  27588. this.action = action;
  27589. this.isPositionDependent = true;
  27590. return this;
  27591. }
  27592. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  27593. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  27594. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  27595. // using the provided {@code lexer}.</p>
  27596. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  27597. // assume the input stream position was properly set by the calling code
  27598. this.action.execute(lexer);
  27599. };
  27600. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  27601. hash.update(this.actionType, this.offset, this.action);
  27602. };
  27603. LexerIndexedCustomAction.prototype.equals = function (other) {
  27604. if (this === other) {
  27605. return true;
  27606. } else if (!(other instanceof LexerIndexedCustomAction)) {
  27607. return false;
  27608. } else {
  27609. return this.offset === other.offset && this.action === other.action;
  27610. }
  27611. };
  27612. exports.LexerActionType = LexerActionType;
  27613. exports.LexerSkipAction = LexerSkipAction;
  27614. exports.LexerChannelAction = LexerChannelAction;
  27615. exports.LexerCustomAction = LexerCustomAction;
  27616. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  27617. exports.LexerMoreAction = LexerMoreAction;
  27618. exports.LexerTypeAction = LexerTypeAction;
  27619. exports.LexerPushModeAction = LexerPushModeAction;
  27620. exports.LexerPopModeAction = LexerPopModeAction;
  27621. exports.LexerModeAction = LexerModeAction;
  27622. /***/ }),
  27623. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  27624. /*!********************************************************!*\
  27625. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  27626. \********************************************************/
  27627. /*! no static exports found */
  27628. /***/ (function(module, exports, __webpack_require__) {
  27629. "use strict";
  27630. //
  27631. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27632. * Use of this file is governed by the BSD 3-clause license that
  27633. * can be found in the LICENSE.txt file in the project root.
  27634. */
  27635. ///
  27636. // Represents an executor for a sequence of lexer actions which traversed during
  27637. // the matching operation of a lexer rule (token).
  27638. //
  27639. // <p>The executor tracks position information for position-dependent lexer actions
  27640. // efficiently, ensuring that actions appearing only at the end of the rule do
  27641. // not cause bloating of the {@link DFA} created for the lexer.</p>
  27642. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27643. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  27644. function LexerActionExecutor(lexerActions) {
  27645. this.lexerActions = lexerActions === null ? [] : lexerActions;
  27646. // Caches the result of {@link //hashCode} since the hash code is an element
  27647. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  27648. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  27649. // lexerActions]))
  27650. return this;
  27651. }
  27652. // Creates a {@link LexerActionExecutor} which executes the actions for
  27653. // the input {@code lexerActionExecutor} followed by a specified
  27654. // {@code lexerAction}.
  27655. //
  27656. // @param lexerActionExecutor The executor for actions already traversed by
  27657. // the lexer while matching a token within a particular
  27658. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  27659. // though it were an empty executor.
  27660. // @param lexerAction The lexer action to execute after the actions
  27661. // specified in {@code lexerActionExecutor}.
  27662. //
  27663. // @return A {@link LexerActionExecutor} for executing the combine actions
  27664. // of {@code lexerActionExecutor} and {@code lexerAction}.
  27665. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  27666. if (lexerActionExecutor === null) {
  27667. return new LexerActionExecutor([lexerAction]);
  27668. }
  27669. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  27670. return new LexerActionExecutor(lexerActions);
  27671. };
  27672. // Creates a {@link LexerActionExecutor} which encodes the current offset
  27673. // for position-dependent lexer actions.
  27674. //
  27675. // <p>Normally, when the executor encounters lexer actions where
  27676. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  27677. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  27678. // position to the <em>end</em> of the current token. This behavior provides
  27679. // for efficient DFA representation of lexer actions which appear at the end
  27680. // of a lexer rule, even when the lexer rule matches a variable number of
  27681. // characters.</p>
  27682. //
  27683. // <p>Prior to traversing a match transition in the ATN, the current offset
  27684. // from the token start index is assigned to all position-dependent lexer
  27685. // actions which have not already been assigned a fixed offset. By storing
  27686. // the offsets relative to the token start index, the DFA representation of
  27687. // lexer actions which appear in the middle of tokens remains efficient due
  27688. // to sharing among tokens of the same length, regardless of their absolute
  27689. // position in the input stream.</p>
  27690. //
  27691. // <p>If the current executor already has offsets assigned to all
  27692. // position-dependent lexer actions, the method returns {@code this}.</p>
  27693. //
  27694. // @param offset The current offset to assign to all position-dependent
  27695. // lexer actions which do not already have offsets assigned.
  27696. //
  27697. // @return A {@link LexerActionExecutor} which stores input stream offsets
  27698. // for all position-dependent lexer actions.
  27699. // /
  27700. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  27701. var updatedLexerActions = null;
  27702. for (var i = 0; i < this.lexerActions.length; i++) {
  27703. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  27704. if (updatedLexerActions === null) {
  27705. updatedLexerActions = this.lexerActions.concat([]);
  27706. }
  27707. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  27708. }
  27709. }
  27710. if (updatedLexerActions === null) {
  27711. return this;
  27712. } else {
  27713. return new LexerActionExecutor(updatedLexerActions);
  27714. }
  27715. };
  27716. // Execute the actions encapsulated by this executor within the context of a
  27717. // particular {@link Lexer}.
  27718. //
  27719. // <p>This method calls {@link IntStream//seek} to set the position of the
  27720. // {@code input} {@link CharStream} prior to calling
  27721. // {@link LexerAction//execute} on a position-dependent action. Before the
  27722. // method returns, the input position will be restored to the same position
  27723. // it was in when the method was invoked.</p>
  27724. //
  27725. // @param lexer The lexer instance.
  27726. // @param input The input stream which is the source for the current token.
  27727. // When this method is called, the current {@link IntStream//index} for
  27728. // {@code input} should be the start of the following token, i.e. 1
  27729. // character past the end of the current token.
  27730. // @param startIndex The token start index. This value may be passed to
  27731. // {@link IntStream//seek} to set the {@code input} position to the beginning
  27732. // of the token.
  27733. // /
  27734. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  27735. var requiresSeek = false;
  27736. var stopIndex = input.index;
  27737. try {
  27738. for (var i = 0; i < this.lexerActions.length; i++) {
  27739. var lexerAction = this.lexerActions[i];
  27740. if (lexerAction instanceof LexerIndexedCustomAction) {
  27741. var offset = lexerAction.offset;
  27742. input.seek(startIndex + offset);
  27743. lexerAction = lexerAction.action;
  27744. requiresSeek = startIndex + offset !== stopIndex;
  27745. } else if (lexerAction.isPositionDependent) {
  27746. input.seek(stopIndex);
  27747. requiresSeek = false;
  27748. }
  27749. lexerAction.execute(lexer);
  27750. }
  27751. } finally {
  27752. if (requiresSeek) {
  27753. input.seek(stopIndex);
  27754. }
  27755. }
  27756. };
  27757. LexerActionExecutor.prototype.hashCode = function () {
  27758. return this.cachedHashCode;
  27759. };
  27760. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  27761. hash.update(this.cachedHashCode);
  27762. };
  27763. LexerActionExecutor.prototype.equals = function (other) {
  27764. if (this === other) {
  27765. return true;
  27766. } else if (!(other instanceof LexerActionExecutor)) {
  27767. return false;
  27768. } else if (this.cachedHashCode != other.cachedHashCode) {
  27769. return false;
  27770. } else if (this.lexerActions.length != other.lexerActions.length) {
  27771. return false;
  27772. } else {
  27773. var numActions = this.lexerActions.length;
  27774. for (var idx = 0; idx < numActions; ++idx) {
  27775. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  27776. return false;
  27777. }
  27778. }
  27779. return true;
  27780. }
  27781. };
  27782. exports.LexerActionExecutor = LexerActionExecutor;
  27783. /***/ }),
  27784. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  27785. /*!*******************************************************!*\
  27786. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  27787. \*******************************************************/
  27788. /*! no static exports found */
  27789. /***/ (function(module, exports, __webpack_require__) {
  27790. "use strict";
  27791. //
  27792. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27793. * Use of this file is governed by the BSD 3-clause license that
  27794. * can be found in the LICENSE.txt file in the project root.
  27795. */
  27796. //
  27797. //
  27798. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  27799. //
  27800. // <p>
  27801. // The basic complexity of the adaptive strategy makes it harder to understand.
  27802. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  27803. // requests go through the DFA first. If they reach a state without an edge for
  27804. // the current symbol, the algorithm fails over to the ATN simulation to
  27805. // complete the DFA path for the current input (until it finds a conflict state
  27806. // or uniquely predicting state).</p>
  27807. //
  27808. // <p>
  27809. // All of that is done without using the outer context because we want to create
  27810. // a DFA that is not dependent upon the rule invocation stack when we do a
  27811. // prediction. One DFA works in all contexts. We avoid using context not
  27812. // necessarily because it's slower, although it can be, but because of the DFA
  27813. // caching problem. The closure routine only considers the rule invocation stack
  27814. // created during prediction beginning in the decision rule. For example, if
  27815. // prediction occurs without invoking another rule's ATN, there are no context
  27816. // stacks in the configurations. When lack of context leads to a conflict, we
  27817. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  27818. // strategy (versus full LL(*)).</p>
  27819. //
  27820. // <p>
  27821. // When SLL yields a configuration set with conflict, we rewind the input and
  27822. // retry the ATN simulation, this time using full outer context without adding
  27823. // to the DFA. Configuration context stacks will be the full invocation stacks
  27824. // from the start rule. If we get a conflict using full context, then we can
  27825. // definitively say we have a true ambiguity for that input sequence. If we
  27826. // don't get a conflict, it implies that the decision is sensitive to the outer
  27827. // context. (It is not context-sensitive in the sense of context-sensitive
  27828. // grammars.)</p>
  27829. //
  27830. // <p>
  27831. // The next time we reach this DFA state with an SLL conflict, through DFA
  27832. // simulation, we will again retry the ATN simulation using full context mode.
  27833. // This is slow because we can't save the results and have to "interpret" the
  27834. // ATN each time we get that input.</p>
  27835. //
  27836. // <p>
  27837. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  27838. //
  27839. // <p>
  27840. // We could cache results from full context to predicted alternative easily and
  27841. // that saves a lot of time but doesn't work in presence of predicates. The set
  27842. // of visible predicates from the ATN start state changes depending on the
  27843. // context, because closure can fall off the end of a rule. I tried to cache
  27844. // tuples (stack context, semantic context, predicted alt) but it was slower
  27845. // than interpreting and much more complicated. Also required a huge amount of
  27846. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  27847. // to keep this algorithm simple. By launching multiple threads, we can improve
  27848. // the speed of parsing across a large number of files.</p>
  27849. //
  27850. // <p>
  27851. // There is no strict ordering between the amount of input used by SLL vs LL,
  27852. // which makes it really hard to build a cache for full context. Let's say that
  27853. // we have input A B C that leads to an SLL conflict with full context X. That
  27854. // implies that using X we might only use A B but we could also use A B C D to
  27855. // resolve conflict. Input A B C D could predict alternative 1 in one position
  27856. // in the input and A B C E could predict alternative 2 in another position in
  27857. // input. The conflicting SLL configurations could still be non-unique in the
  27858. // full context prediction, which would lead us to requiring more input than the
  27859. // original A B C. To make a prediction cache work, we have to track the exact
  27860. // input used during the previous prediction. That amounts to a cache that maps
  27861. // X to a specific DFA for that context.</p>
  27862. //
  27863. // <p>
  27864. // Something should be done for left-recursive expression predictions. They are
  27865. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  27866. // with full LL thing Sam does.</p>
  27867. //
  27868. // <p>
  27869. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  27870. //
  27871. // <p>
  27872. // We avoid doing full context retry when the outer context is empty, we did not
  27873. // dip into the outer context by falling off the end of the decision state rule,
  27874. // or when we force SLL mode.</p>
  27875. //
  27876. // <p>
  27877. // As an example of the not dip into outer context case, consider as super
  27878. // constructor calls versus function calls. One grammar might look like
  27879. // this:</p>
  27880. //
  27881. // <pre>
  27882. // ctorBody
  27883. // : '{' superCall? stat* '}'
  27884. // ;
  27885. // </pre>
  27886. //
  27887. // <p>
  27888. // Or, you might see something like</p>
  27889. //
  27890. // <pre>
  27891. // stat
  27892. // : superCall ';'
  27893. // | expression ';'
  27894. // | ...
  27895. // ;
  27896. // </pre>
  27897. //
  27898. // <p>
  27899. // In both cases I believe that no closure operations will dip into the outer
  27900. // context. In the first case ctorBody in the worst case will stop at the '}'.
  27901. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  27902. // entry rule and not dip into the outer context.</p>
  27903. //
  27904. // <p>
  27905. // <strong>PREDICATES</strong></p>
  27906. //
  27907. // <p>
  27908. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  27909. // LL simulation deals with predicates differently. SLL collects predicates as
  27910. // it performs closure operations like ANTLR v3 did. It delays predicate
  27911. // evaluation until it reaches and accept state. This allows us to cache the SLL
  27912. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  27913. // closure, the DFA state configuration sets would be different and we couldn't
  27914. // build up a suitable DFA.</p>
  27915. //
  27916. // <p>
  27917. // When building a DFA accept state during ATN simulation, we evaluate any
  27918. // predicates and return the sole semantically valid alternative. If there is
  27919. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  27920. // we throw an exception. Alternatives without predicates act like they have
  27921. // true predicates. The simple way to think about it is to strip away all
  27922. // alternatives with false predicates and choose the minimum alternative that
  27923. // remains.</p>
  27924. //
  27925. // <p>
  27926. // When we start in the DFA and reach an accept state that's predicated, we test
  27927. // those and return the minimum semantically viable alternative. If no
  27928. // alternatives are viable, we throw an exception.</p>
  27929. //
  27930. // <p>
  27931. // During full LL ATN simulation, closure always evaluates predicates and
  27932. // on-the-fly. This is crucial to reducing the configuration set size during
  27933. // closure. It hits a landmine when parsing with the Java grammar, for example,
  27934. // without this on-the-fly evaluation.</p>
  27935. //
  27936. // <p>
  27937. // <strong>SHARING DFA</strong></p>
  27938. //
  27939. // <p>
  27940. // All instances of the same parser share the same decision DFAs through a
  27941. // static field. Each instance gets its own ATN simulator but they share the
  27942. // same {@link //decisionToDFA} field. They also share a
  27943. // {@link PredictionContextCache} object that makes sure that all
  27944. // {@link PredictionContext} objects are shared among the DFA states. This makes
  27945. // a big size difference.</p>
  27946. //
  27947. // <p>
  27948. // <strong>THREAD SAFETY</strong></p>
  27949. //
  27950. // <p>
  27951. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  27952. // it adds a new DFA object to that array. {@link //addDFAEdge}
  27953. // locks on the DFA for the current decision when setting the
  27954. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  27955. // the DFA for the current decision when looking up a DFA state to see if it
  27956. // already exists. We must make sure that all requests to add DFA states that
  27957. // are equivalent result in the same shared DFA object. This is because lots of
  27958. // threads will be trying to update the DFA at once. The
  27959. // {@link //addDFAState} method also locks inside the DFA lock
  27960. // but this time on the shared context cache when it rebuilds the
  27961. // configurations' {@link PredictionContext} objects using cached
  27962. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  27963. // safe as long as we can guarantee that all threads referencing
  27964. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  27965. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  27966. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  27967. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  27968. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  27969. // {@code dfa.edges[t]} to be non-null. The
  27970. // {@link //addDFAEdge} method could be racing to set the field
  27971. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  27972. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  27973. // way it will work because it's not doing a test and set operation.</p>
  27974. //
  27975. // <p>
  27976. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  27977. // Parsing)</strong></p>
  27978. //
  27979. // <p>
  27980. // Sam pointed out that if SLL does not give a syntax error, then there is no
  27981. // point in doing full LL, which is slower. We only have to try LL if we get a
  27982. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  27983. // mode with the {@link BailErrorStrategy}:</p>
  27984. //
  27985. // <pre>
  27986. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  27987. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  27988. // </pre>
  27989. //
  27990. // <p>
  27991. // If it does not get a syntax error, then we're done. If it does get a syntax
  27992. // error, we need to retry with the combined SLL/LL strategy.</p>
  27993. //
  27994. // <p>
  27995. // The reason this works is as follows. If there are no SLL conflicts, then the
  27996. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  27997. // the full LL analysis must yield a set of viable alternatives which is a
  27998. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  27999. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  28000. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  28001. // is truly ambiguous on the current input. If the LL set is smaller, then the
  28002. // SLL conflict resolution might choose an alternative that the full LL would
  28003. // rule out as a possibility based upon better context information. If that's
  28004. // the case, then the SLL parse will definitely get an error because the full LL
  28005. // analysis says it's not viable. If SLL conflict resolution chooses an
  28006. // alternative within the LL set, them both SLL and LL would choose the same
  28007. // alternative because they both choose the minimum of multiple conflicting
  28008. // alternatives.</p>
  28009. //
  28010. // <p>
  28011. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  28012. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  28013. // parsing will get an error because SLL will pursue alternative 1. If
  28014. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  28015. // choose the same alternative because alternative one is the minimum of either
  28016. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  28017. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  28018. //
  28019. // <p>
  28020. // Of course, if the input is invalid, then we will get an error for sure in
  28021. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  28022. // the input.</p>
  28023. //
  28024. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  28025. var Set = Utils.Set;
  28026. var BitSet = Utils.BitSet;
  28027. var DoubleDict = Utils.DoubleDict;
  28028. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  28029. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  28030. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28031. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  28032. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  28033. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  28034. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  28035. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  28036. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  28037. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  28038. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  28039. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  28040. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  28041. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28042. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  28043. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28044. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  28045. var Transition = Transitions.Transition;
  28046. var SetTransition = Transitions.SetTransition;
  28047. var NotSetTransition = Transitions.NotSetTransition;
  28048. var RuleTransition = Transitions.RuleTransition;
  28049. var ActionTransition = Transitions.ActionTransition;
  28050. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  28051. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  28052. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  28053. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  28054. ATNSimulator.call(this, atn, sharedContextCache);
  28055. this.parser = parser;
  28056. this.decisionToDFA = decisionToDFA;
  28057. // SLL, LL, or LL + exact ambig detection?//
  28058. this.predictionMode = PredictionMode.LL;
  28059. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  28060. this._input = null;
  28061. this._startIndex = 0;
  28062. this._outerContext = null;
  28063. this._dfa = null;
  28064. // Each prediction operation uses a cache for merge of prediction contexts.
  28065. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  28066. // isn't synchronized but we're ok since two threads shouldn't reuse same
  28067. // parser/atnsim object because it can only handle one input at a time.
  28068. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  28069. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  28070. // also be examined during cache lookup.
  28071. //
  28072. this.mergeCache = null;
  28073. return this;
  28074. }
  28075. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  28076. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  28077. ParserATNSimulator.prototype.debug = false;
  28078. ParserATNSimulator.prototype.debug_closure = false;
  28079. ParserATNSimulator.prototype.debug_add = false;
  28080. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  28081. ParserATNSimulator.prototype.dfa_debug = false;
  28082. ParserATNSimulator.prototype.retry_debug = false;
  28083. ParserATNSimulator.prototype.reset = function () {};
  28084. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  28085. if (this.debug || this.debug_list_atn_decisions) {
  28086. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28087. }
  28088. this._input = input;
  28089. this._startIndex = input.index;
  28090. this._outerContext = outerContext;
  28091. var dfa = this.decisionToDFA[decision];
  28092. this._dfa = dfa;
  28093. var m = input.mark();
  28094. var index = input.index;
  28095. // Now we are certain to have a specific decision's DFA
  28096. // But, do we still need an initial state?
  28097. try {
  28098. var s0;
  28099. if (dfa.precedenceDfa) {
  28100. // the start state for a precedence DFA depends on the current
  28101. // parser precedence, and is provided by a DFA method.
  28102. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28103. } else {
  28104. // the start state for a "regular" DFA is just s0
  28105. s0 = dfa.s0;
  28106. }
  28107. if (s0 === null) {
  28108. if (outerContext === null) {
  28109. outerContext = RuleContext.EMPTY;
  28110. }
  28111. if (this.debug || this.debug_list_atn_decisions) {
  28112. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28113. }
  28114. var fullCtx = false;
  28115. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28116. if (dfa.precedenceDfa) {
  28117. // If this is a precedence DFA, we use applyPrecedenceFilter
  28118. // to convert the computed start state to a precedence start
  28119. // state. We then use DFA.setPrecedenceStartState to set the
  28120. // appropriate start state for the precedence level rather
  28121. // than simply setting DFA.s0.
  28122. //
  28123. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28124. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28125. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28126. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28127. } else {
  28128. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28129. dfa.s0 = s0;
  28130. }
  28131. }
  28132. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28133. if (this.debug) {
  28134. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28135. }
  28136. return alt;
  28137. } finally {
  28138. this._dfa = null;
  28139. this.mergeCache = null; // wack cache after each prediction
  28140. input.seek(index);
  28141. input.release(m);
  28142. }
  28143. };
  28144. // Performs ATN simulation to compute a predicted alternative based
  28145. // upon the remaining input, but also updates the DFA cache to avoid
  28146. // having to traverse the ATN again for the same input sequence.
  28147. // There are some key conditions we're looking for after computing a new
  28148. // set of ATN configs (proposed DFA state):
  28149. // if the set is empty, there is no viable alternative for current symbol
  28150. // does the state uniquely predict an alternative?
  28151. // does the state have a conflict that would prevent us from
  28152. // putting it on the work list?
  28153. // We also have some key operations to do:
  28154. // add an edge from previous DFA state to potentially new DFA state, D,
  28155. // upon current symbol but only if adding to work list, which means in all
  28156. // cases except no viable alternative (and possibly non-greedy decisions?)
  28157. // collecting predicates and adding semantic context to DFA accept states
  28158. // adding rule context to context-sensitive DFA accept states
  28159. // consuming an input symbol
  28160. // reporting a conflict
  28161. // reporting an ambiguity
  28162. // reporting a context sensitivity
  28163. // reporting insufficient predicates
  28164. // cover these cases:
  28165. // dead end
  28166. // single alt
  28167. // single alt + preds
  28168. // conflict
  28169. // conflict + preds
  28170. //
  28171. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28172. if (this.debug || this.debug_list_atn_decisions) {
  28173. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28174. }
  28175. var alt;
  28176. var previousD = s0;
  28177. if (this.debug) {
  28178. console.log("s0 = " + s0);
  28179. }
  28180. var t = input.LA(1);
  28181. while (true) {
  28182. // while more work
  28183. var D = this.getExistingTargetState(previousD, t);
  28184. if (D === null) {
  28185. D = this.computeTargetState(dfa, previousD, t);
  28186. }
  28187. if (D === ATNSimulator.ERROR) {
  28188. // if any configs in previous dipped into outer context, that
  28189. // means that input up to t actually finished entry rule
  28190. // at least for SLL decision. Full LL doesn't dip into outer
  28191. // so don't need special case.
  28192. // We will get an error no matter what so delay until after
  28193. // decision; better error message. Also, no reachable target
  28194. // ATN states in SLL implies LL will also get nowhere.
  28195. // If conflict in states that dip out, choose min since we
  28196. // will get error no matter what.
  28197. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28198. input.seek(startIndex);
  28199. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28200. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28201. return alt;
  28202. } else {
  28203. throw e;
  28204. }
  28205. }
  28206. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28207. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28208. var conflictingAlts = null;
  28209. if (D.predicates !== null) {
  28210. if (this.debug) {
  28211. console.log("DFA state has preds in DFA sim LL failover");
  28212. }
  28213. var conflictIndex = input.index;
  28214. if (conflictIndex !== startIndex) {
  28215. input.seek(startIndex);
  28216. }
  28217. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28218. if (conflictingAlts.length === 1) {
  28219. if (this.debug) {
  28220. console.log("Full LL avoided");
  28221. }
  28222. return conflictingAlts.minValue();
  28223. }
  28224. if (conflictIndex !== startIndex) {
  28225. // restore the index so reporting the fallback to full
  28226. // context occurs with the index at the correct spot
  28227. input.seek(conflictIndex);
  28228. }
  28229. }
  28230. if (this.dfa_debug) {
  28231. console.log("ctx sensitive state " + outerContext + " in " + D);
  28232. }
  28233. var fullCtx = true;
  28234. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28235. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28236. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28237. return alt;
  28238. }
  28239. if (D.isAcceptState) {
  28240. if (D.predicates === null) {
  28241. return D.prediction;
  28242. }
  28243. var stopIndex = input.index;
  28244. input.seek(startIndex);
  28245. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28246. if (alts.length === 0) {
  28247. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28248. } else if (alts.length === 1) {
  28249. return alts.minValue();
  28250. } else {
  28251. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28252. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28253. return alts.minValue();
  28254. }
  28255. }
  28256. previousD = D;
  28257. if (t !== Token.EOF) {
  28258. input.consume();
  28259. t = input.LA(1);
  28260. }
  28261. }
  28262. };
  28263. //
  28264. // Get an existing target state for an edge in the DFA. If the target state
  28265. // for the edge has not yet been computed or is otherwise not available,
  28266. // this method returns {@code null}.
  28267. //
  28268. // @param previousD The current DFA state
  28269. // @param t The next input symbol
  28270. // @return The existing target DFA state for the given input symbol
  28271. // {@code t}, or {@code null} if the target state for this edge is not
  28272. // already cached
  28273. //
  28274. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28275. var edges = previousD.edges;
  28276. if (edges === null) {
  28277. return null;
  28278. } else {
  28279. return edges[t + 1] || null;
  28280. }
  28281. };
  28282. //
  28283. // Compute a target state for an edge in the DFA, and attempt to add the
  28284. // computed state and corresponding edge to the DFA.
  28285. //
  28286. // @param dfa The DFA
  28287. // @param previousD The current DFA state
  28288. // @param t The next input symbol
  28289. //
  28290. // @return The computed target DFA state for the given input symbol
  28291. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28292. // returns {@link //ERROR}.
  28293. //
  28294. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28295. var reach = this.computeReachSet(previousD.configs, t, false);
  28296. if (reach === null) {
  28297. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28298. return ATNSimulator.ERROR;
  28299. }
  28300. // create new target state; we'll add to DFA after it's complete
  28301. var D = new DFAState(null, reach);
  28302. var predictedAlt = this.getUniqueAlt(reach);
  28303. if (this.debug) {
  28304. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28305. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28306. }
  28307. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28308. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28309. D.isAcceptState = true;
  28310. D.configs.uniqueAlt = predictedAlt;
  28311. D.prediction = predictedAlt;
  28312. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28313. // MORE THAN ONE VIABLE ALTERNATIVE
  28314. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28315. D.requiresFullContext = true;
  28316. // in SLL-only mode, we will stop at this state and return the minimum alt
  28317. D.isAcceptState = true;
  28318. D.prediction = D.configs.conflictingAlts.minValue();
  28319. }
  28320. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28321. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28322. if (D.predicates !== null) {
  28323. D.prediction = ATN.INVALID_ALT_NUMBER;
  28324. }
  28325. }
  28326. // all adds to dfa are done after we've created full D state
  28327. D = this.addDFAEdge(dfa, previousD, t, D);
  28328. return D;
  28329. };
  28330. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28331. // We need to test all predicates, even in DFA states that
  28332. // uniquely predict alternative.
  28333. var nalts = decisionState.transitions.length;
  28334. // Update DFA so reach becomes accept state with (predicate,alt)
  28335. // pairs if preds found for conflicting alts
  28336. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28337. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28338. if (altToPred !== null) {
  28339. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28340. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28341. } else {
  28342. // There are preds in configs but they might go away
  28343. // when OR'd together like {p}? || NONE == NONE. If neither
  28344. // alt has preds, resolve to min alt
  28345. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28346. }
  28347. };
  28348. // comes back with reach.uniqueAlt set to a valid alt
  28349. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28350. s0, input, startIndex, outerContext) {
  28351. if (this.debug || this.debug_list_atn_decisions) {
  28352. console.log("execATNWithFullContext " + s0);
  28353. }
  28354. var fullCtx = true;
  28355. var foundExactAmbig = false;
  28356. var reach = null;
  28357. var previous = s0;
  28358. input.seek(startIndex);
  28359. var t = input.LA(1);
  28360. var predictedAlt = -1;
  28361. while (true) {
  28362. // while more work
  28363. reach = this.computeReachSet(previous, t, fullCtx);
  28364. if (reach === null) {
  28365. // if any configs in previous dipped into outer context, that
  28366. // means that input up to t actually finished entry rule
  28367. // at least for LL decision. Full LL doesn't dip into outer
  28368. // so don't need special case.
  28369. // We will get an error no matter what so delay until after
  28370. // decision; better error message. Also, no reachable target
  28371. // ATN states in SLL implies LL will also get nowhere.
  28372. // If conflict in states that dip out, choose min since we
  28373. // will get error no matter what.
  28374. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28375. input.seek(startIndex);
  28376. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28377. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28378. return alt;
  28379. } else {
  28380. throw e;
  28381. }
  28382. }
  28383. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28384. if (this.debug) {
  28385. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28386. }
  28387. reach.uniqueAlt = this.getUniqueAlt(reach);
  28388. // unique prediction?
  28389. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28390. predictedAlt = reach.uniqueAlt;
  28391. break;
  28392. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28393. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28394. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28395. break;
  28396. }
  28397. } else {
  28398. // In exact ambiguity mode, we never try to terminate early.
  28399. // Just keeps scarfing until we know what the conflict is
  28400. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28401. foundExactAmbig = true;
  28402. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28403. break;
  28404. }
  28405. // else there are multiple non-conflicting subsets or
  28406. // we're not sure what the ambiguity is yet.
  28407. // So, keep going.
  28408. }
  28409. previous = reach;
  28410. if (t !== Token.EOF) {
  28411. input.consume();
  28412. t = input.LA(1);
  28413. }
  28414. }
  28415. // If the configuration set uniquely predicts an alternative,
  28416. // without conflict, then we know that it's a full LL decision
  28417. // not SLL.
  28418. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28419. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28420. return predictedAlt;
  28421. }
  28422. // We do not check predicates here because we have checked them
  28423. // on-the-fly when doing full context prediction.
  28424. //
  28425. // In non-exact ambiguity detection mode, we might actually be able to
  28426. // detect an exact ambiguity, but I'm not going to spend the cycles
  28427. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28428. // mode.
  28429. //
  28430. // For example, we might know that we have conflicting configurations.
  28431. // But, that does not mean that there is no way forward without a
  28432. // conflict. It's possible to have nonconflicting alt subsets as in:
  28433. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28434. // from
  28435. //
  28436. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28437. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28438. //
  28439. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28440. // would resolve this without conflict to alternative 1. Any other viable
  28441. // next sequence, however, is associated with a conflict. We stop
  28442. // looking for input because no amount of further lookahead will alter
  28443. // the fact that we should predict alternative 1. We just can't say for
  28444. // sure that there is an ambiguity without looking further.
  28445. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28446. return predictedAlt;
  28447. };
  28448. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28449. if (this.debug) {
  28450. console.log("in computeReachSet, starting closure: " + closure);
  28451. }
  28452. if (this.mergeCache === null) {
  28453. this.mergeCache = new DoubleDict();
  28454. }
  28455. var intermediate = new ATNConfigSet(fullCtx);
  28456. // Configurations already in a rule stop state indicate reaching the end
  28457. // of the decision rule (local context) or end of the start rule (full
  28458. // context). Once reached, these configurations are never updated by a
  28459. // closure operation, so they are handled separately for the performance
  28460. // advantage of having a smaller intermediate set when calling closure.
  28461. //
  28462. // For full-context reach operations, separate handling is required to
  28463. // ensure that the alternative matching the longest overall sequence is
  28464. // chosen when multiple such configurations can match the input.
  28465. var skippedStopStates = null;
  28466. // First figure out where we can reach on input t
  28467. for (var i = 0; i < closure.items.length; i++) {
  28468. var c = closure.items[i];
  28469. if (this.debug_add) {
  28470. console.log("testing " + this.getTokenName(t) + " at " + c);
  28471. }
  28472. if (c.state instanceof RuleStopState) {
  28473. if (fullCtx || t === Token.EOF) {
  28474. if (skippedStopStates === null) {
  28475. skippedStopStates = [];
  28476. }
  28477. skippedStopStates.push(c);
  28478. if (this.debug_add) {
  28479. console.log("added " + c + " to skippedStopStates");
  28480. }
  28481. }
  28482. continue;
  28483. }
  28484. for (var j = 0; j < c.state.transitions.length; j++) {
  28485. var trans = c.state.transitions[j];
  28486. var target = this.getReachableTarget(trans, t);
  28487. if (target !== null) {
  28488. var cfg = new ATNConfig({ state: target }, c);
  28489. intermediate.add(cfg, this.mergeCache);
  28490. if (this.debug_add) {
  28491. console.log("added " + cfg + " to intermediate");
  28492. }
  28493. }
  28494. }
  28495. }
  28496. // Now figure out where the reach operation can take us...
  28497. var reach = null;
  28498. // This block optimizes the reach operation for intermediate sets which
  28499. // trivially indicate a termination state for the overall
  28500. // adaptivePredict operation.
  28501. //
  28502. // The conditions assume that intermediate
  28503. // contains all configurations relevant to the reach set, but this
  28504. // condition is not true when one or more configurations have been
  28505. // withheld in skippedStopStates, or when the current symbol is EOF.
  28506. //
  28507. if (skippedStopStates === null && t !== Token.EOF) {
  28508. if (intermediate.items.length === 1) {
  28509. // Don't pursue the closure if there is just one state.
  28510. // It can only have one alternative; just add to result
  28511. // Also don't pursue the closure if there is unique alternative
  28512. // among the configurations.
  28513. reach = intermediate;
  28514. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  28515. // Also don't pursue the closure if there is unique alternative
  28516. // among the configurations.
  28517. reach = intermediate;
  28518. }
  28519. }
  28520. // If the reach set could not be trivially determined, perform a closure
  28521. // operation on the intermediate set to compute its initial value.
  28522. //
  28523. if (reach === null) {
  28524. reach = new ATNConfigSet(fullCtx);
  28525. var closureBusy = new Set();
  28526. var treatEofAsEpsilon = t === Token.EOF;
  28527. for (var k = 0; k < intermediate.items.length; k++) {
  28528. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  28529. }
  28530. }
  28531. if (t === Token.EOF) {
  28532. // After consuming EOF no additional input is possible, so we are
  28533. // only interested in configurations which reached the end of the
  28534. // decision rule (local context) or end of the start rule (full
  28535. // context). Update reach to contain only these configurations. This
  28536. // handles both explicit EOF transitions in the grammar and implicit
  28537. // EOF transitions following the end of the decision or start rule.
  28538. //
  28539. // When reach==intermediate, no closure operation was performed. In
  28540. // this case, removeAllConfigsNotInRuleStopState needs to check for
  28541. // reachable rule stop states as well as configurations already in
  28542. // a rule stop state.
  28543. //
  28544. // This is handled before the configurations in skippedStopStates,
  28545. // because any configurations potentially added from that list are
  28546. // already guaranteed to meet this condition whether or not it's
  28547. // required.
  28548. //
  28549. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  28550. }
  28551. // If skippedStopStates!==null, then it contains at least one
  28552. // configuration. For full-context reach operations, these
  28553. // configurations reached the end of the start rule, in which case we
  28554. // only add them back to reach if no configuration during the current
  28555. // closure operation reached such a state. This ensures adaptivePredict
  28556. // chooses an alternative matching the longest overall sequence when
  28557. // multiple alternatives are viable.
  28558. //
  28559. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  28560. for (var l = 0; l < skippedStopStates.length; l++) {
  28561. reach.add(skippedStopStates[l], this.mergeCache);
  28562. }
  28563. }
  28564. if (reach.items.length === 0) {
  28565. return null;
  28566. } else {
  28567. return reach;
  28568. }
  28569. };
  28570. //
  28571. // Return a configuration set containing only the configurations from
  28572. // {@code configs} which are in a {@link RuleStopState}. If all
  28573. // configurations in {@code configs} are already in a rule stop state, this
  28574. // method simply returns {@code configs}.
  28575. //
  28576. // <p>When {@code lookToEndOfRule} is true, this method uses
  28577. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  28578. // not already in a rule stop state to see if a rule stop state is reachable
  28579. // from the configuration via epsilon-only transitions.</p>
  28580. //
  28581. // @param configs the configuration set to update
  28582. // @param lookToEndOfRule when true, this method checks for rule stop states
  28583. // reachable by epsilon-only transitions from each configuration in
  28584. // {@code configs}.
  28585. //
  28586. // @return {@code configs} if all configurations in {@code configs} are in a
  28587. // rule stop state, otherwise return a new configuration set containing only
  28588. // the configurations from {@code configs} which are in a rule stop state
  28589. //
  28590. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  28591. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  28592. return configs;
  28593. }
  28594. var result = new ATNConfigSet(configs.fullCtx);
  28595. for (var i = 0; i < configs.items.length; i++) {
  28596. var config = configs.items[i];
  28597. if (config.state instanceof RuleStopState) {
  28598. result.add(config, this.mergeCache);
  28599. continue;
  28600. }
  28601. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  28602. var nextTokens = this.atn.nextTokens(config.state);
  28603. if (nextTokens.contains(Token.EPSILON)) {
  28604. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  28605. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  28606. }
  28607. }
  28608. }
  28609. return result;
  28610. };
  28611. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  28612. // always at least the implicit call to start rule
  28613. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  28614. var configs = new ATNConfigSet(fullCtx);
  28615. for (var i = 0; i < p.transitions.length; i++) {
  28616. var target = p.transitions[i].target;
  28617. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  28618. var closureBusy = new Set();
  28619. this.closure(c, configs, closureBusy, true, fullCtx, false);
  28620. }
  28621. return configs;
  28622. };
  28623. //
  28624. // This method transforms the start state computed by
  28625. // {@link //computeStartState} to the special start state used by a
  28626. // precedence DFA for a particular precedence value. The transformation
  28627. // process applies the following changes to the start state's configuration
  28628. // set.
  28629. //
  28630. // <ol>
  28631. // <li>Evaluate the precedence predicates for each configuration using
  28632. // {@link SemanticContext//evalPrecedence}.</li>
  28633. // <li>Remove all configurations which predict an alternative greater than
  28634. // 1, for which another configuration that predicts alternative 1 is in the
  28635. // same ATN state with the same prediction context. This transformation is
  28636. // valid for the following reasons:
  28637. // <ul>
  28638. // <li>The closure block cannot contain any epsilon transitions which bypass
  28639. // the body of the closure, so all states reachable via alternative 1 are
  28640. // part of the precedence alternatives of the transformed left-recursive
  28641. // rule.</li>
  28642. // <li>The "primary" portion of a left recursive rule cannot contain an
  28643. // epsilon transition, so the only way an alternative other than 1 can exist
  28644. // in a state that is also reachable via alternative 1 is by nesting calls
  28645. // to the left-recursive rule, with the outer calls not being at the
  28646. // preferred precedence level.</li>
  28647. // </ul>
  28648. // </li>
  28649. // </ol>
  28650. //
  28651. // <p>
  28652. // The prediction context must be considered by this filter to address
  28653. // situations like the following.
  28654. // </p>
  28655. // <code>
  28656. // <pre>
  28657. // grammar TA;
  28658. // prog: statement* EOF;
  28659. // statement: letterA | statement letterA 'b' ;
  28660. // letterA: 'a';
  28661. // </pre>
  28662. // </code>
  28663. // <p>
  28664. // If the above grammar, the ATN state immediately before the token
  28665. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  28666. // of both the primary and closure blocks of the left-recursive rule
  28667. // {@code statement}. The prediction context associated with each of these
  28668. // configurations distinguishes between them, and prevents the alternative
  28669. // which stepped out to {@code prog} (and then back in to {@code statement}
  28670. // from being eliminated by the filter.
  28671. // </p>
  28672. //
  28673. // @param configs The configuration set computed by
  28674. // {@link //computeStartState} as the start state for the DFA.
  28675. // @return The transformed configuration set representing the start state
  28676. // for a precedence DFA at a particular precedence level (determined by
  28677. // calling {@link Parser//getPrecedence}).
  28678. //
  28679. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  28680. var config;
  28681. var statesFromAlt1 = [];
  28682. var configSet = new ATNConfigSet(configs.fullCtx);
  28683. for (var i = 0; i < configs.items.length; i++) {
  28684. config = configs.items[i];
  28685. // handle alt 1 first
  28686. if (config.alt !== 1) {
  28687. continue;
  28688. }
  28689. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  28690. if (updatedContext === null) {
  28691. // the configuration was eliminated
  28692. continue;
  28693. }
  28694. statesFromAlt1[config.state.stateNumber] = config.context;
  28695. if (updatedContext !== config.semanticContext) {
  28696. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  28697. } else {
  28698. configSet.add(config, this.mergeCache);
  28699. }
  28700. }
  28701. for (i = 0; i < configs.items.length; i++) {
  28702. config = configs.items[i];
  28703. if (config.alt === 1) {
  28704. // already handled
  28705. continue;
  28706. }
  28707. // In the future, this elimination step could be updated to also
  28708. // filter the prediction context for alternatives predicting alt>1
  28709. // (basically a graph subtraction algorithm).
  28710. if (!config.precedenceFilterSuppressed) {
  28711. var context = statesFromAlt1[config.state.stateNumber] || null;
  28712. if (context !== null && context.equals(config.context)) {
  28713. // eliminated
  28714. continue;
  28715. }
  28716. }
  28717. configSet.add(config, this.mergeCache);
  28718. }
  28719. return configSet;
  28720. };
  28721. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  28722. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  28723. return trans.target;
  28724. } else {
  28725. return null;
  28726. }
  28727. };
  28728. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  28729. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  28730. // altToPred starts as an array of all null contexts. The entry at index i
  28731. // corresponds to alternative i. altToPred[i] may have one of three values:
  28732. // 1. null: no ATNConfig c is found such that c.alt==i
  28733. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  28734. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  28735. // alt i has at least one unpredicated config.
  28736. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  28737. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  28738. //
  28739. // From this, it is clear that NONE||anything==NONE.
  28740. //
  28741. var altToPred = [];
  28742. for (var i = 0; i < configs.items.length; i++) {
  28743. var c = configs.items[i];
  28744. if (ambigAlts.contains(c.alt)) {
  28745. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  28746. }
  28747. }
  28748. var nPredAlts = 0;
  28749. for (i = 1; i < nalts + 1; i++) {
  28750. var pred = altToPred[i] || null;
  28751. if (pred === null) {
  28752. altToPred[i] = SemanticContext.NONE;
  28753. } else if (pred !== SemanticContext.NONE) {
  28754. nPredAlts += 1;
  28755. }
  28756. }
  28757. // nonambig alts are null in altToPred
  28758. if (nPredAlts === 0) {
  28759. altToPred = null;
  28760. }
  28761. if (this.debug) {
  28762. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  28763. }
  28764. return altToPred;
  28765. };
  28766. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  28767. var pairs = [];
  28768. var containsPredicate = false;
  28769. for (var i = 1; i < altToPred.length; i++) {
  28770. var pred = altToPred[i];
  28771. // unpredicated is indicated by SemanticContext.NONE
  28772. if (ambigAlts !== null && ambigAlts.contains(i)) {
  28773. pairs.push(new PredPrediction(pred, i));
  28774. }
  28775. if (pred !== SemanticContext.NONE) {
  28776. containsPredicate = true;
  28777. }
  28778. }
  28779. if (!containsPredicate) {
  28780. return null;
  28781. }
  28782. return pairs;
  28783. };
  28784. //
  28785. // This method is used to improve the localization of error messages by
  28786. // choosing an alternative rather than throwing a
  28787. // {@link NoViableAltException} in particular prediction scenarios where the
  28788. // {@link //ERROR} state was reached during ATN simulation.
  28789. //
  28790. // <p>
  28791. // The default implementation of this method uses the following
  28792. // algorithm to identify an ATN configuration which successfully parsed the
  28793. // decision entry rule. Choosing such an alternative ensures that the
  28794. // {@link ParserRuleContext} returned by the calling rule will be complete
  28795. // and valid, and the syntax error will be reported later at a more
  28796. // localized location.</p>
  28797. //
  28798. // <ul>
  28799. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  28800. // they are semantically valid if predicated, return the min associated alt.</li>
  28801. // <li>Else, if a semantically invalid but syntactically valid path exist
  28802. // or paths exist, return the minimum associated alt.
  28803. // </li>
  28804. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  28805. // </ul>
  28806. //
  28807. // <p>
  28808. // In some scenarios, the algorithm described above could predict an
  28809. // alternative which will result in a {@link FailedPredicateException} in
  28810. // the parser. Specifically, this could occur if the <em>only</em> configuration
  28811. // capable of successfully parsing to the end of the decision rule is
  28812. // blocked by a semantic predicate. By choosing this alternative within
  28813. // {@link //adaptivePredict} instead of throwing a
  28814. // {@link NoViableAltException}, the resulting
  28815. // {@link FailedPredicateException} in the parser will identify the specific
  28816. // predicate which is preventing the parser from successfully parsing the
  28817. // decision rule, which helps developers identify and correct logic errors
  28818. // in semantic predicates.
  28819. // </p>
  28820. //
  28821. // @param configs The ATN configurations which were valid immediately before
  28822. // the {@link //ERROR} state was reached
  28823. // @param outerContext The is the \gamma_0 initial parser context from the paper
  28824. // or the parser stack at the instant before prediction commences.
  28825. //
  28826. // @return The value to return from {@link //adaptivePredict}, or
  28827. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  28828. // identified and {@link //adaptivePredict} should report an error instead.
  28829. //
  28830. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  28831. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  28832. var semValidConfigs = cfgs[0];
  28833. var semInvalidConfigs = cfgs[1];
  28834. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  28835. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28836. // semantically/syntactically viable path exists
  28837. return alt;
  28838. }
  28839. // Is there a syntactically valid path with a failed pred?
  28840. if (semInvalidConfigs.items.length > 0) {
  28841. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  28842. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28843. // syntactically viable path exists
  28844. return alt;
  28845. }
  28846. }
  28847. return ATN.INVALID_ALT_NUMBER;
  28848. };
  28849. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  28850. var alts = [];
  28851. for (var i = 0; i < configs.items.length; i++) {
  28852. var c = configs.items[i];
  28853. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  28854. if (alts.indexOf(c.alt) < 0) {
  28855. alts.push(c.alt);
  28856. }
  28857. }
  28858. }
  28859. if (alts.length === 0) {
  28860. return ATN.INVALID_ALT_NUMBER;
  28861. } else {
  28862. return Math.min.apply(null, alts);
  28863. }
  28864. };
  28865. // Walk the list of configurations and split them according to
  28866. // those that have preds evaluating to true/false. If no pred, assume
  28867. // true pred and include in succeeded set. Returns Pair of sets.
  28868. //
  28869. // Create a new set so as not to alter the incoming parameter.
  28870. //
  28871. // Assumption: the input stream has been restored to the starting point
  28872. // prediction, which is where predicates need to evaluate.
  28873. //
  28874. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  28875. var succeeded = new ATNConfigSet(configs.fullCtx);
  28876. var failed = new ATNConfigSet(configs.fullCtx);
  28877. for (var i = 0; i < configs.items.length; i++) {
  28878. var c = configs.items[i];
  28879. if (c.semanticContext !== SemanticContext.NONE) {
  28880. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  28881. if (predicateEvaluationResult) {
  28882. succeeded.add(c);
  28883. } else {
  28884. failed.add(c);
  28885. }
  28886. } else {
  28887. succeeded.add(c);
  28888. }
  28889. }
  28890. return [succeeded, failed];
  28891. };
  28892. // Look through a list of predicate/alt pairs, returning alts for the
  28893. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  28894. // unpredicated config which behaves as "always true." If !complete
  28895. // then we stop at the first predicate that evaluates to true. This
  28896. // includes pairs with null predicates.
  28897. //
  28898. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  28899. var predictions = new BitSet();
  28900. for (var i = 0; i < predPredictions.length; i++) {
  28901. var pair = predPredictions[i];
  28902. if (pair.pred === SemanticContext.NONE) {
  28903. predictions.add(pair.alt);
  28904. if (!complete) {
  28905. break;
  28906. }
  28907. continue;
  28908. }
  28909. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  28910. if (this.debug || this.dfa_debug) {
  28911. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  28912. }
  28913. if (predicateEvaluationResult) {
  28914. if (this.debug || this.dfa_debug) {
  28915. console.log("PREDICT " + pair.alt);
  28916. }
  28917. predictions.add(pair.alt);
  28918. if (!complete) {
  28919. break;
  28920. }
  28921. }
  28922. }
  28923. return predictions;
  28924. };
  28925. // TODO: If we are doing predicates, there is no point in pursuing
  28926. // closure operations if we reach a DFA state that uniquely predicts
  28927. // alternative. We will not be caching that DFA state and it is a
  28928. // waste to pursue the closure. Might have to advance when we do
  28929. // ambig detection thought :(
  28930. //
  28931. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  28932. var initialDepth = 0;
  28933. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  28934. };
  28935. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28936. if (this.debug || this.debug_closure) {
  28937. console.log("closure(" + config.toString(this.parser, true) + ")");
  28938. // console.log("configs(" + configs.toString() + ")");
  28939. if (config.reachesIntoOuterContext > 50) {
  28940. throw "problem";
  28941. }
  28942. }
  28943. if (config.state instanceof RuleStopState) {
  28944. // We hit rule end. If we have context info, use it
  28945. // run thru all possible stack tops in ctx
  28946. if (!config.context.isEmpty()) {
  28947. for (var i = 0; i < config.context.length; i++) {
  28948. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  28949. if (fullCtx) {
  28950. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  28951. continue;
  28952. } else {
  28953. // we have no context info, just chase follow links (if greedy)
  28954. if (this.debug) {
  28955. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28956. }
  28957. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28958. }
  28959. continue;
  28960. }
  28961. var returnState = this.atn.states[config.context.getReturnState(i)];
  28962. var newContext = config.context.getParent(i); // "pop" return state
  28963. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  28964. var c = new ATNConfig(parms, null);
  28965. // While we have context to pop back from, we may have
  28966. // gotten that context AFTER having falling off a rule.
  28967. // Make sure we track that we are now out of context.
  28968. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  28969. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  28970. }
  28971. return;
  28972. } else if (fullCtx) {
  28973. // reached end of start rule
  28974. configs.add(config, this.mergeCache);
  28975. return;
  28976. } else {
  28977. // else if we have no context info, just chase follow links (if greedy)
  28978. if (this.debug) {
  28979. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28980. }
  28981. }
  28982. }
  28983. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28984. };
  28985. // Do the actual work of walking epsilon edges//
  28986. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28987. var p = config.state;
  28988. // optimization
  28989. if (!p.epsilonOnlyTransitions) {
  28990. configs.add(config, this.mergeCache);
  28991. // make sure to not return here, because EOF transitions can act as
  28992. // both epsilon transitions and non-epsilon transitions.
  28993. }
  28994. for (var i = 0; i < p.transitions.length; i++) {
  28995. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  28996. var t = p.transitions[i];
  28997. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  28998. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  28999. if (c !== null) {
  29000. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  29001. // avoid infinite recursion for EOF* and EOF+
  29002. continue;
  29003. }
  29004. var newDepth = depth;
  29005. if (config.state instanceof RuleStopState) {
  29006. // target fell off end of rule; mark resulting c as having dipped into outer context
  29007. // We can't get here if incoming config was rule stop and we had context
  29008. // track how far we dip into outer context. Might
  29009. // come in handy and we avoid evaluating context dependent
  29010. // preds if this is > 0.
  29011. if (closureBusy.add(c) !== c) {
  29012. // avoid infinite recursion for right-recursive rules
  29013. continue;
  29014. }
  29015. if (this._dfa !== null && this._dfa.precedenceDfa) {
  29016. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  29017. c.precedenceFilterSuppressed = true;
  29018. }
  29019. }
  29020. c.reachesIntoOuterContext += 1;
  29021. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  29022. newDepth -= 1;
  29023. if (this.debug) {
  29024. console.log("dips into outer ctx: " + c);
  29025. }
  29026. } else if (t instanceof RuleTransition) {
  29027. // latch when newDepth goes negative - once we step out of the entry context we can't return
  29028. if (newDepth >= 0) {
  29029. newDepth += 1;
  29030. }
  29031. }
  29032. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  29033. }
  29034. }
  29035. };
  29036. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  29037. // return False
  29038. var p = config.state;
  29039. // First check to see if we are in StarLoopEntryState generated during
  29040. // left-recursion elimination. For efficiency, also check if
  29041. // the context has an empty stack case. If so, it would mean
  29042. // global FOLLOW so we can't perform optimization
  29043. // Are we the special loop entry/exit state? or SLL wildcard
  29044. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  29045. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  29046. // Require all return states to return back to the same rule that p is in.
  29047. var numCtxs = config.context.length;
  29048. for (var i = 0; i < numCtxs; i++) {
  29049. // for each stack context
  29050. var returnState = this.atn.states[config.context.getReturnState(i)];
  29051. if (returnState.ruleIndex != p.ruleIndex) return false;
  29052. }
  29053. var decisionStartState = p.transitions[0].target;
  29054. var blockEndStateNum = decisionStartState.endState.stateNumber;
  29055. var blockEndState = this.atn.states[blockEndStateNum];
  29056. // Verify that the top of each stack context leads to loop entry/exit
  29057. // state through epsilon edges and w/o leaving rule.
  29058. for (var i = 0; i < numCtxs; i++) {
  29059. // for each stack context
  29060. var returnStateNumber = config.context.getReturnState(i);
  29061. var returnState = this.atn.states[returnStateNumber];
  29062. // all states must have single outgoing epsilon edge
  29063. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  29064. // Look for prefix op case like 'not expr', (' type ')' expr
  29065. var returnStateTarget = returnState.transitions[0].target;
  29066. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  29067. // Look for 'expr op expr' or case where expr's return state is block end
  29068. // of (...)* internal block; the block end points to loop back
  29069. // which points to p but we don't need to check that
  29070. if (returnState == blockEndState) continue;
  29071. // Look for ternary expr ? expr : expr. The return state points at block end,
  29072. // which points at loop entry state
  29073. if (returnStateTarget == blockEndState) continue;
  29074. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  29075. // return state points at block end state of (...)* internal block
  29076. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  29077. // anything else ain't conforming
  29078. return false;
  29079. }
  29080. return true;
  29081. };
  29082. ParserATNSimulator.prototype.getRuleName = function (index) {
  29083. if (this.parser !== null && index >= 0) {
  29084. return this.parser.ruleNames[index];
  29085. } else {
  29086. return "<rule " + index + ">";
  29087. }
  29088. };
  29089. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  29090. switch (t.serializationType) {
  29091. case Transition.RULE:
  29092. return this.ruleTransition(config, t);
  29093. case Transition.PRECEDENCE:
  29094. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29095. case Transition.PREDICATE:
  29096. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29097. case Transition.ACTION:
  29098. return this.actionTransition(config, t);
  29099. case Transition.EPSILON:
  29100. return new ATNConfig({ state: t.target }, config);
  29101. case Transition.ATOM:
  29102. case Transition.RANGE:
  29103. case Transition.SET:
  29104. // EOF transitions act like epsilon transitions after the first EOF
  29105. // transition is traversed
  29106. if (treatEofAsEpsilon) {
  29107. if (t.matches(Token.EOF, 0, 1)) {
  29108. return new ATNConfig({ state: t.target }, config);
  29109. }
  29110. }
  29111. return null;
  29112. default:
  29113. return null;
  29114. }
  29115. };
  29116. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29117. if (this.debug) {
  29118. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29119. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29120. }
  29121. return new ATNConfig({ state: t.target }, config);
  29122. };
  29123. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29124. if (this.debug) {
  29125. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29126. if (this.parser !== null) {
  29127. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29128. }
  29129. }
  29130. var c = null;
  29131. if (collectPredicates && inContext) {
  29132. if (fullCtx) {
  29133. // In full context mode, we can evaluate predicates on-the-fly
  29134. // during closure, which dramatically reduces the size of
  29135. // the config sets. It also obviates the need to test predicates
  29136. // later during conflict resolution.
  29137. var currentPosition = this._input.index;
  29138. this._input.seek(this._startIndex);
  29139. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29140. this._input.seek(currentPosition);
  29141. if (predSucceeds) {
  29142. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29143. }
  29144. } else {
  29145. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29146. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29147. }
  29148. } else {
  29149. c = new ATNConfig({ state: pt.target }, config);
  29150. }
  29151. if (this.debug) {
  29152. console.log("config from pred transition=" + c);
  29153. }
  29154. return c;
  29155. };
  29156. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29157. if (this.debug) {
  29158. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29159. if (this.parser !== null) {
  29160. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29161. }
  29162. }
  29163. var c = null;
  29164. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29165. if (fullCtx) {
  29166. // In full context mode, we can evaluate predicates on-the-fly
  29167. // during closure, which dramatically reduces the size of
  29168. // the config sets. It also obviates the need to test predicates
  29169. // later during conflict resolution.
  29170. var currentPosition = this._input.index;
  29171. this._input.seek(this._startIndex);
  29172. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29173. this._input.seek(currentPosition);
  29174. if (predSucceeds) {
  29175. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29176. }
  29177. } else {
  29178. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29179. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29180. }
  29181. } else {
  29182. c = new ATNConfig({ state: pt.target }, config);
  29183. }
  29184. if (this.debug) {
  29185. console.log("config from pred transition=" + c);
  29186. }
  29187. return c;
  29188. };
  29189. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29190. if (this.debug) {
  29191. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29192. }
  29193. var returnState = t.followState;
  29194. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29195. return new ATNConfig({ state: t.target, context: newContext }, config);
  29196. };
  29197. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29198. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29199. return PredictionMode.getAlts(altsets);
  29200. };
  29201. // Sam pointed out a problem with the previous definition, v3, of
  29202. // ambiguous states. If we have another state associated with conflicting
  29203. // alternatives, we should keep going. For example, the following grammar
  29204. //
  29205. // s : (ID | ID ID?) ';' ;
  29206. //
  29207. // When the ATN simulation reaches the state before ';', it has a DFA
  29208. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29209. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29210. // because alternative to has another way to continue, via [6|2|[]].
  29211. // The key is that we have a single state that has config's only associated
  29212. // with a single alternative, 2, and crucially the state transitions
  29213. // among the configurations are all non-epsilon transitions. That means
  29214. // we don't consider any conflicts that include alternative 2. So, we
  29215. // ignore the conflict between alts 1 and 2. We ignore a set of
  29216. // conflicting alts when there is an intersection with an alternative
  29217. // associated with a single alt state in the state&rarr;config-list map.
  29218. //
  29219. // It's also the case that we might have two conflicting configurations but
  29220. // also a 3rd nonconflicting configuration for a different alternative:
  29221. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29222. //
  29223. // a : A | A | A B ;
  29224. //
  29225. // After matching input A, we reach the stop state for rule A, state 1.
  29226. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29227. // conflict and no amount of further lookahead will separate the two.
  29228. // However, alternative 3 will be able to continue and so we do not
  29229. // stop working on this state. In the previous example, we're concerned
  29230. // with states associated with the conflicting alternatives. Here alt
  29231. // 3 is not associated with the conflicting configs, but since we can continue
  29232. // looking for input reasonably, I don't declare the state done. We
  29233. // ignore a set of conflicting alts when we have an alternative
  29234. // that we still need to pursue.
  29235. //
  29236. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29237. var conflictingAlts = null;
  29238. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29239. conflictingAlts = new BitSet();
  29240. conflictingAlts.add(configs.uniqueAlt);
  29241. } else {
  29242. conflictingAlts = configs.conflictingAlts;
  29243. }
  29244. return conflictingAlts;
  29245. };
  29246. ParserATNSimulator.prototype.getTokenName = function (t) {
  29247. if (t === Token.EOF) {
  29248. return "EOF";
  29249. }
  29250. if (this.parser !== null && this.parser.literalNames !== null) {
  29251. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29252. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29253. console.log("" + this.parser.getInputStream().getTokens());
  29254. } else {
  29255. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29256. return name + "<" + t + ">";
  29257. }
  29258. }
  29259. return "" + t;
  29260. };
  29261. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29262. return this.getTokenName(input.LA(1));
  29263. };
  29264. // Used for debugging in adaptivePredict around execATN but I cut
  29265. // it out for clarity now that alg. works well. We can leave this
  29266. // "dead" code for a bit.
  29267. //
  29268. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29269. console.log("dead end configs: ");
  29270. var decs = nvae.getDeadEndConfigs();
  29271. for (var i = 0; i < decs.length; i++) {
  29272. var c = decs[i];
  29273. var trans = "no edges";
  29274. if (c.state.transitions.length > 0) {
  29275. var t = c.state.transitions[0];
  29276. if (t instanceof AtomTransition) {
  29277. trans = "Atom " + this.getTokenName(t.label);
  29278. } else if (t instanceof SetTransition) {
  29279. var neg = t instanceof NotSetTransition;
  29280. trans = (neg ? "~" : "") + "Set " + t.set;
  29281. }
  29282. }
  29283. console.error(c.toString(this.parser, true) + ":" + trans);
  29284. }
  29285. };
  29286. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29287. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29288. };
  29289. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29290. var alt = ATN.INVALID_ALT_NUMBER;
  29291. for (var i = 0; i < configs.items.length; i++) {
  29292. var c = configs.items[i];
  29293. if (alt === ATN.INVALID_ALT_NUMBER) {
  29294. alt = c.alt; // found first alt
  29295. } else if (c.alt !== alt) {
  29296. return ATN.INVALID_ALT_NUMBER;
  29297. }
  29298. }
  29299. return alt;
  29300. };
  29301. //
  29302. // Add an edge to the DFA, if possible. This method calls
  29303. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29304. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29305. // range of edges that can be represented in the DFA tables, this method
  29306. // returns without adding the edge to the DFA.
  29307. //
  29308. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29309. // Otherwise, this method returns the {@link DFAState} returned by calling
  29310. // {@link //addDFAState} for the {@code to} state.</p>
  29311. //
  29312. // @param dfa The DFA
  29313. // @param from The source state for the edge
  29314. // @param t The input symbol
  29315. // @param to The target state for the edge
  29316. //
  29317. // @return If {@code to} is {@code null}, this method returns {@code null};
  29318. // otherwise this method returns the result of calling {@link //addDFAState}
  29319. // on {@code to}
  29320. //
  29321. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29322. if (this.debug) {
  29323. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29324. }
  29325. if (to === null) {
  29326. return null;
  29327. }
  29328. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29329. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29330. return to;
  29331. }
  29332. if (from_.edges === null) {
  29333. from_.edges = [];
  29334. }
  29335. from_.edges[t + 1] = to; // connect
  29336. if (this.debug) {
  29337. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29338. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29339. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29340. }
  29341. return to;
  29342. };
  29343. //
  29344. // Add state {@code D} to the DFA if it is not already present, and return
  29345. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29346. // is already in the DFA, the existing state is returned. Otherwise this
  29347. // method returns {@code D} after adding it to the DFA.
  29348. //
  29349. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29350. // does not change the DFA.</p>
  29351. //
  29352. // @param dfa The dfa
  29353. // @param D The DFA state to add
  29354. // @return The state stored in the DFA. This will be either the existing
  29355. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29356. // state was not already present.
  29357. //
  29358. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29359. if (D == ATNSimulator.ERROR) {
  29360. return D;
  29361. }
  29362. var existing = dfa.states.get(D);
  29363. if (existing !== null) {
  29364. return existing;
  29365. }
  29366. D.stateNumber = dfa.states.length;
  29367. if (!D.configs.readOnly) {
  29368. D.configs.optimizeConfigs(this);
  29369. D.configs.setReadonly(true);
  29370. }
  29371. dfa.states.add(D);
  29372. if (this.debug) {
  29373. console.log("adding new DFA state: " + D);
  29374. }
  29375. return D;
  29376. };
  29377. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29378. if (this.debug || this.retry_debug) {
  29379. var interval = new Interval(startIndex, stopIndex + 1);
  29380. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29381. }
  29382. if (this.parser !== null) {
  29383. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29384. }
  29385. };
  29386. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29387. if (this.debug || this.retry_debug) {
  29388. var interval = new Interval(startIndex, stopIndex + 1);
  29389. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29390. }
  29391. if (this.parser !== null) {
  29392. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29393. }
  29394. };
  29395. // If context sensitive parsing, we know it's ambiguity not conflict//
  29396. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29397. if (this.debug || this.retry_debug) {
  29398. var interval = new Interval(startIndex, stopIndex + 1);
  29399. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29400. }
  29401. if (this.parser !== null) {
  29402. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29403. }
  29404. };
  29405. exports.ParserATNSimulator = ParserATNSimulator;
  29406. /***/ }),
  29407. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29408. /*!***************************************************!*\
  29409. !*** ./node_modules/antlr4/atn/PredictionMode.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. //
  29421. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29422. // utility methods for analyzing configuration sets for conflicts and/or
  29423. // ambiguities.
  29424. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29425. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29426. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29427. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29428. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29429. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29430. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29431. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29432. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29433. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29434. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29435. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29436. function PredictionMode() {
  29437. return this;
  29438. }
  29439. //
  29440. // The SLL(*) prediction mode. This prediction mode ignores the current
  29441. // parser context when making predictions. This is the fastest prediction
  29442. // mode, and provides correct results for many grammars. This prediction
  29443. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29444. // may result in syntax errors for grammar and input combinations which are
  29445. // not SLL.
  29446. //
  29447. // <p>
  29448. // When using this prediction mode, the parser will either return a correct
  29449. // parse tree (i.e. the same parse tree that would be returned with the
  29450. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29451. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29452. // it may be due to either an actual syntax error in the input or indicate
  29453. // that the particular combination of grammar and input requires the more
  29454. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29455. //
  29456. // <p>
  29457. // This prediction mode does not provide any guarantees for prediction
  29458. // behavior for syntactically-incorrect inputs.</p>
  29459. //
  29460. PredictionMode.SLL = 0;
  29461. //
  29462. // The LL(*) prediction mode. This prediction mode allows the current parser
  29463. // context to be used for resolving SLL conflicts that occur during
  29464. // prediction. This is the fastest prediction mode that guarantees correct
  29465. // parse results for all combinations of grammars with syntactically correct
  29466. // inputs.
  29467. //
  29468. // <p>
  29469. // When using this prediction mode, the parser will make correct decisions
  29470. // for all syntactically-correct grammar and input combinations. However, in
  29471. // cases where the grammar is truly ambiguous this prediction mode might not
  29472. // report a precise answer for <em>exactly which</em> alternatives are
  29473. // ambiguous.</p>
  29474. //
  29475. // <p>
  29476. // This prediction mode does not provide any guarantees for prediction
  29477. // behavior for syntactically-incorrect inputs.</p>
  29478. //
  29479. PredictionMode.LL = 1;
  29480. //
  29481. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29482. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29483. // this prediction mode instructs the prediction algorithm to determine the
  29484. // complete and exact set of ambiguous alternatives for every ambiguous
  29485. // decision encountered while parsing.
  29486. //
  29487. // <p>
  29488. // This prediction mode may be used for diagnosing ambiguities during
  29489. // grammar development. Due to the performance overhead of calculating sets
  29490. // of ambiguous alternatives, this prediction mode should be avoided when
  29491. // the exact results are not necessary.</p>
  29492. //
  29493. // <p>
  29494. // This prediction mode does not provide any guarantees for prediction
  29495. // behavior for syntactically-incorrect inputs.</p>
  29496. //
  29497. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29498. //
  29499. // Computes the SLL prediction termination condition.
  29500. //
  29501. // <p>
  29502. // This method computes the SLL prediction termination condition for both of
  29503. // the following cases.</p>
  29504. //
  29505. // <ul>
  29506. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  29507. // <li>Pure SLL without LL fallback</li>
  29508. // </ul>
  29509. //
  29510. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  29511. //
  29512. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  29513. // ensured regardless of how the termination condition is computed by this
  29514. // method. Due to the substantially higher cost of LL prediction, the
  29515. // prediction should only fall back to LL when the additional lookahead
  29516. // cannot lead to a unique SLL prediction.</p>
  29517. //
  29518. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  29519. // conflicting subsets should fall back to full LL, even if the
  29520. // configuration sets don't resolve to the same alternative (e.g.
  29521. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  29522. // configuration, SLL could continue with the hopes that more lookahead will
  29523. // resolve via one of those non-conflicting configurations.</p>
  29524. //
  29525. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  29526. // stops when it sees only conflicting configuration subsets. In contrast,
  29527. // full LL keeps going when there is uncertainty.</p>
  29528. //
  29529. // <p><strong>HEURISTIC</strong></p>
  29530. //
  29531. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  29532. // unless we see a state that only has one alternative associated with it.
  29533. // The single-alt-state thing lets prediction continue upon rules like
  29534. // (otherwise, it would admit defeat too soon):</p>
  29535. //
  29536. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  29537. //
  29538. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  29539. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  29540. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  29541. // processing this node because alternative to has another way to continue,
  29542. // via {@code [6|2|[]]}.</p>
  29543. //
  29544. // <p>It also let's us continue for this rule:</p>
  29545. //
  29546. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  29547. //
  29548. // <p>After matching input A, we reach the stop state for rule A, state 1.
  29549. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29550. // conflict and no amount of further lookahead will separate the two.
  29551. // However, alternative 3 will be able to continue and so we do not stop
  29552. // working on this state. In the previous example, we're concerned with
  29553. // states associated with the conflicting alternatives. Here alt 3 is not
  29554. // associated with the conflicting configs, but since we can continue
  29555. // looking for input reasonably, don't declare the state done.</p>
  29556. //
  29557. // <p><strong>PURE SLL PARSING</strong></p>
  29558. //
  29559. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  29560. // combine stack contexts for configurations that differ only by semantic
  29561. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  29562. //
  29563. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  29564. //
  29565. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  29566. // states because they need to create the DFA cache that works in all
  29567. // semantic situations. In contrast, full LL evaluates predicates collected
  29568. // during start state computation so it can ignore predicates thereafter.
  29569. // This means that SLL termination detection can totally ignore semantic
  29570. // predicates.</p>
  29571. //
  29572. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  29573. // semantic predicate contexts so we might see two configurations like the
  29574. // following.</p>
  29575. //
  29576. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  29577. //
  29578. // <p>Before testing these configurations against others, we have to merge
  29579. // {@code x} and {@code x'} (without modifying the existing configurations).
  29580. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  29581. // the following configurations.</p>
  29582. //
  29583. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  29584. //
  29585. // <p>If the configuration set has predicates (as indicated by
  29586. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  29587. // the configurations to strip out all of the predicates so that a standard
  29588. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  29589. //
  29590. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  29591. // Configs in rule stop states indicate reaching the end of the decision
  29592. // rule (local context) or end of start rule (full context). If all
  29593. // configs meet this condition, then none of the configurations is able
  29594. // to match additional input so we terminate prediction.
  29595. //
  29596. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29597. return true;
  29598. }
  29599. // pure SLL mode parsing
  29600. if (mode === PredictionMode.SLL) {
  29601. // Don't bother with combining configs from different semantic
  29602. // contexts if we can fail over to full LL; costs more time
  29603. // since we'll often fail over anyway.
  29604. if (configs.hasSemanticContext) {
  29605. // dup configs, tossing out semantic predicates
  29606. var dup = new ATNConfigSet();
  29607. for (var i = 0; i < configs.items.length; i++) {
  29608. var c = configs.items[i];
  29609. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  29610. dup.add(c);
  29611. }
  29612. configs = dup;
  29613. }
  29614. // now we have combined contexts for configs with dissimilar preds
  29615. }
  29616. // pure SLL or combined SLL+LL mode parsing
  29617. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29618. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  29619. };
  29620. // Checks if any configuration in {@code configs} is in a
  29621. // {@link RuleStopState}. Configurations meeting this condition have reached
  29622. // the end of the decision rule (local context) or end of start rule (full
  29623. // context).
  29624. //
  29625. // @param configs the configuration set to test
  29626. // @return {@code true} if any configuration in {@code configs} is in a
  29627. // {@link RuleStopState}, otherwise {@code false}
  29628. PredictionMode.hasConfigInRuleStopState = function (configs) {
  29629. for (var i = 0; i < configs.items.length; i++) {
  29630. var c = configs.items[i];
  29631. if (c.state instanceof RuleStopState) {
  29632. return true;
  29633. }
  29634. }
  29635. return false;
  29636. };
  29637. // Checks if all configurations in {@code configs} are in a
  29638. // {@link RuleStopState}. Configurations meeting this condition have reached
  29639. // the end of the decision rule (local context) or end of start rule (full
  29640. // context).
  29641. //
  29642. // @param configs the configuration set to test
  29643. // @return {@code true} if all configurations in {@code configs} are in a
  29644. // {@link RuleStopState}, otherwise {@code false}
  29645. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  29646. for (var i = 0; i < configs.items.length; i++) {
  29647. var c = configs.items[i];
  29648. if (!(c.state instanceof RuleStopState)) {
  29649. return false;
  29650. }
  29651. }
  29652. return true;
  29653. };
  29654. //
  29655. // Full LL prediction termination.
  29656. //
  29657. // <p>Can we stop looking ahead during ATN simulation or is there some
  29658. // uncertainty as to which alternative we will ultimately pick, after
  29659. // consuming more input? Even if there are partial conflicts, we might know
  29660. // that everything is going to resolve to the same minimum alternative. That
  29661. // means we can stop since no more lookahead will change that fact. On the
  29662. // other hand, there might be multiple conflicts that resolve to different
  29663. // minimums. That means we need more look ahead to decide which of those
  29664. // alternatives we should predict.</p>
  29665. //
  29666. // <p>The basic idea is to split the set of configurations {@code C}, into
  29667. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  29668. // non-conflicting configurations. Two configurations conflict if they have
  29669. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  29670. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  29671. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  29672. //
  29673. // <p>Reduce these configuration subsets to the set of possible alternatives.
  29674. // You can compute the alternative subsets in one pass as follows:</p>
  29675. //
  29676. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  29677. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  29678. //
  29679. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  29680. //
  29681. // <pre>
  29682. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29683. // alt and not pred
  29684. // </pre>
  29685. //
  29686. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  29687. //
  29688. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  29689. // {@code s} and {@code ctx}.</p>
  29690. //
  29691. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  29692. // the union of these alternative subsets is a singleton, then no amount of
  29693. // more lookahead will help us. We will always pick that alternative. If,
  29694. // however, there is more than one alternative, then we are uncertain which
  29695. // alternative to predict and must continue looking for resolution. We may
  29696. // or may not discover an ambiguity in the future, even if there are no
  29697. // conflicting subsets this round.</p>
  29698. //
  29699. // <p>The biggest sin is to terminate early because it means we've made a
  29700. // decision but were uncertain as to the eventual outcome. We haven't used
  29701. // enough lookahead. On the other hand, announcing a conflict too late is no
  29702. // big deal; you will still have the conflict. It's just inefficient. It
  29703. // might even look until the end of file.</p>
  29704. //
  29705. // <p>No special consideration for semantic predicates is required because
  29706. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  29707. // no configuration contains a semantic context during the termination
  29708. // check.</p>
  29709. //
  29710. // <p><strong>CONFLICTING CONFIGS</strong></p>
  29711. //
  29712. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  29713. // when {@code i!=j} but {@code x=x'}. Because we merge all
  29714. // {@code (s, i, _)} configurations together, that means that there are at
  29715. // most {@code n} configurations associated with state {@code s} for
  29716. // {@code n} possible alternatives in the decision. The merged stacks
  29717. // complicate the comparison of configuration contexts {@code x} and
  29718. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  29719. // merge and checking to see if the merged result is either {@code x} or
  29720. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  29721. // is the superset, then {@code i} is the only possible prediction since the
  29722. // others resolve to {@code min(i)} as well. However, if {@code x} is
  29723. // associated with {@code j>i} then at least one stack configuration for
  29724. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  29725. // should keep going, looking for more lookahead due to the uncertainty.</p>
  29726. //
  29727. // <p>For simplicity, I'm doing a equality check between {@code x} and
  29728. // {@code x'} that lets the algorithm continue to consume lookahead longer
  29729. // than necessary. The reason I like the equality is of course the
  29730. // simplicity but also because that is the test you need to detect the
  29731. // alternatives that are actually in conflict.</p>
  29732. //
  29733. // <p><strong>CONTINUE/STOP RULE</strong></p>
  29734. //
  29735. // <p>Continue if union of resolved alternative sets from non-conflicting and
  29736. // conflicting alternative subsets has more than one alternative. We are
  29737. // uncertain about which alternative to predict.</p>
  29738. //
  29739. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  29740. // alternatives are still in the running for the amount of input we've
  29741. // consumed at this point. The conflicting sets let us to strip away
  29742. // configurations that won't lead to more states because we resolve
  29743. // conflicts to the configuration with a minimum alternate for the
  29744. // conflicting set.</p>
  29745. //
  29746. // <p><strong>CASES</strong></p>
  29747. //
  29748. // <ul>
  29749. //
  29750. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  29751. //
  29752. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  29753. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  29754. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29755. // {@code {1,3}} =&gt; continue
  29756. // </li>
  29757. //
  29758. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29759. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  29760. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29761. // {@code {1}} =&gt; stop and predict 1</li>
  29762. //
  29763. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29764. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  29765. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  29766. // ambiguity {@code {1,2}}</li>
  29767. //
  29768. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  29769. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  29770. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  29771. //
  29772. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  29773. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  29774. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  29775. //
  29776. // </ul>
  29777. //
  29778. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  29779. //
  29780. // <p>If all states report the same conflicting set of alternatives, then we
  29781. // know we have the exact ambiguity set.</p>
  29782. //
  29783. // <p><code>|A_<em>i</em>|&gt;1</code> and
  29784. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  29785. //
  29786. // <p>In other words, we continue examining lookahead until all {@code A_i}
  29787. // have more than one alternative and all {@code A_i} are the same. If
  29788. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  29789. // because the resolved set is {@code {1}}. To determine what the real
  29790. // ambiguity is, we have to know whether the ambiguity is between one and
  29791. // two or one and three so we keep going. We can only stop prediction when
  29792. // we need exact ambiguity detection when the sets look like
  29793. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  29794. //
  29795. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  29796. return PredictionMode.getSingleViableAlt(altsets);
  29797. };
  29798. //
  29799. // Determines if every alternative subset in {@code altsets} contains more
  29800. // than one alternative.
  29801. //
  29802. // @param altsets a collection of alternative subsets
  29803. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  29804. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29805. //
  29806. PredictionMode.allSubsetsConflict = function (altsets) {
  29807. return !PredictionMode.hasNonConflictingAltSet(altsets);
  29808. };
  29809. //
  29810. // Determines if any single alternative subset in {@code altsets} contains
  29811. // exactly one alternative.
  29812. //
  29813. // @param altsets a collection of alternative subsets
  29814. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29815. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  29816. //
  29817. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  29818. for (var i = 0; i < altsets.length; i++) {
  29819. var alts = altsets[i];
  29820. if (alts.length === 1) {
  29821. return true;
  29822. }
  29823. }
  29824. return false;
  29825. };
  29826. //
  29827. // Determines if any single alternative subset in {@code altsets} contains
  29828. // more than one alternative.
  29829. //
  29830. // @param altsets a collection of alternative subsets
  29831. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29832. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29833. //
  29834. PredictionMode.hasConflictingAltSet = function (altsets) {
  29835. for (var i = 0; i < altsets.length; i++) {
  29836. var alts = altsets[i];
  29837. if (alts.length > 1) {
  29838. return true;
  29839. }
  29840. }
  29841. return false;
  29842. };
  29843. //
  29844. // Determines if every alternative subset in {@code altsets} is equivalent.
  29845. //
  29846. // @param altsets a collection of alternative subsets
  29847. // @return {@code true} if every member of {@code altsets} is equal to the
  29848. // others, otherwise {@code false}
  29849. //
  29850. PredictionMode.allSubsetsEqual = function (altsets) {
  29851. var first = null;
  29852. for (var i = 0; i < altsets.length; i++) {
  29853. var alts = altsets[i];
  29854. if (first === null) {
  29855. first = alts;
  29856. } else if (alts !== first) {
  29857. return false;
  29858. }
  29859. }
  29860. return true;
  29861. };
  29862. //
  29863. // Returns the unique alternative predicted by all alternative subsets in
  29864. // {@code altsets}. If no such alternative exists, this method returns
  29865. // {@link ATN//INVALID_ALT_NUMBER}.
  29866. //
  29867. // @param altsets a collection of alternative subsets
  29868. //
  29869. PredictionMode.getUniqueAlt = function (altsets) {
  29870. var all = PredictionMode.getAlts(altsets);
  29871. if (all.length === 1) {
  29872. return all.minValue();
  29873. } else {
  29874. return ATN.INVALID_ALT_NUMBER;
  29875. }
  29876. };
  29877. // Gets the complete set of represented alternatives for a collection of
  29878. // alternative subsets. This method returns the union of each {@link BitSet}
  29879. // in {@code altsets}.
  29880. //
  29881. // @param altsets a collection of alternative subsets
  29882. // @return the set of represented alternatives in {@code altsets}
  29883. //
  29884. PredictionMode.getAlts = function (altsets) {
  29885. var all = new BitSet();
  29886. altsets.map(function (alts) {
  29887. all.or(alts);
  29888. });
  29889. return all;
  29890. };
  29891. //
  29892. // This function gets the conflicting alt subsets from a configuration set.
  29893. // For each configuration {@code c} in {@code configs}:
  29894. //
  29895. // <pre>
  29896. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29897. // alt and not pred
  29898. // </pre>
  29899. PredictionMode.getConflictingAltSubsets = function (configs) {
  29900. var configToAlts = new Map();
  29901. configToAlts.hashFunction = function (cfg) {
  29902. hashStuff(cfg.state.stateNumber, cfg.context);
  29903. };
  29904. configToAlts.equalsFunction = function (c1, c2) {
  29905. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  29906. };
  29907. configs.items.map(function (cfg) {
  29908. var alts = configToAlts.get(cfg);
  29909. if (alts === null) {
  29910. alts = new BitSet();
  29911. configToAlts.put(cfg, alts);
  29912. }
  29913. alts.add(cfg.alt);
  29914. });
  29915. return configToAlts.getValues();
  29916. };
  29917. //
  29918. // Get a map from state to alt subset from a configuration set. For each
  29919. // configuration {@code c} in {@code configs}:
  29920. //
  29921. // <pre>
  29922. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  29923. // </pre>
  29924. //
  29925. PredictionMode.getStateToAltMap = function (configs) {
  29926. var m = new AltDict();
  29927. configs.items.map(function (c) {
  29928. var alts = m.get(c.state);
  29929. if (alts === null) {
  29930. alts = new BitSet();
  29931. m.put(c.state, alts);
  29932. }
  29933. alts.add(c.alt);
  29934. });
  29935. return m;
  29936. };
  29937. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  29938. var values = PredictionMode.getStateToAltMap(configs).values();
  29939. for (var i = 0; i < values.length; i++) {
  29940. if (values[i].length === 1) {
  29941. return true;
  29942. }
  29943. }
  29944. return false;
  29945. };
  29946. PredictionMode.getSingleViableAlt = function (altsets) {
  29947. var result = null;
  29948. for (var i = 0; i < altsets.length; i++) {
  29949. var alts = altsets[i];
  29950. var minAlt = alts.minValue();
  29951. if (result === null) {
  29952. result = minAlt;
  29953. } else if (result !== minAlt) {
  29954. // more than 1 viable alt
  29955. return ATN.INVALID_ALT_NUMBER;
  29956. }
  29957. }
  29958. return result;
  29959. };
  29960. exports.PredictionMode = PredictionMode;
  29961. /***/ }),
  29962. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  29963. /*!****************************************************!*\
  29964. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  29965. \****************************************************/
  29966. /*! no static exports found */
  29967. /***/ (function(module, exports, __webpack_require__) {
  29968. "use strict";
  29969. //
  29970. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29971. * Use of this file is governed by the BSD 3-clause license that
  29972. * can be found in the LICENSE.txt file in the project root.
  29973. */
  29974. //
  29975. // A tree structure used to record the semantic context in which
  29976. // an ATN configuration is valid. It's either a single predicate,
  29977. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  29978. //
  29979. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  29980. // {@link SemanticContext} within the scope of this outer class.</p>
  29981. //
  29982. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29983. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29984. function SemanticContext() {
  29985. return this;
  29986. }
  29987. SemanticContext.prototype.hashCode = function () {
  29988. var hash = new Hash();
  29989. this.updateHashCode(hash);
  29990. return hash.finish();
  29991. };
  29992. // For context independent predicates, we evaluate them without a local
  29993. // context (i.e., null context). That way, we can evaluate them without
  29994. // having to create proper rule-specific context during prediction (as
  29995. // opposed to the parser, which creates them naturally). In a practical
  29996. // sense, this avoids a cast exception from RuleContext to myruleContext.
  29997. //
  29998. // <p>For context dependent predicates, we must pass in a local context so that
  29999. // references such as $arg evaluate properly as _localctx.arg. We only
  30000. // capture context dependent predicates in the context in which we begin
  30001. // prediction, so we passed in the outer context here in case of context
  30002. // dependent predicate evaluation.</p>
  30003. //
  30004. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  30005. //
  30006. // Evaluate the precedence predicates for the context and reduce the result.
  30007. //
  30008. // @param parser The parser instance.
  30009. // @param outerContext The current parser context object.
  30010. // @return The simplified semantic context after precedence predicates are
  30011. // evaluated, which will be one of the following values.
  30012. // <ul>
  30013. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  30014. // precedence predicates are evaluated.</li>
  30015. // <li>{@code null}: if the predicate simplifies to {@code false} after
  30016. // precedence predicates are evaluated.</li>
  30017. // <li>{@code this}: if the semantic context is not changed as a result of
  30018. // precedence predicate evaluation.</li>
  30019. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  30020. // semantic context after precedence predicates are evaluated.</li>
  30021. // </ul>
  30022. //
  30023. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  30024. return this;
  30025. };
  30026. SemanticContext.andContext = function (a, b) {
  30027. if (a === null || a === SemanticContext.NONE) {
  30028. return b;
  30029. }
  30030. if (b === null || b === SemanticContext.NONE) {
  30031. return a;
  30032. }
  30033. var result = new AND(a, b);
  30034. if (result.opnds.length === 1) {
  30035. return result.opnds[0];
  30036. } else {
  30037. return result;
  30038. }
  30039. };
  30040. SemanticContext.orContext = function (a, b) {
  30041. if (a === null) {
  30042. return b;
  30043. }
  30044. if (b === null) {
  30045. return a;
  30046. }
  30047. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  30048. return SemanticContext.NONE;
  30049. }
  30050. var result = new OR(a, b);
  30051. if (result.opnds.length === 1) {
  30052. return result.opnds[0];
  30053. } else {
  30054. return result;
  30055. }
  30056. };
  30057. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  30058. SemanticContext.call(this);
  30059. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  30060. this.predIndex = predIndex === undefined ? -1 : predIndex;
  30061. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30062. return this;
  30063. }
  30064. Predicate.prototype = Object.create(SemanticContext.prototype);
  30065. Predicate.prototype.constructor = Predicate;
  30066. //The default {@link SemanticContext}, which is semantically equivalent to
  30067. //a predicate of the form {@code {true}?}.
  30068. //
  30069. SemanticContext.NONE = new Predicate();
  30070. Predicate.prototype.evaluate = function (parser, outerContext) {
  30071. var localctx = this.isCtxDependent ? outerContext : null;
  30072. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  30073. };
  30074. Predicate.prototype.updateHashCode = function (hash) {
  30075. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30076. };
  30077. Predicate.prototype.equals = function (other) {
  30078. if (this === other) {
  30079. return true;
  30080. } else if (!(other instanceof Predicate)) {
  30081. return false;
  30082. } else {
  30083. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  30084. }
  30085. };
  30086. Predicate.prototype.toString = function () {
  30087. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  30088. };
  30089. function PrecedencePredicate(precedence) {
  30090. SemanticContext.call(this);
  30091. this.precedence = precedence === undefined ? 0 : precedence;
  30092. }
  30093. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  30094. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30095. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30096. return parser.precpred(outerContext, this.precedence);
  30097. };
  30098. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30099. if (parser.precpred(outerContext, this.precedence)) {
  30100. return SemanticContext.NONE;
  30101. } else {
  30102. return null;
  30103. }
  30104. };
  30105. PrecedencePredicate.prototype.compareTo = function (other) {
  30106. return this.precedence - other.precedence;
  30107. };
  30108. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30109. hash.update(31);
  30110. };
  30111. PrecedencePredicate.prototype.equals = function (other) {
  30112. if (this === other) {
  30113. return true;
  30114. } else if (!(other instanceof PrecedencePredicate)) {
  30115. return false;
  30116. } else {
  30117. return this.precedence === other.precedence;
  30118. }
  30119. };
  30120. PrecedencePredicate.prototype.toString = function () {
  30121. return "{" + this.precedence + ">=prec}?";
  30122. };
  30123. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30124. var result = [];
  30125. set.values().map(function (context) {
  30126. if (context instanceof PrecedencePredicate) {
  30127. result.push(context);
  30128. }
  30129. });
  30130. return result;
  30131. };
  30132. // A semantic context which is true whenever none of the contained contexts
  30133. // is false.
  30134. //
  30135. function AND(a, b) {
  30136. SemanticContext.call(this);
  30137. var operands = new Set();
  30138. if (a instanceof AND) {
  30139. a.opnds.map(function (o) {
  30140. operands.add(o);
  30141. });
  30142. } else {
  30143. operands.add(a);
  30144. }
  30145. if (b instanceof AND) {
  30146. b.opnds.map(function (o) {
  30147. operands.add(o);
  30148. });
  30149. } else {
  30150. operands.add(b);
  30151. }
  30152. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30153. if (precedencePredicates.length > 0) {
  30154. // interested in the transition with the lowest precedence
  30155. var reduced = null;
  30156. precedencePredicates.map(function (p) {
  30157. if (reduced === null || p.precedence < reduced.precedence) {
  30158. reduced = p;
  30159. }
  30160. });
  30161. operands.add(reduced);
  30162. }
  30163. this.opnds = operands.values();
  30164. return this;
  30165. }
  30166. AND.prototype = Object.create(SemanticContext.prototype);
  30167. AND.prototype.constructor = AND;
  30168. AND.prototype.equals = function (other) {
  30169. if (this === other) {
  30170. return true;
  30171. } else if (!(other instanceof AND)) {
  30172. return false;
  30173. } else {
  30174. return this.opnds === other.opnds;
  30175. }
  30176. };
  30177. AND.prototype.updateHashCode = function (hash) {
  30178. hash.update(this.opnds, "AND");
  30179. };
  30180. //
  30181. // {@inheritDoc}
  30182. //
  30183. // <p>
  30184. // The evaluation of predicates by this context is short-circuiting, but
  30185. // unordered.</p>
  30186. //
  30187. AND.prototype.evaluate = function (parser, outerContext) {
  30188. for (var i = 0; i < this.opnds.length; i++) {
  30189. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30190. return false;
  30191. }
  30192. }
  30193. return true;
  30194. };
  30195. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30196. var differs = false;
  30197. var operands = [];
  30198. for (var i = 0; i < this.opnds.length; i++) {
  30199. var context = this.opnds[i];
  30200. var evaluated = context.evalPrecedence(parser, outerContext);
  30201. differs |= evaluated !== context;
  30202. if (evaluated === null) {
  30203. // The AND context is false if any element is false
  30204. return null;
  30205. } else if (evaluated !== SemanticContext.NONE) {
  30206. // Reduce the result by skipping true elements
  30207. operands.push(evaluated);
  30208. }
  30209. }
  30210. if (!differs) {
  30211. return this;
  30212. }
  30213. if (operands.length === 0) {
  30214. // all elements were true, so the AND context is true
  30215. return SemanticContext.NONE;
  30216. }
  30217. var result = null;
  30218. operands.map(function (o) {
  30219. result = result === null ? o : SemanticContext.andContext(result, o);
  30220. });
  30221. return result;
  30222. };
  30223. AND.prototype.toString = function () {
  30224. var s = "";
  30225. this.opnds.map(function (o) {
  30226. s += "&& " + o.toString();
  30227. });
  30228. return s.length > 3 ? s.slice(3) : s;
  30229. };
  30230. //
  30231. // A semantic context which is true whenever at least one of the contained
  30232. // contexts is true.
  30233. //
  30234. function OR(a, b) {
  30235. SemanticContext.call(this);
  30236. var operands = new Set();
  30237. if (a instanceof OR) {
  30238. a.opnds.map(function (o) {
  30239. operands.add(o);
  30240. });
  30241. } else {
  30242. operands.add(a);
  30243. }
  30244. if (b instanceof OR) {
  30245. b.opnds.map(function (o) {
  30246. operands.add(o);
  30247. });
  30248. } else {
  30249. operands.add(b);
  30250. }
  30251. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30252. if (precedencePredicates.length > 0) {
  30253. // interested in the transition with the highest precedence
  30254. var s = precedencePredicates.sort(function (a, b) {
  30255. return a.compareTo(b);
  30256. });
  30257. var reduced = s[s.length - 1];
  30258. operands.add(reduced);
  30259. }
  30260. this.opnds = operands.values();
  30261. return this;
  30262. }
  30263. OR.prototype = Object.create(SemanticContext.prototype);
  30264. OR.prototype.constructor = OR;
  30265. OR.prototype.constructor = function (other) {
  30266. if (this === other) {
  30267. return true;
  30268. } else if (!(other instanceof OR)) {
  30269. return false;
  30270. } else {
  30271. return this.opnds === other.opnds;
  30272. }
  30273. };
  30274. OR.prototype.updateHashCode = function (hash) {
  30275. hash.update(this.opnds, "OR");
  30276. };
  30277. // <p>
  30278. // The evaluation of predicates by this context is short-circuiting, but
  30279. // unordered.</p>
  30280. //
  30281. OR.prototype.evaluate = function (parser, outerContext) {
  30282. for (var i = 0; i < this.opnds.length; i++) {
  30283. if (this.opnds[i].evaluate(parser, outerContext)) {
  30284. return true;
  30285. }
  30286. }
  30287. return false;
  30288. };
  30289. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30290. var differs = false;
  30291. var operands = [];
  30292. for (var i = 0; i < this.opnds.length; i++) {
  30293. var context = this.opnds[i];
  30294. var evaluated = context.evalPrecedence(parser, outerContext);
  30295. differs |= evaluated !== context;
  30296. if (evaluated === SemanticContext.NONE) {
  30297. // The OR context is true if any element is true
  30298. return SemanticContext.NONE;
  30299. } else if (evaluated !== null) {
  30300. // Reduce the result by skipping false elements
  30301. operands.push(evaluated);
  30302. }
  30303. }
  30304. if (!differs) {
  30305. return this;
  30306. }
  30307. if (operands.length === 0) {
  30308. // all elements were false, so the OR context is false
  30309. return null;
  30310. }
  30311. var result = null;
  30312. operands.map(function (o) {
  30313. return result === null ? o : SemanticContext.orContext(result, o);
  30314. });
  30315. return result;
  30316. };
  30317. OR.prototype.toString = function () {
  30318. var s = "";
  30319. this.opnds.map(function (o) {
  30320. s += "|| " + o.toString();
  30321. });
  30322. return s.length > 3 ? s.slice(3) : s;
  30323. };
  30324. exports.SemanticContext = SemanticContext;
  30325. exports.PrecedencePredicate = PrecedencePredicate;
  30326. exports.Predicate = Predicate;
  30327. /***/ }),
  30328. /***/ "./node_modules/antlr4/atn/Transition.js":
  30329. /*!***********************************************!*\
  30330. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30331. \***********************************************/
  30332. /*! no static exports found */
  30333. /***/ (function(module, exports, __webpack_require__) {
  30334. "use strict";
  30335. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30336. * Use of this file is governed by the BSD 3-clause license that
  30337. * can be found in the LICENSE.txt file in the project root.
  30338. */
  30339. //
  30340. // An ATN transition between any two ATN states. Subclasses define
  30341. // atom, set, epsilon, action, predicate, rule transitions.
  30342. //
  30343. // <p>This is a one way link. It emanates from a state (usually via a list of
  30344. // transitions) and has a target state.</p>
  30345. //
  30346. // <p>Since we never have to change the ATN transitions once we construct it,
  30347. // we can fix these transitions as specific classes. The DFA transitions
  30348. // on the other hand need to update the labels as it adds transitions to
  30349. // the states. We'll use the term Edge for the DFA to distinguish them from
  30350. // ATN transitions.</p>
  30351. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30352. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30353. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30354. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30355. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30356. function Transition(target) {
  30357. // The target of this transition.
  30358. if (target === undefined || target === null) {
  30359. throw "target cannot be null.";
  30360. }
  30361. this.target = target;
  30362. // Are we epsilon, action, sempred?
  30363. this.isEpsilon = false;
  30364. this.label = null;
  30365. return this;
  30366. }
  30367. // constants for serialization
  30368. Transition.EPSILON = 1;
  30369. Transition.RANGE = 2;
  30370. Transition.RULE = 3;
  30371. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30372. Transition.ATOM = 5;
  30373. Transition.ACTION = 6;
  30374. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30375. Transition.NOT_SET = 8;
  30376. Transition.WILDCARD = 9;
  30377. Transition.PRECEDENCE = 10;
  30378. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30379. Transition.serializationTypes = {
  30380. EpsilonTransition: Transition.EPSILON,
  30381. RangeTransition: Transition.RANGE,
  30382. RuleTransition: Transition.RULE,
  30383. PredicateTransition: Transition.PREDICATE,
  30384. AtomTransition: Transition.ATOM,
  30385. ActionTransition: Transition.ACTION,
  30386. SetTransition: Transition.SET,
  30387. NotSetTransition: Transition.NOT_SET,
  30388. WildcardTransition: Transition.WILDCARD,
  30389. PrecedencePredicateTransition: Transition.PRECEDENCE
  30390. };
  30391. // TODO: make all transitions sets? no, should remove set edges
  30392. function AtomTransition(target, label) {
  30393. Transition.call(this, target);
  30394. this.label_ = label; // The token type or character value; or, signifies special label.
  30395. this.label = this.makeLabel();
  30396. this.serializationType = Transition.ATOM;
  30397. return this;
  30398. }
  30399. AtomTransition.prototype = Object.create(Transition.prototype);
  30400. AtomTransition.prototype.constructor = AtomTransition;
  30401. AtomTransition.prototype.makeLabel = function () {
  30402. var s = new IntervalSet();
  30403. s.addOne(this.label_);
  30404. return s;
  30405. };
  30406. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30407. return this.label_ === symbol;
  30408. };
  30409. AtomTransition.prototype.toString = function () {
  30410. return this.label_;
  30411. };
  30412. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30413. Transition.call(this, ruleStart);
  30414. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30415. this.precedence = precedence;
  30416. this.followState = followState; // what node to begin computations following ref to rule
  30417. this.serializationType = Transition.RULE;
  30418. this.isEpsilon = true;
  30419. return this;
  30420. }
  30421. RuleTransition.prototype = Object.create(Transition.prototype);
  30422. RuleTransition.prototype.constructor = RuleTransition;
  30423. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30424. return false;
  30425. };
  30426. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30427. Transition.call(this, target);
  30428. this.serializationType = Transition.EPSILON;
  30429. this.isEpsilon = true;
  30430. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30431. return this;
  30432. }
  30433. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30434. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30435. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30436. return false;
  30437. };
  30438. EpsilonTransition.prototype.toString = function () {
  30439. return "epsilon";
  30440. };
  30441. function RangeTransition(target, start, stop) {
  30442. Transition.call(this, target);
  30443. this.serializationType = Transition.RANGE;
  30444. this.start = start;
  30445. this.stop = stop;
  30446. this.label = this.makeLabel();
  30447. return this;
  30448. }
  30449. RangeTransition.prototype = Object.create(Transition.prototype);
  30450. RangeTransition.prototype.constructor = RangeTransition;
  30451. RangeTransition.prototype.makeLabel = function () {
  30452. var s = new IntervalSet();
  30453. s.addRange(this.start, this.stop);
  30454. return s;
  30455. };
  30456. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30457. return symbol >= this.start && symbol <= this.stop;
  30458. };
  30459. RangeTransition.prototype.toString = function () {
  30460. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30461. };
  30462. function AbstractPredicateTransition(target) {
  30463. Transition.call(this, target);
  30464. return this;
  30465. }
  30466. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30467. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30468. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30469. AbstractPredicateTransition.call(this, target);
  30470. this.serializationType = Transition.PREDICATE;
  30471. this.ruleIndex = ruleIndex;
  30472. this.predIndex = predIndex;
  30473. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30474. this.isEpsilon = true;
  30475. return this;
  30476. }
  30477. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30478. PredicateTransition.prototype.constructor = PredicateTransition;
  30479. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30480. return false;
  30481. };
  30482. PredicateTransition.prototype.getPredicate = function () {
  30483. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30484. };
  30485. PredicateTransition.prototype.toString = function () {
  30486. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30487. };
  30488. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30489. Transition.call(this, target);
  30490. this.serializationType = Transition.ACTION;
  30491. this.ruleIndex = ruleIndex;
  30492. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30493. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30494. this.isEpsilon = true;
  30495. return this;
  30496. }
  30497. ActionTransition.prototype = Object.create(Transition.prototype);
  30498. ActionTransition.prototype.constructor = ActionTransition;
  30499. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30500. return false;
  30501. };
  30502. ActionTransition.prototype.toString = function () {
  30503. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  30504. };
  30505. // A transition containing a set of values.
  30506. function SetTransition(target, set) {
  30507. Transition.call(this, target);
  30508. this.serializationType = Transition.SET;
  30509. if (set !== undefined && set !== null) {
  30510. this.label = set;
  30511. } else {
  30512. this.label = new IntervalSet();
  30513. this.label.addOne(Token.INVALID_TYPE);
  30514. }
  30515. return this;
  30516. }
  30517. SetTransition.prototype = Object.create(Transition.prototype);
  30518. SetTransition.prototype.constructor = SetTransition;
  30519. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30520. return this.label.contains(symbol);
  30521. };
  30522. SetTransition.prototype.toString = function () {
  30523. return this.label.toString();
  30524. };
  30525. function NotSetTransition(target, set) {
  30526. SetTransition.call(this, target, set);
  30527. this.serializationType = Transition.NOT_SET;
  30528. return this;
  30529. }
  30530. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  30531. NotSetTransition.prototype.constructor = NotSetTransition;
  30532. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30533. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  30534. };
  30535. NotSetTransition.prototype.toString = function () {
  30536. return '~' + SetTransition.prototype.toString.call(this);
  30537. };
  30538. function WildcardTransition(target) {
  30539. Transition.call(this, target);
  30540. this.serializationType = Transition.WILDCARD;
  30541. return this;
  30542. }
  30543. WildcardTransition.prototype = Object.create(Transition.prototype);
  30544. WildcardTransition.prototype.constructor = WildcardTransition;
  30545. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30546. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  30547. };
  30548. WildcardTransition.prototype.toString = function () {
  30549. return ".";
  30550. };
  30551. function PrecedencePredicateTransition(target, precedence) {
  30552. AbstractPredicateTransition.call(this, target);
  30553. this.serializationType = Transition.PRECEDENCE;
  30554. this.precedence = precedence;
  30555. this.isEpsilon = true;
  30556. return this;
  30557. }
  30558. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30559. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  30560. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30561. return false;
  30562. };
  30563. PrecedencePredicateTransition.prototype.getPredicate = function () {
  30564. return new PrecedencePredicate(this.precedence);
  30565. };
  30566. PrecedencePredicateTransition.prototype.toString = function () {
  30567. return this.precedence + " >= _p";
  30568. };
  30569. exports.Transition = Transition;
  30570. exports.AtomTransition = AtomTransition;
  30571. exports.SetTransition = SetTransition;
  30572. exports.NotSetTransition = NotSetTransition;
  30573. exports.RuleTransition = RuleTransition;
  30574. exports.ActionTransition = ActionTransition;
  30575. exports.EpsilonTransition = EpsilonTransition;
  30576. exports.RangeTransition = RangeTransition;
  30577. exports.WildcardTransition = WildcardTransition;
  30578. exports.PredicateTransition = PredicateTransition;
  30579. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  30580. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  30581. /***/ }),
  30582. /***/ "./node_modules/antlr4/atn/index.js":
  30583. /*!******************************************!*\
  30584. !*** ./node_modules/antlr4/atn/index.js ***!
  30585. \******************************************/
  30586. /*! no static exports found */
  30587. /***/ (function(module, exports, __webpack_require__) {
  30588. "use strict";
  30589. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30590. * Use of this file is governed by the BSD 3-clause license that
  30591. * can be found in the LICENSE.txt file in the project root.
  30592. */
  30593. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30594. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  30595. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  30596. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  30597. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  30598. /***/ }),
  30599. /***/ "./node_modules/antlr4/dfa/DFA.js":
  30600. /*!****************************************!*\
  30601. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  30602. \****************************************/
  30603. /*! no static exports found */
  30604. /***/ (function(module, exports, __webpack_require__) {
  30605. "use strict";
  30606. //
  30607. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30608. * Use of this file is governed by the BSD 3-clause license that
  30609. * can be found in the LICENSE.txt file in the project root.
  30610. */
  30611. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30612. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  30613. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  30614. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30615. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30616. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30617. function DFA(atnStartState, decision) {
  30618. if (decision === undefined) {
  30619. decision = 0;
  30620. }
  30621. // From which ATN state did we create this DFA?
  30622. this.atnStartState = atnStartState;
  30623. this.decision = decision;
  30624. // A set of all DFA states. Use {@link Map} so we can get old state back
  30625. // ({@link Set} only allows you to see if it's there).
  30626. this._states = new Set();
  30627. this.s0 = null;
  30628. // {@code true} if this DFA is for a precedence decision; otherwise,
  30629. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  30630. // {@link //setPrecedenceDfa}.
  30631. this.precedenceDfa = false;
  30632. if (atnStartState instanceof StarLoopEntryState) {
  30633. if (atnStartState.isPrecedenceDecision) {
  30634. this.precedenceDfa = true;
  30635. var precedenceState = new DFAState(null, new ATNConfigSet());
  30636. precedenceState.edges = [];
  30637. precedenceState.isAcceptState = false;
  30638. precedenceState.requiresFullContext = false;
  30639. this.s0 = precedenceState;
  30640. }
  30641. }
  30642. return this;
  30643. }
  30644. // Get the start state for a specific precedence value.
  30645. //
  30646. // @param precedence The current precedence.
  30647. // @return The start state corresponding to the specified precedence, or
  30648. // {@code null} if no start state exists for the specified precedence.
  30649. //
  30650. // @throws IllegalStateException if this is not a precedence DFA.
  30651. // @see //isPrecedenceDfa()
  30652. DFA.prototype.getPrecedenceStartState = function (precedence) {
  30653. if (!this.precedenceDfa) {
  30654. throw "Only precedence DFAs may contain a precedence start state.";
  30655. }
  30656. // s0.edges is never null for a precedence DFA
  30657. if (precedence < 0 || precedence >= this.s0.edges.length) {
  30658. return null;
  30659. }
  30660. return this.s0.edges[precedence] || null;
  30661. };
  30662. // Set the start state for a specific precedence value.
  30663. //
  30664. // @param precedence The current precedence.
  30665. // @param startState The start state corresponding to the specified
  30666. // precedence.
  30667. //
  30668. // @throws IllegalStateException if this is not a precedence DFA.
  30669. // @see //isPrecedenceDfa()
  30670. //
  30671. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  30672. if (!this.precedenceDfa) {
  30673. throw "Only precedence DFAs may contain a precedence start state.";
  30674. }
  30675. if (precedence < 0) {
  30676. return;
  30677. }
  30678. // synchronization on s0 here is ok. when the DFA is turned into a
  30679. // precedence DFA, s0 will be initialized once and not updated again
  30680. // s0.edges is never null for a precedence DFA
  30681. this.s0.edges[precedence] = startState;
  30682. };
  30683. //
  30684. // Sets whether this is a precedence DFA. If the specified value differs
  30685. // from the current DFA configuration, the following actions are taken;
  30686. // otherwise no changes are made to the current DFA.
  30687. //
  30688. // <ul>
  30689. // <li>The {@link //states} map is cleared</li>
  30690. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  30691. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  30692. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  30693. // store the start states for individual precedence values.</li>
  30694. // <li>The {@link //precedenceDfa} field is updated</li>
  30695. // </ul>
  30696. //
  30697. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  30698. // {@code false}
  30699. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  30700. if (this.precedenceDfa !== precedenceDfa) {
  30701. this._states = new DFAStatesSet();
  30702. if (precedenceDfa) {
  30703. var precedenceState = new DFAState(null, new ATNConfigSet());
  30704. precedenceState.edges = [];
  30705. precedenceState.isAcceptState = false;
  30706. precedenceState.requiresFullContext = false;
  30707. this.s0 = precedenceState;
  30708. } else {
  30709. this.s0 = null;
  30710. }
  30711. this.precedenceDfa = precedenceDfa;
  30712. }
  30713. };
  30714. Object.defineProperty(DFA.prototype, "states", {
  30715. get: function get() {
  30716. return this._states;
  30717. }
  30718. });
  30719. // Return a list of all states in this DFA, ordered by state number.
  30720. DFA.prototype.sortedStates = function () {
  30721. var list = this._states.values();
  30722. return list.sort(function (a, b) {
  30723. return a.stateNumber - b.stateNumber;
  30724. });
  30725. };
  30726. DFA.prototype.toString = function (literalNames, symbolicNames) {
  30727. literalNames = literalNames || null;
  30728. symbolicNames = symbolicNames || null;
  30729. if (this.s0 === null) {
  30730. return "";
  30731. }
  30732. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  30733. return serializer.toString();
  30734. };
  30735. DFA.prototype.toLexerString = function () {
  30736. if (this.s0 === null) {
  30737. return "";
  30738. }
  30739. var serializer = new LexerDFASerializer(this);
  30740. return serializer.toString();
  30741. };
  30742. exports.DFA = DFA;
  30743. /***/ }),
  30744. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  30745. /*!**************************************************!*\
  30746. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  30747. \**************************************************/
  30748. /*! no static exports found */
  30749. /***/ (function(module, exports, __webpack_require__) {
  30750. "use strict";
  30751. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30752. * Use of this file is governed by the BSD 3-clause license that
  30753. * can be found in the LICENSE.txt file in the project root.
  30754. */
  30755. // A DFA walker that knows how to dump them to serialized strings.#/
  30756. function DFASerializer(dfa, literalNames, symbolicNames) {
  30757. this.dfa = dfa;
  30758. this.literalNames = literalNames || [];
  30759. this.symbolicNames = symbolicNames || [];
  30760. return this;
  30761. }
  30762. DFASerializer.prototype.toString = function () {
  30763. if (this.dfa.s0 === null) {
  30764. return null;
  30765. }
  30766. var buf = "";
  30767. var states = this.dfa.sortedStates();
  30768. for (var i = 0; i < states.length; i++) {
  30769. var s = states[i];
  30770. if (s.edges !== null) {
  30771. var n = s.edges.length;
  30772. for (var j = 0; j < n; j++) {
  30773. var t = s.edges[j] || null;
  30774. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  30775. buf = buf.concat(this.getStateString(s));
  30776. buf = buf.concat("-");
  30777. buf = buf.concat(this.getEdgeLabel(j));
  30778. buf = buf.concat("->");
  30779. buf = buf.concat(this.getStateString(t));
  30780. buf = buf.concat('\n');
  30781. }
  30782. }
  30783. }
  30784. }
  30785. return buf.length === 0 ? null : buf;
  30786. };
  30787. DFASerializer.prototype.getEdgeLabel = function (i) {
  30788. if (i === 0) {
  30789. return "EOF";
  30790. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  30791. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  30792. } else {
  30793. return String.fromCharCode(i - 1);
  30794. }
  30795. };
  30796. DFASerializer.prototype.getStateString = function (s) {
  30797. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  30798. if (s.isAcceptState) {
  30799. if (s.predicates !== null) {
  30800. return baseStateStr + "=>" + s.predicates.toString();
  30801. } else {
  30802. return baseStateStr + "=>" + s.prediction.toString();
  30803. }
  30804. } else {
  30805. return baseStateStr;
  30806. }
  30807. };
  30808. function LexerDFASerializer(dfa) {
  30809. DFASerializer.call(this, dfa, null);
  30810. return this;
  30811. }
  30812. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  30813. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  30814. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  30815. return "'" + String.fromCharCode(i) + "'";
  30816. };
  30817. exports.DFASerializer = DFASerializer;
  30818. exports.LexerDFASerializer = LexerDFASerializer;
  30819. /***/ }),
  30820. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  30821. /*!*********************************************!*\
  30822. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  30823. \*********************************************/
  30824. /*! no static exports found */
  30825. /***/ (function(module, exports, __webpack_require__) {
  30826. "use strict";
  30827. //
  30828. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30829. * Use of this file is governed by the BSD 3-clause license that
  30830. * can be found in the LICENSE.txt file in the project root.
  30831. */
  30832. ///
  30833. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30834. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30835. var Hash = Utils.Hash;
  30836. var Set = Utils.Set;
  30837. // Map a predicate to a predicted alternative.///
  30838. function PredPrediction(pred, alt) {
  30839. this.alt = alt;
  30840. this.pred = pred;
  30841. return this;
  30842. }
  30843. PredPrediction.prototype.toString = function () {
  30844. return "(" + this.pred + ", " + this.alt + ")";
  30845. };
  30846. // A DFA state represents a set of possible ATN configurations.
  30847. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  30848. // to keep track of all possible states the ATN can be in after
  30849. // reading each input symbol. That is to say, after reading
  30850. // input a1a2..an, the DFA is in a state that represents the
  30851. // subset T of the states of the ATN that are reachable from the
  30852. // ATN's start state along some path labeled a1a2..an."
  30853. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  30854. // would be a bitset representing the set of states the
  30855. // ATN could be in. We need to track the alt predicted by each
  30856. // state as well, however. More importantly, we need to maintain
  30857. // a stack of states, tracking the closure operations as they
  30858. // jump from rule to rule, emulating rule invocations (method calls).
  30859. // I have to add a stack to simulate the proper lookahead sequences for
  30860. // the underlying LL grammar from which the ATN was derived.
  30861. //
  30862. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  30863. // is both a state (ala normal conversion) and a RuleContext describing
  30864. // the chain of rules (if any) followed to arrive at that state.</p>
  30865. //
  30866. // <p>A DFA state may have multiple references to a particular state,
  30867. // but with different ATN contexts (with same or different alts)
  30868. // meaning that state was reached via a different set of rule invocations.</p>
  30869. // /
  30870. function DFAState(stateNumber, configs) {
  30871. if (stateNumber === null) {
  30872. stateNumber = -1;
  30873. }
  30874. if (configs === null) {
  30875. configs = new ATNConfigSet();
  30876. }
  30877. this.stateNumber = stateNumber;
  30878. this.configs = configs;
  30879. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  30880. // {@link Token//EOF} maps to {@code edges[0]}.
  30881. this.edges = null;
  30882. this.isAcceptState = false;
  30883. // if accept state, what ttype do we match or alt do we predict?
  30884. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  30885. // //predicates}{@code !=null} or
  30886. // {@link //requiresFullContext}.
  30887. this.prediction = 0;
  30888. this.lexerActionExecutor = null;
  30889. // Indicates that this state was created during SLL prediction that
  30890. // discovered a conflict between the configurations in the state. Future
  30891. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  30892. // full context prediction if this field is true.
  30893. this.requiresFullContext = false;
  30894. // During SLL parsing, this is a list of predicates associated with the
  30895. // ATN configurations of the DFA state. When we have predicates,
  30896. // {@link //requiresFullContext} is {@code false} since full context
  30897. // prediction evaluates predicates
  30898. // on-the-fly. If this is not null, then {@link //prediction} is
  30899. // {@link ATN//INVALID_ALT_NUMBER}.
  30900. //
  30901. // <p>We only use these for non-{@link //requiresFullContext} but
  30902. // conflicting states. That
  30903. // means we know from the context (it's $ or we don't dip into outer
  30904. // context) that it's an ambiguity not a conflict.</p>
  30905. //
  30906. // <p>This list is computed by {@link
  30907. // ParserATNSimulator//predicateDFAState}.</p>
  30908. this.predicates = null;
  30909. return this;
  30910. }
  30911. // Get the set of all alts mentioned by all ATN configurations in this
  30912. // DFA state.
  30913. DFAState.prototype.getAltSet = function () {
  30914. var alts = new Set();
  30915. if (this.configs !== null) {
  30916. for (var i = 0; i < this.configs.length; i++) {
  30917. var c = this.configs[i];
  30918. alts.add(c.alt);
  30919. }
  30920. }
  30921. if (alts.length === 0) {
  30922. return null;
  30923. } else {
  30924. return alts;
  30925. }
  30926. };
  30927. // Two {@link DFAState} instances are equal if their ATN configuration sets
  30928. // are the same. This method is used to see if a state already exists.
  30929. //
  30930. // <p>Because the number of alternatives and number of ATN configurations are
  30931. // finite, there is a finite number of DFA states that can be processed.
  30932. // This is necessary to show that the algorithm terminates.</p>
  30933. //
  30934. // <p>Cannot test the DFA state numbers here because in
  30935. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  30936. // exists that has this exact set of ATN configurations. The
  30937. // {@link //stateNumber} is irrelevant.</p>
  30938. DFAState.prototype.equals = function (other) {
  30939. // compare set of ATN configurations in this set with other
  30940. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  30941. };
  30942. DFAState.prototype.toString = function () {
  30943. var s = "" + this.stateNumber + ":" + this.configs;
  30944. if (this.isAcceptState) {
  30945. s = s + "=>";
  30946. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  30947. }
  30948. return s;
  30949. };
  30950. DFAState.prototype.hashCode = function () {
  30951. var hash = new Hash();
  30952. hash.update(this.configs);
  30953. if (this.isAcceptState) {
  30954. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  30955. }
  30956. return hash.finish();
  30957. };
  30958. exports.DFAState = DFAState;
  30959. exports.PredPrediction = PredPrediction;
  30960. /***/ }),
  30961. /***/ "./node_modules/antlr4/dfa/index.js":
  30962. /*!******************************************!*\
  30963. !*** ./node_modules/antlr4/dfa/index.js ***!
  30964. \******************************************/
  30965. /*! no static exports found */
  30966. /***/ (function(module, exports, __webpack_require__) {
  30967. "use strict";
  30968. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30969. * Use of this file is governed by the BSD 3-clause license that
  30970. * can be found in the LICENSE.txt file in the project root.
  30971. */
  30972. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  30973. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30974. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30975. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  30976. /***/ }),
  30977. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  30978. /*!**************************************************************!*\
  30979. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  30980. \**************************************************************/
  30981. /*! no static exports found */
  30982. /***/ (function(module, exports, __webpack_require__) {
  30983. "use strict";
  30984. //
  30985. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30986. * Use of this file is governed by the BSD 3-clause license that
  30987. * can be found in the LICENSE.txt file in the project root.
  30988. */
  30989. //
  30990. //
  30991. // This implementation of {@link ANTLRErrorListener} can be used to identify
  30992. // certain potential correctness and performance problems in grammars. "Reports"
  30993. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  30994. // message.
  30995. //
  30996. // <ul>
  30997. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  30998. // grammar can match the input.</li>
  30999. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  31000. // prediction resolved an SLL conflict to a unique alternative which equaled the
  31001. // minimum alternative of the SLL conflict.</li>
  31002. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  31003. // full-context prediction resolved an SLL conflict to a unique alternative,
  31004. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  31005. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  31006. // this situation occurs.</li>
  31007. // </ul>
  31008. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  31009. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31010. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31011. function DiagnosticErrorListener(exactOnly) {
  31012. ErrorListener.call(this);
  31013. exactOnly = exactOnly || true;
  31014. // whether all ambiguities or only exact ambiguities are reported.
  31015. this.exactOnly = exactOnly;
  31016. return this;
  31017. }
  31018. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  31019. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  31020. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31021. if (this.exactOnly && !exact) {
  31022. return;
  31023. }
  31024. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31025. recognizer.notifyErrorListeners(msg);
  31026. };
  31027. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31028. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31029. recognizer.notifyErrorListeners(msg);
  31030. };
  31031. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31032. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  31033. recognizer.notifyErrorListeners(msg);
  31034. };
  31035. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  31036. var decision = dfa.decision;
  31037. var ruleIndex = dfa.atnStartState.ruleIndex;
  31038. var ruleNames = recognizer.ruleNames;
  31039. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  31040. return "" + decision;
  31041. }
  31042. var ruleName = ruleNames[ruleIndex] || null;
  31043. if (ruleName === null || ruleName.length === 0) {
  31044. return "" + decision;
  31045. }
  31046. return "" + decision + " (" + ruleName + ")";
  31047. };
  31048. //
  31049. // Computes the set of conflicting or ambiguous alternatives from a
  31050. // configuration set, if that information was not already provided by the
  31051. // parser.
  31052. //
  31053. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  31054. // reported by the parser.
  31055. // @param configs The conflicting or ambiguous configuration set.
  31056. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  31057. // returns the set of alternatives represented in {@code configs}.
  31058. //
  31059. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  31060. if (reportedAlts !== null) {
  31061. return reportedAlts;
  31062. }
  31063. var result = new BitSet();
  31064. for (var i = 0; i < configs.items.length; i++) {
  31065. result.add(configs.items[i].alt);
  31066. }
  31067. return "{" + result.values().join(", ") + "}";
  31068. };
  31069. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  31070. /***/ }),
  31071. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  31072. /*!****************************************************!*\
  31073. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  31074. \****************************************************/
  31075. /*! no static exports found */
  31076. /***/ (function(module, exports, __webpack_require__) {
  31077. "use strict";
  31078. //
  31079. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31080. * Use of this file is governed by the BSD 3-clause license that
  31081. * can be found in the LICENSE.txt file in the project root.
  31082. */
  31083. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  31084. // default implementation of each method does nothing, but can be overridden as
  31085. // necessary.
  31086. function ErrorListener() {
  31087. return this;
  31088. }
  31089. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  31090. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  31091. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  31092. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  31093. function ConsoleErrorListener() {
  31094. ErrorListener.call(this);
  31095. return this;
  31096. }
  31097. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31098. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31099. //
  31100. // Provides a default instance of {@link ConsoleErrorListener}.
  31101. //
  31102. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31103. //
  31104. // {@inheritDoc}
  31105. //
  31106. // <p>
  31107. // This implementation prints messages to {@link System//err} containing the
  31108. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31109. // the following format.</p>
  31110. //
  31111. // <pre>
  31112. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31113. // </pre>
  31114. //
  31115. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31116. console.error("line " + line + ":" + column + " " + msg);
  31117. };
  31118. function ProxyErrorListener(delegates) {
  31119. ErrorListener.call(this);
  31120. if (delegates === null) {
  31121. throw "delegates";
  31122. }
  31123. this.delegates = delegates;
  31124. return this;
  31125. }
  31126. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31127. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31128. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31129. this.delegates.map(function (d) {
  31130. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31131. });
  31132. };
  31133. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31134. this.delegates.map(function (d) {
  31135. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31136. });
  31137. };
  31138. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31139. this.delegates.map(function (d) {
  31140. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31141. });
  31142. };
  31143. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31144. this.delegates.map(function (d) {
  31145. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31146. });
  31147. };
  31148. exports.ErrorListener = ErrorListener;
  31149. exports.ConsoleErrorListener = ConsoleErrorListener;
  31150. exports.ProxyErrorListener = ProxyErrorListener;
  31151. /***/ }),
  31152. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31153. /*!****************************************************!*\
  31154. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31155. \****************************************************/
  31156. /*! no static exports found */
  31157. /***/ (function(module, exports, __webpack_require__) {
  31158. "use strict";
  31159. //
  31160. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31161. * Use of this file is governed by the BSD 3-clause license that
  31162. * can be found in the LICENSE.txt file in the project root.
  31163. */
  31164. //
  31165. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31166. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31167. var NoViableAltException = Errors.NoViableAltException;
  31168. var InputMismatchException = Errors.InputMismatchException;
  31169. var FailedPredicateException = Errors.FailedPredicateException;
  31170. var ParseCancellationException = Errors.ParseCancellationException;
  31171. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31172. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31173. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31174. function ErrorStrategy() {}
  31175. ErrorStrategy.prototype.reset = function (recognizer) {};
  31176. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31177. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31178. ErrorStrategy.prototype.sync = function (recognizer) {};
  31179. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31180. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31181. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31182. // error reporting and recovery in ANTLR parsers.
  31183. //
  31184. function DefaultErrorStrategy() {
  31185. ErrorStrategy.call(this);
  31186. // Indicates whether the error strategy is currently "recovering from an
  31187. // error". This is used to suppress reporting multiple error messages while
  31188. // attempting to recover from a detected syntax error.
  31189. //
  31190. // @see //inErrorRecoveryMode
  31191. //
  31192. this.errorRecoveryMode = false;
  31193. // The index into the input stream where the last error occurred.
  31194. // This is used to prevent infinite loops where an error is found
  31195. // but no token is consumed during recovery...another error is found,
  31196. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31197. // one token/tree node is consumed for two errors.
  31198. //
  31199. this.lastErrorIndex = -1;
  31200. this.lastErrorStates = null;
  31201. return this;
  31202. }
  31203. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31204. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31205. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31206. // ensure that the handler is not in error recovery mode.</p>
  31207. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31208. this.endErrorCondition(recognizer);
  31209. };
  31210. //
  31211. // This method is called to enter error recovery mode when a recognition
  31212. // exception is reported.
  31213. //
  31214. // @param recognizer the parser instance
  31215. //
  31216. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31217. this.errorRecoveryMode = true;
  31218. };
  31219. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31220. return this.errorRecoveryMode;
  31221. };
  31222. //
  31223. // This method is called to leave error recovery mode after recovering from
  31224. // a recognition exception.
  31225. //
  31226. // @param recognizer
  31227. //
  31228. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31229. this.errorRecoveryMode = false;
  31230. this.lastErrorStates = null;
  31231. this.lastErrorIndex = -1;
  31232. };
  31233. //
  31234. // {@inheritDoc}
  31235. //
  31236. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31237. //
  31238. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31239. this.endErrorCondition(recognizer);
  31240. };
  31241. //
  31242. // {@inheritDoc}
  31243. //
  31244. // <p>The default implementation returns immediately if the handler is already
  31245. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31246. // and dispatches the reporting task based on the runtime type of {@code e}
  31247. // according to the following table.</p>
  31248. //
  31249. // <ul>
  31250. // <li>{@link NoViableAltException}: Dispatches the call to
  31251. // {@link //reportNoViableAlternative}</li>
  31252. // <li>{@link InputMismatchException}: Dispatches the call to
  31253. // {@link //reportInputMismatch}</li>
  31254. // <li>{@link FailedPredicateException}: Dispatches the call to
  31255. // {@link //reportFailedPredicate}</li>
  31256. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31257. // the exception</li>
  31258. // </ul>
  31259. //
  31260. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31261. // if we've already reported an error and have not matched a token
  31262. // yet successfully, don't report any errors.
  31263. if (this.inErrorRecoveryMode(recognizer)) {
  31264. return; // don't report spurious errors
  31265. }
  31266. this.beginErrorCondition(recognizer);
  31267. if (e instanceof NoViableAltException) {
  31268. this.reportNoViableAlternative(recognizer, e);
  31269. } else if (e instanceof InputMismatchException) {
  31270. this.reportInputMismatch(recognizer, e);
  31271. } else if (e instanceof FailedPredicateException) {
  31272. this.reportFailedPredicate(recognizer, e);
  31273. } else {
  31274. console.log("unknown recognition error type: " + e.constructor.name);
  31275. console.log(e.stack);
  31276. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31277. }
  31278. };
  31279. //
  31280. // {@inheritDoc}
  31281. //
  31282. // <p>The default implementation resynchronizes the parser by consuming tokens
  31283. // until we find one in the resynchronization set--loosely the set of tokens
  31284. // that can follow the current rule.</p>
  31285. //
  31286. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31287. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31288. // uh oh, another error at same token index and previously-visited
  31289. // state in ATN; must be a case where LT(1) is in the recovery
  31290. // token set so nothing got consumed. Consume a single token
  31291. // at least to prevent an infinite loop; this is a failsafe.
  31292. recognizer.consume();
  31293. }
  31294. this.lastErrorIndex = recognizer._input.index;
  31295. if (this.lastErrorStates === null) {
  31296. this.lastErrorStates = [];
  31297. }
  31298. this.lastErrorStates.push(recognizer.state);
  31299. var followSet = this.getErrorRecoverySet(recognizer);
  31300. this.consumeUntil(recognizer, followSet);
  31301. };
  31302. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31303. // that the current lookahead symbol is consistent with what were expecting
  31304. // at this point in the ATN. You can call this anytime but ANTLR only
  31305. // generates code to check before subrules/loops and each iteration.
  31306. //
  31307. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31308. // subrules. E.g.,</p>
  31309. //
  31310. // <pre>
  31311. // a : sync ( stuff sync )* ;
  31312. // sync : {consume to what can follow sync} ;
  31313. // </pre>
  31314. //
  31315. // At the start of a sub rule upon error, {@link //sync} performs single
  31316. // token deletion, if possible. If it can't do that, it bails on the current
  31317. // rule and uses the default error recovery, which consumes until the
  31318. // resynchronization set of the current rule.
  31319. //
  31320. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31321. // with an empty alternative), then the expected set includes what follows
  31322. // the subrule.</p>
  31323. //
  31324. // <p>During loop iteration, it consumes until it sees a token that can start a
  31325. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31326. // stay in the loop as long as possible.</p>
  31327. //
  31328. // <p><strong>ORIGINS</strong></p>
  31329. //
  31330. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31331. // A single mismatch token or missing token would force the parser to bail
  31332. // out of the entire rules surrounding the loop. So, for rule</p>
  31333. //
  31334. // <pre>
  31335. // classDef : 'class' ID '{' member* '}'
  31336. // </pre>
  31337. //
  31338. // input with an extra token between members would force the parser to
  31339. // consume until it found the next class definition rather than the next
  31340. // member definition of the current class.
  31341. //
  31342. // <p>This functionality cost a little bit of effort because the parser has to
  31343. // compare token set at the start of the loop and at each iteration. If for
  31344. // some reason speed is suffering for you, you can turn off this
  31345. // functionality by simply overriding this method as a blank { }.</p>
  31346. //
  31347. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31348. // If already recovering, don't try to sync
  31349. if (this.inErrorRecoveryMode(recognizer)) {
  31350. return;
  31351. }
  31352. var s = recognizer._interp.atn.states[recognizer.state];
  31353. var la = recognizer.getTokenStream().LA(1);
  31354. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31355. var nextTokens = recognizer.atn.nextTokens(s);
  31356. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31357. return;
  31358. }
  31359. switch (s.stateType) {
  31360. case ATNState.BLOCK_START:
  31361. case ATNState.STAR_BLOCK_START:
  31362. case ATNState.PLUS_BLOCK_START:
  31363. case ATNState.STAR_LOOP_ENTRY:
  31364. // report error and recover if possible
  31365. if (this.singleTokenDeletion(recognizer) !== null) {
  31366. return;
  31367. } else {
  31368. throw new InputMismatchException(recognizer);
  31369. }
  31370. break;
  31371. case ATNState.PLUS_LOOP_BACK:
  31372. case ATNState.STAR_LOOP_BACK:
  31373. this.reportUnwantedToken(recognizer);
  31374. var expecting = new IntervalSet();
  31375. expecting.addSet(recognizer.getExpectedTokens());
  31376. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31377. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31378. break;
  31379. default:
  31380. // do nothing if we can't identify the exact kind of ATN state
  31381. }
  31382. };
  31383. // This is called by {@link //reportError} when the exception is a
  31384. // {@link NoViableAltException}.
  31385. //
  31386. // @see //reportError
  31387. //
  31388. // @param recognizer the parser instance
  31389. // @param e the recognition exception
  31390. //
  31391. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31392. var tokens = recognizer.getTokenStream();
  31393. var input;
  31394. if (tokens !== null) {
  31395. if (e.startToken.type === Token.EOF) {
  31396. input = "<EOF>";
  31397. } else {
  31398. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31399. }
  31400. } else {
  31401. input = "<unknown input>";
  31402. }
  31403. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31404. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31405. };
  31406. //
  31407. // This is called by {@link //reportError} when the exception is an
  31408. // {@link InputMismatchException}.
  31409. //
  31410. // @see //reportError
  31411. //
  31412. // @param recognizer the parser instance
  31413. // @param e the recognition exception
  31414. //
  31415. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31416. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31417. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31418. };
  31419. //
  31420. // This is called by {@link //reportError} when the exception is a
  31421. // {@link FailedPredicateException}.
  31422. //
  31423. // @see //reportError
  31424. //
  31425. // @param recognizer the parser instance
  31426. // @param e the recognition exception
  31427. //
  31428. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31429. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31430. var msg = "rule " + ruleName + " " + e.message;
  31431. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31432. };
  31433. // This method is called to report a syntax error which requires the removal
  31434. // of a token from the input stream. At the time this method is called, the
  31435. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31436. // removed from the input stream. When this method returns,
  31437. // {@code recognizer} is in error recovery mode.
  31438. //
  31439. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31440. // single-token deletion as a viable recovery strategy for a mismatched
  31441. // input error.</p>
  31442. //
  31443. // <p>The default implementation simply returns if the handler is already in
  31444. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31445. // enter error recovery mode, followed by calling
  31446. // {@link Parser//notifyErrorListeners}.</p>
  31447. //
  31448. // @param recognizer the parser instance
  31449. //
  31450. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31451. if (this.inErrorRecoveryMode(recognizer)) {
  31452. return;
  31453. }
  31454. this.beginErrorCondition(recognizer);
  31455. var t = recognizer.getCurrentToken();
  31456. var tokenName = this.getTokenErrorDisplay(t);
  31457. var expecting = this.getExpectedTokens(recognizer);
  31458. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31459. recognizer.notifyErrorListeners(msg, t, null);
  31460. };
  31461. // This method is called to report a syntax error which requires the
  31462. // insertion of a missing token into the input stream. At the time this
  31463. // method is called, the missing token has not yet been inserted. When this
  31464. // method returns, {@code recognizer} is in error recovery mode.
  31465. //
  31466. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31467. // single-token insertion as a viable recovery strategy for a mismatched
  31468. // input error.</p>
  31469. //
  31470. // <p>The default implementation simply returns if the handler is already in
  31471. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31472. // enter error recovery mode, followed by calling
  31473. // {@link Parser//notifyErrorListeners}.</p>
  31474. //
  31475. // @param recognizer the parser instance
  31476. //
  31477. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31478. if (this.inErrorRecoveryMode(recognizer)) {
  31479. return;
  31480. }
  31481. this.beginErrorCondition(recognizer);
  31482. var t = recognizer.getCurrentToken();
  31483. var expecting = this.getExpectedTokens(recognizer);
  31484. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31485. recognizer.notifyErrorListeners(msg, t, null);
  31486. };
  31487. // <p>The default implementation attempts to recover from the mismatched input
  31488. // by using single token insertion and deletion as described below. If the
  31489. // recovery attempt fails, this method throws an
  31490. // {@link InputMismatchException}.</p>
  31491. //
  31492. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31493. //
  31494. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31495. // right token, however, then assume {@code LA(1)} is some extra spurious
  31496. // token and delete it. Then consume and return the next token (which was
  31497. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31498. //
  31499. // <p>This recovery strategy is implemented by {@link
  31500. // //singleTokenDeletion}.</p>
  31501. //
  31502. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  31503. //
  31504. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  31505. // after the expected {@code LA(1)} token, then assume the token is missing
  31506. // and use the parser's {@link TokenFactory} to create it on the fly. The
  31507. // "insertion" is performed by returning the created token as the successful
  31508. // result of the match operation.</p>
  31509. //
  31510. // <p>This recovery strategy is implemented by {@link
  31511. // //singleTokenInsertion}.</p>
  31512. //
  31513. // <p><strong>EXAMPLE</strong></p>
  31514. //
  31515. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  31516. // the parser returns from the nested call to {@code expr}, it will have
  31517. // call chain:</p>
  31518. //
  31519. // <pre>
  31520. // stat &rarr; expr &rarr; atom
  31521. // </pre>
  31522. //
  31523. // and it will be trying to match the {@code ')'} at this point in the
  31524. // derivation:
  31525. //
  31526. // <pre>
  31527. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  31528. // ^
  31529. // </pre>
  31530. //
  31531. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  31532. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  31533. // is in the set of tokens that can follow the {@code ')'} token reference
  31534. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  31535. //
  31536. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  31537. // SINGLE TOKEN DELETION
  31538. var matchedSymbol = this.singleTokenDeletion(recognizer);
  31539. if (matchedSymbol !== null) {
  31540. // we have deleted the extra token.
  31541. // now, move past ttype token as if all were ok
  31542. recognizer.consume();
  31543. return matchedSymbol;
  31544. }
  31545. // SINGLE TOKEN INSERTION
  31546. if (this.singleTokenInsertion(recognizer)) {
  31547. return this.getMissingSymbol(recognizer);
  31548. }
  31549. // even that didn't work; must throw the exception
  31550. throw new InputMismatchException(recognizer);
  31551. };
  31552. //
  31553. // This method implements the single-token insertion inline error recovery
  31554. // strategy. It is called by {@link //recoverInline} if the single-token
  31555. // deletion strategy fails to recover from the mismatched input. If this
  31556. // method returns {@code true}, {@code recognizer} will be in error recovery
  31557. // mode.
  31558. //
  31559. // <p>This method determines whether or not single-token insertion is viable by
  31560. // checking if the {@code LA(1)} input symbol could be successfully matched
  31561. // if it were instead the {@code LA(2)} symbol. If this method returns
  31562. // {@code true}, the caller is responsible for creating and inserting a
  31563. // token with the correct type to produce this behavior.</p>
  31564. //
  31565. // @param recognizer the parser instance
  31566. // @return {@code true} if single-token insertion is a viable recovery
  31567. // strategy for the current mismatched input, otherwise {@code false}
  31568. //
  31569. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  31570. var currentSymbolType = recognizer.getTokenStream().LA(1);
  31571. // if current token is consistent with what could come after current
  31572. // ATN state, then we know we're missing a token; error recovery
  31573. // is free to conjure up and insert the missing token
  31574. var atn = recognizer._interp.atn;
  31575. var currentState = atn.states[recognizer.state];
  31576. var next = currentState.transitions[0].target;
  31577. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  31578. if (expectingAtLL2.contains(currentSymbolType)) {
  31579. this.reportMissingToken(recognizer);
  31580. return true;
  31581. } else {
  31582. return false;
  31583. }
  31584. };
  31585. // This method implements the single-token deletion inline error recovery
  31586. // strategy. It is called by {@link //recoverInline} to attempt to recover
  31587. // from mismatched input. If this method returns null, the parser and error
  31588. // handler state will not have changed. If this method returns non-null,
  31589. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  31590. // returned token was a successful match.
  31591. //
  31592. // <p>If the single-token deletion is successful, this method calls
  31593. // {@link //reportUnwantedToken} to report the error, followed by
  31594. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  31595. // before returning {@link //reportMatch} is called to signal a successful
  31596. // match.</p>
  31597. //
  31598. // @param recognizer the parser instance
  31599. // @return the successfully matched {@link Token} instance if single-token
  31600. // deletion successfully recovers from the mismatched input, otherwise
  31601. // {@code null}
  31602. //
  31603. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  31604. var nextTokenType = recognizer.getTokenStream().LA(2);
  31605. var expecting = this.getExpectedTokens(recognizer);
  31606. if (expecting.contains(nextTokenType)) {
  31607. this.reportUnwantedToken(recognizer);
  31608. // print("recoverFromMismatchedToken deleting " \
  31609. // + str(recognizer.getTokenStream().LT(1)) \
  31610. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  31611. // + " is what we want", file=sys.stderr)
  31612. recognizer.consume(); // simply delete extra token
  31613. // we want to return the token we're actually matching
  31614. var matchedSymbol = recognizer.getCurrentToken();
  31615. this.reportMatch(recognizer); // we know current token is correct
  31616. return matchedSymbol;
  31617. } else {
  31618. return null;
  31619. }
  31620. };
  31621. // Conjure up a missing token during error recovery.
  31622. //
  31623. // The recognizer attempts to recover from single missing
  31624. // symbols. But, actions might refer to that missing symbol.
  31625. // For example, x=ID {f($x);}. The action clearly assumes
  31626. // that there has been an identifier matched previously and that
  31627. // $x points at that token. If that token is missing, but
  31628. // the next token in the stream is what we want we assume that
  31629. // this token is missing and we keep going. Because we
  31630. // have to return some token to replace the missing token,
  31631. // we have to conjure one up. This method gives the user control
  31632. // over the tokens returned for missing tokens. Mostly,
  31633. // you will want to create something special for identifier
  31634. // tokens. For literals such as '{' and ',', the default
  31635. // action in the parser or tree parser works. It simply creates
  31636. // a CommonToken of the appropriate type. The text will be the token.
  31637. // If you change what tokens must be created by the lexer,
  31638. // override this method to create the appropriate tokens.
  31639. //
  31640. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  31641. var currentSymbol = recognizer.getCurrentToken();
  31642. var expecting = this.getExpectedTokens(recognizer);
  31643. var expectedTokenType = expecting.first(); // get any element
  31644. var tokenText;
  31645. if (expectedTokenType === Token.EOF) {
  31646. tokenText = "<missing EOF>";
  31647. } else {
  31648. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  31649. }
  31650. var current = currentSymbol;
  31651. var lookback = recognizer.getTokenStream().LT(-1);
  31652. if (current.type === Token.EOF && lookback !== null) {
  31653. current = lookback;
  31654. }
  31655. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  31656. };
  31657. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  31658. return recognizer.getExpectedTokens();
  31659. };
  31660. // How should a token be displayed in an error message? The default
  31661. // is to display just the text, but during development you might
  31662. // want to have a lot of information spit out. Override in that case
  31663. // to use t.toString() (which, for CommonToken, dumps everything about
  31664. // the token). This is better than forcing you to override a method in
  31665. // your token objects because you don't have to go modify your lexer
  31666. // so that it creates a new Java type.
  31667. //
  31668. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  31669. if (t === null) {
  31670. return "<no token>";
  31671. }
  31672. var s = t.text;
  31673. if (s === null) {
  31674. if (t.type === Token.EOF) {
  31675. s = "<EOF>";
  31676. } else {
  31677. s = "<" + t.type + ">";
  31678. }
  31679. }
  31680. return this.escapeWSAndQuote(s);
  31681. };
  31682. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  31683. s = s.replace(/\n/g, "\\n");
  31684. s = s.replace(/\r/g, "\\r");
  31685. s = s.replace(/\t/g, "\\t");
  31686. return "'" + s + "'";
  31687. };
  31688. // Compute the error recovery set for the current rule. During
  31689. // rule invocation, the parser pushes the set of tokens that can
  31690. // follow that rule reference on the stack; this amounts to
  31691. // computing FIRST of what follows the rule reference in the
  31692. // enclosing rule. See LinearApproximator.FIRST().
  31693. // This local follow set only includes tokens
  31694. // from within the rule; i.e., the FIRST computation done by
  31695. // ANTLR stops at the end of a rule.
  31696. //
  31697. // EXAMPLE
  31698. //
  31699. // When you find a "no viable alt exception", the input is not
  31700. // consistent with any of the alternatives for rule r. The best
  31701. // thing to do is to consume tokens until you see something that
  31702. // can legally follow a call to r//or* any rule that called r.
  31703. // You don't want the exact set of viable next tokens because the
  31704. // input might just be missing a token--you might consume the
  31705. // rest of the input looking for one of the missing tokens.
  31706. //
  31707. // Consider grammar:
  31708. //
  31709. // a : '[' b ']'
  31710. // | '(' b ')'
  31711. // ;
  31712. // b : c '^' INT ;
  31713. // c : ID
  31714. // | INT
  31715. // ;
  31716. //
  31717. // At each rule invocation, the set of tokens that could follow
  31718. // that rule is pushed on a stack. Here are the various
  31719. // context-sensitive follow sets:
  31720. //
  31721. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  31722. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  31723. // FOLLOW(c_in_b) = FIRST('^') = '^'
  31724. //
  31725. // Upon erroneous input "[]", the call chain is
  31726. //
  31727. // a -> b -> c
  31728. //
  31729. // and, hence, the follow context stack is:
  31730. //
  31731. // depth follow set start of rule execution
  31732. // 0 <EOF> a (from main())
  31733. // 1 ']' b
  31734. // 2 '^' c
  31735. //
  31736. // Notice that ')' is not included, because b would have to have
  31737. // been called from a different context in rule a for ')' to be
  31738. // included.
  31739. //
  31740. // For error recovery, we cannot consider FOLLOW(c)
  31741. // (context-sensitive or otherwise). We need the combined set of
  31742. // all context-sensitive FOLLOW sets--the set of all tokens that
  31743. // could follow any reference in the call chain. We need to
  31744. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  31745. // we resync'd to that token, we'd consume until EOF. We need to
  31746. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  31747. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  31748. // not consume anything. After printing an error, rule c would
  31749. // return normally. Rule b would not find the required '^' though.
  31750. // At this point, it gets a mismatched token error and throws an
  31751. // exception (since LA(1) is not in the viable following token
  31752. // set). The rule exception handler tries to recover, but finds
  31753. // the same recovery set and doesn't consume anything. Rule b
  31754. // exits normally returning to rule a. Now it finds the ']' (and
  31755. // with the successful match exits errorRecovery mode).
  31756. //
  31757. // So, you can see that the parser walks up the call chain looking
  31758. // for the token that was a member of the recovery set.
  31759. //
  31760. // Errors are not generated in errorRecovery mode.
  31761. //
  31762. // ANTLR's error recovery mechanism is based upon original ideas:
  31763. //
  31764. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  31765. //
  31766. // and
  31767. //
  31768. // "A note on error recovery in recursive descent parsers":
  31769. // http://portal.acm.org/citation.cfm?id=947902.947905
  31770. //
  31771. // Later, Josef Grosch had some good ideas:
  31772. //
  31773. // "Efficient and Comfortable Error Recovery in Recursive Descent
  31774. // Parsers":
  31775. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  31776. //
  31777. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  31778. // at run-time upon error to avoid overhead during parsing.
  31779. //
  31780. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  31781. var atn = recognizer._interp.atn;
  31782. var ctx = recognizer._ctx;
  31783. var recoverSet = new IntervalSet();
  31784. while (ctx !== null && ctx.invokingState >= 0) {
  31785. // compute what follows who invoked us
  31786. var invokingState = atn.states[ctx.invokingState];
  31787. var rt = invokingState.transitions[0];
  31788. var follow = atn.nextTokens(rt.followState);
  31789. recoverSet.addSet(follow);
  31790. ctx = ctx.parentCtx;
  31791. }
  31792. recoverSet.removeOne(Token.EPSILON);
  31793. return recoverSet;
  31794. };
  31795. // Consume tokens until one matches the given token set.//
  31796. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  31797. var ttype = recognizer.getTokenStream().LA(1);
  31798. while (ttype !== Token.EOF && !set.contains(ttype)) {
  31799. recognizer.consume();
  31800. ttype = recognizer.getTokenStream().LA(1);
  31801. }
  31802. };
  31803. //
  31804. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  31805. // by immediately canceling the parse operation with a
  31806. // {@link ParseCancellationException}. The implementation ensures that the
  31807. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  31808. // that were not completed prior to encountering the error.
  31809. //
  31810. // <p>
  31811. // This error strategy is useful in the following scenarios.</p>
  31812. //
  31813. // <ul>
  31814. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  31815. // stage of two-stage parsing to immediately terminate if an error is
  31816. // encountered, and immediately fall back to the second stage. In addition to
  31817. // avoiding wasted work by attempting to recover from errors here, the empty
  31818. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  31819. // the first stage.</li>
  31820. // <li><strong>Silent validation:</strong> When syntax errors are not being
  31821. // reported or logged, and the parse result is simply ignored if errors occur,
  31822. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  31823. // when the result will be ignored either way.</li>
  31824. // </ul>
  31825. //
  31826. // <p>
  31827. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  31828. //
  31829. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  31830. //
  31831. function BailErrorStrategy() {
  31832. DefaultErrorStrategy.call(this);
  31833. return this;
  31834. }
  31835. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  31836. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  31837. // Instead of recovering from exception {@code e}, re-throw it wrapped
  31838. // in a {@link ParseCancellationException} so it is not caught by the
  31839. // rule function catches. Use {@link Exception//getCause()} to get the
  31840. // original {@link RecognitionException}.
  31841. //
  31842. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  31843. var context = recognizer._ctx;
  31844. while (context !== null) {
  31845. context.exception = e;
  31846. context = context.parentCtx;
  31847. }
  31848. throw new ParseCancellationException(e);
  31849. };
  31850. // Make sure we don't attempt to recover inline; if the parser
  31851. // successfully recovers, it won't throw an exception.
  31852. //
  31853. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  31854. this.recover(recognizer, new InputMismatchException(recognizer));
  31855. };
  31856. // Make sure we don't attempt to recover from problems in subrules.//
  31857. BailErrorStrategy.prototype.sync = function (recognizer) {
  31858. // pass
  31859. };
  31860. exports.BailErrorStrategy = BailErrorStrategy;
  31861. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  31862. /***/ }),
  31863. /***/ "./node_modules/antlr4/error/Errors.js":
  31864. /*!*********************************************!*\
  31865. !*** ./node_modules/antlr4/error/Errors.js ***!
  31866. \*********************************************/
  31867. /*! no static exports found */
  31868. /***/ (function(module, exports, __webpack_require__) {
  31869. "use strict";
  31870. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31871. * Use of this file is governed by the BSD 3-clause license that
  31872. * can be found in the LICENSE.txt file in the project root.
  31873. */
  31874. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  31875. // 3 kinds of errors: prediction errors, failed predicate errors, and
  31876. // mismatched input errors. In each case, the parser knows where it is
  31877. // in the input, where it is in the ATN, the rule invocation stack,
  31878. // and what kind of problem occurred.
  31879. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  31880. function RecognitionException(params) {
  31881. Error.call(this);
  31882. if (!!Error.captureStackTrace) {
  31883. Error.captureStackTrace(this, RecognitionException);
  31884. } else {
  31885. var stack = new Error().stack;
  31886. }
  31887. this.message = params.message;
  31888. this.recognizer = params.recognizer;
  31889. this.input = params.input;
  31890. this.ctx = params.ctx;
  31891. // The current {@link Token} when an error occurred. Since not all streams
  31892. // support accessing symbols by index, we have to track the {@link Token}
  31893. // instance itself.
  31894. this.offendingToken = null;
  31895. // Get the ATN state number the parser was in at the time the error
  31896. // occurred. For {@link NoViableAltException} and
  31897. // {@link LexerNoViableAltException} exceptions, this is the
  31898. // {@link DecisionState} number. For others, it is the state whose outgoing
  31899. // edge we couldn't match.
  31900. this.offendingState = -1;
  31901. if (this.recognizer !== null) {
  31902. this.offendingState = this.recognizer.state;
  31903. }
  31904. return this;
  31905. }
  31906. RecognitionException.prototype = Object.create(Error.prototype);
  31907. RecognitionException.prototype.constructor = RecognitionException;
  31908. // <p>If the state number is not known, this method returns -1.</p>
  31909. //
  31910. // Gets the set of input symbols which could potentially follow the
  31911. // previously matched symbol at the time this exception was thrown.
  31912. //
  31913. // <p>If the set of expected tokens is not known and could not be computed,
  31914. // this method returns {@code null}.</p>
  31915. //
  31916. // @return The set of token types that could potentially follow the current
  31917. // state in the ATN, or {@code null} if the information is not available.
  31918. // /
  31919. RecognitionException.prototype.getExpectedTokens = function () {
  31920. if (this.recognizer !== null) {
  31921. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  31922. } else {
  31923. return null;
  31924. }
  31925. };
  31926. RecognitionException.prototype.toString = function () {
  31927. return this.message;
  31928. };
  31929. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  31930. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  31931. this.startIndex = startIndex;
  31932. this.deadEndConfigs = deadEndConfigs;
  31933. return this;
  31934. }
  31935. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31936. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  31937. LexerNoViableAltException.prototype.toString = function () {
  31938. var symbol = "";
  31939. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  31940. symbol = this.input.getText((this.startIndex, this.startIndex));
  31941. }
  31942. return "LexerNoViableAltException" + symbol;
  31943. };
  31944. // Indicates that the parser could not decide which of two or more paths
  31945. // to take based upon the remaining input. It tracks the starting token
  31946. // of the offending input and also knows where the parser was
  31947. // in the various paths when the error. Reported by reportNoViableAlternative()
  31948. //
  31949. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  31950. ctx = ctx || recognizer._ctx;
  31951. offendingToken = offendingToken || recognizer.getCurrentToken();
  31952. startToken = startToken || recognizer.getCurrentToken();
  31953. input = input || recognizer.getInputStream();
  31954. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  31955. // Which configurations did we try at input.index() that couldn't match
  31956. // input.LT(1)?//
  31957. this.deadEndConfigs = deadEndConfigs;
  31958. // The token object at the start index; the input stream might
  31959. // not be buffering tokens so get a reference to it. (At the
  31960. // time the error occurred, of course the stream needs to keep a
  31961. // buffer all of the tokens but later we might not have access to those.)
  31962. this.startToken = startToken;
  31963. this.offendingToken = offendingToken;
  31964. }
  31965. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31966. NoViableAltException.prototype.constructor = NoViableAltException;
  31967. // This signifies any kind of mismatched input exceptions such as
  31968. // when the current input does not match the expected token.
  31969. //
  31970. function InputMismatchException(recognizer) {
  31971. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31972. this.offendingToken = recognizer.getCurrentToken();
  31973. }
  31974. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  31975. InputMismatchException.prototype.constructor = InputMismatchException;
  31976. // A semantic predicate failed during validation. Validation of predicates
  31977. // occurs when normally parsing the alternative just like matching a token.
  31978. // Disambiguating predicate evaluation occurs when we test a predicate during
  31979. // prediction.
  31980. function FailedPredicateException(recognizer, predicate, message) {
  31981. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  31982. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31983. var s = recognizer._interp.atn.states[recognizer.state];
  31984. var trans = s.transitions[0];
  31985. if (trans instanceof PredicateTransition) {
  31986. this.ruleIndex = trans.ruleIndex;
  31987. this.predicateIndex = trans.predIndex;
  31988. } else {
  31989. this.ruleIndex = 0;
  31990. this.predicateIndex = 0;
  31991. }
  31992. this.predicate = predicate;
  31993. this.offendingToken = recognizer.getCurrentToken();
  31994. return this;
  31995. }
  31996. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  31997. FailedPredicateException.prototype.constructor = FailedPredicateException;
  31998. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  31999. if (message !== null) {
  32000. return message;
  32001. } else {
  32002. return "failed predicate: {" + predicate + "}?";
  32003. }
  32004. };
  32005. function ParseCancellationException() {
  32006. Error.call(this);
  32007. Error.captureStackTrace(this, ParseCancellationException);
  32008. return this;
  32009. }
  32010. ParseCancellationException.prototype = Object.create(Error.prototype);
  32011. ParseCancellationException.prototype.constructor = ParseCancellationException;
  32012. exports.RecognitionException = RecognitionException;
  32013. exports.NoViableAltException = NoViableAltException;
  32014. exports.LexerNoViableAltException = LexerNoViableAltException;
  32015. exports.InputMismatchException = InputMismatchException;
  32016. exports.FailedPredicateException = FailedPredicateException;
  32017. exports.ParseCancellationException = ParseCancellationException;
  32018. /***/ }),
  32019. /***/ "./node_modules/antlr4/error/index.js":
  32020. /*!********************************************!*\
  32021. !*** ./node_modules/antlr4/error/index.js ***!
  32022. \********************************************/
  32023. /*! no static exports found */
  32024. /***/ (function(module, exports, __webpack_require__) {
  32025. "use strict";
  32026. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32027. * Use of this file is governed by the BSD 3-clause license that
  32028. * can be found in the LICENSE.txt file in the project root.
  32029. */
  32030. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  32031. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  32032. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32033. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  32034. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  32035. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  32036. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  32037. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  32038. /***/ }),
  32039. /***/ "./node_modules/antlr4/index.js":
  32040. /*!**************************************!*\
  32041. !*** ./node_modules/antlr4/index.js ***!
  32042. \**************************************/
  32043. /*! no static exports found */
  32044. /***/ (function(module, exports, __webpack_require__) {
  32045. "use strict";
  32046. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32047. * Use of this file is governed by the BSD 3-clause license that
  32048. * can be found in the LICENSE.txt file in the project root.
  32049. */
  32050. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  32051. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  32052. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  32053. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  32054. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  32055. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  32056. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  32057. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  32058. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  32059. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  32060. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  32061. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  32062. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32063. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  32064. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  32065. exports.PredictionContextCache = pc.PredictionContextCache;
  32066. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32067. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32068. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  32069. /***/ }),
  32070. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  32071. /*!******************************************************!*\
  32072. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  32073. \******************************************************/
  32074. /*! no static exports found */
  32075. /***/ (function(module, exports, __webpack_require__) {
  32076. "use strict";
  32077. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  32078. if (!String.prototype.codePointAt) {
  32079. (function () {
  32080. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  32081. var defineProperty = function () {
  32082. // IE 8 only supports `Object.defineProperty` on DOM elements
  32083. try {
  32084. var object = {};
  32085. var $defineProperty = Object.defineProperty;
  32086. var result = $defineProperty(object, object, object) && $defineProperty;
  32087. } catch (error) {}
  32088. return result;
  32089. }();
  32090. var codePointAt = function codePointAt(position) {
  32091. if (this == null) {
  32092. throw TypeError();
  32093. }
  32094. var string = String(this);
  32095. var size = string.length;
  32096. // `ToInteger`
  32097. var index = position ? Number(position) : 0;
  32098. if (index != index) {
  32099. // better `isNaN`
  32100. index = 0;
  32101. }
  32102. // Account for out-of-bounds indices:
  32103. if (index < 0 || index >= size) {
  32104. return undefined;
  32105. }
  32106. // Get the first code unit
  32107. var first = string.charCodeAt(index);
  32108. var second;
  32109. if ( // check if it’s the start of a surrogate pair
  32110. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32111. size > index + 1 // there is a next code unit
  32112. ) {
  32113. second = string.charCodeAt(index + 1);
  32114. if (second >= 0xDC00 && second <= 0xDFFF) {
  32115. // low surrogate
  32116. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32117. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32118. }
  32119. }
  32120. return first;
  32121. };
  32122. if (defineProperty) {
  32123. defineProperty(String.prototype, 'codePointAt', {
  32124. 'value': codePointAt,
  32125. 'configurable': true,
  32126. 'writable': true
  32127. });
  32128. } else {
  32129. String.prototype.codePointAt = codePointAt;
  32130. }
  32131. })();
  32132. }
  32133. /***/ }),
  32134. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32135. /*!********************************************************!*\
  32136. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32137. \********************************************************/
  32138. /*! no static exports found */
  32139. /***/ (function(module, exports, __webpack_require__) {
  32140. "use strict";
  32141. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32142. if (!String.fromCodePoint) {
  32143. (function () {
  32144. var defineProperty = function () {
  32145. // IE 8 only supports `Object.defineProperty` on DOM elements
  32146. try {
  32147. var object = {};
  32148. var $defineProperty = Object.defineProperty;
  32149. var result = $defineProperty(object, object, object) && $defineProperty;
  32150. } catch (error) {}
  32151. return result;
  32152. }();
  32153. var stringFromCharCode = String.fromCharCode;
  32154. var floor = Math.floor;
  32155. var fromCodePoint = function fromCodePoint(_) {
  32156. var MAX_SIZE = 0x4000;
  32157. var codeUnits = [];
  32158. var highSurrogate;
  32159. var lowSurrogate;
  32160. var index = -1;
  32161. var length = arguments.length;
  32162. if (!length) {
  32163. return '';
  32164. }
  32165. var result = '';
  32166. while (++index < length) {
  32167. var codePoint = Number(arguments[index]);
  32168. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32169. codePoint < 0 || // not a valid Unicode code point
  32170. codePoint > 0x10FFFF || // not a valid Unicode code point
  32171. floor(codePoint) != codePoint // not an integer
  32172. ) {
  32173. throw RangeError('Invalid code point: ' + codePoint);
  32174. }
  32175. if (codePoint <= 0xFFFF) {
  32176. // BMP code point
  32177. codeUnits.push(codePoint);
  32178. } else {
  32179. // Astral code point; split in surrogate halves
  32180. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32181. codePoint -= 0x10000;
  32182. highSurrogate = (codePoint >> 10) + 0xD800;
  32183. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32184. codeUnits.push(highSurrogate, lowSurrogate);
  32185. }
  32186. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32187. result += stringFromCharCode.apply(null, codeUnits);
  32188. codeUnits.length = 0;
  32189. }
  32190. }
  32191. return result;
  32192. };
  32193. if (defineProperty) {
  32194. defineProperty(String, 'fromCodePoint', {
  32195. 'value': fromCodePoint,
  32196. 'configurable': true,
  32197. 'writable': true
  32198. });
  32199. } else {
  32200. String.fromCodePoint = fromCodePoint;
  32201. }
  32202. })();
  32203. }
  32204. /***/ }),
  32205. /***/ "./node_modules/antlr4/tree/Tree.js":
  32206. /*!******************************************!*\
  32207. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32208. \******************************************/
  32209. /*! no static exports found */
  32210. /***/ (function(module, exports, __webpack_require__) {
  32211. "use strict";
  32212. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32213. * Use of this file is governed by the BSD 3-clause license that
  32214. * can be found in the LICENSE.txt file in the project root.
  32215. */
  32216. ///
  32217. // The basic notion of a tree has a parent, a payload, and a list of children.
  32218. // It is the most abstract interface for all the trees used by ANTLR.
  32219. ///
  32220. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32221. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32222. var INVALID_INTERVAL = new Interval(-1, -2);
  32223. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32224. function Tree() {
  32225. return this;
  32226. }
  32227. function SyntaxTree() {
  32228. Tree.call(this);
  32229. return this;
  32230. }
  32231. SyntaxTree.prototype = Object.create(Tree.prototype);
  32232. SyntaxTree.prototype.constructor = SyntaxTree;
  32233. function ParseTree() {
  32234. SyntaxTree.call(this);
  32235. return this;
  32236. }
  32237. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32238. ParseTree.prototype.constructor = ParseTree;
  32239. function RuleNode() {
  32240. ParseTree.call(this);
  32241. return this;
  32242. }
  32243. RuleNode.prototype = Object.create(ParseTree.prototype);
  32244. RuleNode.prototype.constructor = RuleNode;
  32245. function TerminalNode() {
  32246. ParseTree.call(this);
  32247. return this;
  32248. }
  32249. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32250. TerminalNode.prototype.constructor = TerminalNode;
  32251. function ErrorNode() {
  32252. TerminalNode.call(this);
  32253. return this;
  32254. }
  32255. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32256. ErrorNode.prototype.constructor = ErrorNode;
  32257. function ParseTreeVisitor() {
  32258. return this;
  32259. }
  32260. ParseTreeVisitor.prototype.visit = function (ctx) {
  32261. if (Array.isArray(ctx)) {
  32262. return ctx.map(function (child) {
  32263. return child.accept(this);
  32264. }, this);
  32265. } else {
  32266. return ctx.accept(this);
  32267. }
  32268. };
  32269. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32270. return this.visit(ctx.children);
  32271. };
  32272. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32273. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32274. function ParseTreeListener() {
  32275. return this;
  32276. }
  32277. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32278. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32279. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32280. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32281. function TerminalNodeImpl(symbol) {
  32282. TerminalNode.call(this);
  32283. this.parentCtx = null;
  32284. this.symbol = symbol;
  32285. return this;
  32286. }
  32287. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32288. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32289. TerminalNodeImpl.prototype.getChild = function (i) {
  32290. return null;
  32291. };
  32292. TerminalNodeImpl.prototype.getSymbol = function () {
  32293. return this.symbol;
  32294. };
  32295. TerminalNodeImpl.prototype.getParent = function () {
  32296. return this.parentCtx;
  32297. };
  32298. TerminalNodeImpl.prototype.getPayload = function () {
  32299. return this.symbol;
  32300. };
  32301. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32302. if (this.symbol === null) {
  32303. return INVALID_INTERVAL;
  32304. }
  32305. var tokenIndex = this.symbol.tokenIndex;
  32306. return new Interval(tokenIndex, tokenIndex);
  32307. };
  32308. TerminalNodeImpl.prototype.getChildCount = function () {
  32309. return 0;
  32310. };
  32311. TerminalNodeImpl.prototype.accept = function (visitor) {
  32312. return visitor.visitTerminal(this);
  32313. };
  32314. TerminalNodeImpl.prototype.getText = function () {
  32315. return this.symbol.text;
  32316. };
  32317. TerminalNodeImpl.prototype.toString = function () {
  32318. if (this.symbol.type === Token.EOF) {
  32319. return "<EOF>";
  32320. } else {
  32321. return this.symbol.text;
  32322. }
  32323. };
  32324. // Represents a token that was consumed during resynchronization
  32325. // rather than during a valid match operation. For example,
  32326. // we will create this kind of a node during single token insertion
  32327. // and deletion as well as during "consume until error recovery set"
  32328. // upon no viable alternative exceptions.
  32329. function ErrorNodeImpl(token) {
  32330. TerminalNodeImpl.call(this, token);
  32331. return this;
  32332. }
  32333. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32334. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32335. ErrorNodeImpl.prototype.isErrorNode = function () {
  32336. return true;
  32337. };
  32338. ErrorNodeImpl.prototype.accept = function (visitor) {
  32339. return visitor.visitErrorNode(this);
  32340. };
  32341. function ParseTreeWalker() {
  32342. return this;
  32343. }
  32344. ParseTreeWalker.prototype.walk = function (listener, t) {
  32345. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32346. if (errorNode) {
  32347. listener.visitErrorNode(t);
  32348. } else if (t instanceof TerminalNode) {
  32349. listener.visitTerminal(t);
  32350. } else {
  32351. this.enterRule(listener, t);
  32352. for (var i = 0; i < t.getChildCount(); i++) {
  32353. var child = t.getChild(i);
  32354. this.walk(listener, child);
  32355. }
  32356. this.exitRule(listener, t);
  32357. }
  32358. };
  32359. //
  32360. // The discovery of a rule node, involves sending two events: the generic
  32361. // {@link ParseTreeListener//enterEveryRule} and a
  32362. // {@link RuleContext}-specific event. First we trigger the generic and then
  32363. // the rule specific. We to them in reverse order upon finishing the node.
  32364. //
  32365. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32366. var ctx = r.getRuleContext();
  32367. listener.enterEveryRule(ctx);
  32368. ctx.enterRule(listener);
  32369. };
  32370. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32371. var ctx = r.getRuleContext();
  32372. ctx.exitRule(listener);
  32373. listener.exitEveryRule(ctx);
  32374. };
  32375. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32376. exports.RuleNode = RuleNode;
  32377. exports.ErrorNode = ErrorNode;
  32378. exports.TerminalNode = TerminalNode;
  32379. exports.ErrorNodeImpl = ErrorNodeImpl;
  32380. exports.TerminalNodeImpl = TerminalNodeImpl;
  32381. exports.ParseTreeListener = ParseTreeListener;
  32382. exports.ParseTreeVisitor = ParseTreeVisitor;
  32383. exports.ParseTreeWalker = ParseTreeWalker;
  32384. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32385. /***/ }),
  32386. /***/ "./node_modules/antlr4/tree/Trees.js":
  32387. /*!*******************************************!*\
  32388. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32389. \*******************************************/
  32390. /*! no static exports found */
  32391. /***/ (function(module, exports, __webpack_require__) {
  32392. "use strict";
  32393. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32394. * Use of this file is governed by the BSD 3-clause license that
  32395. * can be found in the LICENSE.txt file in the project root.
  32396. */
  32397. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32398. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32399. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32400. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32401. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32402. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32403. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32404. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32405. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32406. function Trees() {}
  32407. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32408. // node payloads to get the text for the nodes. Detect
  32409. // parse trees and extract data appropriately.
  32410. Trees.toStringTree = function (tree, ruleNames, recog) {
  32411. ruleNames = ruleNames || null;
  32412. recog = recog || null;
  32413. if (recog !== null) {
  32414. ruleNames = recog.ruleNames;
  32415. }
  32416. var s = Trees.getNodeText(tree, ruleNames);
  32417. s = Utils.escapeWhitespace(s, false);
  32418. var c = tree.getChildCount();
  32419. if (c === 0) {
  32420. return s;
  32421. }
  32422. var res = "(" + s + ' ';
  32423. if (c > 0) {
  32424. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32425. res = res.concat(s);
  32426. }
  32427. for (var i = 1; i < c; i++) {
  32428. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32429. res = res.concat(' ' + s);
  32430. }
  32431. res = res.concat(")");
  32432. return res;
  32433. };
  32434. Trees.getNodeText = function (t, ruleNames, recog) {
  32435. ruleNames = ruleNames || null;
  32436. recog = recog || null;
  32437. if (recog !== null) {
  32438. ruleNames = recog.ruleNames;
  32439. }
  32440. if (ruleNames !== null) {
  32441. if (t instanceof RuleContext) {
  32442. var altNumber = t.getAltNumber();
  32443. if (altNumber != INVALID_ALT_NUMBER) {
  32444. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32445. }
  32446. return ruleNames[t.ruleIndex];
  32447. } else if (t instanceof ErrorNode) {
  32448. return t.toString();
  32449. } else if (t instanceof TerminalNode) {
  32450. if (t.symbol !== null) {
  32451. return t.symbol.text;
  32452. }
  32453. }
  32454. }
  32455. // no recog for rule names
  32456. var payload = t.getPayload();
  32457. if (payload instanceof Token) {
  32458. return payload.text;
  32459. }
  32460. return t.getPayload().toString();
  32461. };
  32462. // Return ordered list of all children of this node
  32463. Trees.getChildren = function (t) {
  32464. var list = [];
  32465. for (var i = 0; i < t.getChildCount(); i++) {
  32466. list.push(t.getChild(i));
  32467. }
  32468. return list;
  32469. };
  32470. // Return a list of all ancestors of this node. The first node of
  32471. // list is the root and the last is the parent of this node.
  32472. //
  32473. Trees.getAncestors = function (t) {
  32474. var ancestors = [];
  32475. t = t.getParent();
  32476. while (t !== null) {
  32477. ancestors = [t].concat(ancestors);
  32478. t = t.getParent();
  32479. }
  32480. return ancestors;
  32481. };
  32482. Trees.findAllTokenNodes = function (t, ttype) {
  32483. return Trees.findAllNodes(t, ttype, true);
  32484. };
  32485. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32486. return Trees.findAllNodes(t, ruleIndex, false);
  32487. };
  32488. Trees.findAllNodes = function (t, index, findTokens) {
  32489. var nodes = [];
  32490. Trees._findAllNodes(t, index, findTokens, nodes);
  32491. return nodes;
  32492. };
  32493. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32494. // check this node (the root) first
  32495. if (findTokens && t instanceof TerminalNode) {
  32496. if (t.symbol.type === index) {
  32497. nodes.push(t);
  32498. }
  32499. } else if (!findTokens && t instanceof ParserRuleContext) {
  32500. if (t.ruleIndex === index) {
  32501. nodes.push(t);
  32502. }
  32503. }
  32504. // check children
  32505. for (var i = 0; i < t.getChildCount(); i++) {
  32506. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  32507. }
  32508. };
  32509. Trees.descendants = function (t) {
  32510. var nodes = [t];
  32511. for (var i = 0; i < t.getChildCount(); i++) {
  32512. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  32513. }
  32514. return nodes;
  32515. };
  32516. exports.Trees = Trees;
  32517. /***/ }),
  32518. /***/ "./node_modules/antlr4/tree/index.js":
  32519. /*!*******************************************!*\
  32520. !*** ./node_modules/antlr4/tree/index.js ***!
  32521. \*******************************************/
  32522. /*! no static exports found */
  32523. /***/ (function(module, exports, __webpack_require__) {
  32524. "use strict";
  32525. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32526. * Use of this file is governed by the BSD 3-clause license that
  32527. * can be found in the LICENSE.txt file in the project root.
  32528. */
  32529. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  32530. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  32531. exports.RuleNode = Tree.RuleNode;
  32532. exports.ParseTreeListener = Tree.ParseTreeListener;
  32533. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  32534. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  32535. /***/ }),
  32536. /***/ "./node_modules/decimal.js/decimal.js":
  32537. /*!********************************************!*\
  32538. !*** ./node_modules/decimal.js/decimal.js ***!
  32539. \********************************************/
  32540. /*! no static exports found */
  32541. /***/ (function(module, exports, __webpack_require__) {
  32542. "use strict";
  32543. var __WEBPACK_AMD_DEFINE_RESULT__;
  32544. 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; };
  32545. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  32546. ;(function (globalScope) {
  32547. 'use strict';
  32548. /*
  32549. * decimal.js v10.0.1
  32550. * An arbitrary-precision Decimal type for JavaScript.
  32551. * https://github.com/MikeMcl/decimal.js
  32552. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  32553. * MIT Licence
  32554. */
  32555. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  32556. // The maximum exponent magnitude.
  32557. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  32558. var EXP_LIMIT = 9e15,
  32559. // 0 to 9e15
  32560. // The limit on the value of `precision`, and on the value of the first argument to
  32561. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  32562. MAX_DIGITS = 1e9,
  32563. // 0 to 1e9
  32564. // Base conversion alphabet.
  32565. NUMERALS = '0123456789abcdef',
  32566. // The natural logarithm of 10 (1025 digits).
  32567. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  32568. // Pi (1025 digits).
  32569. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  32570. // The initial configuration properties of the Decimal constructor.
  32571. DEFAULTS = {
  32572. // These values must be integers within the stated ranges (inclusive).
  32573. // Most of these values can be changed at run-time using the `Decimal.config` method.
  32574. // The maximum number of significant digits of the result of a calculation or base conversion.
  32575. // E.g. `Decimal.config({ precision: 20 });`
  32576. precision: 20, // 1 to MAX_DIGITS
  32577. // The rounding mode used when rounding to `precision`.
  32578. //
  32579. // ROUND_UP 0 Away from zero.
  32580. // ROUND_DOWN 1 Towards zero.
  32581. // ROUND_CEIL 2 Towards +Infinity.
  32582. // ROUND_FLOOR 3 Towards -Infinity.
  32583. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  32584. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  32585. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  32586. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  32587. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  32588. //
  32589. // E.g.
  32590. // `Decimal.rounding = 4;`
  32591. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  32592. rounding: 4, // 0 to 8
  32593. // The modulo mode used when calculating the modulus: a mod n.
  32594. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  32595. // The remainder (r) is calculated as: r = a - n * q.
  32596. //
  32597. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  32598. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  32599. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  32600. // HALF_EVEN 6 The IEEE 754 remainder function.
  32601. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  32602. //
  32603. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  32604. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  32605. // be used, but they may not give useful results.
  32606. modulo: 1, // 0 to 9
  32607. // The exponent value at and beneath which `toString` returns exponential notation.
  32608. // JavaScript numbers: -7
  32609. toExpNeg: -7, // 0 to -EXP_LIMIT
  32610. // The exponent value at and above which `toString` returns exponential notation.
  32611. // JavaScript numbers: 21
  32612. toExpPos: 21, // 0 to EXP_LIMIT
  32613. // The minimum exponent value, beneath which underflow to zero occurs.
  32614. // JavaScript numbers: -324 (5e-324)
  32615. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  32616. // The maximum exponent value, above which overflow to Infinity occurs.
  32617. // JavaScript numbers: 308 (1.7976931348623157e+308)
  32618. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  32619. // Whether to use cryptographically-secure random number generation, if available.
  32620. crypto: false // true/false
  32621. },
  32622. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  32623. Decimal,
  32624. inexact,
  32625. noConflict,
  32626. quadrant,
  32627. external = true,
  32628. decimalError = '[DecimalError] ',
  32629. invalidArgument = decimalError + 'Invalid argument: ',
  32630. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  32631. cryptoUnavailable = decimalError + 'crypto unavailable',
  32632. mathfloor = Math.floor,
  32633. mathpow = Math.pow,
  32634. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  32635. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  32636. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  32637. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  32638. BASE = 1e7,
  32639. LOG_BASE = 7,
  32640. MAX_SAFE_INTEGER = 9007199254740991,
  32641. LN10_PRECISION = LN10.length - 1,
  32642. PI_PRECISION = PI.length - 1,
  32643. // Decimal.prototype object
  32644. P = { name: '[object Decimal]' };
  32645. // Decimal prototype methods
  32646. /*
  32647. * absoluteValue abs
  32648. * ceil
  32649. * comparedTo cmp
  32650. * cosine cos
  32651. * cubeRoot cbrt
  32652. * decimalPlaces dp
  32653. * dividedBy div
  32654. * dividedToIntegerBy divToInt
  32655. * equals eq
  32656. * floor
  32657. * greaterThan gt
  32658. * greaterThanOrEqualTo gte
  32659. * hyperbolicCosine cosh
  32660. * hyperbolicSine sinh
  32661. * hyperbolicTangent tanh
  32662. * inverseCosine acos
  32663. * inverseHyperbolicCosine acosh
  32664. * inverseHyperbolicSine asinh
  32665. * inverseHyperbolicTangent atanh
  32666. * inverseSine asin
  32667. * inverseTangent atan
  32668. * isFinite
  32669. * isInteger isInt
  32670. * isNaN
  32671. * isNegative isNeg
  32672. * isPositive isPos
  32673. * isZero
  32674. * lessThan lt
  32675. * lessThanOrEqualTo lte
  32676. * logarithm log
  32677. * [maximum] [max]
  32678. * [minimum] [min]
  32679. * minus sub
  32680. * modulo mod
  32681. * naturalExponential exp
  32682. * naturalLogarithm ln
  32683. * negated neg
  32684. * plus add
  32685. * precision sd
  32686. * round
  32687. * sine sin
  32688. * squareRoot sqrt
  32689. * tangent tan
  32690. * times mul
  32691. * toBinary
  32692. * toDecimalPlaces toDP
  32693. * toExponential
  32694. * toFixed
  32695. * toFraction
  32696. * toHexadecimal toHex
  32697. * toNearest
  32698. * toNumber
  32699. * toOctal
  32700. * toPower pow
  32701. * toPrecision
  32702. * toSignificantDigits toSD
  32703. * toString
  32704. * truncated trunc
  32705. * valueOf toJSON
  32706. */
  32707. /*
  32708. * Return a new Decimal whose value is the absolute value of this Decimal.
  32709. *
  32710. */
  32711. P.absoluteValue = P.abs = function () {
  32712. var x = new this.constructor(this);
  32713. if (x.s < 0) x.s = 1;
  32714. return finalise(x);
  32715. };
  32716. /*
  32717. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32718. * direction of positive Infinity.
  32719. *
  32720. */
  32721. P.ceil = function () {
  32722. return finalise(new this.constructor(this), this.e + 1, 2);
  32723. };
  32724. /*
  32725. * Return
  32726. * 1 if the value of this Decimal is greater than the value of `y`,
  32727. * -1 if the value of this Decimal is less than the value of `y`,
  32728. * 0 if they have the same value,
  32729. * NaN if the value of either Decimal is NaN.
  32730. *
  32731. */
  32732. P.comparedTo = P.cmp = function (y) {
  32733. var i,
  32734. j,
  32735. xdL,
  32736. ydL,
  32737. x = this,
  32738. xd = x.d,
  32739. yd = (y = new x.constructor(y)).d,
  32740. xs = x.s,
  32741. ys = y.s;
  32742. // Either NaN or ±Infinity?
  32743. if (!xd || !yd) {
  32744. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  32745. }
  32746. // Either zero?
  32747. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  32748. // Signs differ?
  32749. if (xs !== ys) return xs;
  32750. // Compare exponents.
  32751. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  32752. xdL = xd.length;
  32753. ydL = yd.length;
  32754. // Compare digit by digit.
  32755. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  32756. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  32757. }
  32758. // Compare lengths.
  32759. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  32760. };
  32761. /*
  32762. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  32763. *
  32764. * Domain: [-Infinity, Infinity]
  32765. * Range: [-1, 1]
  32766. *
  32767. * cos(0) = 1
  32768. * cos(-0) = 1
  32769. * cos(Infinity) = NaN
  32770. * cos(-Infinity) = NaN
  32771. * cos(NaN) = NaN
  32772. *
  32773. */
  32774. P.cosine = P.cos = function () {
  32775. var pr,
  32776. rm,
  32777. x = this,
  32778. Ctor = x.constructor;
  32779. if (!x.d) return new Ctor(NaN);
  32780. // cos(0) = cos(-0) = 1
  32781. if (!x.d[0]) return new Ctor(1);
  32782. pr = Ctor.precision;
  32783. rm = Ctor.rounding;
  32784. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  32785. Ctor.rounding = 1;
  32786. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  32787. Ctor.precision = pr;
  32788. Ctor.rounding = rm;
  32789. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  32790. };
  32791. /*
  32792. *
  32793. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  32794. * `precision` significant digits using rounding mode `rounding`.
  32795. *
  32796. * cbrt(0) = 0
  32797. * cbrt(-0) = -0
  32798. * cbrt(1) = 1
  32799. * cbrt(-1) = -1
  32800. * cbrt(N) = N
  32801. * cbrt(-I) = -I
  32802. * cbrt(I) = I
  32803. *
  32804. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  32805. *
  32806. */
  32807. P.cubeRoot = P.cbrt = function () {
  32808. var e,
  32809. m,
  32810. n,
  32811. r,
  32812. rep,
  32813. s,
  32814. sd,
  32815. t,
  32816. t3,
  32817. t3plusx,
  32818. x = this,
  32819. Ctor = x.constructor;
  32820. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32821. external = false;
  32822. // Initial estimate.
  32823. s = x.s * Math.pow(x.s * x, 1 / 3);
  32824. // Math.cbrt underflow/overflow?
  32825. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  32826. if (!s || Math.abs(s) == 1 / 0) {
  32827. n = digitsToString(x.d);
  32828. e = x.e;
  32829. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  32830. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  32831. s = Math.pow(n, 1 / 3);
  32832. // Rarely, e may be one less than the result exponent value.
  32833. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  32834. if (s == 1 / 0) {
  32835. n = '5e' + e;
  32836. } else {
  32837. n = s.toExponential();
  32838. n = n.slice(0, n.indexOf('e') + 1) + e;
  32839. }
  32840. r = new Ctor(n);
  32841. r.s = x.s;
  32842. } else {
  32843. r = new Ctor(s.toString());
  32844. }
  32845. sd = (e = Ctor.precision) + 3;
  32846. // Halley's method.
  32847. // TODO? Compare Newton's method.
  32848. for (;;) {
  32849. t = r;
  32850. t3 = t.times(t).times(t);
  32851. t3plusx = t3.plus(x);
  32852. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  32853. // TODO? Replace with for-loop and checkRoundingDigits.
  32854. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  32855. n = n.slice(sd - 3, sd + 1);
  32856. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  32857. // , i.e. approaching a rounding boundary, continue the iteration.
  32858. if (n == '9999' || !rep && n == '4999') {
  32859. // On the first iteration only, check to see if rounding up gives the exact result as the
  32860. // nines may infinitely repeat.
  32861. if (!rep) {
  32862. finalise(t, e + 1, 0);
  32863. if (t.times(t).times(t).eq(x)) {
  32864. r = t;
  32865. break;
  32866. }
  32867. }
  32868. sd += 4;
  32869. rep = 1;
  32870. } else {
  32871. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  32872. // If not, then there are further digits and m will be truthy.
  32873. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  32874. // Truncate to the first rounding digit.
  32875. finalise(r, e + 1, 1);
  32876. m = !r.times(r).times(r).eq(x);
  32877. }
  32878. break;
  32879. }
  32880. }
  32881. }
  32882. external = true;
  32883. return finalise(r, e, Ctor.rounding, m);
  32884. };
  32885. /*
  32886. * Return the number of decimal places of the value of this Decimal.
  32887. *
  32888. */
  32889. P.decimalPlaces = P.dp = function () {
  32890. var w,
  32891. d = this.d,
  32892. n = NaN;
  32893. if (d) {
  32894. w = d.length - 1;
  32895. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  32896. // Subtract the number of trailing zeros of the last word.
  32897. w = d[w];
  32898. if (w) for (; w % 10 == 0; w /= 10) {
  32899. n--;
  32900. }if (n < 0) n = 0;
  32901. }
  32902. return n;
  32903. };
  32904. /*
  32905. * n / 0 = I
  32906. * n / N = N
  32907. * n / I = 0
  32908. * 0 / n = 0
  32909. * 0 / 0 = N
  32910. * 0 / N = N
  32911. * 0 / I = 0
  32912. * N / n = N
  32913. * N / 0 = N
  32914. * N / N = N
  32915. * N / I = N
  32916. * I / n = I
  32917. * I / 0 = I
  32918. * I / N = N
  32919. * I / I = N
  32920. *
  32921. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  32922. * `precision` significant digits using rounding mode `rounding`.
  32923. *
  32924. */
  32925. P.dividedBy = P.div = function (y) {
  32926. return divide(this, new this.constructor(y));
  32927. };
  32928. /*
  32929. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  32930. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  32931. *
  32932. */
  32933. P.dividedToIntegerBy = P.divToInt = function (y) {
  32934. var x = this,
  32935. Ctor = x.constructor;
  32936. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  32937. };
  32938. /*
  32939. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  32940. *
  32941. */
  32942. P.equals = P.eq = function (y) {
  32943. return this.cmp(y) === 0;
  32944. };
  32945. /*
  32946. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32947. * direction of negative Infinity.
  32948. *
  32949. */
  32950. P.floor = function () {
  32951. return finalise(new this.constructor(this), this.e + 1, 3);
  32952. };
  32953. /*
  32954. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  32955. * false.
  32956. *
  32957. */
  32958. P.greaterThan = P.gt = function (y) {
  32959. return this.cmp(y) > 0;
  32960. };
  32961. /*
  32962. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  32963. * otherwise return false.
  32964. *
  32965. */
  32966. P.greaterThanOrEqualTo = P.gte = function (y) {
  32967. var k = this.cmp(y);
  32968. return k == 1 || k === 0;
  32969. };
  32970. /*
  32971. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  32972. * Decimal.
  32973. *
  32974. * Domain: [-Infinity, Infinity]
  32975. * Range: [1, Infinity]
  32976. *
  32977. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  32978. *
  32979. * cosh(0) = 1
  32980. * cosh(-0) = 1
  32981. * cosh(Infinity) = Infinity
  32982. * cosh(-Infinity) = Infinity
  32983. * cosh(NaN) = NaN
  32984. *
  32985. * x time taken (ms) result
  32986. * 1000 9 9.8503555700852349694e+433
  32987. * 10000 25 4.4034091128314607936e+4342
  32988. * 100000 171 1.4033316802130615897e+43429
  32989. * 1000000 3817 1.5166076984010437725e+434294
  32990. * 10000000 abandoned after 2 minute wait
  32991. *
  32992. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  32993. *
  32994. */
  32995. P.hyperbolicCosine = P.cosh = function () {
  32996. var k,
  32997. n,
  32998. pr,
  32999. rm,
  33000. len,
  33001. x = this,
  33002. Ctor = x.constructor,
  33003. one = new Ctor(1);
  33004. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  33005. if (x.isZero()) return one;
  33006. pr = Ctor.precision;
  33007. rm = Ctor.rounding;
  33008. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33009. Ctor.rounding = 1;
  33010. len = x.d.length;
  33011. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  33012. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  33013. // Estimate the optimum number of times to use the argument reduction.
  33014. // TODO? Estimation reused from cosine() and may not be optimal here.
  33015. if (len < 32) {
  33016. k = Math.ceil(len / 3);
  33017. n = Math.pow(4, -k).toString();
  33018. } else {
  33019. k = 16;
  33020. n = '2.3283064365386962890625e-10';
  33021. }
  33022. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  33023. // Reverse argument reduction
  33024. var cosh2_x,
  33025. i = k,
  33026. d8 = new Ctor(8);
  33027. for (; i--;) {
  33028. cosh2_x = x.times(x);
  33029. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  33030. }
  33031. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  33032. };
  33033. /*
  33034. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  33035. * Decimal.
  33036. *
  33037. * Domain: [-Infinity, Infinity]
  33038. * Range: [-Infinity, Infinity]
  33039. *
  33040. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  33041. *
  33042. * sinh(0) = 0
  33043. * sinh(-0) = -0
  33044. * sinh(Infinity) = Infinity
  33045. * sinh(-Infinity) = -Infinity
  33046. * sinh(NaN) = NaN
  33047. *
  33048. * x time taken (ms)
  33049. * 10 2 ms
  33050. * 100 5 ms
  33051. * 1000 14 ms
  33052. * 10000 82 ms
  33053. * 100000 886 ms 1.4033316802130615897e+43429
  33054. * 200000 2613 ms
  33055. * 300000 5407 ms
  33056. * 400000 8824 ms
  33057. * 500000 13026 ms 8.7080643612718084129e+217146
  33058. * 1000000 48543 ms
  33059. *
  33060. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  33061. *
  33062. */
  33063. P.hyperbolicSine = P.sinh = function () {
  33064. var k,
  33065. pr,
  33066. rm,
  33067. len,
  33068. x = this,
  33069. Ctor = x.constructor;
  33070. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33071. pr = Ctor.precision;
  33072. rm = Ctor.rounding;
  33073. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  33074. Ctor.rounding = 1;
  33075. len = x.d.length;
  33076. if (len < 3) {
  33077. x = taylorSeries(Ctor, 2, x, x, true);
  33078. } else {
  33079. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  33080. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  33081. // 3 multiplications and 1 addition
  33082. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  33083. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  33084. // 4 multiplications and 2 additions
  33085. // Estimate the optimum number of times to use the argument reduction.
  33086. k = 1.4 * Math.sqrt(len);
  33087. k = k > 16 ? 16 : k | 0;
  33088. x = x.times(Math.pow(5, -k));
  33089. x = taylorSeries(Ctor, 2, x, x, true);
  33090. // Reverse argument reduction
  33091. var sinh2_x,
  33092. d5 = new Ctor(5),
  33093. d16 = new Ctor(16),
  33094. d20 = new Ctor(20);
  33095. for (; k--;) {
  33096. sinh2_x = x.times(x);
  33097. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33098. }
  33099. }
  33100. Ctor.precision = pr;
  33101. Ctor.rounding = rm;
  33102. return finalise(x, pr, rm, true);
  33103. };
  33104. /*
  33105. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33106. * Decimal.
  33107. *
  33108. * Domain: [-Infinity, Infinity]
  33109. * Range: [-1, 1]
  33110. *
  33111. * tanh(x) = sinh(x) / cosh(x)
  33112. *
  33113. * tanh(0) = 0
  33114. * tanh(-0) = -0
  33115. * tanh(Infinity) = 1
  33116. * tanh(-Infinity) = -1
  33117. * tanh(NaN) = NaN
  33118. *
  33119. */
  33120. P.hyperbolicTangent = P.tanh = function () {
  33121. var pr,
  33122. rm,
  33123. x = this,
  33124. Ctor = x.constructor;
  33125. if (!x.isFinite()) return new Ctor(x.s);
  33126. if (x.isZero()) return new Ctor(x);
  33127. pr = Ctor.precision;
  33128. rm = Ctor.rounding;
  33129. Ctor.precision = pr + 7;
  33130. Ctor.rounding = 1;
  33131. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33132. };
  33133. /*
  33134. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33135. * this Decimal.
  33136. *
  33137. * Domain: [-1, 1]
  33138. * Range: [0, pi]
  33139. *
  33140. * acos(x) = pi/2 - asin(x)
  33141. *
  33142. * acos(0) = pi/2
  33143. * acos(-0) = pi/2
  33144. * acos(1) = 0
  33145. * acos(-1) = pi
  33146. * acos(1/2) = pi/3
  33147. * acos(-1/2) = 2*pi/3
  33148. * acos(|x| > 1) = NaN
  33149. * acos(NaN) = NaN
  33150. *
  33151. */
  33152. P.inverseCosine = P.acos = function () {
  33153. var halfPi,
  33154. x = this,
  33155. Ctor = x.constructor,
  33156. k = x.abs().cmp(1),
  33157. pr = Ctor.precision,
  33158. rm = Ctor.rounding;
  33159. if (k !== -1) {
  33160. return k === 0
  33161. // |x| is 1
  33162. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33163. // |x| > 1 or x is NaN
  33164. : new Ctor(NaN);
  33165. }
  33166. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33167. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33168. Ctor.precision = pr + 6;
  33169. Ctor.rounding = 1;
  33170. x = x.asin();
  33171. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33172. Ctor.precision = pr;
  33173. Ctor.rounding = rm;
  33174. return halfPi.minus(x);
  33175. };
  33176. /*
  33177. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33178. * value of this Decimal.
  33179. *
  33180. * Domain: [1, Infinity]
  33181. * Range: [0, Infinity]
  33182. *
  33183. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33184. *
  33185. * acosh(x < 1) = NaN
  33186. * acosh(NaN) = NaN
  33187. * acosh(Infinity) = Infinity
  33188. * acosh(-Infinity) = NaN
  33189. * acosh(0) = NaN
  33190. * acosh(-0) = NaN
  33191. * acosh(1) = 0
  33192. * acosh(-1) = NaN
  33193. *
  33194. */
  33195. P.inverseHyperbolicCosine = P.acosh = function () {
  33196. var pr,
  33197. rm,
  33198. x = this,
  33199. Ctor = x.constructor;
  33200. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33201. if (!x.isFinite()) return new Ctor(x);
  33202. pr = Ctor.precision;
  33203. rm = Ctor.rounding;
  33204. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33205. Ctor.rounding = 1;
  33206. external = false;
  33207. x = x.times(x).minus(1).sqrt().plus(x);
  33208. external = true;
  33209. Ctor.precision = pr;
  33210. Ctor.rounding = rm;
  33211. return x.ln();
  33212. };
  33213. /*
  33214. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33215. * of this Decimal.
  33216. *
  33217. * Domain: [-Infinity, Infinity]
  33218. * Range: [-Infinity, Infinity]
  33219. *
  33220. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33221. *
  33222. * asinh(NaN) = NaN
  33223. * asinh(Infinity) = Infinity
  33224. * asinh(-Infinity) = -Infinity
  33225. * asinh(0) = 0
  33226. * asinh(-0) = -0
  33227. *
  33228. */
  33229. P.inverseHyperbolicSine = P.asinh = function () {
  33230. var pr,
  33231. rm,
  33232. x = this,
  33233. Ctor = x.constructor;
  33234. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33235. pr = Ctor.precision;
  33236. rm = Ctor.rounding;
  33237. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33238. Ctor.rounding = 1;
  33239. external = false;
  33240. x = x.times(x).plus(1).sqrt().plus(x);
  33241. external = true;
  33242. Ctor.precision = pr;
  33243. Ctor.rounding = rm;
  33244. return x.ln();
  33245. };
  33246. /*
  33247. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33248. * value of this Decimal.
  33249. *
  33250. * Domain: [-1, 1]
  33251. * Range: [-Infinity, Infinity]
  33252. *
  33253. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33254. *
  33255. * atanh(|x| > 1) = NaN
  33256. * atanh(NaN) = NaN
  33257. * atanh(Infinity) = NaN
  33258. * atanh(-Infinity) = NaN
  33259. * atanh(0) = 0
  33260. * atanh(-0) = -0
  33261. * atanh(1) = Infinity
  33262. * atanh(-1) = -Infinity
  33263. *
  33264. */
  33265. P.inverseHyperbolicTangent = P.atanh = function () {
  33266. var pr,
  33267. rm,
  33268. wpr,
  33269. xsd,
  33270. x = this,
  33271. Ctor = x.constructor;
  33272. if (!x.isFinite()) return new Ctor(NaN);
  33273. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33274. pr = Ctor.precision;
  33275. rm = Ctor.rounding;
  33276. xsd = x.sd();
  33277. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33278. Ctor.precision = wpr = xsd - x.e;
  33279. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33280. Ctor.precision = pr + 4;
  33281. Ctor.rounding = 1;
  33282. x = x.ln();
  33283. Ctor.precision = pr;
  33284. Ctor.rounding = rm;
  33285. return x.times(0.5);
  33286. };
  33287. /*
  33288. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33289. * Decimal.
  33290. *
  33291. * Domain: [-Infinity, Infinity]
  33292. * Range: [-pi/2, pi/2]
  33293. *
  33294. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33295. *
  33296. * asin(0) = 0
  33297. * asin(-0) = -0
  33298. * asin(1/2) = pi/6
  33299. * asin(-1/2) = -pi/6
  33300. * asin(1) = pi/2
  33301. * asin(-1) = -pi/2
  33302. * asin(|x| > 1) = NaN
  33303. * asin(NaN) = NaN
  33304. *
  33305. * TODO? Compare performance of Taylor series.
  33306. *
  33307. */
  33308. P.inverseSine = P.asin = function () {
  33309. var halfPi,
  33310. k,
  33311. pr,
  33312. rm,
  33313. x = this,
  33314. Ctor = x.constructor;
  33315. if (x.isZero()) return new Ctor(x);
  33316. k = x.abs().cmp(1);
  33317. pr = Ctor.precision;
  33318. rm = Ctor.rounding;
  33319. if (k !== -1) {
  33320. // |x| is 1
  33321. if (k === 0) {
  33322. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33323. halfPi.s = x.s;
  33324. return halfPi;
  33325. }
  33326. // |x| > 1 or x is NaN
  33327. return new Ctor(NaN);
  33328. }
  33329. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33330. Ctor.precision = pr + 6;
  33331. Ctor.rounding = 1;
  33332. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33333. Ctor.precision = pr;
  33334. Ctor.rounding = rm;
  33335. return x.times(2);
  33336. };
  33337. /*
  33338. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33339. * of this Decimal.
  33340. *
  33341. * Domain: [-Infinity, Infinity]
  33342. * Range: [-pi/2, pi/2]
  33343. *
  33344. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33345. *
  33346. * atan(0) = 0
  33347. * atan(-0) = -0
  33348. * atan(1) = pi/4
  33349. * atan(-1) = -pi/4
  33350. * atan(Infinity) = pi/2
  33351. * atan(-Infinity) = -pi/2
  33352. * atan(NaN) = NaN
  33353. *
  33354. */
  33355. P.inverseTangent = P.atan = function () {
  33356. var i,
  33357. j,
  33358. k,
  33359. n,
  33360. px,
  33361. t,
  33362. r,
  33363. wpr,
  33364. x2,
  33365. x = this,
  33366. Ctor = x.constructor,
  33367. pr = Ctor.precision,
  33368. rm = Ctor.rounding;
  33369. if (!x.isFinite()) {
  33370. if (!x.s) return new Ctor(NaN);
  33371. if (pr + 4 <= PI_PRECISION) {
  33372. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33373. r.s = x.s;
  33374. return r;
  33375. }
  33376. } else if (x.isZero()) {
  33377. return new Ctor(x);
  33378. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33379. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33380. r.s = x.s;
  33381. return r;
  33382. }
  33383. Ctor.precision = wpr = pr + 10;
  33384. Ctor.rounding = 1;
  33385. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33386. // Argument reduction
  33387. // Ensure |x| < 0.42
  33388. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33389. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33390. for (i = k; i; --i) {
  33391. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33392. }external = false;
  33393. j = Math.ceil(wpr / LOG_BASE);
  33394. n = 1;
  33395. x2 = x.times(x);
  33396. r = new Ctor(x);
  33397. px = x;
  33398. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33399. for (; i !== -1;) {
  33400. px = px.times(x2);
  33401. t = r.minus(px.div(n += 2));
  33402. px = px.times(x2);
  33403. r = t.plus(px.div(n += 2));
  33404. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33405. }
  33406. if (k) r = r.times(2 << k - 1);
  33407. external = true;
  33408. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33409. };
  33410. /*
  33411. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33412. *
  33413. */
  33414. P.isFinite = function () {
  33415. return !!this.d;
  33416. };
  33417. /*
  33418. * Return true if the value of this Decimal is an integer, otherwise return false.
  33419. *
  33420. */
  33421. P.isInteger = P.isInt = function () {
  33422. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33423. };
  33424. /*
  33425. * Return true if the value of this Decimal is NaN, otherwise return false.
  33426. *
  33427. */
  33428. P.isNaN = function () {
  33429. return !this.s;
  33430. };
  33431. /*
  33432. * Return true if the value of this Decimal is negative, otherwise return false.
  33433. *
  33434. */
  33435. P.isNegative = P.isNeg = function () {
  33436. return this.s < 0;
  33437. };
  33438. /*
  33439. * Return true if the value of this Decimal is positive, otherwise return false.
  33440. *
  33441. */
  33442. P.isPositive = P.isPos = function () {
  33443. return this.s > 0;
  33444. };
  33445. /*
  33446. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33447. *
  33448. */
  33449. P.isZero = function () {
  33450. return !!this.d && this.d[0] === 0;
  33451. };
  33452. /*
  33453. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33454. *
  33455. */
  33456. P.lessThan = P.lt = function (y) {
  33457. return this.cmp(y) < 0;
  33458. };
  33459. /*
  33460. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33461. *
  33462. */
  33463. P.lessThanOrEqualTo = P.lte = function (y) {
  33464. return this.cmp(y) < 1;
  33465. };
  33466. /*
  33467. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33468. * significant digits using rounding mode `rounding`.
  33469. *
  33470. * If no base is specified, return log[10](arg).
  33471. *
  33472. * log[base](arg) = ln(arg) / ln(base)
  33473. *
  33474. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33475. * otherwise:
  33476. *
  33477. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33478. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33479. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33480. *
  33481. * log[-b](a) = NaN
  33482. * log[0](a) = NaN
  33483. * log[1](a) = NaN
  33484. * log[NaN](a) = NaN
  33485. * log[Infinity](a) = NaN
  33486. * log[b](0) = -Infinity
  33487. * log[b](-0) = -Infinity
  33488. * log[b](-a) = NaN
  33489. * log[b](1) = 0
  33490. * log[b](Infinity) = Infinity
  33491. * log[b](NaN) = NaN
  33492. *
  33493. * [base] {number|string|Decimal} The base of the logarithm.
  33494. *
  33495. */
  33496. P.logarithm = P.log = function (base) {
  33497. var isBase10,
  33498. d,
  33499. denominator,
  33500. k,
  33501. inf,
  33502. num,
  33503. sd,
  33504. r,
  33505. arg = this,
  33506. Ctor = arg.constructor,
  33507. pr = Ctor.precision,
  33508. rm = Ctor.rounding,
  33509. guard = 5;
  33510. // Default base is 10.
  33511. if (base == null) {
  33512. base = new Ctor(10);
  33513. isBase10 = true;
  33514. } else {
  33515. base = new Ctor(base);
  33516. d = base.d;
  33517. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  33518. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  33519. isBase10 = base.eq(10);
  33520. }
  33521. d = arg.d;
  33522. // Is arg negative, non-finite, 0 or 1?
  33523. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  33524. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  33525. }
  33526. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  33527. // integer power of 10.
  33528. if (isBase10) {
  33529. if (d.length > 1) {
  33530. inf = true;
  33531. } else {
  33532. for (k = d[0]; k % 10 === 0;) {
  33533. k /= 10;
  33534. }inf = k !== 1;
  33535. }
  33536. }
  33537. external = false;
  33538. sd = pr + guard;
  33539. num = naturalLogarithm(arg, sd);
  33540. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33541. // The result will have 5 rounding digits.
  33542. r = divide(num, denominator, sd, 1);
  33543. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  33544. // calculate 10 further digits.
  33545. //
  33546. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  33547. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  33548. // further digits, the last 14 are nines, round up and assume the result is exact.
  33549. // Also assume the result is exact if the last 14 are zero.
  33550. //
  33551. // Example of a result that will be incorrectly rounded:
  33552. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  33553. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  33554. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  33555. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  33556. // place is still 2.6.
  33557. if (checkRoundingDigits(r.d, k = pr, rm)) {
  33558. do {
  33559. sd += 10;
  33560. num = naturalLogarithm(arg, sd);
  33561. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33562. r = divide(num, denominator, sd, 1);
  33563. if (!inf) {
  33564. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  33565. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  33566. r = finalise(r, pr + 1, 0);
  33567. }
  33568. break;
  33569. }
  33570. } while (checkRoundingDigits(r.d, k += 10, rm));
  33571. }
  33572. external = true;
  33573. return finalise(r, pr, rm);
  33574. };
  33575. /*
  33576. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  33577. *
  33578. * arguments {number|string|Decimal}
  33579. *
  33580. P.max = function () {
  33581. Array.prototype.push.call(arguments, this);
  33582. return maxOrMin(this.constructor, arguments, 'lt');
  33583. };
  33584. */
  33585. /*
  33586. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  33587. *
  33588. * arguments {number|string|Decimal}
  33589. *
  33590. P.min = function () {
  33591. Array.prototype.push.call(arguments, this);
  33592. return maxOrMin(this.constructor, arguments, 'gt');
  33593. };
  33594. */
  33595. /*
  33596. * n - 0 = n
  33597. * n - N = N
  33598. * n - I = -I
  33599. * 0 - n = -n
  33600. * 0 - 0 = 0
  33601. * 0 - N = N
  33602. * 0 - I = -I
  33603. * N - n = N
  33604. * N - 0 = N
  33605. * N - N = N
  33606. * N - I = N
  33607. * I - n = I
  33608. * I - 0 = I
  33609. * I - N = N
  33610. * I - I = N
  33611. *
  33612. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  33613. * significant digits using rounding mode `rounding`.
  33614. *
  33615. */
  33616. P.minus = P.sub = function (y) {
  33617. var d,
  33618. e,
  33619. i,
  33620. j,
  33621. k,
  33622. len,
  33623. pr,
  33624. rm,
  33625. xd,
  33626. xe,
  33627. xLTy,
  33628. yd,
  33629. x = this,
  33630. Ctor = x.constructor;
  33631. y = new Ctor(y);
  33632. // If either is not finite...
  33633. if (!x.d || !y.d) {
  33634. // Return NaN if either is NaN.
  33635. if (!x.s || !y.s) y = new Ctor(NaN);
  33636. // Return y negated if x is finite and y is ±Infinity.
  33637. else if (x.d) y.s = -y.s;
  33638. // Return x if y is finite and x is ±Infinity.
  33639. // Return x if both are ±Infinity with different signs.
  33640. // Return NaN if both are ±Infinity with the same sign.
  33641. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  33642. return y;
  33643. }
  33644. // If signs differ...
  33645. if (x.s != y.s) {
  33646. y.s = -y.s;
  33647. return x.plus(y);
  33648. }
  33649. xd = x.d;
  33650. yd = y.d;
  33651. pr = Ctor.precision;
  33652. rm = Ctor.rounding;
  33653. // If either is zero...
  33654. if (!xd[0] || !yd[0]) {
  33655. // Return y negated if x is zero and y is non-zero.
  33656. if (yd[0]) y.s = -y.s;
  33657. // Return x if y is zero and x is non-zero.
  33658. else if (xd[0]) y = new Ctor(x);
  33659. // Return zero if both are zero.
  33660. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  33661. else return new Ctor(rm === 3 ? -0 : 0);
  33662. return external ? finalise(y, pr, rm) : y;
  33663. }
  33664. // x and y are finite, non-zero numbers with the same sign.
  33665. // Calculate base 1e7 exponents.
  33666. e = mathfloor(y.e / LOG_BASE);
  33667. xe = mathfloor(x.e / LOG_BASE);
  33668. xd = xd.slice();
  33669. k = xe - e;
  33670. // If base 1e7 exponents differ...
  33671. if (k) {
  33672. xLTy = k < 0;
  33673. if (xLTy) {
  33674. d = xd;
  33675. k = -k;
  33676. len = yd.length;
  33677. } else {
  33678. d = yd;
  33679. e = xe;
  33680. len = xd.length;
  33681. }
  33682. // Numbers with massively different exponents would result in a very high number of
  33683. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  33684. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  33685. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  33686. if (k > i) {
  33687. k = i;
  33688. d.length = 1;
  33689. }
  33690. // Prepend zeros to equalise exponents.
  33691. d.reverse();
  33692. for (i = k; i--;) {
  33693. d.push(0);
  33694. }d.reverse();
  33695. // Base 1e7 exponents equal.
  33696. } else {
  33697. // Check digits to determine which is the bigger number.
  33698. i = xd.length;
  33699. len = yd.length;
  33700. xLTy = i < len;
  33701. if (xLTy) len = i;
  33702. for (i = 0; i < len; i++) {
  33703. if (xd[i] != yd[i]) {
  33704. xLTy = xd[i] < yd[i];
  33705. break;
  33706. }
  33707. }
  33708. k = 0;
  33709. }
  33710. if (xLTy) {
  33711. d = xd;
  33712. xd = yd;
  33713. yd = d;
  33714. y.s = -y.s;
  33715. }
  33716. len = xd.length;
  33717. // Append zeros to `xd` if shorter.
  33718. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  33719. for (i = yd.length - len; i > 0; --i) {
  33720. xd[len++] = 0;
  33721. } // Subtract yd from xd.
  33722. for (i = yd.length; i > k;) {
  33723. if (xd[--i] < yd[i]) {
  33724. for (j = i; j && xd[--j] === 0;) {
  33725. xd[j] = BASE - 1;
  33726. }--xd[j];
  33727. xd[i] += BASE;
  33728. }
  33729. xd[i] -= yd[i];
  33730. }
  33731. // Remove trailing zeros.
  33732. for (; xd[--len] === 0;) {
  33733. xd.pop();
  33734. } // Remove leading zeros and adjust exponent accordingly.
  33735. for (; xd[0] === 0; xd.shift()) {
  33736. --e;
  33737. } // Zero?
  33738. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  33739. y.d = xd;
  33740. y.e = getBase10Exponent(xd, e);
  33741. return external ? finalise(y, pr, rm) : y;
  33742. };
  33743. /*
  33744. * n % 0 = N
  33745. * n % N = N
  33746. * n % I = n
  33747. * 0 % n = 0
  33748. * -0 % n = -0
  33749. * 0 % 0 = N
  33750. * 0 % N = N
  33751. * 0 % I = 0
  33752. * N % n = N
  33753. * N % 0 = N
  33754. * N % N = N
  33755. * N % I = N
  33756. * I % n = N
  33757. * I % 0 = N
  33758. * I % N = N
  33759. * I % I = N
  33760. *
  33761. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  33762. * `precision` significant digits using rounding mode `rounding`.
  33763. *
  33764. * The result depends on the modulo mode.
  33765. *
  33766. */
  33767. P.modulo = P.mod = function (y) {
  33768. var q,
  33769. x = this,
  33770. Ctor = x.constructor;
  33771. y = new Ctor(y);
  33772. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  33773. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  33774. // Return x if y is ±Infinity or x is ±0.
  33775. if (!y.d || x.d && !x.d[0]) {
  33776. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  33777. }
  33778. // Prevent rounding of intermediate calculations.
  33779. external = false;
  33780. if (Ctor.modulo == 9) {
  33781. // Euclidian division: q = sign(y) * floor(x / abs(y))
  33782. // result = x - q * y where 0 <= result < abs(y)
  33783. q = divide(x, y.abs(), 0, 3, 1);
  33784. q.s *= y.s;
  33785. } else {
  33786. q = divide(x, y, 0, Ctor.modulo, 1);
  33787. }
  33788. q = q.times(y);
  33789. external = true;
  33790. return x.minus(q);
  33791. };
  33792. /*
  33793. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  33794. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  33795. * significant digits using rounding mode `rounding`.
  33796. *
  33797. */
  33798. P.naturalExponential = P.exp = function () {
  33799. return naturalExponential(this);
  33800. };
  33801. /*
  33802. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  33803. * rounded to `precision` significant digits using rounding mode `rounding`.
  33804. *
  33805. */
  33806. P.naturalLogarithm = P.ln = function () {
  33807. return naturalLogarithm(this);
  33808. };
  33809. /*
  33810. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  33811. * -1.
  33812. *
  33813. */
  33814. P.negated = P.neg = function () {
  33815. var x = new this.constructor(this);
  33816. x.s = -x.s;
  33817. return finalise(x);
  33818. };
  33819. /*
  33820. * n + 0 = n
  33821. * n + N = N
  33822. * n + I = I
  33823. * 0 + n = n
  33824. * 0 + 0 = 0
  33825. * 0 + N = N
  33826. * 0 + I = I
  33827. * N + n = N
  33828. * N + 0 = N
  33829. * N + N = N
  33830. * N + I = N
  33831. * I + n = I
  33832. * I + 0 = I
  33833. * I + N = N
  33834. * I + I = I
  33835. *
  33836. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  33837. * significant digits using rounding mode `rounding`.
  33838. *
  33839. */
  33840. P.plus = P.add = function (y) {
  33841. var carry,
  33842. d,
  33843. e,
  33844. i,
  33845. k,
  33846. len,
  33847. pr,
  33848. rm,
  33849. xd,
  33850. yd,
  33851. x = this,
  33852. Ctor = x.constructor;
  33853. y = new Ctor(y);
  33854. // If either is not finite...
  33855. if (!x.d || !y.d) {
  33856. // Return NaN if either is NaN.
  33857. if (!x.s || !y.s) y = new Ctor(NaN);
  33858. // Return x if y is finite and x is ±Infinity.
  33859. // Return x if both are ±Infinity with the same sign.
  33860. // Return NaN if both are ±Infinity with different signs.
  33861. // Return y if x is finite and y is ±Infinity.
  33862. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  33863. return y;
  33864. }
  33865. // If signs differ...
  33866. if (x.s != y.s) {
  33867. y.s = -y.s;
  33868. return x.minus(y);
  33869. }
  33870. xd = x.d;
  33871. yd = y.d;
  33872. pr = Ctor.precision;
  33873. rm = Ctor.rounding;
  33874. // If either is zero...
  33875. if (!xd[0] || !yd[0]) {
  33876. // Return x if y is zero.
  33877. // Return y if y is non-zero.
  33878. if (!yd[0]) y = new Ctor(x);
  33879. return external ? finalise(y, pr, rm) : y;
  33880. }
  33881. // x and y are finite, non-zero numbers with the same sign.
  33882. // Calculate base 1e7 exponents.
  33883. k = mathfloor(x.e / LOG_BASE);
  33884. e = mathfloor(y.e / LOG_BASE);
  33885. xd = xd.slice();
  33886. i = k - e;
  33887. // If base 1e7 exponents differ...
  33888. if (i) {
  33889. if (i < 0) {
  33890. d = xd;
  33891. i = -i;
  33892. len = yd.length;
  33893. } else {
  33894. d = yd;
  33895. e = k;
  33896. len = xd.length;
  33897. }
  33898. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  33899. k = Math.ceil(pr / LOG_BASE);
  33900. len = k > len ? k + 1 : len + 1;
  33901. if (i > len) {
  33902. i = len;
  33903. d.length = 1;
  33904. }
  33905. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  33906. d.reverse();
  33907. for (; i--;) {
  33908. d.push(0);
  33909. }d.reverse();
  33910. }
  33911. len = xd.length;
  33912. i = yd.length;
  33913. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  33914. if (len - i < 0) {
  33915. i = len;
  33916. d = yd;
  33917. yd = xd;
  33918. xd = d;
  33919. }
  33920. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  33921. for (carry = 0; i;) {
  33922. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  33923. xd[i] %= BASE;
  33924. }
  33925. if (carry) {
  33926. xd.unshift(carry);
  33927. ++e;
  33928. }
  33929. // Remove trailing zeros.
  33930. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  33931. for (len = xd.length; xd[--len] == 0;) {
  33932. xd.pop();
  33933. }y.d = xd;
  33934. y.e = getBase10Exponent(xd, e);
  33935. return external ? finalise(y, pr, rm) : y;
  33936. };
  33937. /*
  33938. * Return the number of significant digits of the value of this Decimal.
  33939. *
  33940. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  33941. *
  33942. */
  33943. P.precision = P.sd = function (z) {
  33944. var k,
  33945. x = this;
  33946. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  33947. if (x.d) {
  33948. k = getPrecision(x.d);
  33949. if (z && x.e + 1 > k) k = x.e + 1;
  33950. } else {
  33951. k = NaN;
  33952. }
  33953. return k;
  33954. };
  33955. /*
  33956. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  33957. * rounding mode `rounding`.
  33958. *
  33959. */
  33960. P.round = function () {
  33961. var x = this,
  33962. Ctor = x.constructor;
  33963. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  33964. };
  33965. /*
  33966. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  33967. *
  33968. * Domain: [-Infinity, Infinity]
  33969. * Range: [-1, 1]
  33970. *
  33971. * sin(x) = x - x^3/3! + x^5/5! - ...
  33972. *
  33973. * sin(0) = 0
  33974. * sin(-0) = -0
  33975. * sin(Infinity) = NaN
  33976. * sin(-Infinity) = NaN
  33977. * sin(NaN) = NaN
  33978. *
  33979. */
  33980. P.sine = P.sin = function () {
  33981. var pr,
  33982. rm,
  33983. x = this,
  33984. Ctor = x.constructor;
  33985. if (!x.isFinite()) return new Ctor(NaN);
  33986. if (x.isZero()) return new Ctor(x);
  33987. pr = Ctor.precision;
  33988. rm = Ctor.rounding;
  33989. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33990. Ctor.rounding = 1;
  33991. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  33992. Ctor.precision = pr;
  33993. Ctor.rounding = rm;
  33994. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  33995. };
  33996. /*
  33997. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  33998. * significant digits using rounding mode `rounding`.
  33999. *
  34000. * sqrt(-n) = N
  34001. * sqrt(N) = N
  34002. * sqrt(-I) = N
  34003. * sqrt(I) = I
  34004. * sqrt(0) = 0
  34005. * sqrt(-0) = -0
  34006. *
  34007. */
  34008. P.squareRoot = P.sqrt = function () {
  34009. var m,
  34010. n,
  34011. sd,
  34012. r,
  34013. rep,
  34014. t,
  34015. x = this,
  34016. d = x.d,
  34017. e = x.e,
  34018. s = x.s,
  34019. Ctor = x.constructor;
  34020. // Negative/NaN/Infinity/zero?
  34021. if (s !== 1 || !d || !d[0]) {
  34022. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  34023. }
  34024. external = false;
  34025. // Initial estimate.
  34026. s = Math.sqrt(+x);
  34027. // Math.sqrt underflow/overflow?
  34028. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  34029. if (s == 0 || s == 1 / 0) {
  34030. n = digitsToString(d);
  34031. if ((n.length + e) % 2 == 0) n += '0';
  34032. s = Math.sqrt(n);
  34033. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  34034. if (s == 1 / 0) {
  34035. n = '1e' + e;
  34036. } else {
  34037. n = s.toExponential();
  34038. n = n.slice(0, n.indexOf('e') + 1) + e;
  34039. }
  34040. r = new Ctor(n);
  34041. } else {
  34042. r = new Ctor(s.toString());
  34043. }
  34044. sd = (e = Ctor.precision) + 3;
  34045. // Newton-Raphson iteration.
  34046. for (;;) {
  34047. t = r;
  34048. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  34049. // TODO? Replace with for-loop and checkRoundingDigits.
  34050. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  34051. n = n.slice(sd - 3, sd + 1);
  34052. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  34053. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  34054. if (n == '9999' || !rep && n == '4999') {
  34055. // On the first iteration only, check to see if rounding up gives the exact result as the
  34056. // nines may infinitely repeat.
  34057. if (!rep) {
  34058. finalise(t, e + 1, 0);
  34059. if (t.times(t).eq(x)) {
  34060. r = t;
  34061. break;
  34062. }
  34063. }
  34064. sd += 4;
  34065. rep = 1;
  34066. } else {
  34067. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  34068. // If not, then there are further digits and m will be truthy.
  34069. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  34070. // Truncate to the first rounding digit.
  34071. finalise(r, e + 1, 1);
  34072. m = !r.times(r).eq(x);
  34073. }
  34074. break;
  34075. }
  34076. }
  34077. }
  34078. external = true;
  34079. return finalise(r, e, Ctor.rounding, m);
  34080. };
  34081. /*
  34082. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  34083. *
  34084. * Domain: [-Infinity, Infinity]
  34085. * Range: [-Infinity, Infinity]
  34086. *
  34087. * tan(0) = 0
  34088. * tan(-0) = -0
  34089. * tan(Infinity) = NaN
  34090. * tan(-Infinity) = NaN
  34091. * tan(NaN) = NaN
  34092. *
  34093. */
  34094. P.tangent = P.tan = function () {
  34095. var pr,
  34096. rm,
  34097. x = this,
  34098. Ctor = x.constructor;
  34099. if (!x.isFinite()) return new Ctor(NaN);
  34100. if (x.isZero()) return new Ctor(x);
  34101. pr = Ctor.precision;
  34102. rm = Ctor.rounding;
  34103. Ctor.precision = pr + 10;
  34104. Ctor.rounding = 1;
  34105. x = x.sin();
  34106. x.s = 1;
  34107. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34108. Ctor.precision = pr;
  34109. Ctor.rounding = rm;
  34110. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34111. };
  34112. /*
  34113. * n * 0 = 0
  34114. * n * N = N
  34115. * n * I = I
  34116. * 0 * n = 0
  34117. * 0 * 0 = 0
  34118. * 0 * N = N
  34119. * 0 * I = N
  34120. * N * n = N
  34121. * N * 0 = N
  34122. * N * N = N
  34123. * N * I = N
  34124. * I * n = I
  34125. * I * 0 = N
  34126. * I * N = N
  34127. * I * I = I
  34128. *
  34129. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34130. * digits using rounding mode `rounding`.
  34131. *
  34132. */
  34133. P.times = P.mul = function (y) {
  34134. var carry,
  34135. e,
  34136. i,
  34137. k,
  34138. r,
  34139. rL,
  34140. t,
  34141. xdL,
  34142. ydL,
  34143. x = this,
  34144. Ctor = x.constructor,
  34145. xd = x.d,
  34146. yd = (y = new Ctor(y)).d;
  34147. y.s *= x.s;
  34148. // If either is NaN, ±Infinity or ±0...
  34149. if (!xd || !xd[0] || !yd || !yd[0]) {
  34150. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34151. // Return NaN if either is NaN.
  34152. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34153. ? NaN
  34154. // Return ±Infinity if either is ±Infinity.
  34155. // Return ±0 if either is ±0.
  34156. : !xd || !yd ? y.s / 0 : y.s * 0);
  34157. }
  34158. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34159. xdL = xd.length;
  34160. ydL = yd.length;
  34161. // Ensure xd points to the longer array.
  34162. if (xdL < ydL) {
  34163. r = xd;
  34164. xd = yd;
  34165. yd = r;
  34166. rL = xdL;
  34167. xdL = ydL;
  34168. ydL = rL;
  34169. }
  34170. // Initialise the result array with zeros.
  34171. r = [];
  34172. rL = xdL + ydL;
  34173. for (i = rL; i--;) {
  34174. r.push(0);
  34175. } // Multiply!
  34176. for (i = ydL; --i >= 0;) {
  34177. carry = 0;
  34178. for (k = xdL + i; k > i;) {
  34179. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34180. r[k--] = t % BASE | 0;
  34181. carry = t / BASE | 0;
  34182. }
  34183. r[k] = (r[k] + carry) % BASE | 0;
  34184. }
  34185. // Remove trailing zeros.
  34186. for (; !r[--rL];) {
  34187. r.pop();
  34188. }if (carry) ++e;else r.shift();
  34189. y.d = r;
  34190. y.e = getBase10Exponent(r, e);
  34191. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34192. };
  34193. /*
  34194. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34195. * digits using rounding mode `rm`.
  34196. *
  34197. * If the optional `sd` argument is present then return binary exponential notation.
  34198. *
  34199. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34200. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34201. *
  34202. */
  34203. P.toBinary = function (sd, rm) {
  34204. return toStringBinary(this, 2, sd, rm);
  34205. };
  34206. /*
  34207. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34208. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34209. *
  34210. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34211. *
  34212. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34213. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34214. *
  34215. */
  34216. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34217. var x = this,
  34218. Ctor = x.constructor;
  34219. x = new Ctor(x);
  34220. if (dp === void 0) return x;
  34221. checkInt32(dp, 0, MAX_DIGITS);
  34222. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34223. return finalise(x, dp + x.e + 1, rm);
  34224. };
  34225. /*
  34226. * Return a string representing the value of this Decimal in exponential notation rounded to
  34227. * `dp` fixed decimal places using rounding mode `rounding`.
  34228. *
  34229. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34230. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34231. *
  34232. */
  34233. P.toExponential = function (dp, rm) {
  34234. var str,
  34235. x = this,
  34236. Ctor = x.constructor;
  34237. if (dp === void 0) {
  34238. str = finiteToString(x, true);
  34239. } else {
  34240. checkInt32(dp, 0, MAX_DIGITS);
  34241. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34242. x = finalise(new Ctor(x), dp + 1, rm);
  34243. str = finiteToString(x, true, dp + 1);
  34244. }
  34245. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34246. };
  34247. /*
  34248. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34249. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34250. * omitted.
  34251. *
  34252. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34253. *
  34254. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34255. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34256. *
  34257. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34258. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34259. * (-0).toFixed(3) is '0.000'.
  34260. * (-0.5).toFixed(0) is '-0'.
  34261. *
  34262. */
  34263. P.toFixed = function (dp, rm) {
  34264. var str,
  34265. y,
  34266. x = this,
  34267. Ctor = x.constructor;
  34268. if (dp === void 0) {
  34269. str = finiteToString(x);
  34270. } else {
  34271. checkInt32(dp, 0, MAX_DIGITS);
  34272. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34273. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34274. str = finiteToString(y, false, dp + y.e + 1);
  34275. }
  34276. // To determine whether to add the minus sign look at the value before it was rounded,
  34277. // i.e. look at `x` rather than `y`.
  34278. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34279. };
  34280. /*
  34281. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34282. * numerator and an integer denominator.
  34283. *
  34284. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34285. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34286. * value necessary to represent the number exactly.
  34287. *
  34288. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34289. *
  34290. */
  34291. P.toFraction = function (maxD) {
  34292. var d,
  34293. d0,
  34294. d1,
  34295. d2,
  34296. e,
  34297. k,
  34298. n,
  34299. n0,
  34300. n1,
  34301. pr,
  34302. q,
  34303. r,
  34304. x = this,
  34305. xd = x.d,
  34306. Ctor = x.constructor;
  34307. if (!xd) return new Ctor(x);
  34308. n1 = d0 = new Ctor(1);
  34309. d1 = n0 = new Ctor(0);
  34310. d = new Ctor(d1);
  34311. e = d.e = getPrecision(xd) - x.e - 1;
  34312. k = e % LOG_BASE;
  34313. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34314. if (maxD == null) {
  34315. // d is 10**e, the minimum max-denominator needed.
  34316. maxD = e > 0 ? d : n1;
  34317. } else {
  34318. n = new Ctor(maxD);
  34319. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34320. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34321. }
  34322. external = false;
  34323. n = new Ctor(digitsToString(xd));
  34324. pr = Ctor.precision;
  34325. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34326. for (;;) {
  34327. q = divide(n, d, 0, 1, 1);
  34328. d2 = d0.plus(q.times(d1));
  34329. if (d2.cmp(maxD) == 1) break;
  34330. d0 = d1;
  34331. d1 = d2;
  34332. d2 = n1;
  34333. n1 = n0.plus(q.times(d2));
  34334. n0 = d2;
  34335. d2 = d;
  34336. d = n.minus(q.times(d2));
  34337. n = d2;
  34338. }
  34339. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34340. n0 = n0.plus(d2.times(n1));
  34341. d0 = d0.plus(d2.times(d1));
  34342. n0.s = n1.s = x.s;
  34343. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34344. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34345. Ctor.precision = pr;
  34346. external = true;
  34347. return r;
  34348. };
  34349. /*
  34350. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34351. * digits using rounding mode `rm`.
  34352. *
  34353. * If the optional `sd` argument is present then return binary exponential notation.
  34354. *
  34355. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34356. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34357. *
  34358. */
  34359. P.toHexadecimal = P.toHex = function (sd, rm) {
  34360. return toStringBinary(this, 16, sd, rm);
  34361. };
  34362. /*
  34363. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34364. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34365. *
  34366. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34367. * or `y` is NaN, in which case the return value will be also be NaN.
  34368. *
  34369. * The return value is not affected by the value of `precision`.
  34370. *
  34371. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34372. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34373. *
  34374. * 'toNearest() rounding mode not an integer: {rm}'
  34375. * 'toNearest() rounding mode out of range: {rm}'
  34376. *
  34377. */
  34378. P.toNearest = function (y, rm) {
  34379. var x = this,
  34380. Ctor = x.constructor;
  34381. x = new Ctor(x);
  34382. if (y == null) {
  34383. // If x is not finite, return x.
  34384. if (!x.d) return x;
  34385. y = new Ctor(1);
  34386. rm = Ctor.rounding;
  34387. } else {
  34388. y = new Ctor(y);
  34389. if (rm === void 0) {
  34390. rm = Ctor.rounding;
  34391. } else {
  34392. checkInt32(rm, 0, 8);
  34393. }
  34394. // If x is not finite, return x if y is not NaN, else NaN.
  34395. if (!x.d) return y.s ? x : y;
  34396. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34397. if (!y.d) {
  34398. if (y.s) y.s = x.s;
  34399. return y;
  34400. }
  34401. }
  34402. // If y is not zero, calculate the nearest multiple of y to x.
  34403. if (y.d[0]) {
  34404. external = false;
  34405. x = divide(x, y, 0, rm, 1).times(y);
  34406. external = true;
  34407. finalise(x);
  34408. // If y is zero, return zero with the sign of x.
  34409. } else {
  34410. y.s = x.s;
  34411. x = y;
  34412. }
  34413. return x;
  34414. };
  34415. /*
  34416. * Return the value of this Decimal converted to a number primitive.
  34417. * Zero keeps its sign.
  34418. *
  34419. */
  34420. P.toNumber = function () {
  34421. return +this;
  34422. };
  34423. /*
  34424. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34425. * digits using rounding mode `rm`.
  34426. *
  34427. * If the optional `sd` argument is present then return binary exponential notation.
  34428. *
  34429. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34430. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34431. *
  34432. */
  34433. P.toOctal = function (sd, rm) {
  34434. return toStringBinary(this, 8, sd, rm);
  34435. };
  34436. /*
  34437. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34438. * to `precision` significant digits using rounding mode `rounding`.
  34439. *
  34440. * ECMAScript compliant.
  34441. *
  34442. * pow(x, NaN) = NaN
  34443. * pow(x, ±0) = 1
  34444. * pow(NaN, non-zero) = NaN
  34445. * pow(abs(x) > 1, +Infinity) = +Infinity
  34446. * pow(abs(x) > 1, -Infinity) = +0
  34447. * pow(abs(x) == 1, ±Infinity) = NaN
  34448. * pow(abs(x) < 1, +Infinity) = +0
  34449. * pow(abs(x) < 1, -Infinity) = +Infinity
  34450. * pow(+Infinity, y > 0) = +Infinity
  34451. * pow(+Infinity, y < 0) = +0
  34452. * pow(-Infinity, odd integer > 0) = -Infinity
  34453. * pow(-Infinity, even integer > 0) = +Infinity
  34454. * pow(-Infinity, odd integer < 0) = -0
  34455. * pow(-Infinity, even integer < 0) = +0
  34456. * pow(+0, y > 0) = +0
  34457. * pow(+0, y < 0) = +Infinity
  34458. * pow(-0, odd integer > 0) = -0
  34459. * pow(-0, even integer > 0) = +0
  34460. * pow(-0, odd integer < 0) = -Infinity
  34461. * pow(-0, even integer < 0) = +Infinity
  34462. * pow(finite x < 0, finite non-integer) = NaN
  34463. *
  34464. * For non-integer or very large exponents pow(x, y) is calculated using
  34465. *
  34466. * x^y = exp(y*ln(x))
  34467. *
  34468. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34469. * probability of an incorrectly rounded result
  34470. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34471. * i.e. 1 in 250,000,000,000,000
  34472. *
  34473. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34474. *
  34475. * y {number|string|Decimal} The power to which to raise this Decimal.
  34476. *
  34477. */
  34478. P.toPower = P.pow = function (y) {
  34479. var e,
  34480. k,
  34481. pr,
  34482. r,
  34483. rm,
  34484. s,
  34485. x = this,
  34486. Ctor = x.constructor,
  34487. yn = +(y = new Ctor(y));
  34488. // Either ±Infinity, NaN or ±0?
  34489. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34490. x = new Ctor(x);
  34491. if (x.eq(1)) return x;
  34492. pr = Ctor.precision;
  34493. rm = Ctor.rounding;
  34494. if (y.eq(1)) return finalise(x, pr, rm);
  34495. // y exponent
  34496. e = mathfloor(y.e / LOG_BASE);
  34497. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34498. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34499. r = intPow(Ctor, x, k, pr);
  34500. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34501. }
  34502. s = x.s;
  34503. // if x is negative
  34504. if (s < 0) {
  34505. // if y is not an integer
  34506. if (e < y.d.length - 1) return new Ctor(NaN);
  34507. // Result is positive if x is negative and the last digit of integer y is even.
  34508. if ((y.d[e] & 1) == 0) s = 1;
  34509. // if x.eq(-1)
  34510. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  34511. x.s = s;
  34512. return x;
  34513. }
  34514. }
  34515. // Estimate result exponent.
  34516. // x^y = 10^e, where e = y * log10(x)
  34517. // log10(x) = log10(x_significand) + x_exponent
  34518. // log10(x_significand) = ln(x_significand) / ln(10)
  34519. k = mathpow(+x, yn);
  34520. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  34521. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  34522. // Overflow/underflow?
  34523. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  34524. external = false;
  34525. Ctor.rounding = x.s = 1;
  34526. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  34527. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  34528. // new Decimal(2.32456).pow('2087987436534566.46411')
  34529. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  34530. k = Math.min(12, (e + '').length);
  34531. // r = x^y = exp(y*ln(x))
  34532. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  34533. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  34534. if (r.d) {
  34535. // Truncate to the required precision plus five rounding digits.
  34536. r = finalise(r, pr + 5, 1);
  34537. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  34538. // the result.
  34539. if (checkRoundingDigits(r.d, pr, rm)) {
  34540. e = pr + 10;
  34541. // Truncate to the increased precision plus five rounding digits.
  34542. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  34543. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  34544. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  34545. r = finalise(r, pr + 1, 0);
  34546. }
  34547. }
  34548. }
  34549. r.s = s;
  34550. external = true;
  34551. Ctor.rounding = rm;
  34552. return finalise(r, pr, rm);
  34553. };
  34554. /*
  34555. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  34556. * using rounding mode `rounding`.
  34557. *
  34558. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  34559. * the integer part of the value in normal notation.
  34560. *
  34561. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34562. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34563. *
  34564. */
  34565. P.toPrecision = function (sd, rm) {
  34566. var str,
  34567. x = this,
  34568. Ctor = x.constructor;
  34569. if (sd === void 0) {
  34570. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34571. } else {
  34572. checkInt32(sd, 1, MAX_DIGITS);
  34573. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34574. x = finalise(new Ctor(x), sd, rm);
  34575. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  34576. }
  34577. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34578. };
  34579. /*
  34580. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  34581. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  34582. * omitted.
  34583. *
  34584. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34585. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34586. *
  34587. * 'toSD() digits out of range: {sd}'
  34588. * 'toSD() digits not an integer: {sd}'
  34589. * 'toSD() rounding mode not an integer: {rm}'
  34590. * 'toSD() rounding mode out of range: {rm}'
  34591. *
  34592. */
  34593. P.toSignificantDigits = P.toSD = function (sd, rm) {
  34594. var x = this,
  34595. Ctor = x.constructor;
  34596. if (sd === void 0) {
  34597. sd = Ctor.precision;
  34598. rm = Ctor.rounding;
  34599. } else {
  34600. checkInt32(sd, 1, MAX_DIGITS);
  34601. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34602. }
  34603. return finalise(new Ctor(x), sd, rm);
  34604. };
  34605. /*
  34606. * Return a string representing the value of this Decimal.
  34607. *
  34608. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  34609. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  34610. *
  34611. */
  34612. P.toString = function () {
  34613. var x = this,
  34614. Ctor = x.constructor,
  34615. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34616. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34617. };
  34618. /*
  34619. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  34620. *
  34621. */
  34622. P.truncated = P.trunc = function () {
  34623. return finalise(new this.constructor(this), this.e + 1, 1);
  34624. };
  34625. /*
  34626. * Return a string representing the value of this Decimal.
  34627. * Unlike `toString`, negative zero will include the minus sign.
  34628. *
  34629. */
  34630. P.valueOf = P.toJSON = function () {
  34631. var x = this,
  34632. Ctor = x.constructor,
  34633. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34634. return x.isNeg() ? '-' + str : str;
  34635. };
  34636. /*
  34637. // Add aliases to match BigDecimal method names.
  34638. // P.add = P.plus;
  34639. P.subtract = P.minus;
  34640. P.multiply = P.times;
  34641. P.divide = P.div;
  34642. P.remainder = P.mod;
  34643. P.compareTo = P.cmp;
  34644. P.negate = P.neg;
  34645. */
  34646. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  34647. /*
  34648. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  34649. * finiteToString, naturalExponential, naturalLogarithm
  34650. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  34651. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  34652. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  34653. * convertBase toStringBinary, parseOther
  34654. * cos P.cos
  34655. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  34656. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  34657. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  34658. * taylorSeries, atan2, parseOther
  34659. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  34660. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  34661. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  34662. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  34663. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  34664. * P.truncated, divide, getLn10, getPi, naturalExponential,
  34665. * naturalLogarithm, ceil, floor, round, trunc
  34666. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  34667. * toStringBinary
  34668. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  34669. * getLn10 P.logarithm, naturalLogarithm
  34670. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  34671. * getPrecision P.precision, P.toFraction
  34672. * getZeroString digitsToString, finiteToString
  34673. * intPow P.toPower, parseOther
  34674. * isOdd toLessThanHalfPi
  34675. * maxOrMin max, min
  34676. * naturalExponential P.naturalExponential, P.toPower
  34677. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  34678. * P.toPower, naturalExponential
  34679. * nonFiniteToString finiteToString, toStringBinary
  34680. * parseDecimal Decimal
  34681. * parseOther Decimal
  34682. * sin P.sin
  34683. * taylorSeries P.cosh, P.sinh, cos, sin
  34684. * toLessThanHalfPi P.cos, P.sin
  34685. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  34686. * truncate intPow
  34687. *
  34688. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  34689. * naturalLogarithm, config, parseOther, random, Decimal
  34690. */
  34691. function digitsToString(d) {
  34692. var i,
  34693. k,
  34694. ws,
  34695. indexOfLastWord = d.length - 1,
  34696. str = '',
  34697. w = d[0];
  34698. if (indexOfLastWord > 0) {
  34699. str += w;
  34700. for (i = 1; i < indexOfLastWord; i++) {
  34701. ws = d[i] + '';
  34702. k = LOG_BASE - ws.length;
  34703. if (k) str += getZeroString(k);
  34704. str += ws;
  34705. }
  34706. w = d[i];
  34707. ws = w + '';
  34708. k = LOG_BASE - ws.length;
  34709. if (k) str += getZeroString(k);
  34710. } else if (w === 0) {
  34711. return '0';
  34712. }
  34713. // Remove trailing zeros of last w.
  34714. for (; w % 10 === 0;) {
  34715. w /= 10;
  34716. }return str + w;
  34717. }
  34718. function checkInt32(i, min, max) {
  34719. if (i !== ~~i || i < min || i > max) {
  34720. throw Error(invalidArgument + i);
  34721. }
  34722. }
  34723. /*
  34724. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  34725. * `repeating == null` if caller is `log` or `pow`,
  34726. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  34727. */
  34728. function checkRoundingDigits(d, i, rm, repeating) {
  34729. var di, k, r, rd;
  34730. // Get the length of the first word of the array d.
  34731. for (k = d[0]; k >= 10; k /= 10) {
  34732. --i;
  34733. } // Is the rounding digit in the first word of d?
  34734. if (--i < 0) {
  34735. i += LOG_BASE;
  34736. di = 0;
  34737. } else {
  34738. di = Math.ceil((i + 1) / LOG_BASE);
  34739. i %= LOG_BASE;
  34740. }
  34741. // i is the index (0 - 6) of the rounding digit.
  34742. // E.g. if within the word 3487563 the first rounding digit is 5,
  34743. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  34744. k = mathpow(10, LOG_BASE - i);
  34745. rd = d[di] % k | 0;
  34746. if (repeating == null) {
  34747. if (i < 3) {
  34748. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  34749. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  34750. } else {
  34751. 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;
  34752. }
  34753. } else {
  34754. if (i < 4) {
  34755. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  34756. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  34757. } else {
  34758. 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;
  34759. }
  34760. }
  34761. return r;
  34762. }
  34763. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  34764. // Eg. convertBase('255', 10, 16) returns [15, 15].
  34765. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  34766. function convertBase(str, baseIn, baseOut) {
  34767. var j,
  34768. arr = [0],
  34769. arrL,
  34770. i = 0,
  34771. strL = str.length;
  34772. for (; i < strL;) {
  34773. for (arrL = arr.length; arrL--;) {
  34774. arr[arrL] *= baseIn;
  34775. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  34776. for (j = 0; j < arr.length; j++) {
  34777. if (arr[j] > baseOut - 1) {
  34778. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  34779. arr[j + 1] += arr[j] / baseOut | 0;
  34780. arr[j] %= baseOut;
  34781. }
  34782. }
  34783. }
  34784. return arr.reverse();
  34785. }
  34786. /*
  34787. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  34788. * |x| < pi/2
  34789. *
  34790. */
  34791. function cosine(Ctor, x) {
  34792. var k,
  34793. y,
  34794. len = x.d.length;
  34795. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  34796. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  34797. // Estimate the optimum number of times to use the argument reduction.
  34798. if (len < 32) {
  34799. k = Math.ceil(len / 3);
  34800. y = Math.pow(4, -k).toString();
  34801. } else {
  34802. k = 16;
  34803. y = '2.3283064365386962890625e-10';
  34804. }
  34805. Ctor.precision += k;
  34806. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  34807. // Reverse argument reduction
  34808. for (var i = k; i--;) {
  34809. var cos2x = x.times(x);
  34810. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  34811. }
  34812. Ctor.precision -= k;
  34813. return x;
  34814. }
  34815. /*
  34816. * Perform division in the specified base.
  34817. */
  34818. var divide = function () {
  34819. // Assumes non-zero x and k, and hence non-zero result.
  34820. function multiplyInteger(x, k, base) {
  34821. var temp,
  34822. carry = 0,
  34823. i = x.length;
  34824. for (x = x.slice(); i--;) {
  34825. temp = x[i] * k + carry;
  34826. x[i] = temp % base | 0;
  34827. carry = temp / base | 0;
  34828. }
  34829. if (carry) x.unshift(carry);
  34830. return x;
  34831. }
  34832. function compare(a, b, aL, bL) {
  34833. var i, r;
  34834. if (aL != bL) {
  34835. r = aL > bL ? 1 : -1;
  34836. } else {
  34837. for (i = r = 0; i < aL; i++) {
  34838. if (a[i] != b[i]) {
  34839. r = a[i] > b[i] ? 1 : -1;
  34840. break;
  34841. }
  34842. }
  34843. }
  34844. return r;
  34845. }
  34846. function subtract(a, b, aL, base) {
  34847. var i = 0;
  34848. // Subtract b from a.
  34849. for (; aL--;) {
  34850. a[aL] -= i;
  34851. i = a[aL] < b[aL] ? 1 : 0;
  34852. a[aL] = i * base + a[aL] - b[aL];
  34853. }
  34854. // Remove leading zeros.
  34855. for (; !a[0] && a.length > 1;) {
  34856. a.shift();
  34857. }
  34858. }
  34859. return function (x, y, pr, rm, dp, base) {
  34860. var cmp,
  34861. e,
  34862. i,
  34863. k,
  34864. logBase,
  34865. more,
  34866. prod,
  34867. prodL,
  34868. q,
  34869. qd,
  34870. rem,
  34871. remL,
  34872. rem0,
  34873. sd,
  34874. t,
  34875. xi,
  34876. xL,
  34877. yd0,
  34878. yL,
  34879. yz,
  34880. Ctor = x.constructor,
  34881. sign = x.s == y.s ? 1 : -1,
  34882. xd = x.d,
  34883. yd = y.d;
  34884. // Either NaN, Infinity or 0?
  34885. if (!xd || !xd[0] || !yd || !yd[0]) {
  34886. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  34887. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  34888. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  34889. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  34890. }
  34891. if (base) {
  34892. logBase = 1;
  34893. e = x.e - y.e;
  34894. } else {
  34895. base = BASE;
  34896. logBase = LOG_BASE;
  34897. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  34898. }
  34899. yL = yd.length;
  34900. xL = xd.length;
  34901. q = new Ctor(sign);
  34902. qd = q.d = [];
  34903. // Result exponent may be one less than e.
  34904. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  34905. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  34906. if (yd[i] > (xd[i] || 0)) e--;
  34907. if (pr == null) {
  34908. sd = pr = Ctor.precision;
  34909. rm = Ctor.rounding;
  34910. } else if (dp) {
  34911. sd = pr + (x.e - y.e) + 1;
  34912. } else {
  34913. sd = pr;
  34914. }
  34915. if (sd < 0) {
  34916. qd.push(1);
  34917. more = true;
  34918. } else {
  34919. // Convert precision in number of base 10 digits to base 1e7 digits.
  34920. sd = sd / logBase + 2 | 0;
  34921. i = 0;
  34922. // divisor < 1e7
  34923. if (yL == 1) {
  34924. k = 0;
  34925. yd = yd[0];
  34926. sd++;
  34927. // k is the carry.
  34928. for (; (i < xL || k) && sd--; i++) {
  34929. t = k * base + (xd[i] || 0);
  34930. qd[i] = t / yd | 0;
  34931. k = t % yd | 0;
  34932. }
  34933. more = k || i < xL;
  34934. // divisor >= 1e7
  34935. } else {
  34936. // Normalise xd and yd so highest order digit of yd is >= base/2
  34937. k = base / (yd[0] + 1) | 0;
  34938. if (k > 1) {
  34939. yd = multiplyInteger(yd, k, base);
  34940. xd = multiplyInteger(xd, k, base);
  34941. yL = yd.length;
  34942. xL = xd.length;
  34943. }
  34944. xi = yL;
  34945. rem = xd.slice(0, yL);
  34946. remL = rem.length;
  34947. // Add zeros to make remainder as long as divisor.
  34948. for (; remL < yL;) {
  34949. rem[remL++] = 0;
  34950. }yz = yd.slice();
  34951. yz.unshift(0);
  34952. yd0 = yd[0];
  34953. if (yd[1] >= base / 2) ++yd0;
  34954. do {
  34955. k = 0;
  34956. // Compare divisor and remainder.
  34957. cmp = compare(yd, rem, yL, remL);
  34958. // If divisor < remainder.
  34959. if (cmp < 0) {
  34960. // Calculate trial digit, k.
  34961. rem0 = rem[0];
  34962. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  34963. // k will be how many times the divisor goes into the current remainder.
  34964. k = rem0 / yd0 | 0;
  34965. // Algorithm:
  34966. // 1. product = divisor * trial digit (k)
  34967. // 2. if product > remainder: product -= divisor, k--
  34968. // 3. remainder -= product
  34969. // 4. if product was < remainder at 2:
  34970. // 5. compare new remainder and divisor
  34971. // 6. If remainder > divisor: remainder -= divisor, k++
  34972. if (k > 1) {
  34973. if (k >= base) k = base - 1;
  34974. // product = divisor * trial digit.
  34975. prod = multiplyInteger(yd, k, base);
  34976. prodL = prod.length;
  34977. remL = rem.length;
  34978. // Compare product and remainder.
  34979. cmp = compare(prod, rem, prodL, remL);
  34980. // product > remainder.
  34981. if (cmp == 1) {
  34982. k--;
  34983. // Subtract divisor from product.
  34984. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  34985. }
  34986. } else {
  34987. // cmp is -1.
  34988. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  34989. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  34990. if (k == 0) cmp = k = 1;
  34991. prod = yd.slice();
  34992. }
  34993. prodL = prod.length;
  34994. if (prodL < remL) prod.unshift(0);
  34995. // Subtract product from remainder.
  34996. subtract(rem, prod, remL, base);
  34997. // If product was < previous remainder.
  34998. if (cmp == -1) {
  34999. remL = rem.length;
  35000. // Compare divisor and new remainder.
  35001. cmp = compare(yd, rem, yL, remL);
  35002. // If divisor < new remainder, subtract divisor from remainder.
  35003. if (cmp < 1) {
  35004. k++;
  35005. // Subtract divisor from remainder.
  35006. subtract(rem, yL < remL ? yz : yd, remL, base);
  35007. }
  35008. }
  35009. remL = rem.length;
  35010. } else if (cmp === 0) {
  35011. k++;
  35012. rem = [0];
  35013. } // if cmp === 1, k will be 0
  35014. // Add the next digit, k, to the result array.
  35015. qd[i++] = k;
  35016. // Update the remainder.
  35017. if (cmp && rem[0]) {
  35018. rem[remL++] = xd[xi] || 0;
  35019. } else {
  35020. rem = [xd[xi]];
  35021. remL = 1;
  35022. }
  35023. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  35024. more = rem[0] !== void 0;
  35025. }
  35026. // Leading zero?
  35027. if (!qd[0]) qd.shift();
  35028. }
  35029. // logBase is 1 when divide is being used for base conversion.
  35030. if (logBase == 1) {
  35031. q.e = e;
  35032. inexact = more;
  35033. } else {
  35034. // To calculate q.e, first get the number of digits of qd[0].
  35035. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  35036. i++;
  35037. }q.e = i + e * logBase - 1;
  35038. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  35039. }
  35040. return q;
  35041. };
  35042. }();
  35043. /*
  35044. * Round `x` to `sd` significant digits using rounding mode `rm`.
  35045. * Check for over/under-flow.
  35046. */
  35047. function finalise(x, sd, rm, isTruncated) {
  35048. var digits,
  35049. i,
  35050. j,
  35051. k,
  35052. rd,
  35053. roundUp,
  35054. w,
  35055. xd,
  35056. xdi,
  35057. Ctor = x.constructor;
  35058. // Don't round if sd is null or undefined.
  35059. out: if (sd != null) {
  35060. xd = x.d;
  35061. // Infinity/NaN.
  35062. if (!xd) return x;
  35063. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  35064. // w: the word of xd containing rd, a base 1e7 number.
  35065. // xdi: the index of w within xd.
  35066. // digits: the number of digits of w.
  35067. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  35068. // they had leading zeros)
  35069. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  35070. // Get the length of the first word of the digits array xd.
  35071. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  35072. digits++;
  35073. }i = sd - digits;
  35074. // Is the rounding digit in the first word of xd?
  35075. if (i < 0) {
  35076. i += LOG_BASE;
  35077. j = sd;
  35078. w = xd[xdi = 0];
  35079. // Get the rounding digit at index j of w.
  35080. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  35081. } else {
  35082. xdi = Math.ceil((i + 1) / LOG_BASE);
  35083. k = xd.length;
  35084. if (xdi >= k) {
  35085. if (isTruncated) {
  35086. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  35087. for (; k++ <= xdi;) {
  35088. xd.push(0);
  35089. }w = rd = 0;
  35090. digits = 1;
  35091. i %= LOG_BASE;
  35092. j = i - LOG_BASE + 1;
  35093. } else {
  35094. break out;
  35095. }
  35096. } else {
  35097. w = k = xd[xdi];
  35098. // Get the number of digits of w.
  35099. for (digits = 1; k >= 10; k /= 10) {
  35100. digits++;
  35101. } // Get the index of rd within w.
  35102. i %= LOG_BASE;
  35103. // Get the index of rd within w, adjusted for leading zeros.
  35104. // The number of leading zeros of w is given by LOG_BASE - digits.
  35105. j = i - LOG_BASE + digits;
  35106. // Get the rounding digit at index j of w.
  35107. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35108. }
  35109. }
  35110. // Are there any non-zero digits after the rounding digit?
  35111. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35112. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35113. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35114. // will give 714.
  35115. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35116. // Check whether the digit to the left of the rounding digit is odd.
  35117. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35118. if (sd < 1 || !xd[0]) {
  35119. xd.length = 0;
  35120. if (roundUp) {
  35121. // Convert sd to decimal places.
  35122. sd -= x.e + 1;
  35123. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35124. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35125. x.e = -sd || 0;
  35126. } else {
  35127. // Zero.
  35128. xd[0] = x.e = 0;
  35129. }
  35130. return x;
  35131. }
  35132. // Remove excess digits.
  35133. if (i == 0) {
  35134. xd.length = xdi;
  35135. k = 1;
  35136. xdi--;
  35137. } else {
  35138. xd.length = xdi + 1;
  35139. k = mathpow(10, LOG_BASE - i);
  35140. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35141. // j > 0 means i > number of leading zeros of w.
  35142. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35143. }
  35144. if (roundUp) {
  35145. for (;;) {
  35146. // Is the digit to be rounded up in the first word of xd?
  35147. if (xdi == 0) {
  35148. // i will be the length of xd[0] before k is added.
  35149. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35150. i++;
  35151. }j = xd[0] += k;
  35152. for (k = 1; j >= 10; j /= 10) {
  35153. k++;
  35154. } // if i != k the length has increased.
  35155. if (i != k) {
  35156. x.e++;
  35157. if (xd[0] == BASE) xd[0] = 1;
  35158. }
  35159. break;
  35160. } else {
  35161. xd[xdi] += k;
  35162. if (xd[xdi] != BASE) break;
  35163. xd[xdi--] = 0;
  35164. k = 1;
  35165. }
  35166. }
  35167. }
  35168. // Remove trailing zeros.
  35169. for (i = xd.length; xd[--i] === 0;) {
  35170. xd.pop();
  35171. }
  35172. }
  35173. if (external) {
  35174. // Overflow?
  35175. if (x.e > Ctor.maxE) {
  35176. // Infinity.
  35177. x.d = null;
  35178. x.e = NaN;
  35179. // Underflow?
  35180. } else if (x.e < Ctor.minE) {
  35181. // Zero.
  35182. x.e = 0;
  35183. x.d = [0];
  35184. // Ctor.underflow = true;
  35185. } // else Ctor.underflow = false;
  35186. }
  35187. return x;
  35188. }
  35189. function finiteToString(x, isExp, sd) {
  35190. if (!x.isFinite()) return nonFiniteToString(x);
  35191. var k,
  35192. e = x.e,
  35193. str = digitsToString(x.d),
  35194. len = str.length;
  35195. if (isExp) {
  35196. if (sd && (k = sd - len) > 0) {
  35197. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35198. } else if (len > 1) {
  35199. str = str.charAt(0) + '.' + str.slice(1);
  35200. }
  35201. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35202. } else if (e < 0) {
  35203. str = '0.' + getZeroString(-e - 1) + str;
  35204. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35205. } else if (e >= len) {
  35206. str += getZeroString(e + 1 - len);
  35207. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35208. } else {
  35209. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35210. if (sd && (k = sd - len) > 0) {
  35211. if (e + 1 === len) str += '.';
  35212. str += getZeroString(k);
  35213. }
  35214. }
  35215. return str;
  35216. }
  35217. // Calculate the base 10 exponent from the base 1e7 exponent.
  35218. function getBase10Exponent(digits, e) {
  35219. var w = digits[0];
  35220. // Add the number of digits of the first word of the digits array.
  35221. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35222. e++;
  35223. }return e;
  35224. }
  35225. function getLn10(Ctor, sd, pr) {
  35226. if (sd > LN10_PRECISION) {
  35227. // Reset global state in case the exception is caught.
  35228. external = true;
  35229. if (pr) Ctor.precision = pr;
  35230. throw Error(precisionLimitExceeded);
  35231. }
  35232. return finalise(new Ctor(LN10), sd, 1, true);
  35233. }
  35234. function getPi(Ctor, sd, rm) {
  35235. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35236. return finalise(new Ctor(PI), sd, rm, true);
  35237. }
  35238. function getPrecision(digits) {
  35239. var w = digits.length - 1,
  35240. len = w * LOG_BASE + 1;
  35241. w = digits[w];
  35242. // If non-zero...
  35243. if (w) {
  35244. // Subtract the number of trailing zeros of the last word.
  35245. for (; w % 10 == 0; w /= 10) {
  35246. len--;
  35247. } // Add the number of digits of the first word.
  35248. for (w = digits[0]; w >= 10; w /= 10) {
  35249. len++;
  35250. }
  35251. }
  35252. return len;
  35253. }
  35254. function getZeroString(k) {
  35255. var zs = '';
  35256. for (; k--;) {
  35257. zs += '0';
  35258. }return zs;
  35259. }
  35260. /*
  35261. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35262. * integer of type number.
  35263. *
  35264. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35265. *
  35266. */
  35267. function intPow(Ctor, x, n, pr) {
  35268. var isTruncated,
  35269. r = new Ctor(1),
  35270. // Max n of 9007199254740991 takes 53 loop iterations.
  35271. // Maximum digits array length; leaves [28, 34] guard digits.
  35272. k = Math.ceil(pr / LOG_BASE + 4);
  35273. external = false;
  35274. for (;;) {
  35275. if (n % 2) {
  35276. r = r.times(x);
  35277. if (truncate(r.d, k)) isTruncated = true;
  35278. }
  35279. n = mathfloor(n / 2);
  35280. if (n === 0) {
  35281. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35282. n = r.d.length - 1;
  35283. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35284. break;
  35285. }
  35286. x = x.times(x);
  35287. truncate(x.d, k);
  35288. }
  35289. external = true;
  35290. return r;
  35291. }
  35292. function isOdd(n) {
  35293. return n.d[n.d.length - 1] & 1;
  35294. }
  35295. /*
  35296. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35297. */
  35298. function maxOrMin(Ctor, args, ltgt) {
  35299. var y,
  35300. x = new Ctor(args[0]),
  35301. i = 0;
  35302. for (; ++i < args.length;) {
  35303. y = new Ctor(args[i]);
  35304. if (!y.s) {
  35305. x = y;
  35306. break;
  35307. } else if (x[ltgt](y)) {
  35308. x = y;
  35309. }
  35310. }
  35311. return x;
  35312. }
  35313. /*
  35314. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35315. * digits.
  35316. *
  35317. * Taylor/Maclaurin series.
  35318. *
  35319. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35320. *
  35321. * Argument reduction:
  35322. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35323. * exp(x) = exp(x / 2^k)^(2^k)
  35324. *
  35325. * Previously, the argument was initially reduced by
  35326. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35327. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35328. * found to be slower than just dividing repeatedly by 32 as above.
  35329. *
  35330. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35331. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35332. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35333. *
  35334. * exp(Infinity) = Infinity
  35335. * exp(-Infinity) = 0
  35336. * exp(NaN) = NaN
  35337. * exp(±0) = 1
  35338. *
  35339. * exp(x) is non-terminating for any finite, non-zero x.
  35340. *
  35341. * The result will always be correctly rounded.
  35342. *
  35343. */
  35344. function naturalExponential(x, sd) {
  35345. var denominator,
  35346. guard,
  35347. j,
  35348. pow,
  35349. sum,
  35350. t,
  35351. wpr,
  35352. rep = 0,
  35353. i = 0,
  35354. k = 0,
  35355. Ctor = x.constructor,
  35356. rm = Ctor.rounding,
  35357. pr = Ctor.precision;
  35358. // 0/NaN/Infinity?
  35359. if (!x.d || !x.d[0] || x.e > 17) {
  35360. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35361. }
  35362. if (sd == null) {
  35363. external = false;
  35364. wpr = pr;
  35365. } else {
  35366. wpr = sd;
  35367. }
  35368. t = new Ctor(0.03125);
  35369. // while abs(x) >= 0.1
  35370. while (x.e > -2) {
  35371. // x = x / 2^5
  35372. x = x.times(t);
  35373. k += 5;
  35374. }
  35375. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35376. // necessary to ensure the first 4 rounding digits are correct.
  35377. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35378. wpr += guard;
  35379. denominator = pow = sum = new Ctor(1);
  35380. Ctor.precision = wpr;
  35381. for (;;) {
  35382. pow = finalise(pow.times(x), wpr, 1);
  35383. denominator = denominator.times(++i);
  35384. t = sum.plus(divide(pow, denominator, wpr, 1));
  35385. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35386. j = k;
  35387. while (j--) {
  35388. sum = finalise(sum.times(sum), wpr, 1);
  35389. } // Check to see if the first 4 rounding digits are [49]999.
  35390. // If so, repeat the summation with a higher precision, otherwise
  35391. // e.g. with precision: 18, rounding: 1
  35392. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35393. // `wpr - guard` is the index of first rounding digit.
  35394. if (sd == null) {
  35395. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35396. Ctor.precision = wpr += 10;
  35397. denominator = pow = t = new Ctor(1);
  35398. i = 0;
  35399. rep++;
  35400. } else {
  35401. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35402. }
  35403. } else {
  35404. Ctor.precision = pr;
  35405. return sum;
  35406. }
  35407. }
  35408. sum = t;
  35409. }
  35410. }
  35411. /*
  35412. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35413. * digits.
  35414. *
  35415. * ln(-n) = NaN
  35416. * ln(0) = -Infinity
  35417. * ln(-0) = -Infinity
  35418. * ln(1) = 0
  35419. * ln(Infinity) = Infinity
  35420. * ln(-Infinity) = NaN
  35421. * ln(NaN) = NaN
  35422. *
  35423. * ln(n) (n != 1) is non-terminating.
  35424. *
  35425. */
  35426. function naturalLogarithm(y, sd) {
  35427. var c,
  35428. c0,
  35429. denominator,
  35430. e,
  35431. numerator,
  35432. rep,
  35433. sum,
  35434. t,
  35435. wpr,
  35436. x1,
  35437. x2,
  35438. n = 1,
  35439. guard = 10,
  35440. x = y,
  35441. xd = x.d,
  35442. Ctor = x.constructor,
  35443. rm = Ctor.rounding,
  35444. pr = Ctor.precision;
  35445. // Is x negative or Infinity, NaN, 0 or 1?
  35446. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35447. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35448. }
  35449. if (sd == null) {
  35450. external = false;
  35451. wpr = pr;
  35452. } else {
  35453. wpr = sd;
  35454. }
  35455. Ctor.precision = wpr += guard;
  35456. c = digitsToString(xd);
  35457. c0 = c.charAt(0);
  35458. if (Math.abs(e = x.e) < 1.5e15) {
  35459. // Argument reduction.
  35460. // The series converges faster the closer the argument is to 1, so using
  35461. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35462. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35463. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35464. // later be divided by this number, then separate out the power of 10 using
  35465. // ln(a*10^b) = ln(a) + b*ln(10).
  35466. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35467. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35468. // max n is 6 (gives 0.7 - 1.3)
  35469. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35470. x = x.times(y);
  35471. c = digitsToString(x.d);
  35472. c0 = c.charAt(0);
  35473. n++;
  35474. }
  35475. e = x.e;
  35476. if (c0 > 1) {
  35477. x = new Ctor('0.' + c);
  35478. e++;
  35479. } else {
  35480. x = new Ctor(c0 + '.' + c.slice(1));
  35481. }
  35482. } else {
  35483. // The argument reduction method above may result in overflow if the argument y is a massive
  35484. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35485. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35486. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35487. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35488. Ctor.precision = pr;
  35489. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35490. }
  35491. // x1 is x reduced to a value near 1.
  35492. x1 = x;
  35493. // Taylor series.
  35494. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35495. // where x = (y - 1)/(y + 1) (|x| < 1)
  35496. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35497. x2 = finalise(x.times(x), wpr, 1);
  35498. denominator = 3;
  35499. for (;;) {
  35500. numerator = finalise(numerator.times(x2), wpr, 1);
  35501. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  35502. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35503. sum = sum.times(2);
  35504. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  35505. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  35506. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  35507. sum = divide(sum, new Ctor(n), wpr, 1);
  35508. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  35509. // been repeated previously) and the first 4 rounding digits 9999?
  35510. // If so, restart the summation with a higher precision, otherwise
  35511. // e.g. with precision: 12, rounding: 1
  35512. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  35513. // `wpr - guard` is the index of first rounding digit.
  35514. if (sd == null) {
  35515. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35516. Ctor.precision = wpr += guard;
  35517. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  35518. x2 = finalise(x.times(x), wpr, 1);
  35519. denominator = rep = 1;
  35520. } else {
  35521. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35522. }
  35523. } else {
  35524. Ctor.precision = pr;
  35525. return sum;
  35526. }
  35527. }
  35528. sum = t;
  35529. denominator += 2;
  35530. }
  35531. }
  35532. // ±Infinity, NaN.
  35533. function nonFiniteToString(x) {
  35534. // Unsigned.
  35535. return String(x.s * x.s / 0);
  35536. }
  35537. /*
  35538. * Parse the value of a new Decimal `x` from string `str`.
  35539. */
  35540. function parseDecimal(x, str) {
  35541. var e, i, len;
  35542. // Decimal point?
  35543. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  35544. // Exponential form?
  35545. if ((i = str.search(/e/i)) > 0) {
  35546. // Determine exponent.
  35547. if (e < 0) e = i;
  35548. e += +str.slice(i + 1);
  35549. str = str.substring(0, i);
  35550. } else if (e < 0) {
  35551. // Integer.
  35552. e = str.length;
  35553. }
  35554. // Determine leading zeros.
  35555. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  35556. // Determine trailing zeros.
  35557. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  35558. str = str.slice(i, len);
  35559. if (str) {
  35560. len -= i;
  35561. x.e = e = e - i - 1;
  35562. x.d = [];
  35563. // Transform base
  35564. // e is the base 10 exponent.
  35565. // i is where to slice str to get the first word of the digits array.
  35566. i = (e + 1) % LOG_BASE;
  35567. if (e < 0) i += LOG_BASE;
  35568. if (i < len) {
  35569. if (i) x.d.push(+str.slice(0, i));
  35570. for (len -= LOG_BASE; i < len;) {
  35571. x.d.push(+str.slice(i, i += LOG_BASE));
  35572. }str = str.slice(i);
  35573. i = LOG_BASE - str.length;
  35574. } else {
  35575. i -= len;
  35576. }
  35577. for (; i--;) {
  35578. str += '0';
  35579. }x.d.push(+str);
  35580. if (external) {
  35581. // Overflow?
  35582. if (x.e > x.constructor.maxE) {
  35583. // Infinity.
  35584. x.d = null;
  35585. x.e = NaN;
  35586. // Underflow?
  35587. } else if (x.e < x.constructor.minE) {
  35588. // Zero.
  35589. x.e = 0;
  35590. x.d = [0];
  35591. // x.constructor.underflow = true;
  35592. } // else x.constructor.underflow = false;
  35593. }
  35594. } else {
  35595. // Zero.
  35596. x.e = 0;
  35597. x.d = [0];
  35598. }
  35599. return x;
  35600. }
  35601. /*
  35602. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  35603. */
  35604. function parseOther(x, str) {
  35605. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  35606. if (str === 'Infinity' || str === 'NaN') {
  35607. if (!+str) x.s = NaN;
  35608. x.e = NaN;
  35609. x.d = null;
  35610. return x;
  35611. }
  35612. if (isHex.test(str)) {
  35613. base = 16;
  35614. str = str.toLowerCase();
  35615. } else if (isBinary.test(str)) {
  35616. base = 2;
  35617. } else if (isOctal.test(str)) {
  35618. base = 8;
  35619. } else {
  35620. throw Error(invalidArgument + str);
  35621. }
  35622. // Is there a binary exponent part?
  35623. i = str.search(/p/i);
  35624. if (i > 0) {
  35625. p = +str.slice(i + 1);
  35626. str = str.substring(2, i);
  35627. } else {
  35628. str = str.slice(2);
  35629. }
  35630. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  35631. // fraction part will be restored.
  35632. i = str.indexOf('.');
  35633. isFloat = i >= 0;
  35634. Ctor = x.constructor;
  35635. if (isFloat) {
  35636. str = str.replace('.', '');
  35637. len = str.length;
  35638. i = len - i;
  35639. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  35640. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  35641. }
  35642. xd = convertBase(str, base, BASE);
  35643. xe = xd.length - 1;
  35644. // Remove trailing zeros.
  35645. for (i = xe; xd[i] === 0; --i) {
  35646. xd.pop();
  35647. }if (i < 0) return new Ctor(x.s * 0);
  35648. x.e = getBase10Exponent(xd, xe);
  35649. x.d = xd;
  35650. external = false;
  35651. // At what precision to perform the division to ensure exact conversion?
  35652. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  35653. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  35654. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  35655. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  35656. // Therefore using 4 * the number of digits of str will always be enough.
  35657. if (isFloat) x = divide(x, divisor, len * 4);
  35658. // Multiply by the binary exponent part if present.
  35659. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  35660. external = true;
  35661. return x;
  35662. }
  35663. /*
  35664. * sin(x) = x - x^3/3! + x^5/5! - ...
  35665. * |x| < pi/2
  35666. *
  35667. */
  35668. function sine(Ctor, x) {
  35669. var k,
  35670. len = x.d.length;
  35671. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  35672. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  35673. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  35674. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  35675. // Estimate the optimum number of times to use the argument reduction.
  35676. k = 1.4 * Math.sqrt(len);
  35677. k = k > 16 ? 16 : k | 0;
  35678. // Max k before Math.pow precision loss is 22
  35679. x = x.times(Math.pow(5, -k));
  35680. x = taylorSeries(Ctor, 2, x, x);
  35681. // Reverse argument reduction
  35682. var sin2_x,
  35683. d5 = new Ctor(5),
  35684. d16 = new Ctor(16),
  35685. d20 = new Ctor(20);
  35686. for (; k--;) {
  35687. sin2_x = x.times(x);
  35688. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  35689. }
  35690. return x;
  35691. }
  35692. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  35693. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  35694. var j,
  35695. t,
  35696. u,
  35697. x2,
  35698. i = 1,
  35699. pr = Ctor.precision,
  35700. k = Math.ceil(pr / LOG_BASE);
  35701. external = false;
  35702. x2 = x.times(x);
  35703. u = new Ctor(y);
  35704. for (;;) {
  35705. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  35706. u = isHyperbolic ? y.plus(t) : y.minus(t);
  35707. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  35708. t = u.plus(y);
  35709. if (t.d[k] !== void 0) {
  35710. for (j = k; t.d[j] === u.d[j] && j--;) {}
  35711. if (j == -1) break;
  35712. }
  35713. j = u;
  35714. u = y;
  35715. y = t;
  35716. t = j;
  35717. i++;
  35718. }
  35719. external = true;
  35720. t.d.length = k + 1;
  35721. return t;
  35722. }
  35723. // Return the absolute value of `x` reduced to less than or equal to half pi.
  35724. function toLessThanHalfPi(Ctor, x) {
  35725. var t,
  35726. isNeg = x.s < 0,
  35727. pi = getPi(Ctor, Ctor.precision, 1),
  35728. halfPi = pi.times(0.5);
  35729. x = x.abs();
  35730. if (x.lte(halfPi)) {
  35731. quadrant = isNeg ? 4 : 1;
  35732. return x;
  35733. }
  35734. t = x.divToInt(pi);
  35735. if (t.isZero()) {
  35736. quadrant = isNeg ? 3 : 2;
  35737. } else {
  35738. x = x.minus(t.times(pi));
  35739. // 0 <= x < pi
  35740. if (x.lte(halfPi)) {
  35741. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  35742. return x;
  35743. }
  35744. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  35745. }
  35746. return x.minus(pi).abs();
  35747. }
  35748. /*
  35749. * Return the value of Decimal `x` as a string in base `baseOut`.
  35750. *
  35751. * If the optional `sd` argument is present include a binary exponent suffix.
  35752. */
  35753. function toStringBinary(x, baseOut, sd, rm) {
  35754. var base,
  35755. e,
  35756. i,
  35757. k,
  35758. len,
  35759. roundUp,
  35760. str,
  35761. xd,
  35762. y,
  35763. Ctor = x.constructor,
  35764. isExp = sd !== void 0;
  35765. if (isExp) {
  35766. checkInt32(sd, 1, MAX_DIGITS);
  35767. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35768. } else {
  35769. sd = Ctor.precision;
  35770. rm = Ctor.rounding;
  35771. }
  35772. if (!x.isFinite()) {
  35773. str = nonFiniteToString(x);
  35774. } else {
  35775. str = finiteToString(x);
  35776. i = str.indexOf('.');
  35777. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  35778. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  35779. // minBinaryExponent = floor(decimalExponent * log[2](10))
  35780. // log[2](10) = 3.321928094887362347870319429489390175864
  35781. if (isExp) {
  35782. base = 2;
  35783. if (baseOut == 16) {
  35784. sd = sd * 4 - 3;
  35785. } else if (baseOut == 8) {
  35786. sd = sd * 3 - 2;
  35787. }
  35788. } else {
  35789. base = baseOut;
  35790. }
  35791. // Convert the number as an integer then divide the result by its base raised to a power such
  35792. // that the fraction part will be restored.
  35793. // Non-integer.
  35794. if (i >= 0) {
  35795. str = str.replace('.', '');
  35796. y = new Ctor(1);
  35797. y.e = str.length - i;
  35798. y.d = convertBase(finiteToString(y), 10, base);
  35799. y.e = y.d.length;
  35800. }
  35801. xd = convertBase(str, 10, base);
  35802. e = len = xd.length;
  35803. // Remove trailing zeros.
  35804. for (; xd[--len] == 0;) {
  35805. xd.pop();
  35806. }if (!xd[0]) {
  35807. str = isExp ? '0p+0' : '0';
  35808. } else {
  35809. if (i < 0) {
  35810. e--;
  35811. } else {
  35812. x = new Ctor(x);
  35813. x.d = xd;
  35814. x.e = e;
  35815. x = divide(x, y, sd, rm, 0, base);
  35816. xd = x.d;
  35817. e = x.e;
  35818. roundUp = inexact;
  35819. }
  35820. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  35821. i = xd[sd];
  35822. k = base / 2;
  35823. roundUp = roundUp || xd[sd + 1] !== void 0;
  35824. 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));
  35825. xd.length = sd;
  35826. if (roundUp) {
  35827. // Rounding up may mean the previous digit has to be rounded up and so on.
  35828. for (; ++xd[--sd] > base - 1;) {
  35829. xd[sd] = 0;
  35830. if (!sd) {
  35831. ++e;
  35832. xd.unshift(1);
  35833. }
  35834. }
  35835. }
  35836. // Determine trailing zeros.
  35837. for (len = xd.length; !xd[len - 1]; --len) {}
  35838. // E.g. [4, 11, 15] becomes 4bf.
  35839. for (i = 0, str = ''; i < len; i++) {
  35840. str += NUMERALS.charAt(xd[i]);
  35841. } // Add binary exponent suffix?
  35842. if (isExp) {
  35843. if (len > 1) {
  35844. if (baseOut == 16 || baseOut == 8) {
  35845. i = baseOut == 16 ? 4 : 3;
  35846. for (--len; len % i; len++) {
  35847. str += '0';
  35848. }xd = convertBase(str, base, baseOut);
  35849. for (len = xd.length; !xd[len - 1]; --len) {}
  35850. // xd[0] will always be be 1
  35851. for (i = 1, str = '1.'; i < len; i++) {
  35852. str += NUMERALS.charAt(xd[i]);
  35853. }
  35854. } else {
  35855. str = str.charAt(0) + '.' + str.slice(1);
  35856. }
  35857. }
  35858. str = str + (e < 0 ? 'p' : 'p+') + e;
  35859. } else if (e < 0) {
  35860. for (; ++e;) {
  35861. str = '0' + str;
  35862. }str = '0.' + str;
  35863. } else {
  35864. if (++e > len) for (e -= len; e--;) {
  35865. str += '0';
  35866. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  35867. }
  35868. }
  35869. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  35870. }
  35871. return x.s < 0 ? '-' + str : str;
  35872. }
  35873. // Does not strip trailing zeros.
  35874. function truncate(arr, len) {
  35875. if (arr.length > len) {
  35876. arr.length = len;
  35877. return true;
  35878. }
  35879. }
  35880. // Decimal methods
  35881. /*
  35882. * abs
  35883. * acos
  35884. * acosh
  35885. * add
  35886. * asin
  35887. * asinh
  35888. * atan
  35889. * atanh
  35890. * atan2
  35891. * cbrt
  35892. * ceil
  35893. * clone
  35894. * config
  35895. * cos
  35896. * cosh
  35897. * div
  35898. * exp
  35899. * floor
  35900. * hypot
  35901. * ln
  35902. * log
  35903. * log2
  35904. * log10
  35905. * max
  35906. * min
  35907. * mod
  35908. * mul
  35909. * pow
  35910. * random
  35911. * round
  35912. * set
  35913. * sign
  35914. * sin
  35915. * sinh
  35916. * sqrt
  35917. * sub
  35918. * tan
  35919. * tanh
  35920. * trunc
  35921. */
  35922. /*
  35923. * Return a new Decimal whose value is the absolute value of `x`.
  35924. *
  35925. * x {number|string|Decimal}
  35926. *
  35927. */
  35928. function abs(x) {
  35929. return new this(x).abs();
  35930. }
  35931. /*
  35932. * Return a new Decimal whose value is the arccosine in radians of `x`.
  35933. *
  35934. * x {number|string|Decimal}
  35935. *
  35936. */
  35937. function acos(x) {
  35938. return new this(x).acos();
  35939. }
  35940. /*
  35941. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  35942. * `precision` significant digits using rounding mode `rounding`.
  35943. *
  35944. * x {number|string|Decimal} A value in radians.
  35945. *
  35946. */
  35947. function acosh(x) {
  35948. return new this(x).acosh();
  35949. }
  35950. /*
  35951. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  35952. * digits using rounding mode `rounding`.
  35953. *
  35954. * x {number|string|Decimal}
  35955. * y {number|string|Decimal}
  35956. *
  35957. */
  35958. function add(x, y) {
  35959. return new this(x).plus(y);
  35960. }
  35961. /*
  35962. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  35963. * significant digits using rounding mode `rounding`.
  35964. *
  35965. * x {number|string|Decimal}
  35966. *
  35967. */
  35968. function asin(x) {
  35969. return new this(x).asin();
  35970. }
  35971. /*
  35972. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  35973. * `precision` significant digits using rounding mode `rounding`.
  35974. *
  35975. * x {number|string|Decimal} A value in radians.
  35976. *
  35977. */
  35978. function asinh(x) {
  35979. return new this(x).asinh();
  35980. }
  35981. /*
  35982. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  35983. * significant digits using rounding mode `rounding`.
  35984. *
  35985. * x {number|string|Decimal}
  35986. *
  35987. */
  35988. function atan(x) {
  35989. return new this(x).atan();
  35990. }
  35991. /*
  35992. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  35993. * `precision` significant digits using rounding mode `rounding`.
  35994. *
  35995. * x {number|string|Decimal} A value in radians.
  35996. *
  35997. */
  35998. function atanh(x) {
  35999. return new this(x).atanh();
  36000. }
  36001. /*
  36002. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  36003. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  36004. *
  36005. * Domain: [-Infinity, Infinity]
  36006. * Range: [-pi, pi]
  36007. *
  36008. * y {number|string|Decimal} The y-coordinate.
  36009. * x {number|string|Decimal} The x-coordinate.
  36010. *
  36011. * atan2(±0, -0) = ±pi
  36012. * atan2(±0, +0) = ±0
  36013. * atan2(±0, -x) = ±pi for x > 0
  36014. * atan2(±0, x) = ±0 for x > 0
  36015. * atan2(-y, ±0) = -pi/2 for y > 0
  36016. * atan2(y, ±0) = pi/2 for y > 0
  36017. * atan2(±y, -Infinity) = ±pi for finite y > 0
  36018. * atan2(±y, +Infinity) = ±0 for finite y > 0
  36019. * atan2(±Infinity, x) = ±pi/2 for finite x
  36020. * atan2(±Infinity, -Infinity) = ±3*pi/4
  36021. * atan2(±Infinity, +Infinity) = ±pi/4
  36022. * atan2(NaN, x) = NaN
  36023. * atan2(y, NaN) = NaN
  36024. *
  36025. */
  36026. function atan2(y, x) {
  36027. y = new this(y);
  36028. x = new this(x);
  36029. var r,
  36030. pr = this.precision,
  36031. rm = this.rounding,
  36032. wpr = pr + 4;
  36033. // Either NaN
  36034. if (!y.s || !x.s) {
  36035. r = new this(NaN);
  36036. // Both ±Infinity
  36037. } else if (!y.d && !x.d) {
  36038. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  36039. r.s = y.s;
  36040. // x is ±Infinity or y is ±0
  36041. } else if (!x.d || y.isZero()) {
  36042. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  36043. r.s = y.s;
  36044. // y is ±Infinity or x is ±0
  36045. } else if (!y.d || x.isZero()) {
  36046. r = getPi(this, wpr, 1).times(0.5);
  36047. r.s = y.s;
  36048. // Both non-zero and finite
  36049. } else if (x.s < 0) {
  36050. this.precision = wpr;
  36051. this.rounding = 1;
  36052. r = this.atan(divide(y, x, wpr, 1));
  36053. x = getPi(this, wpr, 1);
  36054. this.precision = pr;
  36055. this.rounding = rm;
  36056. r = y.s < 0 ? r.minus(x) : r.plus(x);
  36057. } else {
  36058. r = this.atan(divide(y, x, wpr, 1));
  36059. }
  36060. return r;
  36061. }
  36062. /*
  36063. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  36064. * digits using rounding mode `rounding`.
  36065. *
  36066. * x {number|string|Decimal}
  36067. *
  36068. */
  36069. function cbrt(x) {
  36070. return new this(x).cbrt();
  36071. }
  36072. /*
  36073. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  36074. *
  36075. * x {number|string|Decimal}
  36076. *
  36077. */
  36078. function ceil(x) {
  36079. return finalise(x = new this(x), x.e + 1, 2);
  36080. }
  36081. /*
  36082. * Configure global settings for a Decimal constructor.
  36083. *
  36084. * `obj` is an object with one or more of the following properties,
  36085. *
  36086. * precision {number}
  36087. * rounding {number}
  36088. * toExpNeg {number}
  36089. * toExpPos {number}
  36090. * maxE {number}
  36091. * minE {number}
  36092. * modulo {number}
  36093. * crypto {boolean|number}
  36094. * defaults {true}
  36095. *
  36096. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36097. *
  36098. */
  36099. function config(obj) {
  36100. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36101. var i,
  36102. p,
  36103. v,
  36104. useDefaults = obj.defaults === true,
  36105. 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];
  36106. for (i = 0; i < ps.length; i += 3) {
  36107. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36108. if ((v = obj[p]) !== void 0) {
  36109. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36110. }
  36111. }
  36112. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36113. if ((v = obj[p]) !== void 0) {
  36114. if (v === true || v === false || v === 0 || v === 1) {
  36115. if (v) {
  36116. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36117. this[p] = true;
  36118. } else {
  36119. throw Error(cryptoUnavailable);
  36120. }
  36121. } else {
  36122. this[p] = false;
  36123. }
  36124. } else {
  36125. throw Error(invalidArgument + p + ': ' + v);
  36126. }
  36127. }
  36128. return this;
  36129. }
  36130. /*
  36131. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36132. * digits using rounding mode `rounding`.
  36133. *
  36134. * x {number|string|Decimal} A value in radians.
  36135. *
  36136. */
  36137. function cos(x) {
  36138. return new this(x).cos();
  36139. }
  36140. /*
  36141. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36142. * significant digits using rounding mode `rounding`.
  36143. *
  36144. * x {number|string|Decimal} A value in radians.
  36145. *
  36146. */
  36147. function cosh(x) {
  36148. return new this(x).cosh();
  36149. }
  36150. /*
  36151. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36152. * constructor.
  36153. *
  36154. */
  36155. function clone(obj) {
  36156. var i, p, ps;
  36157. /*
  36158. * The Decimal constructor and exported function.
  36159. * Return a new Decimal instance.
  36160. *
  36161. * v {number|string|Decimal} A numeric value.
  36162. *
  36163. */
  36164. function Decimal(v) {
  36165. var e,
  36166. i,
  36167. t,
  36168. x = this;
  36169. // Decimal called without new.
  36170. if (!(x instanceof Decimal)) return new Decimal(v);
  36171. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36172. // which points to Object.
  36173. x.constructor = Decimal;
  36174. // Duplicate.
  36175. if (v instanceof Decimal) {
  36176. x.s = v.s;
  36177. x.e = v.e;
  36178. x.d = (v = v.d) ? v.slice() : v;
  36179. return;
  36180. }
  36181. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36182. if (t === 'number') {
  36183. if (v === 0) {
  36184. x.s = 1 / v < 0 ? -1 : 1;
  36185. x.e = 0;
  36186. x.d = [0];
  36187. return;
  36188. }
  36189. if (v < 0) {
  36190. v = -v;
  36191. x.s = -1;
  36192. } else {
  36193. x.s = 1;
  36194. }
  36195. // Fast path for small integers.
  36196. if (v === ~~v && v < 1e7) {
  36197. for (e = 0, i = v; i >= 10; i /= 10) {
  36198. e++;
  36199. }x.e = e;
  36200. x.d = [v];
  36201. return;
  36202. // Infinity, NaN.
  36203. } else if (v * 0 !== 0) {
  36204. if (!v) x.s = NaN;
  36205. x.e = NaN;
  36206. x.d = null;
  36207. return;
  36208. }
  36209. return parseDecimal(x, v.toString());
  36210. } else if (t !== 'string') {
  36211. throw Error(invalidArgument + v);
  36212. }
  36213. // Minus sign?
  36214. if (v.charCodeAt(0) === 45) {
  36215. v = v.slice(1);
  36216. x.s = -1;
  36217. } else {
  36218. x.s = 1;
  36219. }
  36220. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36221. }
  36222. Decimal.prototype = P;
  36223. Decimal.ROUND_UP = 0;
  36224. Decimal.ROUND_DOWN = 1;
  36225. Decimal.ROUND_CEIL = 2;
  36226. Decimal.ROUND_FLOOR = 3;
  36227. Decimal.ROUND_HALF_UP = 4;
  36228. Decimal.ROUND_HALF_DOWN = 5;
  36229. Decimal.ROUND_HALF_EVEN = 6;
  36230. Decimal.ROUND_HALF_CEIL = 7;
  36231. Decimal.ROUND_HALF_FLOOR = 8;
  36232. Decimal.EUCLID = 9;
  36233. Decimal.config = Decimal.set = config;
  36234. Decimal.clone = clone;
  36235. Decimal.isDecimal = isDecimalInstance;
  36236. Decimal.abs = abs;
  36237. Decimal.acos = acos;
  36238. Decimal.acosh = acosh; // ES6
  36239. Decimal.add = add;
  36240. Decimal.asin = asin;
  36241. Decimal.asinh = asinh; // ES6
  36242. Decimal.atan = atan;
  36243. Decimal.atanh = atanh; // ES6
  36244. Decimal.atan2 = atan2;
  36245. Decimal.cbrt = cbrt; // ES6
  36246. Decimal.ceil = ceil;
  36247. Decimal.cos = cos;
  36248. Decimal.cosh = cosh; // ES6
  36249. Decimal.div = div;
  36250. Decimal.exp = exp;
  36251. Decimal.floor = floor;
  36252. Decimal.hypot = hypot; // ES6
  36253. Decimal.ln = ln;
  36254. Decimal.log = log;
  36255. Decimal.log10 = log10; // ES6
  36256. Decimal.log2 = log2; // ES6
  36257. Decimal.max = max;
  36258. Decimal.min = min;
  36259. Decimal.mod = mod;
  36260. Decimal.mul = mul;
  36261. Decimal.pow = pow;
  36262. Decimal.random = random;
  36263. Decimal.round = round;
  36264. Decimal.sign = sign; // ES6
  36265. Decimal.sin = sin;
  36266. Decimal.sinh = sinh; // ES6
  36267. Decimal.sqrt = sqrt;
  36268. Decimal.sub = sub;
  36269. Decimal.tan = tan;
  36270. Decimal.tanh = tanh; // ES6
  36271. Decimal.trunc = trunc; // ES6
  36272. if (obj === void 0) obj = {};
  36273. if (obj) {
  36274. if (obj.defaults !== true) {
  36275. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36276. for (i = 0; i < ps.length;) {
  36277. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36278. }
  36279. }
  36280. }
  36281. Decimal.config(obj);
  36282. return Decimal;
  36283. }
  36284. /*
  36285. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36286. * digits using rounding mode `rounding`.
  36287. *
  36288. * x {number|string|Decimal}
  36289. * y {number|string|Decimal}
  36290. *
  36291. */
  36292. function div(x, y) {
  36293. return new this(x).div(y);
  36294. }
  36295. /*
  36296. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36297. * significant digits using rounding mode `rounding`.
  36298. *
  36299. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36300. *
  36301. */
  36302. function exp(x) {
  36303. return new this(x).exp();
  36304. }
  36305. /*
  36306. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36307. *
  36308. * x {number|string|Decimal}
  36309. *
  36310. */
  36311. function floor(x) {
  36312. return finalise(x = new this(x), x.e + 1, 3);
  36313. }
  36314. /*
  36315. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36316. * rounded to `precision` significant digits using rounding mode `rounding`.
  36317. *
  36318. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36319. *
  36320. */
  36321. function hypot() {
  36322. var i,
  36323. n,
  36324. t = new this(0);
  36325. external = false;
  36326. for (i = 0; i < arguments.length;) {
  36327. n = new this(arguments[i++]);
  36328. if (!n.d) {
  36329. if (n.s) {
  36330. external = true;
  36331. return new this(1 / 0);
  36332. }
  36333. t = n;
  36334. } else if (t.d) {
  36335. t = t.plus(n.times(n));
  36336. }
  36337. }
  36338. external = true;
  36339. return t.sqrt();
  36340. }
  36341. /*
  36342. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36343. * otherwise return false.
  36344. *
  36345. */
  36346. function isDecimalInstance(obj) {
  36347. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36348. }
  36349. /*
  36350. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36351. * significant digits using rounding mode `rounding`.
  36352. *
  36353. * x {number|string|Decimal}
  36354. *
  36355. */
  36356. function ln(x) {
  36357. return new this(x).ln();
  36358. }
  36359. /*
  36360. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36361. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36362. *
  36363. * log[y](x)
  36364. *
  36365. * x {number|string|Decimal} The argument of the logarithm.
  36366. * y {number|string|Decimal} The base of the logarithm.
  36367. *
  36368. */
  36369. function log(x, y) {
  36370. return new this(x).log(y);
  36371. }
  36372. /*
  36373. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36374. * significant digits using rounding mode `rounding`.
  36375. *
  36376. * x {number|string|Decimal}
  36377. *
  36378. */
  36379. function log2(x) {
  36380. return new this(x).log(2);
  36381. }
  36382. /*
  36383. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36384. * significant digits using rounding mode `rounding`.
  36385. *
  36386. * x {number|string|Decimal}
  36387. *
  36388. */
  36389. function log10(x) {
  36390. return new this(x).log(10);
  36391. }
  36392. /*
  36393. * Return a new Decimal whose value is the maximum of the arguments.
  36394. *
  36395. * arguments {number|string|Decimal}
  36396. *
  36397. */
  36398. function max() {
  36399. return maxOrMin(this, arguments, 'lt');
  36400. }
  36401. /*
  36402. * Return a new Decimal whose value is the minimum of the arguments.
  36403. *
  36404. * arguments {number|string|Decimal}
  36405. *
  36406. */
  36407. function min() {
  36408. return maxOrMin(this, arguments, 'gt');
  36409. }
  36410. /*
  36411. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36412. * using rounding mode `rounding`.
  36413. *
  36414. * x {number|string|Decimal}
  36415. * y {number|string|Decimal}
  36416. *
  36417. */
  36418. function mod(x, y) {
  36419. return new this(x).mod(y);
  36420. }
  36421. /*
  36422. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36423. * digits using rounding mode `rounding`.
  36424. *
  36425. * x {number|string|Decimal}
  36426. * y {number|string|Decimal}
  36427. *
  36428. */
  36429. function mul(x, y) {
  36430. return new this(x).mul(y);
  36431. }
  36432. /*
  36433. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36434. * significant digits using rounding mode `rounding`.
  36435. *
  36436. * x {number|string|Decimal} The base.
  36437. * y {number|string|Decimal} The exponent.
  36438. *
  36439. */
  36440. function pow(x, y) {
  36441. return new this(x).pow(y);
  36442. }
  36443. /*
  36444. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36445. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36446. * are produced).
  36447. *
  36448. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36449. *
  36450. */
  36451. function random(sd) {
  36452. var d,
  36453. e,
  36454. k,
  36455. n,
  36456. i = 0,
  36457. r = new this(1),
  36458. rd = [];
  36459. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36460. k = Math.ceil(sd / LOG_BASE);
  36461. if (!this.crypto) {
  36462. for (; i < k;) {
  36463. rd[i++] = Math.random() * 1e7 | 0;
  36464. } // Browsers supporting crypto.getRandomValues.
  36465. } else if (crypto.getRandomValues) {
  36466. d = crypto.getRandomValues(new Uint32Array(k));
  36467. for (; i < k;) {
  36468. n = d[i];
  36469. // 0 <= n < 4294967296
  36470. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36471. if (n >= 4.29e9) {
  36472. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36473. } else {
  36474. // 0 <= n <= 4289999999
  36475. // 0 <= (n % 1e7) <= 9999999
  36476. rd[i++] = n % 1e7;
  36477. }
  36478. }
  36479. // Node.js supporting crypto.randomBytes.
  36480. } else if (crypto.randomBytes) {
  36481. // buffer
  36482. d = crypto.randomBytes(k *= 4);
  36483. for (; i < k;) {
  36484. // 0 <= n < 2147483648
  36485. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36486. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36487. if (n >= 2.14e9) {
  36488. crypto.randomBytes(4).copy(d, i);
  36489. } else {
  36490. // 0 <= n <= 2139999999
  36491. // 0 <= (n % 1e7) <= 9999999
  36492. rd.push(n % 1e7);
  36493. i += 4;
  36494. }
  36495. }
  36496. i = k / 4;
  36497. } else {
  36498. throw Error(cryptoUnavailable);
  36499. }
  36500. k = rd[--i];
  36501. sd %= LOG_BASE;
  36502. // Convert trailing digits to zeros according to sd.
  36503. if (k && sd) {
  36504. n = mathpow(10, LOG_BASE - sd);
  36505. rd[i] = (k / n | 0) * n;
  36506. }
  36507. // Remove trailing words which are zero.
  36508. for (; rd[i] === 0; i--) {
  36509. rd.pop();
  36510. } // Zero?
  36511. if (i < 0) {
  36512. e = 0;
  36513. rd = [0];
  36514. } else {
  36515. e = -1;
  36516. // Remove leading words which are zero and adjust exponent accordingly.
  36517. for (; rd[0] === 0; e -= LOG_BASE) {
  36518. rd.shift();
  36519. } // Count the digits of the first word of rd to determine leading zeros.
  36520. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  36521. k++;
  36522. } // Adjust the exponent for leading zeros of the first word of rd.
  36523. if (k < LOG_BASE) e -= LOG_BASE - k;
  36524. }
  36525. r.e = e;
  36526. r.d = rd;
  36527. return r;
  36528. }
  36529. /*
  36530. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  36531. *
  36532. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  36533. *
  36534. * x {number|string|Decimal}
  36535. *
  36536. */
  36537. function round(x) {
  36538. return finalise(x = new this(x), x.e + 1, this.rounding);
  36539. }
  36540. /*
  36541. * Return
  36542. * 1 if x > 0,
  36543. * -1 if x < 0,
  36544. * 0 if x is 0,
  36545. * -0 if x is -0,
  36546. * NaN otherwise
  36547. *
  36548. */
  36549. function sign(x) {
  36550. x = new this(x);
  36551. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  36552. }
  36553. /*
  36554. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  36555. * using rounding mode `rounding`.
  36556. *
  36557. * x {number|string|Decimal} A value in radians.
  36558. *
  36559. */
  36560. function sin(x) {
  36561. return new this(x).sin();
  36562. }
  36563. /*
  36564. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  36565. * significant digits using rounding mode `rounding`.
  36566. *
  36567. * x {number|string|Decimal} A value in radians.
  36568. *
  36569. */
  36570. function sinh(x) {
  36571. return new this(x).sinh();
  36572. }
  36573. /*
  36574. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  36575. * digits using rounding mode `rounding`.
  36576. *
  36577. * x {number|string|Decimal}
  36578. *
  36579. */
  36580. function sqrt(x) {
  36581. return new this(x).sqrt();
  36582. }
  36583. /*
  36584. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  36585. * using rounding mode `rounding`.
  36586. *
  36587. * x {number|string|Decimal}
  36588. * y {number|string|Decimal}
  36589. *
  36590. */
  36591. function sub(x, y) {
  36592. return new this(x).sub(y);
  36593. }
  36594. /*
  36595. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  36596. * digits using rounding mode `rounding`.
  36597. *
  36598. * x {number|string|Decimal} A value in radians.
  36599. *
  36600. */
  36601. function tan(x) {
  36602. return new this(x).tan();
  36603. }
  36604. /*
  36605. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  36606. * significant digits using rounding mode `rounding`.
  36607. *
  36608. * x {number|string|Decimal} A value in radians.
  36609. *
  36610. */
  36611. function tanh(x) {
  36612. return new this(x).tanh();
  36613. }
  36614. /*
  36615. * Return a new Decimal whose value is `x` truncated to an integer.
  36616. *
  36617. * x {number|string|Decimal}
  36618. *
  36619. */
  36620. function trunc(x) {
  36621. return finalise(x = new this(x), x.e + 1, 1);
  36622. }
  36623. // Create and configure initial Decimal constructor.
  36624. Decimal = clone(DEFAULTS);
  36625. Decimal['default'] = Decimal.Decimal = Decimal;
  36626. // Create the internal constants from their string values.
  36627. LN10 = new Decimal(LN10);
  36628. PI = new Decimal(PI);
  36629. // Export.
  36630. // AMD.
  36631. if (true) {
  36632. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  36633. return Decimal;
  36634. }).call(exports, __webpack_require__, exports, module),
  36635. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36636. // Node and other environments that support module.exports.
  36637. } else {}
  36638. })(undefined);
  36639. /***/ }),
  36640. /***/ "./node_modules/jquery/dist/jquery.js":
  36641. /*!********************************************!*\
  36642. !*** ./node_modules/jquery/dist/jquery.js ***!
  36643. \********************************************/
  36644. /*! no static exports found */
  36645. /***/ (function(module, exports, __webpack_require__) {
  36646. "use strict";
  36647. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36648. 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; };
  36649. /*!
  36650. * jQuery JavaScript Library v3.3.1
  36651. * https://jquery.com/
  36652. *
  36653. * Includes Sizzle.js
  36654. * https://sizzlejs.com/
  36655. *
  36656. * Copyright JS Foundation and other contributors
  36657. * Released under the MIT license
  36658. * https://jquery.org/license
  36659. *
  36660. * Date: 2018-01-20T17:24Z
  36661. */
  36662. (function (global, factory) {
  36663. "use strict";
  36664. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  36665. // For CommonJS and CommonJS-like environments where a proper `window`
  36666. // is present, execute the factory and get jQuery.
  36667. // For environments that do not have a `window` with a `document`
  36668. // (such as Node.js), expose a factory as module.exports.
  36669. // This accentuates the need for the creation of a real `window`.
  36670. // e.g. var jQuery = require("jquery")(window);
  36671. // See ticket #14549 for more info.
  36672. module.exports = global.document ? factory(global, true) : function (w) {
  36673. if (!w.document) {
  36674. throw new Error("jQuery requires a window with a document");
  36675. }
  36676. return factory(w);
  36677. };
  36678. } else {
  36679. factory(global);
  36680. }
  36681. // Pass this if window is not defined yet
  36682. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  36683. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  36684. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  36685. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  36686. // enough that all such attempts are guarded in a try block.
  36687. "use strict";
  36688. var arr = [];
  36689. var document = window.document;
  36690. var getProto = Object.getPrototypeOf;
  36691. var _slice = arr.slice;
  36692. var concat = arr.concat;
  36693. var push = arr.push;
  36694. var indexOf = arr.indexOf;
  36695. var class2type = {};
  36696. var toString = class2type.toString;
  36697. var hasOwn = class2type.hasOwnProperty;
  36698. var fnToString = hasOwn.toString;
  36699. var ObjectFunctionString = fnToString.call(Object);
  36700. var support = {};
  36701. var isFunction = function isFunction(obj) {
  36702. // Support: Chrome <=57, Firefox <=52
  36703. // In some browsers, typeof returns "function" for HTML <object> elements
  36704. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  36705. // We don't want to classify *any* DOM node as a function.
  36706. return typeof obj === "function" && typeof obj.nodeType !== "number";
  36707. };
  36708. var isWindow = function isWindow(obj) {
  36709. return obj != null && obj === obj.window;
  36710. };
  36711. var preservedScriptAttributes = {
  36712. type: true,
  36713. src: true,
  36714. noModule: true
  36715. };
  36716. function DOMEval(code, doc, node) {
  36717. doc = doc || document;
  36718. var i,
  36719. script = doc.createElement("script");
  36720. script.text = code;
  36721. if (node) {
  36722. for (i in preservedScriptAttributes) {
  36723. if (node[i]) {
  36724. script[i] = node[i];
  36725. }
  36726. }
  36727. }
  36728. doc.head.appendChild(script).parentNode.removeChild(script);
  36729. }
  36730. function toType(obj) {
  36731. if (obj == null) {
  36732. return obj + "";
  36733. }
  36734. // Support: Android <=2.3 only (functionish RegExp)
  36735. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  36736. }
  36737. /* global Symbol */
  36738. // Defining this global in .eslintrc.json would create a danger of using the global
  36739. // unguarded in another place, it seems safer to define global only for this module
  36740. var version = "3.3.1",
  36741. // Define a local copy of jQuery
  36742. jQuery = function jQuery(selector, context) {
  36743. // The jQuery object is actually just the init constructor 'enhanced'
  36744. // Need init if jQuery is called (just allow error to be thrown if not included)
  36745. return new jQuery.fn.init(selector, context);
  36746. },
  36747. // Support: Android <=4.0 only
  36748. // Make sure we trim BOM and NBSP
  36749. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  36750. jQuery.fn = jQuery.prototype = {
  36751. // The current version of jQuery being used
  36752. jquery: version,
  36753. constructor: jQuery,
  36754. // The default length of a jQuery object is 0
  36755. length: 0,
  36756. toArray: function toArray() {
  36757. return _slice.call(this);
  36758. },
  36759. // Get the Nth element in the matched element set OR
  36760. // Get the whole matched element set as a clean array
  36761. get: function get(num) {
  36762. // Return all the elements in a clean array
  36763. if (num == null) {
  36764. return _slice.call(this);
  36765. }
  36766. // Return just the one element from the set
  36767. return num < 0 ? this[num + this.length] : this[num];
  36768. },
  36769. // Take an array of elements and push it onto the stack
  36770. // (returning the new matched element set)
  36771. pushStack: function pushStack(elems) {
  36772. // Build a new jQuery matched element set
  36773. var ret = jQuery.merge(this.constructor(), elems);
  36774. // Add the old object onto the stack (as a reference)
  36775. ret.prevObject = this;
  36776. // Return the newly-formed element set
  36777. return ret;
  36778. },
  36779. // Execute a callback for every element in the matched set.
  36780. each: function each(callback) {
  36781. return jQuery.each(this, callback);
  36782. },
  36783. map: function map(callback) {
  36784. return this.pushStack(jQuery.map(this, function (elem, i) {
  36785. return callback.call(elem, i, elem);
  36786. }));
  36787. },
  36788. slice: function slice() {
  36789. return this.pushStack(_slice.apply(this, arguments));
  36790. },
  36791. first: function first() {
  36792. return this.eq(0);
  36793. },
  36794. last: function last() {
  36795. return this.eq(-1);
  36796. },
  36797. eq: function eq(i) {
  36798. var len = this.length,
  36799. j = +i + (i < 0 ? len : 0);
  36800. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  36801. },
  36802. end: function end() {
  36803. return this.prevObject || this.constructor();
  36804. },
  36805. // For internal use only.
  36806. // Behaves like an Array's method, not like a jQuery method.
  36807. push: push,
  36808. sort: arr.sort,
  36809. splice: arr.splice
  36810. };
  36811. jQuery.extend = jQuery.fn.extend = function () {
  36812. var options,
  36813. name,
  36814. src,
  36815. copy,
  36816. copyIsArray,
  36817. clone,
  36818. target = arguments[0] || {},
  36819. i = 1,
  36820. length = arguments.length,
  36821. deep = false;
  36822. // Handle a deep copy situation
  36823. if (typeof target === "boolean") {
  36824. deep = target;
  36825. // Skip the boolean and the target
  36826. target = arguments[i] || {};
  36827. i++;
  36828. }
  36829. // Handle case when target is a string or something (possible in deep copy)
  36830. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  36831. target = {};
  36832. }
  36833. // Extend jQuery itself if only one argument is passed
  36834. if (i === length) {
  36835. target = this;
  36836. i--;
  36837. }
  36838. for (; i < length; i++) {
  36839. // Only deal with non-null/undefined values
  36840. if ((options = arguments[i]) != null) {
  36841. // Extend the base object
  36842. for (name in options) {
  36843. src = target[name];
  36844. copy = options[name];
  36845. // Prevent never-ending loop
  36846. if (target === copy) {
  36847. continue;
  36848. }
  36849. // Recurse if we're merging plain objects or arrays
  36850. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  36851. if (copyIsArray) {
  36852. copyIsArray = false;
  36853. clone = src && Array.isArray(src) ? src : [];
  36854. } else {
  36855. clone = src && jQuery.isPlainObject(src) ? src : {};
  36856. }
  36857. // Never move original objects, clone them
  36858. target[name] = jQuery.extend(deep, clone, copy);
  36859. // Don't bring in undefined values
  36860. } else if (copy !== undefined) {
  36861. target[name] = copy;
  36862. }
  36863. }
  36864. }
  36865. }
  36866. // Return the modified object
  36867. return target;
  36868. };
  36869. jQuery.extend({
  36870. // Unique for each copy of jQuery on the page
  36871. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  36872. // Assume jQuery is ready without the ready module
  36873. isReady: true,
  36874. error: function error(msg) {
  36875. throw new Error(msg);
  36876. },
  36877. noop: function noop() {},
  36878. isPlainObject: function isPlainObject(obj) {
  36879. var proto, Ctor;
  36880. // Detect obvious negatives
  36881. // Use toString instead of jQuery.type to catch host objects
  36882. if (!obj || toString.call(obj) !== "[object Object]") {
  36883. return false;
  36884. }
  36885. proto = getProto(obj);
  36886. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  36887. if (!proto) {
  36888. return true;
  36889. }
  36890. // Objects with prototype are plain iff they were constructed by a global Object function
  36891. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  36892. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  36893. },
  36894. isEmptyObject: function isEmptyObject(obj) {
  36895. /* eslint-disable no-unused-vars */
  36896. // See https://github.com/eslint/eslint/issues/6125
  36897. var name;
  36898. for (name in obj) {
  36899. return false;
  36900. }
  36901. return true;
  36902. },
  36903. // Evaluates a script in a global context
  36904. globalEval: function globalEval(code) {
  36905. DOMEval(code);
  36906. },
  36907. each: function each(obj, callback) {
  36908. var length,
  36909. i = 0;
  36910. if (isArrayLike(obj)) {
  36911. length = obj.length;
  36912. for (; i < length; i++) {
  36913. if (callback.call(obj[i], i, obj[i]) === false) {
  36914. break;
  36915. }
  36916. }
  36917. } else {
  36918. for (i in obj) {
  36919. if (callback.call(obj[i], i, obj[i]) === false) {
  36920. break;
  36921. }
  36922. }
  36923. }
  36924. return obj;
  36925. },
  36926. // Support: Android <=4.0 only
  36927. trim: function trim(text) {
  36928. return text == null ? "" : (text + "").replace(rtrim, "");
  36929. },
  36930. // results is for internal usage only
  36931. makeArray: function makeArray(arr, results) {
  36932. var ret = results || [];
  36933. if (arr != null) {
  36934. if (isArrayLike(Object(arr))) {
  36935. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  36936. } else {
  36937. push.call(ret, arr);
  36938. }
  36939. }
  36940. return ret;
  36941. },
  36942. inArray: function inArray(elem, arr, i) {
  36943. return arr == null ? -1 : indexOf.call(arr, elem, i);
  36944. },
  36945. // Support: Android <=4.0 only, PhantomJS 1 only
  36946. // push.apply(_, arraylike) throws on ancient WebKit
  36947. merge: function merge(first, second) {
  36948. var len = +second.length,
  36949. j = 0,
  36950. i = first.length;
  36951. for (; j < len; j++) {
  36952. first[i++] = second[j];
  36953. }
  36954. first.length = i;
  36955. return first;
  36956. },
  36957. grep: function grep(elems, callback, invert) {
  36958. var callbackInverse,
  36959. matches = [],
  36960. i = 0,
  36961. length = elems.length,
  36962. callbackExpect = !invert;
  36963. // Go through the array, only saving the items
  36964. // that pass the validator function
  36965. for (; i < length; i++) {
  36966. callbackInverse = !callback(elems[i], i);
  36967. if (callbackInverse !== callbackExpect) {
  36968. matches.push(elems[i]);
  36969. }
  36970. }
  36971. return matches;
  36972. },
  36973. // arg is for internal usage only
  36974. map: function map(elems, callback, arg) {
  36975. var length,
  36976. value,
  36977. i = 0,
  36978. ret = [];
  36979. // Go through the array, translating each of the items to their new values
  36980. if (isArrayLike(elems)) {
  36981. length = elems.length;
  36982. for (; i < length; i++) {
  36983. value = callback(elems[i], i, arg);
  36984. if (value != null) {
  36985. ret.push(value);
  36986. }
  36987. }
  36988. // Go through every key on the object,
  36989. } else {
  36990. for (i in elems) {
  36991. value = callback(elems[i], i, arg);
  36992. if (value != null) {
  36993. ret.push(value);
  36994. }
  36995. }
  36996. }
  36997. // Flatten any nested arrays
  36998. return concat.apply([], ret);
  36999. },
  37000. // A global GUID counter for objects
  37001. guid: 1,
  37002. // jQuery.support is not used in Core but other projects attach their
  37003. // properties to it so it needs to exist.
  37004. support: support
  37005. });
  37006. if (typeof Symbol === "function") {
  37007. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  37008. }
  37009. // Populate the class2type map
  37010. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  37011. class2type["[object " + name + "]"] = name.toLowerCase();
  37012. });
  37013. function isArrayLike(obj) {
  37014. // Support: real iOS 8.2 only (not reproducible in simulator)
  37015. // `in` check used to prevent JIT error (gh-2145)
  37016. // hasOwn isn't used here due to false negatives
  37017. // regarding Nodelist length in IE
  37018. var length = !!obj && "length" in obj && obj.length,
  37019. type = toType(obj);
  37020. if (isFunction(obj) || isWindow(obj)) {
  37021. return false;
  37022. }
  37023. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  37024. }
  37025. var Sizzle =
  37026. /*!
  37027. * Sizzle CSS Selector Engine v2.3.3
  37028. * https://sizzlejs.com/
  37029. *
  37030. * Copyright jQuery Foundation and other contributors
  37031. * Released under the MIT license
  37032. * http://jquery.org/license
  37033. *
  37034. * Date: 2016-08-08
  37035. */
  37036. function (window) {
  37037. var i,
  37038. support,
  37039. Expr,
  37040. getText,
  37041. isXML,
  37042. tokenize,
  37043. compile,
  37044. select,
  37045. outermostContext,
  37046. sortInput,
  37047. hasDuplicate,
  37048. // Local document vars
  37049. setDocument,
  37050. document,
  37051. docElem,
  37052. documentIsHTML,
  37053. rbuggyQSA,
  37054. rbuggyMatches,
  37055. matches,
  37056. contains,
  37057. // Instance-specific data
  37058. expando = "sizzle" + 1 * new Date(),
  37059. preferredDoc = window.document,
  37060. dirruns = 0,
  37061. done = 0,
  37062. classCache = createCache(),
  37063. tokenCache = createCache(),
  37064. compilerCache = createCache(),
  37065. sortOrder = function sortOrder(a, b) {
  37066. if (a === b) {
  37067. hasDuplicate = true;
  37068. }
  37069. return 0;
  37070. },
  37071. // Instance methods
  37072. hasOwn = {}.hasOwnProperty,
  37073. arr = [],
  37074. pop = arr.pop,
  37075. push_native = arr.push,
  37076. push = arr.push,
  37077. slice = arr.slice,
  37078. // Use a stripped-down indexOf as it's faster than native
  37079. // https://jsperf.com/thor-indexof-vs-for/5
  37080. indexOf = function indexOf(list, elem) {
  37081. var i = 0,
  37082. len = list.length;
  37083. for (; i < len; i++) {
  37084. if (list[i] === elem) {
  37085. return i;
  37086. }
  37087. }
  37088. return -1;
  37089. },
  37090. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  37091. // Regular expressions
  37092. // http://www.w3.org/TR/css3-selectors/#whitespace
  37093. whitespace = "[\\x20\\t\\r\\n\\f]",
  37094. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37095. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37096. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37097. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37098. // Operator (capture 2)
  37099. "*([*^$|!~]?=)" + whitespace +
  37100. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37101. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37102. pseudos = ":(" + identifier + ")(?:\\((" +
  37103. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37104. // 1. quoted (capture 3; capture 4 or capture 5)
  37105. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37106. // 2. simple (capture 6)
  37107. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37108. // 3. anything else (capture 2)
  37109. ".*" + ")\\)|)",
  37110. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37111. rwhitespace = new RegExp(whitespace + "+", "g"),
  37112. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37113. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37114. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37115. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37116. rpseudo = new RegExp(pseudos),
  37117. ridentifier = new RegExp("^" + identifier + "$"),
  37118. matchExpr = {
  37119. "ID": new RegExp("^#(" + identifier + ")"),
  37120. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37121. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37122. "ATTR": new RegExp("^" + attributes),
  37123. "PSEUDO": new RegExp("^" + pseudos),
  37124. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37125. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37126. // For use in libraries implementing .is()
  37127. // We use this for POS matching in `select`
  37128. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37129. },
  37130. rinputs = /^(?:input|select|textarea|button)$/i,
  37131. rheader = /^h\d$/i,
  37132. rnative = /^[^{]+\{\s*\[native \w/,
  37133. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37134. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37135. rsibling = /[+~]/,
  37136. // CSS escapes
  37137. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37138. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37139. funescape = function funescape(_, escaped, escapedWhitespace) {
  37140. var high = "0x" + escaped - 0x10000;
  37141. // NaN means non-codepoint
  37142. // Support: Firefox<24
  37143. // Workaround erroneous numeric interpretation of +"0x"
  37144. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37145. // BMP codepoint
  37146. String.fromCharCode(high + 0x10000) :
  37147. // Supplemental Plane codepoint (surrogate pair)
  37148. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37149. },
  37150. // CSS string/identifier serialization
  37151. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37152. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37153. fcssescape = function fcssescape(ch, asCodePoint) {
  37154. if (asCodePoint) {
  37155. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37156. if (ch === "\0") {
  37157. return "\uFFFD";
  37158. }
  37159. // Control characters and (dependent upon position) numbers get escaped as code points
  37160. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37161. }
  37162. // Other potentially-special ASCII characters get backslash-escaped
  37163. return "\\" + ch;
  37164. },
  37165. // Used for iframes
  37166. // See setDocument()
  37167. // Removing the function wrapper causes a "Permission Denied"
  37168. // error in IE
  37169. unloadHandler = function unloadHandler() {
  37170. setDocument();
  37171. },
  37172. disabledAncestor = addCombinator(function (elem) {
  37173. return elem.disabled === true && ("form" in elem || "label" in elem);
  37174. }, { dir: "parentNode", next: "legend" });
  37175. // Optimize for push.apply( _, NodeList )
  37176. try {
  37177. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37178. // Support: Android<4.0
  37179. // Detect silently failing push.apply
  37180. arr[preferredDoc.childNodes.length].nodeType;
  37181. } catch (e) {
  37182. push = { apply: arr.length ?
  37183. // Leverage slice if possible
  37184. function (target, els) {
  37185. push_native.apply(target, slice.call(els));
  37186. } :
  37187. // Support: IE<9
  37188. // Otherwise append directly
  37189. function (target, els) {
  37190. var j = target.length,
  37191. i = 0;
  37192. // Can't trust NodeList.length
  37193. while (target[j++] = els[i++]) {}
  37194. target.length = j - 1;
  37195. }
  37196. };
  37197. }
  37198. function Sizzle(selector, context, results, seed) {
  37199. var m,
  37200. i,
  37201. elem,
  37202. nid,
  37203. match,
  37204. groups,
  37205. newSelector,
  37206. newContext = context && context.ownerDocument,
  37207. // nodeType defaults to 9, since context defaults to document
  37208. nodeType = context ? context.nodeType : 9;
  37209. results = results || [];
  37210. // Return early from calls with invalid selector or context
  37211. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37212. return results;
  37213. }
  37214. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37215. if (!seed) {
  37216. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37217. setDocument(context);
  37218. }
  37219. context = context || document;
  37220. if (documentIsHTML) {
  37221. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37222. // (excepting DocumentFragment context, where the methods don't exist)
  37223. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37224. // ID selector
  37225. if (m = match[1]) {
  37226. // Document context
  37227. if (nodeType === 9) {
  37228. if (elem = context.getElementById(m)) {
  37229. // Support: IE, Opera, Webkit
  37230. // TODO: identify versions
  37231. // getElementById can match elements by name instead of ID
  37232. if (elem.id === m) {
  37233. results.push(elem);
  37234. return results;
  37235. }
  37236. } else {
  37237. return results;
  37238. }
  37239. // Element context
  37240. } else {
  37241. // Support: IE, Opera, Webkit
  37242. // TODO: identify versions
  37243. // getElementById can match elements by name instead of ID
  37244. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37245. results.push(elem);
  37246. return results;
  37247. }
  37248. }
  37249. // Type selector
  37250. } else if (match[2]) {
  37251. push.apply(results, context.getElementsByTagName(selector));
  37252. return results;
  37253. // Class selector
  37254. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37255. push.apply(results, context.getElementsByClassName(m));
  37256. return results;
  37257. }
  37258. }
  37259. // Take advantage of querySelectorAll
  37260. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37261. if (nodeType !== 1) {
  37262. newContext = context;
  37263. newSelector = selector;
  37264. // qSA looks outside Element context, which is not what we want
  37265. // Thanks to Andrew Dupont for this workaround technique
  37266. // Support: IE <=8
  37267. // Exclude object elements
  37268. } else if (context.nodeName.toLowerCase() !== "object") {
  37269. // Capture the context ID, setting it first if necessary
  37270. if (nid = context.getAttribute("id")) {
  37271. nid = nid.replace(rcssescape, fcssescape);
  37272. } else {
  37273. context.setAttribute("id", nid = expando);
  37274. }
  37275. // Prefix every selector in the list
  37276. groups = tokenize(selector);
  37277. i = groups.length;
  37278. while (i--) {
  37279. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37280. }
  37281. newSelector = groups.join(",");
  37282. // Expand context for sibling selectors
  37283. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37284. }
  37285. if (newSelector) {
  37286. try {
  37287. push.apply(results, newContext.querySelectorAll(newSelector));
  37288. return results;
  37289. } catch (qsaError) {} finally {
  37290. if (nid === expando) {
  37291. context.removeAttribute("id");
  37292. }
  37293. }
  37294. }
  37295. }
  37296. }
  37297. }
  37298. // All others
  37299. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37300. }
  37301. /**
  37302. * Create key-value caches of limited size
  37303. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37304. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37305. * deleting the oldest entry
  37306. */
  37307. function createCache() {
  37308. var keys = [];
  37309. function cache(key, value) {
  37310. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37311. if (keys.push(key + " ") > Expr.cacheLength) {
  37312. // Only keep the most recent entries
  37313. delete cache[keys.shift()];
  37314. }
  37315. return cache[key + " "] = value;
  37316. }
  37317. return cache;
  37318. }
  37319. /**
  37320. * Mark a function for special use by Sizzle
  37321. * @param {Function} fn The function to mark
  37322. */
  37323. function markFunction(fn) {
  37324. fn[expando] = true;
  37325. return fn;
  37326. }
  37327. /**
  37328. * Support testing using an element
  37329. * @param {Function} fn Passed the created element and returns a boolean result
  37330. */
  37331. function assert(fn) {
  37332. var el = document.createElement("fieldset");
  37333. try {
  37334. return !!fn(el);
  37335. } catch (e) {
  37336. return false;
  37337. } finally {
  37338. // Remove from its parent by default
  37339. if (el.parentNode) {
  37340. el.parentNode.removeChild(el);
  37341. }
  37342. // release memory in IE
  37343. el = null;
  37344. }
  37345. }
  37346. /**
  37347. * Adds the same handler for all of the specified attrs
  37348. * @param {String} attrs Pipe-separated list of attributes
  37349. * @param {Function} handler The method that will be applied
  37350. */
  37351. function addHandle(attrs, handler) {
  37352. var arr = attrs.split("|"),
  37353. i = arr.length;
  37354. while (i--) {
  37355. Expr.attrHandle[arr[i]] = handler;
  37356. }
  37357. }
  37358. /**
  37359. * Checks document order of two siblings
  37360. * @param {Element} a
  37361. * @param {Element} b
  37362. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37363. */
  37364. function siblingCheck(a, b) {
  37365. var cur = b && a,
  37366. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37367. // Use IE sourceIndex if available on both nodes
  37368. if (diff) {
  37369. return diff;
  37370. }
  37371. // Check if b follows a
  37372. if (cur) {
  37373. while (cur = cur.nextSibling) {
  37374. if (cur === b) {
  37375. return -1;
  37376. }
  37377. }
  37378. }
  37379. return a ? 1 : -1;
  37380. }
  37381. /**
  37382. * Returns a function to use in pseudos for input types
  37383. * @param {String} type
  37384. */
  37385. function createInputPseudo(type) {
  37386. return function (elem) {
  37387. var name = elem.nodeName.toLowerCase();
  37388. return name === "input" && elem.type === type;
  37389. };
  37390. }
  37391. /**
  37392. * Returns a function to use in pseudos for buttons
  37393. * @param {String} type
  37394. */
  37395. function createButtonPseudo(type) {
  37396. return function (elem) {
  37397. var name = elem.nodeName.toLowerCase();
  37398. return (name === "input" || name === "button") && elem.type === type;
  37399. };
  37400. }
  37401. /**
  37402. * Returns a function to use in pseudos for :enabled/:disabled
  37403. * @param {Boolean} disabled true for :disabled; false for :enabled
  37404. */
  37405. function createDisabledPseudo(disabled) {
  37406. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37407. return function (elem) {
  37408. // Only certain elements can match :enabled or :disabled
  37409. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37410. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37411. if ("form" in elem) {
  37412. // Check for inherited disabledness on relevant non-disabled elements:
  37413. // * listed form-associated elements in a disabled fieldset
  37414. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37415. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37416. // * option elements in a disabled optgroup
  37417. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37418. // All such elements have a "form" property.
  37419. if (elem.parentNode && elem.disabled === false) {
  37420. // Option elements defer to a parent optgroup if present
  37421. if ("label" in elem) {
  37422. if ("label" in elem.parentNode) {
  37423. return elem.parentNode.disabled === disabled;
  37424. } else {
  37425. return elem.disabled === disabled;
  37426. }
  37427. }
  37428. // Support: IE 6 - 11
  37429. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37430. return elem.isDisabled === disabled ||
  37431. // Where there is no isDisabled, check manually
  37432. /* jshint -W018 */
  37433. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37434. }
  37435. return elem.disabled === disabled;
  37436. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37437. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37438. // even exist on them, let alone have a boolean value.
  37439. } else if ("label" in elem) {
  37440. return elem.disabled === disabled;
  37441. }
  37442. // Remaining elements are neither :enabled nor :disabled
  37443. return false;
  37444. };
  37445. }
  37446. /**
  37447. * Returns a function to use in pseudos for positionals
  37448. * @param {Function} fn
  37449. */
  37450. function createPositionalPseudo(fn) {
  37451. return markFunction(function (argument) {
  37452. argument = +argument;
  37453. return markFunction(function (seed, matches) {
  37454. var j,
  37455. matchIndexes = fn([], seed.length, argument),
  37456. i = matchIndexes.length;
  37457. // Match elements found at the specified indexes
  37458. while (i--) {
  37459. if (seed[j = matchIndexes[i]]) {
  37460. seed[j] = !(matches[j] = seed[j]);
  37461. }
  37462. }
  37463. });
  37464. });
  37465. }
  37466. /**
  37467. * Checks a node for validity as a Sizzle context
  37468. * @param {Element|Object=} context
  37469. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37470. */
  37471. function testContext(context) {
  37472. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37473. }
  37474. // Expose support vars for convenience
  37475. support = Sizzle.support = {};
  37476. /**
  37477. * Detects XML nodes
  37478. * @param {Element|Object} elem An element or a document
  37479. * @returns {Boolean} True iff elem is a non-HTML XML node
  37480. */
  37481. isXML = Sizzle.isXML = function (elem) {
  37482. // documentElement is verified for cases where it doesn't yet exist
  37483. // (such as loading iframes in IE - #4833)
  37484. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37485. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37486. };
  37487. /**
  37488. * Sets document-related variables once based on the current document
  37489. * @param {Element|Object} [doc] An element or document object to use to set the document
  37490. * @returns {Object} Returns the current document
  37491. */
  37492. setDocument = Sizzle.setDocument = function (node) {
  37493. var hasCompare,
  37494. subWindow,
  37495. doc = node ? node.ownerDocument || node : preferredDoc;
  37496. // Return early if doc is invalid or already selected
  37497. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37498. return document;
  37499. }
  37500. // Update global variables
  37501. document = doc;
  37502. docElem = document.documentElement;
  37503. documentIsHTML = !isXML(document);
  37504. // Support: IE 9-11, Edge
  37505. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  37506. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  37507. // Support: IE 11, Edge
  37508. if (subWindow.addEventListener) {
  37509. subWindow.addEventListener("unload", unloadHandler, false);
  37510. // Support: IE 9 - 10 only
  37511. } else if (subWindow.attachEvent) {
  37512. subWindow.attachEvent("onunload", unloadHandler);
  37513. }
  37514. }
  37515. /* Attributes
  37516. ---------------------------------------------------------------------- */
  37517. // Support: IE<8
  37518. // Verify that getAttribute really returns attributes and not properties
  37519. // (excepting IE8 booleans)
  37520. support.attributes = assert(function (el) {
  37521. el.className = "i";
  37522. return !el.getAttribute("className");
  37523. });
  37524. /* getElement(s)By*
  37525. ---------------------------------------------------------------------- */
  37526. // Check if getElementsByTagName("*") returns only elements
  37527. support.getElementsByTagName = assert(function (el) {
  37528. el.appendChild(document.createComment(""));
  37529. return !el.getElementsByTagName("*").length;
  37530. });
  37531. // Support: IE<9
  37532. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  37533. // Support: IE<10
  37534. // Check if getElementById returns elements by name
  37535. // The broken getElementById methods don't pick up programmatically-set names,
  37536. // so use a roundabout getElementsByName test
  37537. support.getById = assert(function (el) {
  37538. docElem.appendChild(el).id = expando;
  37539. return !document.getElementsByName || !document.getElementsByName(expando).length;
  37540. });
  37541. // ID filter and find
  37542. if (support.getById) {
  37543. Expr.filter["ID"] = function (id) {
  37544. var attrId = id.replace(runescape, funescape);
  37545. return function (elem) {
  37546. return elem.getAttribute("id") === attrId;
  37547. };
  37548. };
  37549. Expr.find["ID"] = function (id, context) {
  37550. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37551. var elem = context.getElementById(id);
  37552. return elem ? [elem] : [];
  37553. }
  37554. };
  37555. } else {
  37556. Expr.filter["ID"] = function (id) {
  37557. var attrId = id.replace(runescape, funescape);
  37558. return function (elem) {
  37559. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  37560. return node && node.value === attrId;
  37561. };
  37562. };
  37563. // Support: IE 6 - 7 only
  37564. // getElementById is not reliable as a find shortcut
  37565. Expr.find["ID"] = function (id, context) {
  37566. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37567. var node,
  37568. i,
  37569. elems,
  37570. elem = context.getElementById(id);
  37571. if (elem) {
  37572. // Verify the id attribute
  37573. node = elem.getAttributeNode("id");
  37574. if (node && node.value === id) {
  37575. return [elem];
  37576. }
  37577. // Fall back on getElementsByName
  37578. elems = context.getElementsByName(id);
  37579. i = 0;
  37580. while (elem = elems[i++]) {
  37581. node = elem.getAttributeNode("id");
  37582. if (node && node.value === id) {
  37583. return [elem];
  37584. }
  37585. }
  37586. }
  37587. return [];
  37588. }
  37589. };
  37590. }
  37591. // Tag
  37592. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  37593. if (typeof context.getElementsByTagName !== "undefined") {
  37594. return context.getElementsByTagName(tag);
  37595. // DocumentFragment nodes don't have gEBTN
  37596. } else if (support.qsa) {
  37597. return context.querySelectorAll(tag);
  37598. }
  37599. } : function (tag, context) {
  37600. var elem,
  37601. tmp = [],
  37602. i = 0,
  37603. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  37604. results = context.getElementsByTagName(tag);
  37605. // Filter out possible comments
  37606. if (tag === "*") {
  37607. while (elem = results[i++]) {
  37608. if (elem.nodeType === 1) {
  37609. tmp.push(elem);
  37610. }
  37611. }
  37612. return tmp;
  37613. }
  37614. return results;
  37615. };
  37616. // Class
  37617. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  37618. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  37619. return context.getElementsByClassName(className);
  37620. }
  37621. };
  37622. /* QSA/matchesSelector
  37623. ---------------------------------------------------------------------- */
  37624. // QSA and matchesSelector support
  37625. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  37626. rbuggyMatches = [];
  37627. // qSa(:focus) reports false when true (Chrome 21)
  37628. // We allow this because of a bug in IE8/9 that throws an error
  37629. // whenever `document.activeElement` is accessed on an iframe
  37630. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  37631. // See https://bugs.jquery.com/ticket/13378
  37632. rbuggyQSA = [];
  37633. if (support.qsa = rnative.test(document.querySelectorAll)) {
  37634. // Build QSA regex
  37635. // Regex strategy adopted from Diego Perini
  37636. assert(function (el) {
  37637. // Select is set to empty string on purpose
  37638. // This is to test IE's treatment of not explicitly
  37639. // setting a boolean content attribute,
  37640. // since its presence should be enough
  37641. // https://bugs.jquery.com/ticket/12359
  37642. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  37643. // Support: IE8, Opera 11-12.16
  37644. // Nothing should be selected when empty strings follow ^= or $= or *=
  37645. // The test attribute must be unknown in Opera but "safe" for WinRT
  37646. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  37647. if (el.querySelectorAll("[msallowcapture^='']").length) {
  37648. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  37649. }
  37650. // Support: IE8
  37651. // Boolean attributes and "value" are not treated correctly
  37652. if (!el.querySelectorAll("[selected]").length) {
  37653. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  37654. }
  37655. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  37656. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  37657. rbuggyQSA.push("~=");
  37658. }
  37659. // Webkit/Opera - :checked should return selected option elements
  37660. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  37661. // IE8 throws error here and will not see later tests
  37662. if (!el.querySelectorAll(":checked").length) {
  37663. rbuggyQSA.push(":checked");
  37664. }
  37665. // Support: Safari 8+, iOS 8+
  37666. // https://bugs.webkit.org/show_bug.cgi?id=136851
  37667. // In-page `selector#id sibling-combinator selector` fails
  37668. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  37669. rbuggyQSA.push(".#.+[+~]");
  37670. }
  37671. });
  37672. assert(function (el) {
  37673. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  37674. // Support: Windows 8 Native Apps
  37675. // The type and name attributes are restricted during .innerHTML assignment
  37676. var input = document.createElement("input");
  37677. input.setAttribute("type", "hidden");
  37678. el.appendChild(input).setAttribute("name", "D");
  37679. // Support: IE8
  37680. // Enforce case-sensitivity of name attribute
  37681. if (el.querySelectorAll("[name=d]").length) {
  37682. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  37683. }
  37684. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  37685. // IE8 throws error here and will not see later tests
  37686. if (el.querySelectorAll(":enabled").length !== 2) {
  37687. rbuggyQSA.push(":enabled", ":disabled");
  37688. }
  37689. // Support: IE9-11+
  37690. // IE's :disabled selector does not pick up the children of disabled fieldsets
  37691. docElem.appendChild(el).disabled = true;
  37692. if (el.querySelectorAll(":disabled").length !== 2) {
  37693. rbuggyQSA.push(":enabled", ":disabled");
  37694. }
  37695. // Opera 10-11 does not throw on post-comma invalid pseudos
  37696. el.querySelectorAll("*,:x");
  37697. rbuggyQSA.push(",.*:");
  37698. });
  37699. }
  37700. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  37701. assert(function (el) {
  37702. // Check to see if it's possible to do matchesSelector
  37703. // on a disconnected node (IE 9)
  37704. support.disconnectedMatch = matches.call(el, "*");
  37705. // This should fail with an exception
  37706. // Gecko does not error, returns false instead
  37707. matches.call(el, "[s!='']:x");
  37708. rbuggyMatches.push("!=", pseudos);
  37709. });
  37710. }
  37711. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  37712. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  37713. /* Contains
  37714. ---------------------------------------------------------------------- */
  37715. hasCompare = rnative.test(docElem.compareDocumentPosition);
  37716. // Element contains another
  37717. // Purposefully self-exclusive
  37718. // As in, an element does not contain itself
  37719. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  37720. var adown = a.nodeType === 9 ? a.documentElement : a,
  37721. bup = b && b.parentNode;
  37722. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  37723. } : function (a, b) {
  37724. if (b) {
  37725. while (b = b.parentNode) {
  37726. if (b === a) {
  37727. return true;
  37728. }
  37729. }
  37730. }
  37731. return false;
  37732. };
  37733. /* Sorting
  37734. ---------------------------------------------------------------------- */
  37735. // Document order sorting
  37736. sortOrder = hasCompare ? function (a, b) {
  37737. // Flag for duplicate removal
  37738. if (a === b) {
  37739. hasDuplicate = true;
  37740. return 0;
  37741. }
  37742. // Sort on method existence if only one input has compareDocumentPosition
  37743. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  37744. if (compare) {
  37745. return compare;
  37746. }
  37747. // Calculate position if both inputs belong to the same document
  37748. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  37749. // Otherwise we know they are disconnected
  37750. 1;
  37751. // Disconnected nodes
  37752. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  37753. // Choose the first element that is related to our preferred document
  37754. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  37755. return -1;
  37756. }
  37757. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  37758. return 1;
  37759. }
  37760. // Maintain original order
  37761. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37762. }
  37763. return compare & 4 ? -1 : 1;
  37764. } : function (a, b) {
  37765. // Exit early if the nodes are identical
  37766. if (a === b) {
  37767. hasDuplicate = true;
  37768. return 0;
  37769. }
  37770. var cur,
  37771. i = 0,
  37772. aup = a.parentNode,
  37773. bup = b.parentNode,
  37774. ap = [a],
  37775. bp = [b];
  37776. // Parentless nodes are either documents or disconnected
  37777. if (!aup || !bup) {
  37778. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37779. // If the nodes are siblings, we can do a quick check
  37780. } else if (aup === bup) {
  37781. return siblingCheck(a, b);
  37782. }
  37783. // Otherwise we need full lists of their ancestors for comparison
  37784. cur = a;
  37785. while (cur = cur.parentNode) {
  37786. ap.unshift(cur);
  37787. }
  37788. cur = b;
  37789. while (cur = cur.parentNode) {
  37790. bp.unshift(cur);
  37791. }
  37792. // Walk down the tree looking for a discrepancy
  37793. while (ap[i] === bp[i]) {
  37794. i++;
  37795. }
  37796. return i ?
  37797. // Do a sibling check if the nodes have a common ancestor
  37798. siblingCheck(ap[i], bp[i]) :
  37799. // Otherwise nodes in our document sort first
  37800. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  37801. };
  37802. return document;
  37803. };
  37804. Sizzle.matches = function (expr, elements) {
  37805. return Sizzle(expr, null, null, elements);
  37806. };
  37807. Sizzle.matchesSelector = function (elem, expr) {
  37808. // Set document vars if needed
  37809. if ((elem.ownerDocument || elem) !== document) {
  37810. setDocument(elem);
  37811. }
  37812. // Make sure that attribute selectors are quoted
  37813. expr = expr.replace(rattributeQuotes, "='$1']");
  37814. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  37815. try {
  37816. var ret = matches.call(elem, expr);
  37817. // IE 9's matchesSelector returns false on disconnected nodes
  37818. if (ret || support.disconnectedMatch ||
  37819. // As well, disconnected nodes are said to be in a document
  37820. // fragment in IE 9
  37821. elem.document && elem.document.nodeType !== 11) {
  37822. return ret;
  37823. }
  37824. } catch (e) {}
  37825. }
  37826. return Sizzle(expr, document, null, [elem]).length > 0;
  37827. };
  37828. Sizzle.contains = function (context, elem) {
  37829. // Set document vars if needed
  37830. if ((context.ownerDocument || context) !== document) {
  37831. setDocument(context);
  37832. }
  37833. return contains(context, elem);
  37834. };
  37835. Sizzle.attr = function (elem, name) {
  37836. // Set document vars if needed
  37837. if ((elem.ownerDocument || elem) !== document) {
  37838. setDocument(elem);
  37839. }
  37840. var fn = Expr.attrHandle[name.toLowerCase()],
  37841. // Don't get fooled by Object.prototype properties (jQuery #13807)
  37842. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  37843. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  37844. };
  37845. Sizzle.escape = function (sel) {
  37846. return (sel + "").replace(rcssescape, fcssescape);
  37847. };
  37848. Sizzle.error = function (msg) {
  37849. throw new Error("Syntax error, unrecognized expression: " + msg);
  37850. };
  37851. /**
  37852. * Document sorting and removing duplicates
  37853. * @param {ArrayLike} results
  37854. */
  37855. Sizzle.uniqueSort = function (results) {
  37856. var elem,
  37857. duplicates = [],
  37858. j = 0,
  37859. i = 0;
  37860. // Unless we *know* we can detect duplicates, assume their presence
  37861. hasDuplicate = !support.detectDuplicates;
  37862. sortInput = !support.sortStable && results.slice(0);
  37863. results.sort(sortOrder);
  37864. if (hasDuplicate) {
  37865. while (elem = results[i++]) {
  37866. if (elem === results[i]) {
  37867. j = duplicates.push(i);
  37868. }
  37869. }
  37870. while (j--) {
  37871. results.splice(duplicates[j], 1);
  37872. }
  37873. }
  37874. // Clear input after sorting to release objects
  37875. // See https://github.com/jquery/sizzle/pull/225
  37876. sortInput = null;
  37877. return results;
  37878. };
  37879. /**
  37880. * Utility function for retrieving the text value of an array of DOM nodes
  37881. * @param {Array|Element} elem
  37882. */
  37883. getText = Sizzle.getText = function (elem) {
  37884. var node,
  37885. ret = "",
  37886. i = 0,
  37887. nodeType = elem.nodeType;
  37888. if (!nodeType) {
  37889. // If no nodeType, this is expected to be an array
  37890. while (node = elem[i++]) {
  37891. // Do not traverse comment nodes
  37892. ret += getText(node);
  37893. }
  37894. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  37895. // Use textContent for elements
  37896. // innerText usage removed for consistency of new lines (jQuery #11153)
  37897. if (typeof elem.textContent === "string") {
  37898. return elem.textContent;
  37899. } else {
  37900. // Traverse its children
  37901. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  37902. ret += getText(elem);
  37903. }
  37904. }
  37905. } else if (nodeType === 3 || nodeType === 4) {
  37906. return elem.nodeValue;
  37907. }
  37908. // Do not include comment or processing instruction nodes
  37909. return ret;
  37910. };
  37911. Expr = Sizzle.selectors = {
  37912. // Can be adjusted by the user
  37913. cacheLength: 50,
  37914. createPseudo: markFunction,
  37915. match: matchExpr,
  37916. attrHandle: {},
  37917. find: {},
  37918. relative: {
  37919. ">": { dir: "parentNode", first: true },
  37920. " ": { dir: "parentNode" },
  37921. "+": { dir: "previousSibling", first: true },
  37922. "~": { dir: "previousSibling" }
  37923. },
  37924. preFilter: {
  37925. "ATTR": function ATTR(match) {
  37926. match[1] = match[1].replace(runescape, funescape);
  37927. // Move the given value to match[3] whether quoted or unquoted
  37928. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  37929. if (match[2] === "~=") {
  37930. match[3] = " " + match[3] + " ";
  37931. }
  37932. return match.slice(0, 4);
  37933. },
  37934. "CHILD": function CHILD(match) {
  37935. /* matches from matchExpr["CHILD"]
  37936. 1 type (only|nth|...)
  37937. 2 what (child|of-type)
  37938. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  37939. 4 xn-component of xn+y argument ([+-]?\d*n|)
  37940. 5 sign of xn-component
  37941. 6 x of xn-component
  37942. 7 sign of y-component
  37943. 8 y of y-component
  37944. */
  37945. match[1] = match[1].toLowerCase();
  37946. if (match[1].slice(0, 3) === "nth") {
  37947. // nth-* requires argument
  37948. if (!match[3]) {
  37949. Sizzle.error(match[0]);
  37950. }
  37951. // numeric x and y parameters for Expr.filter.CHILD
  37952. // remember that false/true cast respectively to 0/1
  37953. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  37954. match[5] = +(match[7] + match[8] || match[3] === "odd");
  37955. // other types prohibit arguments
  37956. } else if (match[3]) {
  37957. Sizzle.error(match[0]);
  37958. }
  37959. return match;
  37960. },
  37961. "PSEUDO": function PSEUDO(match) {
  37962. var excess,
  37963. unquoted = !match[6] && match[2];
  37964. if (matchExpr["CHILD"].test(match[0])) {
  37965. return null;
  37966. }
  37967. // Accept quoted arguments as-is
  37968. if (match[3]) {
  37969. match[2] = match[4] || match[5] || "";
  37970. // Strip excess characters from unquoted arguments
  37971. } else if (unquoted && rpseudo.test(unquoted) && (
  37972. // Get excess from tokenize (recursively)
  37973. excess = tokenize(unquoted, true)) && (
  37974. // advance to the next closing parenthesis
  37975. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  37976. // excess is a negative index
  37977. match[0] = match[0].slice(0, excess);
  37978. match[2] = unquoted.slice(0, excess);
  37979. }
  37980. // Return only captures needed by the pseudo filter method (type and argument)
  37981. return match.slice(0, 3);
  37982. }
  37983. },
  37984. filter: {
  37985. "TAG": function TAG(nodeNameSelector) {
  37986. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  37987. return nodeNameSelector === "*" ? function () {
  37988. return true;
  37989. } : function (elem) {
  37990. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  37991. };
  37992. },
  37993. "CLASS": function CLASS(className) {
  37994. var pattern = classCache[className + " "];
  37995. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  37996. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  37997. });
  37998. },
  37999. "ATTR": function ATTR(name, operator, check) {
  38000. return function (elem) {
  38001. var result = Sizzle.attr(elem, name);
  38002. if (result == null) {
  38003. return operator === "!=";
  38004. }
  38005. if (!operator) {
  38006. return true;
  38007. }
  38008. result += "";
  38009. 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;
  38010. };
  38011. },
  38012. "CHILD": function CHILD(type, what, argument, first, last) {
  38013. var simple = type.slice(0, 3) !== "nth",
  38014. forward = type.slice(-4) !== "last",
  38015. ofType = what === "of-type";
  38016. return first === 1 && last === 0 ?
  38017. // Shortcut for :nth-*(n)
  38018. function (elem) {
  38019. return !!elem.parentNode;
  38020. } : function (elem, context, xml) {
  38021. var cache,
  38022. uniqueCache,
  38023. outerCache,
  38024. node,
  38025. nodeIndex,
  38026. start,
  38027. dir = simple !== forward ? "nextSibling" : "previousSibling",
  38028. parent = elem.parentNode,
  38029. name = ofType && elem.nodeName.toLowerCase(),
  38030. useCache = !xml && !ofType,
  38031. diff = false;
  38032. if (parent) {
  38033. // :(first|last|only)-(child|of-type)
  38034. if (simple) {
  38035. while (dir) {
  38036. node = elem;
  38037. while (node = node[dir]) {
  38038. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  38039. return false;
  38040. }
  38041. }
  38042. // Reverse direction for :only-* (if we haven't yet done so)
  38043. start = dir = type === "only" && !start && "nextSibling";
  38044. }
  38045. return true;
  38046. }
  38047. start = [forward ? parent.firstChild : parent.lastChild];
  38048. // non-xml :nth-child(...) stores cache data on `parent`
  38049. if (forward && useCache) {
  38050. // Seek `elem` from a previously-cached index
  38051. // ...in a gzip-friendly way
  38052. node = parent;
  38053. outerCache = node[expando] || (node[expando] = {});
  38054. // Support: IE <9 only
  38055. // Defend against cloned attroperties (jQuery gh-1709)
  38056. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38057. cache = uniqueCache[type] || [];
  38058. nodeIndex = cache[0] === dirruns && cache[1];
  38059. diff = nodeIndex && cache[2];
  38060. node = nodeIndex && parent.childNodes[nodeIndex];
  38061. while (node = ++nodeIndex && node && node[dir] || (
  38062. // Fallback to seeking `elem` from the start
  38063. diff = nodeIndex = 0) || start.pop()) {
  38064. // When found, cache indexes on `parent` and break
  38065. if (node.nodeType === 1 && ++diff && node === elem) {
  38066. uniqueCache[type] = [dirruns, nodeIndex, diff];
  38067. break;
  38068. }
  38069. }
  38070. } else {
  38071. // Use previously-cached element index if available
  38072. if (useCache) {
  38073. // ...in a gzip-friendly way
  38074. node = elem;
  38075. outerCache = node[expando] || (node[expando] = {});
  38076. // Support: IE <9 only
  38077. // Defend against cloned attroperties (jQuery gh-1709)
  38078. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38079. cache = uniqueCache[type] || [];
  38080. nodeIndex = cache[0] === dirruns && cache[1];
  38081. diff = nodeIndex;
  38082. }
  38083. // xml :nth-child(...)
  38084. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  38085. if (diff === false) {
  38086. // Use the same loop as above to seek `elem` from the start
  38087. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  38088. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  38089. // Cache the index of each encountered element
  38090. if (useCache) {
  38091. outerCache = node[expando] || (node[expando] = {});
  38092. // Support: IE <9 only
  38093. // Defend against cloned attroperties (jQuery gh-1709)
  38094. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38095. uniqueCache[type] = [dirruns, diff];
  38096. }
  38097. if (node === elem) {
  38098. break;
  38099. }
  38100. }
  38101. }
  38102. }
  38103. }
  38104. // Incorporate the offset, then check against cycle size
  38105. diff -= last;
  38106. return diff === first || diff % first === 0 && diff / first >= 0;
  38107. }
  38108. };
  38109. },
  38110. "PSEUDO": function PSEUDO(pseudo, argument) {
  38111. // pseudo-class names are case-insensitive
  38112. // http://www.w3.org/TR/selectors/#pseudo-classes
  38113. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38114. // Remember that setFilters inherits from pseudos
  38115. var args,
  38116. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38117. // The user may use createPseudo to indicate that
  38118. // arguments are needed to create the filter function
  38119. // just as Sizzle does
  38120. if (fn[expando]) {
  38121. return fn(argument);
  38122. }
  38123. // But maintain support for old signatures
  38124. if (fn.length > 1) {
  38125. args = [pseudo, pseudo, "", argument];
  38126. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38127. var idx,
  38128. matched = fn(seed, argument),
  38129. i = matched.length;
  38130. while (i--) {
  38131. idx = indexOf(seed, matched[i]);
  38132. seed[idx] = !(matches[idx] = matched[i]);
  38133. }
  38134. }) : function (elem) {
  38135. return fn(elem, 0, args);
  38136. };
  38137. }
  38138. return fn;
  38139. }
  38140. },
  38141. pseudos: {
  38142. // Potentially complex pseudos
  38143. "not": markFunction(function (selector) {
  38144. // Trim the selector passed to compile
  38145. // to avoid treating leading and trailing
  38146. // spaces as combinators
  38147. var input = [],
  38148. results = [],
  38149. matcher = compile(selector.replace(rtrim, "$1"));
  38150. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38151. var elem,
  38152. unmatched = matcher(seed, null, xml, []),
  38153. i = seed.length;
  38154. // Match elements unmatched by `matcher`
  38155. while (i--) {
  38156. if (elem = unmatched[i]) {
  38157. seed[i] = !(matches[i] = elem);
  38158. }
  38159. }
  38160. }) : function (elem, context, xml) {
  38161. input[0] = elem;
  38162. matcher(input, null, xml, results);
  38163. // Don't keep the element (issue #299)
  38164. input[0] = null;
  38165. return !results.pop();
  38166. };
  38167. }),
  38168. "has": markFunction(function (selector) {
  38169. return function (elem) {
  38170. return Sizzle(selector, elem).length > 0;
  38171. };
  38172. }),
  38173. "contains": markFunction(function (text) {
  38174. text = text.replace(runescape, funescape);
  38175. return function (elem) {
  38176. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38177. };
  38178. }),
  38179. // "Whether an element is represented by a :lang() selector
  38180. // is based solely on the element's language value
  38181. // being equal to the identifier C,
  38182. // or beginning with the identifier C immediately followed by "-".
  38183. // The matching of C against the element's language value is performed case-insensitively.
  38184. // The identifier C does not have to be a valid language name."
  38185. // http://www.w3.org/TR/selectors/#lang-pseudo
  38186. "lang": markFunction(function (lang) {
  38187. // lang value must be a valid identifier
  38188. if (!ridentifier.test(lang || "")) {
  38189. Sizzle.error("unsupported lang: " + lang);
  38190. }
  38191. lang = lang.replace(runescape, funescape).toLowerCase();
  38192. return function (elem) {
  38193. var elemLang;
  38194. do {
  38195. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38196. elemLang = elemLang.toLowerCase();
  38197. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38198. }
  38199. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38200. return false;
  38201. };
  38202. }),
  38203. // Miscellaneous
  38204. "target": function target(elem) {
  38205. var hash = window.location && window.location.hash;
  38206. return hash && hash.slice(1) === elem.id;
  38207. },
  38208. "root": function root(elem) {
  38209. return elem === docElem;
  38210. },
  38211. "focus": function focus(elem) {
  38212. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38213. },
  38214. // Boolean properties
  38215. "enabled": createDisabledPseudo(false),
  38216. "disabled": createDisabledPseudo(true),
  38217. "checked": function checked(elem) {
  38218. // In CSS3, :checked should return both checked and selected elements
  38219. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38220. var nodeName = elem.nodeName.toLowerCase();
  38221. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38222. },
  38223. "selected": function selected(elem) {
  38224. // Accessing this property makes selected-by-default
  38225. // options in Safari work properly
  38226. if (elem.parentNode) {
  38227. elem.parentNode.selectedIndex;
  38228. }
  38229. return elem.selected === true;
  38230. },
  38231. // Contents
  38232. "empty": function empty(elem) {
  38233. // http://www.w3.org/TR/selectors/#empty-pseudo
  38234. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38235. // but not by others (comment: 8; processing instruction: 7; etc.)
  38236. // nodeType < 6 works because attributes (2) do not appear as children
  38237. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38238. if (elem.nodeType < 6) {
  38239. return false;
  38240. }
  38241. }
  38242. return true;
  38243. },
  38244. "parent": function parent(elem) {
  38245. return !Expr.pseudos["empty"](elem);
  38246. },
  38247. // Element/input types
  38248. "header": function header(elem) {
  38249. return rheader.test(elem.nodeName);
  38250. },
  38251. "input": function input(elem) {
  38252. return rinputs.test(elem.nodeName);
  38253. },
  38254. "button": function button(elem) {
  38255. var name = elem.nodeName.toLowerCase();
  38256. return name === "input" && elem.type === "button" || name === "button";
  38257. },
  38258. "text": function text(elem) {
  38259. var attr;
  38260. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38261. // Support: IE<8
  38262. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38263. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38264. },
  38265. // Position-in-collection
  38266. "first": createPositionalPseudo(function () {
  38267. return [0];
  38268. }),
  38269. "last": createPositionalPseudo(function (matchIndexes, length) {
  38270. return [length - 1];
  38271. }),
  38272. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38273. return [argument < 0 ? argument + length : argument];
  38274. }),
  38275. "even": createPositionalPseudo(function (matchIndexes, length) {
  38276. var i = 0;
  38277. for (; i < length; i += 2) {
  38278. matchIndexes.push(i);
  38279. }
  38280. return matchIndexes;
  38281. }),
  38282. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38283. var i = 1;
  38284. for (; i < length; i += 2) {
  38285. matchIndexes.push(i);
  38286. }
  38287. return matchIndexes;
  38288. }),
  38289. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38290. var i = argument < 0 ? argument + length : argument;
  38291. for (; --i >= 0;) {
  38292. matchIndexes.push(i);
  38293. }
  38294. return matchIndexes;
  38295. }),
  38296. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38297. var i = argument < 0 ? argument + length : argument;
  38298. for (; ++i < length;) {
  38299. matchIndexes.push(i);
  38300. }
  38301. return matchIndexes;
  38302. })
  38303. }
  38304. };
  38305. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38306. // Add button/input type pseudos
  38307. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38308. Expr.pseudos[i] = createInputPseudo(i);
  38309. }
  38310. for (i in { submit: true, reset: true }) {
  38311. Expr.pseudos[i] = createButtonPseudo(i);
  38312. }
  38313. // Easy API for creating new setFilters
  38314. function setFilters() {}
  38315. setFilters.prototype = Expr.filters = Expr.pseudos;
  38316. Expr.setFilters = new setFilters();
  38317. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38318. var matched,
  38319. match,
  38320. tokens,
  38321. type,
  38322. soFar,
  38323. groups,
  38324. preFilters,
  38325. cached = tokenCache[selector + " "];
  38326. if (cached) {
  38327. return parseOnly ? 0 : cached.slice(0);
  38328. }
  38329. soFar = selector;
  38330. groups = [];
  38331. preFilters = Expr.preFilter;
  38332. while (soFar) {
  38333. // Comma and first run
  38334. if (!matched || (match = rcomma.exec(soFar))) {
  38335. if (match) {
  38336. // Don't consume trailing commas as valid
  38337. soFar = soFar.slice(match[0].length) || soFar;
  38338. }
  38339. groups.push(tokens = []);
  38340. }
  38341. matched = false;
  38342. // Combinators
  38343. if (match = rcombinators.exec(soFar)) {
  38344. matched = match.shift();
  38345. tokens.push({
  38346. value: matched,
  38347. // Cast descendant combinators to space
  38348. type: match[0].replace(rtrim, " ")
  38349. });
  38350. soFar = soFar.slice(matched.length);
  38351. }
  38352. // Filters
  38353. for (type in Expr.filter) {
  38354. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38355. matched = match.shift();
  38356. tokens.push({
  38357. value: matched,
  38358. type: type,
  38359. matches: match
  38360. });
  38361. soFar = soFar.slice(matched.length);
  38362. }
  38363. }
  38364. if (!matched) {
  38365. break;
  38366. }
  38367. }
  38368. // Return the length of the invalid excess
  38369. // if we're just parsing
  38370. // Otherwise, throw an error or return tokens
  38371. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38372. // Cache the tokens
  38373. tokenCache(selector, groups).slice(0);
  38374. };
  38375. function toSelector(tokens) {
  38376. var i = 0,
  38377. len = tokens.length,
  38378. selector = "";
  38379. for (; i < len; i++) {
  38380. selector += tokens[i].value;
  38381. }
  38382. return selector;
  38383. }
  38384. function addCombinator(matcher, combinator, base) {
  38385. var dir = combinator.dir,
  38386. skip = combinator.next,
  38387. key = skip || dir,
  38388. checkNonElements = base && key === "parentNode",
  38389. doneName = done++;
  38390. return combinator.first ?
  38391. // Check against closest ancestor/preceding element
  38392. function (elem, context, xml) {
  38393. while (elem = elem[dir]) {
  38394. if (elem.nodeType === 1 || checkNonElements) {
  38395. return matcher(elem, context, xml);
  38396. }
  38397. }
  38398. return false;
  38399. } :
  38400. // Check against all ancestor/preceding elements
  38401. function (elem, context, xml) {
  38402. var oldCache,
  38403. uniqueCache,
  38404. outerCache,
  38405. newCache = [dirruns, doneName];
  38406. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38407. if (xml) {
  38408. while (elem = elem[dir]) {
  38409. if (elem.nodeType === 1 || checkNonElements) {
  38410. if (matcher(elem, context, xml)) {
  38411. return true;
  38412. }
  38413. }
  38414. }
  38415. } else {
  38416. while (elem = elem[dir]) {
  38417. if (elem.nodeType === 1 || checkNonElements) {
  38418. outerCache = elem[expando] || (elem[expando] = {});
  38419. // Support: IE <9 only
  38420. // Defend against cloned attroperties (jQuery gh-1709)
  38421. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38422. if (skip && skip === elem.nodeName.toLowerCase()) {
  38423. elem = elem[dir] || elem;
  38424. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38425. // Assign to newCache so results back-propagate to previous elements
  38426. return newCache[2] = oldCache[2];
  38427. } else {
  38428. // Reuse newcache so results back-propagate to previous elements
  38429. uniqueCache[key] = newCache;
  38430. // A match means we're done; a fail means we have to keep checking
  38431. if (newCache[2] = matcher(elem, context, xml)) {
  38432. return true;
  38433. }
  38434. }
  38435. }
  38436. }
  38437. }
  38438. return false;
  38439. };
  38440. }
  38441. function elementMatcher(matchers) {
  38442. return matchers.length > 1 ? function (elem, context, xml) {
  38443. var i = matchers.length;
  38444. while (i--) {
  38445. if (!matchers[i](elem, context, xml)) {
  38446. return false;
  38447. }
  38448. }
  38449. return true;
  38450. } : matchers[0];
  38451. }
  38452. function multipleContexts(selector, contexts, results) {
  38453. var i = 0,
  38454. len = contexts.length;
  38455. for (; i < len; i++) {
  38456. Sizzle(selector, contexts[i], results);
  38457. }
  38458. return results;
  38459. }
  38460. function condense(unmatched, map, filter, context, xml) {
  38461. var elem,
  38462. newUnmatched = [],
  38463. i = 0,
  38464. len = unmatched.length,
  38465. mapped = map != null;
  38466. for (; i < len; i++) {
  38467. if (elem = unmatched[i]) {
  38468. if (!filter || filter(elem, context, xml)) {
  38469. newUnmatched.push(elem);
  38470. if (mapped) {
  38471. map.push(i);
  38472. }
  38473. }
  38474. }
  38475. }
  38476. return newUnmatched;
  38477. }
  38478. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38479. if (postFilter && !postFilter[expando]) {
  38480. postFilter = setMatcher(postFilter);
  38481. }
  38482. if (postFinder && !postFinder[expando]) {
  38483. postFinder = setMatcher(postFinder, postSelector);
  38484. }
  38485. return markFunction(function (seed, results, context, xml) {
  38486. var temp,
  38487. i,
  38488. elem,
  38489. preMap = [],
  38490. postMap = [],
  38491. preexisting = results.length,
  38492. // Get initial elements from seed or context
  38493. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38494. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38495. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38496. matcherOut = matcher ?
  38497. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38498. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38499. // ...intermediate processing is necessary
  38500. [] :
  38501. // ...otherwise use results directly
  38502. results : matcherIn;
  38503. // Find primary matches
  38504. if (matcher) {
  38505. matcher(matcherIn, matcherOut, context, xml);
  38506. }
  38507. // Apply postFilter
  38508. if (postFilter) {
  38509. temp = condense(matcherOut, postMap);
  38510. postFilter(temp, [], context, xml);
  38511. // Un-match failing elements by moving them back to matcherIn
  38512. i = temp.length;
  38513. while (i--) {
  38514. if (elem = temp[i]) {
  38515. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  38516. }
  38517. }
  38518. }
  38519. if (seed) {
  38520. if (postFinder || preFilter) {
  38521. if (postFinder) {
  38522. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  38523. temp = [];
  38524. i = matcherOut.length;
  38525. while (i--) {
  38526. if (elem = matcherOut[i]) {
  38527. // Restore matcherIn since elem is not yet a final match
  38528. temp.push(matcherIn[i] = elem);
  38529. }
  38530. }
  38531. postFinder(null, matcherOut = [], temp, xml);
  38532. }
  38533. // Move matched elements from seed to results to keep them synchronized
  38534. i = matcherOut.length;
  38535. while (i--) {
  38536. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  38537. seed[temp] = !(results[temp] = elem);
  38538. }
  38539. }
  38540. }
  38541. // Add elements to results, through postFinder if defined
  38542. } else {
  38543. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  38544. if (postFinder) {
  38545. postFinder(null, results, matcherOut, xml);
  38546. } else {
  38547. push.apply(results, matcherOut);
  38548. }
  38549. }
  38550. });
  38551. }
  38552. function matcherFromTokens(tokens) {
  38553. var checkContext,
  38554. matcher,
  38555. j,
  38556. len = tokens.length,
  38557. leadingRelative = Expr.relative[tokens[0].type],
  38558. implicitRelative = leadingRelative || Expr.relative[" "],
  38559. i = leadingRelative ? 1 : 0,
  38560. // The foundational matcher ensures that elements are reachable from top-level context(s)
  38561. matchContext = addCombinator(function (elem) {
  38562. return elem === checkContext;
  38563. }, implicitRelative, true),
  38564. matchAnyContext = addCombinator(function (elem) {
  38565. return indexOf(checkContext, elem) > -1;
  38566. }, implicitRelative, true),
  38567. matchers = [function (elem, context, xml) {
  38568. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  38569. // Avoid hanging onto element (issue #299)
  38570. checkContext = null;
  38571. return ret;
  38572. }];
  38573. for (; i < len; i++) {
  38574. if (matcher = Expr.relative[tokens[i].type]) {
  38575. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  38576. } else {
  38577. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  38578. // Return special upon seeing a positional matcher
  38579. if (matcher[expando]) {
  38580. // Find the next relative operator (if any) for proper handling
  38581. j = ++i;
  38582. for (; j < len; j++) {
  38583. if (Expr.relative[tokens[j].type]) {
  38584. break;
  38585. }
  38586. }
  38587. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  38588. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  38589. 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));
  38590. }
  38591. matchers.push(matcher);
  38592. }
  38593. }
  38594. return elementMatcher(matchers);
  38595. }
  38596. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  38597. var bySet = setMatchers.length > 0,
  38598. byElement = elementMatchers.length > 0,
  38599. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  38600. var elem,
  38601. j,
  38602. matcher,
  38603. matchedCount = 0,
  38604. i = "0",
  38605. unmatched = seed && [],
  38606. setMatched = [],
  38607. contextBackup = outermostContext,
  38608. // We must always have either seed elements or outermost context
  38609. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  38610. // Use integer dirruns iff this is the outermost matcher
  38611. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  38612. len = elems.length;
  38613. if (outermost) {
  38614. outermostContext = context === document || context || outermost;
  38615. }
  38616. // Add elements passing elementMatchers directly to results
  38617. // Support: IE<9, Safari
  38618. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  38619. for (; i !== len && (elem = elems[i]) != null; i++) {
  38620. if (byElement && elem) {
  38621. j = 0;
  38622. if (!context && elem.ownerDocument !== document) {
  38623. setDocument(elem);
  38624. xml = !documentIsHTML;
  38625. }
  38626. while (matcher = elementMatchers[j++]) {
  38627. if (matcher(elem, context || document, xml)) {
  38628. results.push(elem);
  38629. break;
  38630. }
  38631. }
  38632. if (outermost) {
  38633. dirruns = dirrunsUnique;
  38634. }
  38635. }
  38636. // Track unmatched elements for set filters
  38637. if (bySet) {
  38638. // They will have gone through all possible matchers
  38639. if (elem = !matcher && elem) {
  38640. matchedCount--;
  38641. }
  38642. // Lengthen the array for every element, matched or not
  38643. if (seed) {
  38644. unmatched.push(elem);
  38645. }
  38646. }
  38647. }
  38648. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  38649. // makes the latter nonnegative.
  38650. matchedCount += i;
  38651. // Apply set filters to unmatched elements
  38652. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  38653. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  38654. // no element matchers and no seed.
  38655. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  38656. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  38657. // numerically zero.
  38658. if (bySet && i !== matchedCount) {
  38659. j = 0;
  38660. while (matcher = setMatchers[j++]) {
  38661. matcher(unmatched, setMatched, context, xml);
  38662. }
  38663. if (seed) {
  38664. // Reintegrate element matches to eliminate the need for sorting
  38665. if (matchedCount > 0) {
  38666. while (i--) {
  38667. if (!(unmatched[i] || setMatched[i])) {
  38668. setMatched[i] = pop.call(results);
  38669. }
  38670. }
  38671. }
  38672. // Discard index placeholder values to get only actual matches
  38673. setMatched = condense(setMatched);
  38674. }
  38675. // Add matches to results
  38676. push.apply(results, setMatched);
  38677. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  38678. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  38679. Sizzle.uniqueSort(results);
  38680. }
  38681. }
  38682. // Override manipulation of globals by nested matchers
  38683. if (outermost) {
  38684. dirruns = dirrunsUnique;
  38685. outermostContext = contextBackup;
  38686. }
  38687. return unmatched;
  38688. };
  38689. return bySet ? markFunction(superMatcher) : superMatcher;
  38690. }
  38691. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  38692. var i,
  38693. setMatchers = [],
  38694. elementMatchers = [],
  38695. cached = compilerCache[selector + " "];
  38696. if (!cached) {
  38697. // Generate a function of recursive functions that can be used to check each element
  38698. if (!match) {
  38699. match = tokenize(selector);
  38700. }
  38701. i = match.length;
  38702. while (i--) {
  38703. cached = matcherFromTokens(match[i]);
  38704. if (cached[expando]) {
  38705. setMatchers.push(cached);
  38706. } else {
  38707. elementMatchers.push(cached);
  38708. }
  38709. }
  38710. // Cache the compiled function
  38711. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  38712. // Save selector and tokenization
  38713. cached.selector = selector;
  38714. }
  38715. return cached;
  38716. };
  38717. /**
  38718. * A low-level selection function that works with Sizzle's compiled
  38719. * selector functions
  38720. * @param {String|Function} selector A selector or a pre-compiled
  38721. * selector function built with Sizzle.compile
  38722. * @param {Element} context
  38723. * @param {Array} [results]
  38724. * @param {Array} [seed] A set of elements to match against
  38725. */
  38726. select = Sizzle.select = function (selector, context, results, seed) {
  38727. var i,
  38728. tokens,
  38729. token,
  38730. type,
  38731. find,
  38732. compiled = typeof selector === "function" && selector,
  38733. match = !seed && tokenize(selector = compiled.selector || selector);
  38734. results = results || [];
  38735. // Try to minimize operations if there is only one selector in the list and no seed
  38736. // (the latter of which guarantees us context)
  38737. if (match.length === 1) {
  38738. // Reduce context if the leading compound selector is an ID
  38739. tokens = match[0] = match[0].slice(0);
  38740. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  38741. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  38742. if (!context) {
  38743. return results;
  38744. // Precompiled matchers will still verify ancestry, so step up a level
  38745. } else if (compiled) {
  38746. context = context.parentNode;
  38747. }
  38748. selector = selector.slice(tokens.shift().value.length);
  38749. }
  38750. // Fetch a seed set for right-to-left matching
  38751. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  38752. while (i--) {
  38753. token = tokens[i];
  38754. // Abort if we hit a combinator
  38755. if (Expr.relative[type = token.type]) {
  38756. break;
  38757. }
  38758. if (find = Expr.find[type]) {
  38759. // Search, expanding context for leading sibling combinators
  38760. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  38761. // If seed is empty or no tokens remain, we can return early
  38762. tokens.splice(i, 1);
  38763. selector = seed.length && toSelector(tokens);
  38764. if (!selector) {
  38765. push.apply(results, seed);
  38766. return results;
  38767. }
  38768. break;
  38769. }
  38770. }
  38771. }
  38772. }
  38773. // Compile and execute a filtering function if one is not provided
  38774. // Provide `match` to avoid retokenization if we modified the selector above
  38775. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  38776. return results;
  38777. };
  38778. // One-time assignments
  38779. // Sort stability
  38780. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  38781. // Support: Chrome 14-35+
  38782. // Always assume duplicates if they aren't passed to the comparison function
  38783. support.detectDuplicates = !!hasDuplicate;
  38784. // Initialize against the default document
  38785. setDocument();
  38786. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  38787. // Detached nodes confoundingly follow *each other*
  38788. support.sortDetached = assert(function (el) {
  38789. // Should return 1, but returns 4 (following)
  38790. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  38791. });
  38792. // Support: IE<8
  38793. // Prevent attribute/property "interpolation"
  38794. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  38795. if (!assert(function (el) {
  38796. el.innerHTML = "<a href='#'></a>";
  38797. return el.firstChild.getAttribute("href") === "#";
  38798. })) {
  38799. addHandle("type|href|height|width", function (elem, name, isXML) {
  38800. if (!isXML) {
  38801. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  38802. }
  38803. });
  38804. }
  38805. // Support: IE<9
  38806. // Use defaultValue in place of getAttribute("value")
  38807. if (!support.attributes || !assert(function (el) {
  38808. el.innerHTML = "<input/>";
  38809. el.firstChild.setAttribute("value", "");
  38810. return el.firstChild.getAttribute("value") === "";
  38811. })) {
  38812. addHandle("value", function (elem, name, isXML) {
  38813. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  38814. return elem.defaultValue;
  38815. }
  38816. });
  38817. }
  38818. // Support: IE<9
  38819. // Use getAttributeNode to fetch booleans when getAttribute lies
  38820. if (!assert(function (el) {
  38821. return el.getAttribute("disabled") == null;
  38822. })) {
  38823. addHandle(booleans, function (elem, name, isXML) {
  38824. var val;
  38825. if (!isXML) {
  38826. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38827. }
  38828. });
  38829. }
  38830. return Sizzle;
  38831. }(window);
  38832. jQuery.find = Sizzle;
  38833. jQuery.expr = Sizzle.selectors;
  38834. // Deprecated
  38835. jQuery.expr[":"] = jQuery.expr.pseudos;
  38836. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  38837. jQuery.text = Sizzle.getText;
  38838. jQuery.isXMLDoc = Sizzle.isXML;
  38839. jQuery.contains = Sizzle.contains;
  38840. jQuery.escapeSelector = Sizzle.escape;
  38841. var dir = function dir(elem, _dir, until) {
  38842. var matched = [],
  38843. truncate = until !== undefined;
  38844. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  38845. if (elem.nodeType === 1) {
  38846. if (truncate && jQuery(elem).is(until)) {
  38847. break;
  38848. }
  38849. matched.push(elem);
  38850. }
  38851. }
  38852. return matched;
  38853. };
  38854. var _siblings = function _siblings(n, elem) {
  38855. var matched = [];
  38856. for (; n; n = n.nextSibling) {
  38857. if (n.nodeType === 1 && n !== elem) {
  38858. matched.push(n);
  38859. }
  38860. }
  38861. return matched;
  38862. };
  38863. var rneedsContext = jQuery.expr.match.needsContext;
  38864. function nodeName(elem, name) {
  38865. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  38866. };
  38867. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  38868. // Implement the identical functionality for filter and not
  38869. function winnow(elements, qualifier, not) {
  38870. if (isFunction(qualifier)) {
  38871. return jQuery.grep(elements, function (elem, i) {
  38872. return !!qualifier.call(elem, i, elem) !== not;
  38873. });
  38874. }
  38875. // Single element
  38876. if (qualifier.nodeType) {
  38877. return jQuery.grep(elements, function (elem) {
  38878. return elem === qualifier !== not;
  38879. });
  38880. }
  38881. // Arraylike of elements (jQuery, arguments, Array)
  38882. if (typeof qualifier !== "string") {
  38883. return jQuery.grep(elements, function (elem) {
  38884. return indexOf.call(qualifier, elem) > -1 !== not;
  38885. });
  38886. }
  38887. // Filtered directly for both simple and complex selectors
  38888. return jQuery.filter(qualifier, elements, not);
  38889. }
  38890. jQuery.filter = function (expr, elems, not) {
  38891. var elem = elems[0];
  38892. if (not) {
  38893. expr = ":not(" + expr + ")";
  38894. }
  38895. if (elems.length === 1 && elem.nodeType === 1) {
  38896. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  38897. }
  38898. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  38899. return elem.nodeType === 1;
  38900. }));
  38901. };
  38902. jQuery.fn.extend({
  38903. find: function find(selector) {
  38904. var i,
  38905. ret,
  38906. len = this.length,
  38907. self = this;
  38908. if (typeof selector !== "string") {
  38909. return this.pushStack(jQuery(selector).filter(function () {
  38910. for (i = 0; i < len; i++) {
  38911. if (jQuery.contains(self[i], this)) {
  38912. return true;
  38913. }
  38914. }
  38915. }));
  38916. }
  38917. ret = this.pushStack([]);
  38918. for (i = 0; i < len; i++) {
  38919. jQuery.find(selector, self[i], ret);
  38920. }
  38921. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  38922. },
  38923. filter: function filter(selector) {
  38924. return this.pushStack(winnow(this, selector || [], false));
  38925. },
  38926. not: function not(selector) {
  38927. return this.pushStack(winnow(this, selector || [], true));
  38928. },
  38929. is: function is(selector) {
  38930. return !!winnow(this,
  38931. // If this is a positional/relative selector, check membership in the returned set
  38932. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  38933. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  38934. }
  38935. });
  38936. // Initialize a jQuery object
  38937. // A central reference to the root jQuery(document)
  38938. var rootjQuery,
  38939. // A simple way to check for HTML strings
  38940. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  38941. // Strict HTML recognition (#11290: must start with <)
  38942. // Shortcut simple #id case for speed
  38943. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  38944. init = jQuery.fn.init = function (selector, context, root) {
  38945. var match, elem;
  38946. // HANDLE: $(""), $(null), $(undefined), $(false)
  38947. if (!selector) {
  38948. return this;
  38949. }
  38950. // Method init() accepts an alternate rootjQuery
  38951. // so migrate can support jQuery.sub (gh-2101)
  38952. root = root || rootjQuery;
  38953. // Handle HTML strings
  38954. if (typeof selector === "string") {
  38955. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  38956. // Assume that strings that start and end with <> are HTML and skip the regex check
  38957. match = [null, selector, null];
  38958. } else {
  38959. match = rquickExpr.exec(selector);
  38960. }
  38961. // Match html or make sure no context is specified for #id
  38962. if (match && (match[1] || !context)) {
  38963. // HANDLE: $(html) -> $(array)
  38964. if (match[1]) {
  38965. context = context instanceof jQuery ? context[0] : context;
  38966. // Option to run scripts is true for back-compat
  38967. // Intentionally let the error be thrown if parseHTML is not present
  38968. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  38969. // HANDLE: $(html, props)
  38970. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  38971. for (match in context) {
  38972. // Properties of context are called as methods if possible
  38973. if (isFunction(this[match])) {
  38974. this[match](context[match]);
  38975. // ...and otherwise set as attributes
  38976. } else {
  38977. this.attr(match, context[match]);
  38978. }
  38979. }
  38980. }
  38981. return this;
  38982. // HANDLE: $(#id)
  38983. } else {
  38984. elem = document.getElementById(match[2]);
  38985. if (elem) {
  38986. // Inject the element directly into the jQuery object
  38987. this[0] = elem;
  38988. this.length = 1;
  38989. }
  38990. return this;
  38991. }
  38992. // HANDLE: $(expr, $(...))
  38993. } else if (!context || context.jquery) {
  38994. return (context || root).find(selector);
  38995. // HANDLE: $(expr, context)
  38996. // (which is just equivalent to: $(context).find(expr)
  38997. } else {
  38998. return this.constructor(context).find(selector);
  38999. }
  39000. // HANDLE: $(DOMElement)
  39001. } else if (selector.nodeType) {
  39002. this[0] = selector;
  39003. this.length = 1;
  39004. return this;
  39005. // HANDLE: $(function)
  39006. // Shortcut for document ready
  39007. } else if (isFunction(selector)) {
  39008. return root.ready !== undefined ? root.ready(selector) :
  39009. // Execute immediately if ready is not present
  39010. selector(jQuery);
  39011. }
  39012. return jQuery.makeArray(selector, this);
  39013. };
  39014. // Give the init function the jQuery prototype for later instantiation
  39015. init.prototype = jQuery.fn;
  39016. // Initialize central reference
  39017. rootjQuery = jQuery(document);
  39018. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  39019. // Methods guaranteed to produce a unique set when starting from a unique set
  39020. guaranteedUnique = {
  39021. children: true,
  39022. contents: true,
  39023. next: true,
  39024. prev: true
  39025. };
  39026. jQuery.fn.extend({
  39027. has: function has(target) {
  39028. var targets = jQuery(target, this),
  39029. l = targets.length;
  39030. return this.filter(function () {
  39031. var i = 0;
  39032. for (; i < l; i++) {
  39033. if (jQuery.contains(this, targets[i])) {
  39034. return true;
  39035. }
  39036. }
  39037. });
  39038. },
  39039. closest: function closest(selectors, context) {
  39040. var cur,
  39041. i = 0,
  39042. l = this.length,
  39043. matched = [],
  39044. targets = typeof selectors !== "string" && jQuery(selectors);
  39045. // Positional selectors never match, since there's no _selection_ context
  39046. if (!rneedsContext.test(selectors)) {
  39047. for (; i < l; i++) {
  39048. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  39049. // Always skip document fragments
  39050. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  39051. // Don't pass non-elements to Sizzle
  39052. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  39053. matched.push(cur);
  39054. break;
  39055. }
  39056. }
  39057. }
  39058. }
  39059. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  39060. },
  39061. // Determine the position of an element within the set
  39062. index: function index(elem) {
  39063. // No argument, return index in parent
  39064. if (!elem) {
  39065. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  39066. }
  39067. // Index in selector
  39068. if (typeof elem === "string") {
  39069. return indexOf.call(jQuery(elem), this[0]);
  39070. }
  39071. // Locate the position of the desired element
  39072. return indexOf.call(this,
  39073. // If it receives a jQuery object, the first element is used
  39074. elem.jquery ? elem[0] : elem);
  39075. },
  39076. add: function add(selector, context) {
  39077. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  39078. },
  39079. addBack: function addBack(selector) {
  39080. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  39081. }
  39082. });
  39083. function sibling(cur, dir) {
  39084. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  39085. return cur;
  39086. }
  39087. jQuery.each({
  39088. parent: function parent(elem) {
  39089. var parent = elem.parentNode;
  39090. return parent && parent.nodeType !== 11 ? parent : null;
  39091. },
  39092. parents: function parents(elem) {
  39093. return dir(elem, "parentNode");
  39094. },
  39095. parentsUntil: function parentsUntil(elem, i, until) {
  39096. return dir(elem, "parentNode", until);
  39097. },
  39098. next: function next(elem) {
  39099. return sibling(elem, "nextSibling");
  39100. },
  39101. prev: function prev(elem) {
  39102. return sibling(elem, "previousSibling");
  39103. },
  39104. nextAll: function nextAll(elem) {
  39105. return dir(elem, "nextSibling");
  39106. },
  39107. prevAll: function prevAll(elem) {
  39108. return dir(elem, "previousSibling");
  39109. },
  39110. nextUntil: function nextUntil(elem, i, until) {
  39111. return dir(elem, "nextSibling", until);
  39112. },
  39113. prevUntil: function prevUntil(elem, i, until) {
  39114. return dir(elem, "previousSibling", until);
  39115. },
  39116. siblings: function siblings(elem) {
  39117. return _siblings((elem.parentNode || {}).firstChild, elem);
  39118. },
  39119. children: function children(elem) {
  39120. return _siblings(elem.firstChild);
  39121. },
  39122. contents: function contents(elem) {
  39123. if (nodeName(elem, "iframe")) {
  39124. return elem.contentDocument;
  39125. }
  39126. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39127. // Treat the template element as a regular one in browsers that
  39128. // don't support it.
  39129. if (nodeName(elem, "template")) {
  39130. elem = elem.content || elem;
  39131. }
  39132. return jQuery.merge([], elem.childNodes);
  39133. }
  39134. }, function (name, fn) {
  39135. jQuery.fn[name] = function (until, selector) {
  39136. var matched = jQuery.map(this, fn, until);
  39137. if (name.slice(-5) !== "Until") {
  39138. selector = until;
  39139. }
  39140. if (selector && typeof selector === "string") {
  39141. matched = jQuery.filter(selector, matched);
  39142. }
  39143. if (this.length > 1) {
  39144. // Remove duplicates
  39145. if (!guaranteedUnique[name]) {
  39146. jQuery.uniqueSort(matched);
  39147. }
  39148. // Reverse order for parents* and prev-derivatives
  39149. if (rparentsprev.test(name)) {
  39150. matched.reverse();
  39151. }
  39152. }
  39153. return this.pushStack(matched);
  39154. };
  39155. });
  39156. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39157. // Convert String-formatted options into Object-formatted ones
  39158. function createOptions(options) {
  39159. var object = {};
  39160. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39161. object[flag] = true;
  39162. });
  39163. return object;
  39164. }
  39165. /*
  39166. * Create a callback list using the following parameters:
  39167. *
  39168. * options: an optional list of space-separated options that will change how
  39169. * the callback list behaves or a more traditional option object
  39170. *
  39171. * By default a callback list will act like an event callback list and can be
  39172. * "fired" multiple times.
  39173. *
  39174. * Possible options:
  39175. *
  39176. * once: will ensure the callback list can only be fired once (like a Deferred)
  39177. *
  39178. * memory: will keep track of previous values and will call any callback added
  39179. * after the list has been fired right away with the latest "memorized"
  39180. * values (like a Deferred)
  39181. *
  39182. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39183. *
  39184. * stopOnFalse: interrupt callings when a callback returns false
  39185. *
  39186. */
  39187. jQuery.Callbacks = function (options) {
  39188. // Convert options from String-formatted to Object-formatted if needed
  39189. // (we check in cache first)
  39190. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39191. var // Flag to know if list is currently firing
  39192. firing,
  39193. // Last fire value for non-forgettable lists
  39194. memory,
  39195. // Flag to know if list was already fired
  39196. _fired,
  39197. // Flag to prevent firing
  39198. _locked,
  39199. // Actual callback list
  39200. list = [],
  39201. // Queue of execution data for repeatable lists
  39202. queue = [],
  39203. // Index of currently firing callback (modified by add/remove as needed)
  39204. firingIndex = -1,
  39205. // Fire callbacks
  39206. fire = function fire() {
  39207. // Enforce single-firing
  39208. _locked = _locked || options.once;
  39209. // Execute callbacks for all pending executions,
  39210. // respecting firingIndex overrides and runtime changes
  39211. _fired = firing = true;
  39212. for (; queue.length; firingIndex = -1) {
  39213. memory = queue.shift();
  39214. while (++firingIndex < list.length) {
  39215. // Run callback and check for early termination
  39216. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39217. // Jump to end and forget the data so .add doesn't re-fire
  39218. firingIndex = list.length;
  39219. memory = false;
  39220. }
  39221. }
  39222. }
  39223. // Forget the data if we're done with it
  39224. if (!options.memory) {
  39225. memory = false;
  39226. }
  39227. firing = false;
  39228. // Clean up if we're done firing for good
  39229. if (_locked) {
  39230. // Keep an empty list if we have data for future add calls
  39231. if (memory) {
  39232. list = [];
  39233. // Otherwise, this object is spent
  39234. } else {
  39235. list = "";
  39236. }
  39237. }
  39238. },
  39239. // Actual Callbacks object
  39240. self = {
  39241. // Add a callback or a collection of callbacks to the list
  39242. add: function add() {
  39243. if (list) {
  39244. // If we have memory from a past run, we should fire after adding
  39245. if (memory && !firing) {
  39246. firingIndex = list.length - 1;
  39247. queue.push(memory);
  39248. }
  39249. (function add(args) {
  39250. jQuery.each(args, function (_, arg) {
  39251. if (isFunction(arg)) {
  39252. if (!options.unique || !self.has(arg)) {
  39253. list.push(arg);
  39254. }
  39255. } else if (arg && arg.length && toType(arg) !== "string") {
  39256. // Inspect recursively
  39257. add(arg);
  39258. }
  39259. });
  39260. })(arguments);
  39261. if (memory && !firing) {
  39262. fire();
  39263. }
  39264. }
  39265. return this;
  39266. },
  39267. // Remove a callback from the list
  39268. remove: function remove() {
  39269. jQuery.each(arguments, function (_, arg) {
  39270. var index;
  39271. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39272. list.splice(index, 1);
  39273. // Handle firing indexes
  39274. if (index <= firingIndex) {
  39275. firingIndex--;
  39276. }
  39277. }
  39278. });
  39279. return this;
  39280. },
  39281. // Check if a given callback is in the list.
  39282. // If no argument is given, return whether or not list has callbacks attached.
  39283. has: function has(fn) {
  39284. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39285. },
  39286. // Remove all callbacks from the list
  39287. empty: function empty() {
  39288. if (list) {
  39289. list = [];
  39290. }
  39291. return this;
  39292. },
  39293. // Disable .fire and .add
  39294. // Abort any current/pending executions
  39295. // Clear all callbacks and values
  39296. disable: function disable() {
  39297. _locked = queue = [];
  39298. list = memory = "";
  39299. return this;
  39300. },
  39301. disabled: function disabled() {
  39302. return !list;
  39303. },
  39304. // Disable .fire
  39305. // Also disable .add unless we have memory (since it would have no effect)
  39306. // Abort any pending executions
  39307. lock: function lock() {
  39308. _locked = queue = [];
  39309. if (!memory && !firing) {
  39310. list = memory = "";
  39311. }
  39312. return this;
  39313. },
  39314. locked: function locked() {
  39315. return !!_locked;
  39316. },
  39317. // Call all callbacks with the given context and arguments
  39318. fireWith: function fireWith(context, args) {
  39319. if (!_locked) {
  39320. args = args || [];
  39321. args = [context, args.slice ? args.slice() : args];
  39322. queue.push(args);
  39323. if (!firing) {
  39324. fire();
  39325. }
  39326. }
  39327. return this;
  39328. },
  39329. // Call all the callbacks with the given arguments
  39330. fire: function fire() {
  39331. self.fireWith(this, arguments);
  39332. return this;
  39333. },
  39334. // To know if the callbacks have already been called at least once
  39335. fired: function fired() {
  39336. return !!_fired;
  39337. }
  39338. };
  39339. return self;
  39340. };
  39341. function Identity(v) {
  39342. return v;
  39343. }
  39344. function Thrower(ex) {
  39345. throw ex;
  39346. }
  39347. function adoptValue(value, resolve, reject, noValue) {
  39348. var method;
  39349. try {
  39350. // Check for promise aspect first to privilege synchronous behavior
  39351. if (value && isFunction(method = value.promise)) {
  39352. method.call(value).done(resolve).fail(reject);
  39353. // Other thenables
  39354. } else if (value && isFunction(method = value.then)) {
  39355. method.call(value, resolve, reject);
  39356. // Other non-thenables
  39357. } else {
  39358. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39359. // * false: [ value ].slice( 0 ) => resolve( value )
  39360. // * true: [ value ].slice( 1 ) => resolve()
  39361. resolve.apply(undefined, [value].slice(noValue));
  39362. }
  39363. // For Promises/A+, convert exceptions into rejections
  39364. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39365. // Deferred#then to conditionally suppress rejection.
  39366. } catch (value) {
  39367. // Support: Android 4.0 only
  39368. // Strict mode functions invoked without .call/.apply get global-object context
  39369. reject.apply(undefined, [value]);
  39370. }
  39371. }
  39372. jQuery.extend({
  39373. Deferred: function Deferred(func) {
  39374. var tuples = [
  39375. // action, add listener, callbacks,
  39376. // ... .then handlers, argument index, [final state]
  39377. ["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"]],
  39378. _state = "pending",
  39379. _promise = {
  39380. state: function state() {
  39381. return _state;
  39382. },
  39383. always: function always() {
  39384. deferred.done(arguments).fail(arguments);
  39385. return this;
  39386. },
  39387. "catch": function _catch(fn) {
  39388. return _promise.then(null, fn);
  39389. },
  39390. // Keep pipe for back-compat
  39391. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39392. var fns = arguments;
  39393. return jQuery.Deferred(function (newDefer) {
  39394. jQuery.each(tuples, function (i, tuple) {
  39395. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39396. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39397. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39398. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39399. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39400. deferred[tuple[1]](function () {
  39401. var returned = fn && fn.apply(this, arguments);
  39402. if (returned && isFunction(returned.promise)) {
  39403. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39404. } else {
  39405. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39406. }
  39407. });
  39408. });
  39409. fns = null;
  39410. }).promise();
  39411. },
  39412. then: function then(onFulfilled, onRejected, onProgress) {
  39413. var maxDepth = 0;
  39414. function resolve(depth, deferred, handler, special) {
  39415. return function () {
  39416. var that = this,
  39417. args = arguments,
  39418. mightThrow = function mightThrow() {
  39419. var returned, then;
  39420. // Support: Promises/A+ section 2.3.3.3.3
  39421. // https://promisesaplus.com/#point-59
  39422. // Ignore double-resolution attempts
  39423. if (depth < maxDepth) {
  39424. return;
  39425. }
  39426. returned = handler.apply(that, args);
  39427. // Support: Promises/A+ section 2.3.1
  39428. // https://promisesaplus.com/#point-48
  39429. if (returned === deferred.promise()) {
  39430. throw new TypeError("Thenable self-resolution");
  39431. }
  39432. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39433. // https://promisesaplus.com/#point-54
  39434. // https://promisesaplus.com/#point-75
  39435. // Retrieve `then` only once
  39436. then = returned && (
  39437. // Support: Promises/A+ section 2.3.4
  39438. // https://promisesaplus.com/#point-64
  39439. // Only check objects and functions for thenability
  39440. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39441. // Handle a returned thenable
  39442. if (isFunction(then)) {
  39443. // Special processors (notify) just wait for resolution
  39444. if (special) {
  39445. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39446. // Normal processors (resolve) also hook into progress
  39447. } else {
  39448. // ...and disregard older resolution values
  39449. maxDepth++;
  39450. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39451. }
  39452. // Handle all other returned values
  39453. } else {
  39454. // Only substitute handlers pass on context
  39455. // and multiple values (non-spec behavior)
  39456. if (handler !== Identity) {
  39457. that = undefined;
  39458. args = [returned];
  39459. }
  39460. // Process the value(s)
  39461. // Default process is resolve
  39462. (special || deferred.resolveWith)(that, args);
  39463. }
  39464. },
  39465. // Only normal processors (resolve) catch and reject exceptions
  39466. process = special ? mightThrow : function () {
  39467. try {
  39468. mightThrow();
  39469. } catch (e) {
  39470. if (jQuery.Deferred.exceptionHook) {
  39471. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39472. }
  39473. // Support: Promises/A+ section 2.3.3.3.4.1
  39474. // https://promisesaplus.com/#point-61
  39475. // Ignore post-resolution exceptions
  39476. if (depth + 1 >= maxDepth) {
  39477. // Only substitute handlers pass on context
  39478. // and multiple values (non-spec behavior)
  39479. if (handler !== Thrower) {
  39480. that = undefined;
  39481. args = [e];
  39482. }
  39483. deferred.rejectWith(that, args);
  39484. }
  39485. }
  39486. };
  39487. // Support: Promises/A+ section 2.3.3.3.1
  39488. // https://promisesaplus.com/#point-57
  39489. // Re-resolve promises immediately to dodge false rejection from
  39490. // subsequent errors
  39491. if (depth) {
  39492. process();
  39493. } else {
  39494. // Call an optional hook to record the stack, in case of exception
  39495. // since it's otherwise lost when execution goes async
  39496. if (jQuery.Deferred.getStackHook) {
  39497. process.stackTrace = jQuery.Deferred.getStackHook();
  39498. }
  39499. window.setTimeout(process);
  39500. }
  39501. };
  39502. }
  39503. return jQuery.Deferred(function (newDefer) {
  39504. // progress_handlers.add( ... )
  39505. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  39506. // fulfilled_handlers.add( ... )
  39507. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  39508. // rejected_handlers.add( ... )
  39509. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  39510. }).promise();
  39511. },
  39512. // Get a promise for this deferred
  39513. // If obj is provided, the promise aspect is added to the object
  39514. promise: function promise(obj) {
  39515. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  39516. }
  39517. },
  39518. deferred = {};
  39519. // Add list-specific methods
  39520. jQuery.each(tuples, function (i, tuple) {
  39521. var list = tuple[2],
  39522. stateString = tuple[5];
  39523. // promise.progress = list.add
  39524. // promise.done = list.add
  39525. // promise.fail = list.add
  39526. _promise[tuple[1]] = list.add;
  39527. // Handle state
  39528. if (stateString) {
  39529. list.add(function () {
  39530. // state = "resolved" (i.e., fulfilled)
  39531. // state = "rejected"
  39532. _state = stateString;
  39533. },
  39534. // rejected_callbacks.disable
  39535. // fulfilled_callbacks.disable
  39536. tuples[3 - i][2].disable,
  39537. // rejected_handlers.disable
  39538. // fulfilled_handlers.disable
  39539. tuples[3 - i][3].disable,
  39540. // progress_callbacks.lock
  39541. tuples[0][2].lock,
  39542. // progress_handlers.lock
  39543. tuples[0][3].lock);
  39544. }
  39545. // progress_handlers.fire
  39546. // fulfilled_handlers.fire
  39547. // rejected_handlers.fire
  39548. list.add(tuple[3].fire);
  39549. // deferred.notify = function() { deferred.notifyWith(...) }
  39550. // deferred.resolve = function() { deferred.resolveWith(...) }
  39551. // deferred.reject = function() { deferred.rejectWith(...) }
  39552. deferred[tuple[0]] = function () {
  39553. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  39554. return this;
  39555. };
  39556. // deferred.notifyWith = list.fireWith
  39557. // deferred.resolveWith = list.fireWith
  39558. // deferred.rejectWith = list.fireWith
  39559. deferred[tuple[0] + "With"] = list.fireWith;
  39560. });
  39561. // Make the deferred a promise
  39562. _promise.promise(deferred);
  39563. // Call given func if any
  39564. if (func) {
  39565. func.call(deferred, deferred);
  39566. }
  39567. // All done!
  39568. return deferred;
  39569. },
  39570. // Deferred helper
  39571. when: function when(singleValue) {
  39572. var
  39573. // count of uncompleted subordinates
  39574. remaining = arguments.length,
  39575. // count of unprocessed arguments
  39576. i = remaining,
  39577. // subordinate fulfillment data
  39578. resolveContexts = Array(i),
  39579. resolveValues = _slice.call(arguments),
  39580. // the master Deferred
  39581. master = jQuery.Deferred(),
  39582. // subordinate callback factory
  39583. updateFunc = function updateFunc(i) {
  39584. return function (value) {
  39585. resolveContexts[i] = this;
  39586. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  39587. if (! --remaining) {
  39588. master.resolveWith(resolveContexts, resolveValues);
  39589. }
  39590. };
  39591. };
  39592. // Single- and empty arguments are adopted like Promise.resolve
  39593. if (remaining <= 1) {
  39594. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  39595. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  39596. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  39597. return master.then();
  39598. }
  39599. }
  39600. // Multiple arguments are aggregated like Promise.all array elements
  39601. while (i--) {
  39602. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  39603. }
  39604. return master.promise();
  39605. }
  39606. });
  39607. // These usually indicate a programmer mistake during development,
  39608. // warn about them ASAP rather than swallowing them by default.
  39609. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  39610. jQuery.Deferred.exceptionHook = function (error, stack) {
  39611. // Support: IE 8 - 9 only
  39612. // Console exists when dev tools are open, which can happen at any time
  39613. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  39614. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  39615. }
  39616. };
  39617. jQuery.readyException = function (error) {
  39618. window.setTimeout(function () {
  39619. throw error;
  39620. });
  39621. };
  39622. // The deferred used on DOM ready
  39623. var readyList = jQuery.Deferred();
  39624. jQuery.fn.ready = function (fn) {
  39625. readyList.then(fn)
  39626. // Wrap jQuery.readyException in a function so that the lookup
  39627. // happens at the time of error handling instead of callback
  39628. // registration.
  39629. .catch(function (error) {
  39630. jQuery.readyException(error);
  39631. });
  39632. return this;
  39633. };
  39634. jQuery.extend({
  39635. // Is the DOM ready to be used? Set to true once it occurs.
  39636. isReady: false,
  39637. // A counter to track how many items to wait for before
  39638. // the ready event fires. See #6781
  39639. readyWait: 1,
  39640. // Handle when the DOM is ready
  39641. ready: function ready(wait) {
  39642. // Abort if there are pending holds or we're already ready
  39643. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  39644. return;
  39645. }
  39646. // Remember that the DOM is ready
  39647. jQuery.isReady = true;
  39648. // If a normal DOM Ready event fired, decrement, and wait if need be
  39649. if (wait !== true && --jQuery.readyWait > 0) {
  39650. return;
  39651. }
  39652. // If there are functions bound, to execute
  39653. readyList.resolveWith(document, [jQuery]);
  39654. }
  39655. });
  39656. jQuery.ready.then = readyList.then;
  39657. // The ready event handler and self cleanup method
  39658. function completed() {
  39659. document.removeEventListener("DOMContentLoaded", completed);
  39660. window.removeEventListener("load", completed);
  39661. jQuery.ready();
  39662. }
  39663. // Catch cases where $(document).ready() is called
  39664. // after the browser event has already occurred.
  39665. // Support: IE <=9 - 10 only
  39666. // Older IE sometimes signals "interactive" too soon
  39667. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  39668. // Handle it asynchronously to allow scripts the opportunity to delay ready
  39669. window.setTimeout(jQuery.ready);
  39670. } else {
  39671. // Use the handy event callback
  39672. document.addEventListener("DOMContentLoaded", completed);
  39673. // A fallback to window.onload, that will always work
  39674. window.addEventListener("load", completed);
  39675. }
  39676. // Multifunctional method to get and set values of a collection
  39677. // The value/s can optionally be executed if it's a function
  39678. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  39679. var i = 0,
  39680. len = elems.length,
  39681. bulk = key == null;
  39682. // Sets many values
  39683. if (toType(key) === "object") {
  39684. chainable = true;
  39685. for (i in key) {
  39686. access(elems, fn, i, key[i], true, emptyGet, raw);
  39687. }
  39688. // Sets one value
  39689. } else if (value !== undefined) {
  39690. chainable = true;
  39691. if (!isFunction(value)) {
  39692. raw = true;
  39693. }
  39694. if (bulk) {
  39695. // Bulk operations run against the entire set
  39696. if (raw) {
  39697. fn.call(elems, value);
  39698. fn = null;
  39699. // ...except when executing function values
  39700. } else {
  39701. bulk = fn;
  39702. fn = function fn(elem, key, value) {
  39703. return bulk.call(jQuery(elem), value);
  39704. };
  39705. }
  39706. }
  39707. if (fn) {
  39708. for (; i < len; i++) {
  39709. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  39710. }
  39711. }
  39712. }
  39713. if (chainable) {
  39714. return elems;
  39715. }
  39716. // Gets
  39717. if (bulk) {
  39718. return fn.call(elems);
  39719. }
  39720. return len ? fn(elems[0], key) : emptyGet;
  39721. };
  39722. // Matches dashed string for camelizing
  39723. var rmsPrefix = /^-ms-/,
  39724. rdashAlpha = /-([a-z])/g;
  39725. // Used by camelCase as callback to replace()
  39726. function fcamelCase(all, letter) {
  39727. return letter.toUpperCase();
  39728. }
  39729. // Convert dashed to camelCase; used by the css and data modules
  39730. // Support: IE <=9 - 11, Edge 12 - 15
  39731. // Microsoft forgot to hump their vendor prefix (#9572)
  39732. function camelCase(string) {
  39733. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  39734. }
  39735. var acceptData = function acceptData(owner) {
  39736. // Accepts only:
  39737. // - Node
  39738. // - Node.ELEMENT_NODE
  39739. // - Node.DOCUMENT_NODE
  39740. // - Object
  39741. // - Any
  39742. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  39743. };
  39744. function Data() {
  39745. this.expando = jQuery.expando + Data.uid++;
  39746. }
  39747. Data.uid = 1;
  39748. Data.prototype = {
  39749. cache: function cache(owner) {
  39750. // Check if the owner object already has a cache
  39751. var value = owner[this.expando];
  39752. // If not, create one
  39753. if (!value) {
  39754. value = {};
  39755. // We can accept data for non-element nodes in modern browsers,
  39756. // but we should not, see #8335.
  39757. // Always return an empty object.
  39758. if (acceptData(owner)) {
  39759. // If it is a node unlikely to be stringify-ed or looped over
  39760. // use plain assignment
  39761. if (owner.nodeType) {
  39762. owner[this.expando] = value;
  39763. // Otherwise secure it in a non-enumerable property
  39764. // configurable must be true to allow the property to be
  39765. // deleted when data is removed
  39766. } else {
  39767. Object.defineProperty(owner, this.expando, {
  39768. value: value,
  39769. configurable: true
  39770. });
  39771. }
  39772. }
  39773. }
  39774. return value;
  39775. },
  39776. set: function set(owner, data, value) {
  39777. var prop,
  39778. cache = this.cache(owner);
  39779. // Handle: [ owner, key, value ] args
  39780. // Always use camelCase key (gh-2257)
  39781. if (typeof data === "string") {
  39782. cache[camelCase(data)] = value;
  39783. // Handle: [ owner, { properties } ] args
  39784. } else {
  39785. // Copy the properties one-by-one to the cache object
  39786. for (prop in data) {
  39787. cache[camelCase(prop)] = data[prop];
  39788. }
  39789. }
  39790. return cache;
  39791. },
  39792. get: function get(owner, key) {
  39793. return key === undefined ? this.cache(owner) :
  39794. // Always use camelCase key (gh-2257)
  39795. owner[this.expando] && owner[this.expando][camelCase(key)];
  39796. },
  39797. access: function access(owner, key, value) {
  39798. // In cases where either:
  39799. //
  39800. // 1. No key was specified
  39801. // 2. A string key was specified, but no value provided
  39802. //
  39803. // Take the "read" path and allow the get method to determine
  39804. // which value to return, respectively either:
  39805. //
  39806. // 1. The entire cache object
  39807. // 2. The data stored at the key
  39808. //
  39809. if (key === undefined || key && typeof key === "string" && value === undefined) {
  39810. return this.get(owner, key);
  39811. }
  39812. // When the key is not a string, or both a key and value
  39813. // are specified, set or extend (existing objects) with either:
  39814. //
  39815. // 1. An object of properties
  39816. // 2. A key and value
  39817. //
  39818. this.set(owner, key, value);
  39819. // Since the "set" path can have two possible entry points
  39820. // return the expected data based on which path was taken[*]
  39821. return value !== undefined ? value : key;
  39822. },
  39823. remove: function remove(owner, key) {
  39824. var i,
  39825. cache = owner[this.expando];
  39826. if (cache === undefined) {
  39827. return;
  39828. }
  39829. if (key !== undefined) {
  39830. // Support array or space separated string of keys
  39831. if (Array.isArray(key)) {
  39832. // If key is an array of keys...
  39833. // We always set camelCase keys, so remove that.
  39834. key = key.map(camelCase);
  39835. } else {
  39836. key = camelCase(key);
  39837. // If a key with the spaces exists, use it.
  39838. // Otherwise, create an array by matching non-whitespace
  39839. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  39840. }
  39841. i = key.length;
  39842. while (i--) {
  39843. delete cache[key[i]];
  39844. }
  39845. }
  39846. // Remove the expando if there's no more data
  39847. if (key === undefined || jQuery.isEmptyObject(cache)) {
  39848. // Support: Chrome <=35 - 45
  39849. // Webkit & Blink performance suffers when deleting properties
  39850. // from DOM nodes, so set to undefined instead
  39851. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  39852. if (owner.nodeType) {
  39853. owner[this.expando] = undefined;
  39854. } else {
  39855. delete owner[this.expando];
  39856. }
  39857. }
  39858. },
  39859. hasData: function hasData(owner) {
  39860. var cache = owner[this.expando];
  39861. return cache !== undefined && !jQuery.isEmptyObject(cache);
  39862. }
  39863. };
  39864. var dataPriv = new Data();
  39865. var dataUser = new Data();
  39866. // Implementation Summary
  39867. //
  39868. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  39869. // 2. Improve the module's maintainability by reducing the storage
  39870. // paths to a single mechanism.
  39871. // 3. Use the same single mechanism to support "private" and "user" data.
  39872. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  39873. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  39874. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  39875. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  39876. rmultiDash = /[A-Z]/g;
  39877. function getData(data) {
  39878. if (data === "true") {
  39879. return true;
  39880. }
  39881. if (data === "false") {
  39882. return false;
  39883. }
  39884. if (data === "null") {
  39885. return null;
  39886. }
  39887. // Only convert to a number if it doesn't change the string
  39888. if (data === +data + "") {
  39889. return +data;
  39890. }
  39891. if (rbrace.test(data)) {
  39892. return JSON.parse(data);
  39893. }
  39894. return data;
  39895. }
  39896. function dataAttr(elem, key, data) {
  39897. var name;
  39898. // If nothing was found internally, try to fetch any
  39899. // data from the HTML5 data-* attribute
  39900. if (data === undefined && elem.nodeType === 1) {
  39901. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  39902. data = elem.getAttribute(name);
  39903. if (typeof data === "string") {
  39904. try {
  39905. data = getData(data);
  39906. } catch (e) {}
  39907. // Make sure we set the data so it isn't changed later
  39908. dataUser.set(elem, key, data);
  39909. } else {
  39910. data = undefined;
  39911. }
  39912. }
  39913. return data;
  39914. }
  39915. jQuery.extend({
  39916. hasData: function hasData(elem) {
  39917. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  39918. },
  39919. data: function data(elem, name, _data) {
  39920. return dataUser.access(elem, name, _data);
  39921. },
  39922. removeData: function removeData(elem, name) {
  39923. dataUser.remove(elem, name);
  39924. },
  39925. // TODO: Now that all calls to _data and _removeData have been replaced
  39926. // with direct calls to dataPriv methods, these can be deprecated.
  39927. _data: function _data(elem, name, data) {
  39928. return dataPriv.access(elem, name, data);
  39929. },
  39930. _removeData: function _removeData(elem, name) {
  39931. dataPriv.remove(elem, name);
  39932. }
  39933. });
  39934. jQuery.fn.extend({
  39935. data: function data(key, value) {
  39936. var i,
  39937. name,
  39938. data,
  39939. elem = this[0],
  39940. attrs = elem && elem.attributes;
  39941. // Gets all values
  39942. if (key === undefined) {
  39943. if (this.length) {
  39944. data = dataUser.get(elem);
  39945. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  39946. i = attrs.length;
  39947. while (i--) {
  39948. // Support: IE 11 only
  39949. // The attrs elements can be null (#14894)
  39950. if (attrs[i]) {
  39951. name = attrs[i].name;
  39952. if (name.indexOf("data-") === 0) {
  39953. name = camelCase(name.slice(5));
  39954. dataAttr(elem, name, data[name]);
  39955. }
  39956. }
  39957. }
  39958. dataPriv.set(elem, "hasDataAttrs", true);
  39959. }
  39960. }
  39961. return data;
  39962. }
  39963. // Sets multiple values
  39964. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  39965. return this.each(function () {
  39966. dataUser.set(this, key);
  39967. });
  39968. }
  39969. return access(this, function (value) {
  39970. var data;
  39971. // The calling jQuery object (element matches) is not empty
  39972. // (and therefore has an element appears at this[ 0 ]) and the
  39973. // `value` parameter was not undefined. An empty jQuery object
  39974. // will result in `undefined` for elem = this[ 0 ] which will
  39975. // throw an exception if an attempt to read a data cache is made.
  39976. if (elem && value === undefined) {
  39977. // Attempt to get data from the cache
  39978. // The key will always be camelCased in Data
  39979. data = dataUser.get(elem, key);
  39980. if (data !== undefined) {
  39981. return data;
  39982. }
  39983. // Attempt to "discover" the data in
  39984. // HTML5 custom data-* attrs
  39985. data = dataAttr(elem, key);
  39986. if (data !== undefined) {
  39987. return data;
  39988. }
  39989. // We tried really hard, but the data doesn't exist.
  39990. return;
  39991. }
  39992. // Set the data...
  39993. this.each(function () {
  39994. // We always store the camelCased key
  39995. dataUser.set(this, key, value);
  39996. });
  39997. }, null, value, arguments.length > 1, null, true);
  39998. },
  39999. removeData: function removeData(key) {
  40000. return this.each(function () {
  40001. dataUser.remove(this, key);
  40002. });
  40003. }
  40004. });
  40005. jQuery.extend({
  40006. queue: function queue(elem, type, data) {
  40007. var queue;
  40008. if (elem) {
  40009. type = (type || "fx") + "queue";
  40010. queue = dataPriv.get(elem, type);
  40011. // Speed up dequeue by getting out quickly if this is just a lookup
  40012. if (data) {
  40013. if (!queue || Array.isArray(data)) {
  40014. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  40015. } else {
  40016. queue.push(data);
  40017. }
  40018. }
  40019. return queue || [];
  40020. }
  40021. },
  40022. dequeue: function dequeue(elem, type) {
  40023. type = type || "fx";
  40024. var queue = jQuery.queue(elem, type),
  40025. startLength = queue.length,
  40026. fn = queue.shift(),
  40027. hooks = jQuery._queueHooks(elem, type),
  40028. next = function next() {
  40029. jQuery.dequeue(elem, type);
  40030. };
  40031. // If the fx queue is dequeued, always remove the progress sentinel
  40032. if (fn === "inprogress") {
  40033. fn = queue.shift();
  40034. startLength--;
  40035. }
  40036. if (fn) {
  40037. // Add a progress sentinel to prevent the fx queue from being
  40038. // automatically dequeued
  40039. if (type === "fx") {
  40040. queue.unshift("inprogress");
  40041. }
  40042. // Clear up the last queue stop function
  40043. delete hooks.stop;
  40044. fn.call(elem, next, hooks);
  40045. }
  40046. if (!startLength && hooks) {
  40047. hooks.empty.fire();
  40048. }
  40049. },
  40050. // Not public - generate a queueHooks object, or return the current one
  40051. _queueHooks: function _queueHooks(elem, type) {
  40052. var key = type + "queueHooks";
  40053. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  40054. empty: jQuery.Callbacks("once memory").add(function () {
  40055. dataPriv.remove(elem, [type + "queue", key]);
  40056. })
  40057. });
  40058. }
  40059. });
  40060. jQuery.fn.extend({
  40061. queue: function queue(type, data) {
  40062. var setter = 2;
  40063. if (typeof type !== "string") {
  40064. data = type;
  40065. type = "fx";
  40066. setter--;
  40067. }
  40068. if (arguments.length < setter) {
  40069. return jQuery.queue(this[0], type);
  40070. }
  40071. return data === undefined ? this : this.each(function () {
  40072. var queue = jQuery.queue(this, type, data);
  40073. // Ensure a hooks for this queue
  40074. jQuery._queueHooks(this, type);
  40075. if (type === "fx" && queue[0] !== "inprogress") {
  40076. jQuery.dequeue(this, type);
  40077. }
  40078. });
  40079. },
  40080. dequeue: function dequeue(type) {
  40081. return this.each(function () {
  40082. jQuery.dequeue(this, type);
  40083. });
  40084. },
  40085. clearQueue: function clearQueue(type) {
  40086. return this.queue(type || "fx", []);
  40087. },
  40088. // Get a promise resolved when queues of a certain type
  40089. // are emptied (fx is the type by default)
  40090. promise: function promise(type, obj) {
  40091. var tmp,
  40092. count = 1,
  40093. defer = jQuery.Deferred(),
  40094. elements = this,
  40095. i = this.length,
  40096. resolve = function resolve() {
  40097. if (! --count) {
  40098. defer.resolveWith(elements, [elements]);
  40099. }
  40100. };
  40101. if (typeof type !== "string") {
  40102. obj = type;
  40103. type = undefined;
  40104. }
  40105. type = type || "fx";
  40106. while (i--) {
  40107. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40108. if (tmp && tmp.empty) {
  40109. count++;
  40110. tmp.empty.add(resolve);
  40111. }
  40112. }
  40113. resolve();
  40114. return defer.promise(obj);
  40115. }
  40116. });
  40117. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40118. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40119. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40120. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40121. // isHiddenWithinTree might be called from jQuery#filter function;
  40122. // in that case, element will be second argument
  40123. elem = el || elem;
  40124. // Inline style trumps all
  40125. return elem.style.display === "none" || elem.style.display === "" &&
  40126. // Otherwise, check computed style
  40127. // Support: Firefox <=43 - 45
  40128. // Disconnected elements can have computed display: none, so first confirm that elem is
  40129. // in the document.
  40130. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40131. };
  40132. var swap = function swap(elem, options, callback, args) {
  40133. var ret,
  40134. name,
  40135. old = {};
  40136. // Remember the old values, and insert the new ones
  40137. for (name in options) {
  40138. old[name] = elem.style[name];
  40139. elem.style[name] = options[name];
  40140. }
  40141. ret = callback.apply(elem, args || []);
  40142. // Revert the old values
  40143. for (name in options) {
  40144. elem.style[name] = old[name];
  40145. }
  40146. return ret;
  40147. };
  40148. function adjustCSS(elem, prop, valueParts, tween) {
  40149. var adjusted,
  40150. scale,
  40151. maxIterations = 20,
  40152. currentValue = tween ? function () {
  40153. return tween.cur();
  40154. } : function () {
  40155. return jQuery.css(elem, prop, "");
  40156. },
  40157. initial = currentValue(),
  40158. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40159. // Starting value computation is required for potential unit mismatches
  40160. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40161. if (initialInUnit && initialInUnit[3] !== unit) {
  40162. // Support: Firefox <=54
  40163. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40164. initial = initial / 2;
  40165. // Trust units reported by jQuery.css
  40166. unit = unit || initialInUnit[3];
  40167. // Iteratively approximate from a nonzero starting point
  40168. initialInUnit = +initial || 1;
  40169. while (maxIterations--) {
  40170. // Evaluate and update our best guess (doubling guesses that zero out).
  40171. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40172. jQuery.style(elem, prop, initialInUnit + unit);
  40173. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40174. maxIterations = 0;
  40175. }
  40176. initialInUnit = initialInUnit / scale;
  40177. }
  40178. initialInUnit = initialInUnit * 2;
  40179. jQuery.style(elem, prop, initialInUnit + unit);
  40180. // Make sure we update the tween properties later on
  40181. valueParts = valueParts || [];
  40182. }
  40183. if (valueParts) {
  40184. initialInUnit = +initialInUnit || +initial || 0;
  40185. // Apply relative offset (+=/-=) if specified
  40186. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40187. if (tween) {
  40188. tween.unit = unit;
  40189. tween.start = initialInUnit;
  40190. tween.end = adjusted;
  40191. }
  40192. }
  40193. return adjusted;
  40194. }
  40195. var defaultDisplayMap = {};
  40196. function getDefaultDisplay(elem) {
  40197. var temp,
  40198. doc = elem.ownerDocument,
  40199. nodeName = elem.nodeName,
  40200. display = defaultDisplayMap[nodeName];
  40201. if (display) {
  40202. return display;
  40203. }
  40204. temp = doc.body.appendChild(doc.createElement(nodeName));
  40205. display = jQuery.css(temp, "display");
  40206. temp.parentNode.removeChild(temp);
  40207. if (display === "none") {
  40208. display = "block";
  40209. }
  40210. defaultDisplayMap[nodeName] = display;
  40211. return display;
  40212. }
  40213. function showHide(elements, show) {
  40214. var display,
  40215. elem,
  40216. values = [],
  40217. index = 0,
  40218. length = elements.length;
  40219. // Determine new display value for elements that need to change
  40220. for (; index < length; index++) {
  40221. elem = elements[index];
  40222. if (!elem.style) {
  40223. continue;
  40224. }
  40225. display = elem.style.display;
  40226. if (show) {
  40227. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40228. // check is required in this first loop unless we have a nonempty display value (either
  40229. // inline or about-to-be-restored)
  40230. if (display === "none") {
  40231. values[index] = dataPriv.get(elem, "display") || null;
  40232. if (!values[index]) {
  40233. elem.style.display = "";
  40234. }
  40235. }
  40236. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40237. values[index] = getDefaultDisplay(elem);
  40238. }
  40239. } else {
  40240. if (display !== "none") {
  40241. values[index] = "none";
  40242. // Remember what we're overwriting
  40243. dataPriv.set(elem, "display", display);
  40244. }
  40245. }
  40246. }
  40247. // Set the display of the elements in a second loop to avoid constant reflow
  40248. for (index = 0; index < length; index++) {
  40249. if (values[index] != null) {
  40250. elements[index].style.display = values[index];
  40251. }
  40252. }
  40253. return elements;
  40254. }
  40255. jQuery.fn.extend({
  40256. show: function show() {
  40257. return showHide(this, true);
  40258. },
  40259. hide: function hide() {
  40260. return showHide(this);
  40261. },
  40262. toggle: function toggle(state) {
  40263. if (typeof state === "boolean") {
  40264. return state ? this.show() : this.hide();
  40265. }
  40266. return this.each(function () {
  40267. if (isHiddenWithinTree(this)) {
  40268. jQuery(this).show();
  40269. } else {
  40270. jQuery(this).hide();
  40271. }
  40272. });
  40273. }
  40274. });
  40275. var rcheckableType = /^(?:checkbox|radio)$/i;
  40276. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40277. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40278. // We have to close these tags to support XHTML (#13200)
  40279. var wrapMap = {
  40280. // Support: IE <=9 only
  40281. option: [1, "<select multiple='multiple'>", "</select>"],
  40282. // XHTML parsers do not magically insert elements in the
  40283. // same way that tag soup parsers do. So we cannot shorten
  40284. // this by omitting <tbody> or other required elements.
  40285. thead: [1, "<table>", "</table>"],
  40286. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40287. tr: [2, "<table><tbody>", "</tbody></table>"],
  40288. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40289. _default: [0, "", ""]
  40290. };
  40291. // Support: IE <=9 only
  40292. wrapMap.optgroup = wrapMap.option;
  40293. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40294. wrapMap.th = wrapMap.td;
  40295. function getAll(context, tag) {
  40296. // Support: IE <=9 - 11 only
  40297. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40298. var ret;
  40299. if (typeof context.getElementsByTagName !== "undefined") {
  40300. ret = context.getElementsByTagName(tag || "*");
  40301. } else if (typeof context.querySelectorAll !== "undefined") {
  40302. ret = context.querySelectorAll(tag || "*");
  40303. } else {
  40304. ret = [];
  40305. }
  40306. if (tag === undefined || tag && nodeName(context, tag)) {
  40307. return jQuery.merge([context], ret);
  40308. }
  40309. return ret;
  40310. }
  40311. // Mark scripts as having already been evaluated
  40312. function setGlobalEval(elems, refElements) {
  40313. var i = 0,
  40314. l = elems.length;
  40315. for (; i < l; i++) {
  40316. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40317. }
  40318. }
  40319. var rhtml = /<|&#?\w+;/;
  40320. function buildFragment(elems, context, scripts, selection, ignored) {
  40321. var elem,
  40322. tmp,
  40323. tag,
  40324. wrap,
  40325. contains,
  40326. j,
  40327. fragment = context.createDocumentFragment(),
  40328. nodes = [],
  40329. i = 0,
  40330. l = elems.length;
  40331. for (; i < l; i++) {
  40332. elem = elems[i];
  40333. if (elem || elem === 0) {
  40334. // Add nodes directly
  40335. if (toType(elem) === "object") {
  40336. // Support: Android <=4.0 only, PhantomJS 1 only
  40337. // push.apply(_, arraylike) throws on ancient WebKit
  40338. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40339. // Convert non-html into a text node
  40340. } else if (!rhtml.test(elem)) {
  40341. nodes.push(context.createTextNode(elem));
  40342. // Convert html into DOM nodes
  40343. } else {
  40344. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40345. // Deserialize a standard representation
  40346. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40347. wrap = wrapMap[tag] || wrapMap._default;
  40348. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40349. // Descend through wrappers to the right content
  40350. j = wrap[0];
  40351. while (j--) {
  40352. tmp = tmp.lastChild;
  40353. }
  40354. // Support: Android <=4.0 only, PhantomJS 1 only
  40355. // push.apply(_, arraylike) throws on ancient WebKit
  40356. jQuery.merge(nodes, tmp.childNodes);
  40357. // Remember the top-level container
  40358. tmp = fragment.firstChild;
  40359. // Ensure the created nodes are orphaned (#12392)
  40360. tmp.textContent = "";
  40361. }
  40362. }
  40363. }
  40364. // Remove wrapper from fragment
  40365. fragment.textContent = "";
  40366. i = 0;
  40367. while (elem = nodes[i++]) {
  40368. // Skip elements already in the context collection (trac-4087)
  40369. if (selection && jQuery.inArray(elem, selection) > -1) {
  40370. if (ignored) {
  40371. ignored.push(elem);
  40372. }
  40373. continue;
  40374. }
  40375. contains = jQuery.contains(elem.ownerDocument, elem);
  40376. // Append to fragment
  40377. tmp = getAll(fragment.appendChild(elem), "script");
  40378. // Preserve script evaluation history
  40379. if (contains) {
  40380. setGlobalEval(tmp);
  40381. }
  40382. // Capture executables
  40383. if (scripts) {
  40384. j = 0;
  40385. while (elem = tmp[j++]) {
  40386. if (rscriptType.test(elem.type || "")) {
  40387. scripts.push(elem);
  40388. }
  40389. }
  40390. }
  40391. }
  40392. return fragment;
  40393. }
  40394. (function () {
  40395. var fragment = document.createDocumentFragment(),
  40396. div = fragment.appendChild(document.createElement("div")),
  40397. input = document.createElement("input");
  40398. // Support: Android 4.0 - 4.3 only
  40399. // Check state lost if the name is set (#11217)
  40400. // Support: Windows Web Apps (WWA)
  40401. // `name` and `type` must use .setAttribute for WWA (#14901)
  40402. input.setAttribute("type", "radio");
  40403. input.setAttribute("checked", "checked");
  40404. input.setAttribute("name", "t");
  40405. div.appendChild(input);
  40406. // Support: Android <=4.1 only
  40407. // Older WebKit doesn't clone checked state correctly in fragments
  40408. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40409. // Support: IE <=11 only
  40410. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40411. div.innerHTML = "<textarea>x</textarea>";
  40412. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40413. })();
  40414. var documentElement = document.documentElement;
  40415. var rkeyEvent = /^key/,
  40416. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40417. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40418. function returnTrue() {
  40419. return true;
  40420. }
  40421. function returnFalse() {
  40422. return false;
  40423. }
  40424. // Support: IE <=9 only
  40425. // See #13393 for more info
  40426. function safeActiveElement() {
  40427. try {
  40428. return document.activeElement;
  40429. } catch (err) {}
  40430. }
  40431. function _on(elem, types, selector, data, fn, one) {
  40432. var origFn, type;
  40433. // Types can be a map of types/handlers
  40434. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40435. // ( types-Object, selector, data )
  40436. if (typeof selector !== "string") {
  40437. // ( types-Object, data )
  40438. data = data || selector;
  40439. selector = undefined;
  40440. }
  40441. for (type in types) {
  40442. _on(elem, type, selector, data, types[type], one);
  40443. }
  40444. return elem;
  40445. }
  40446. if (data == null && fn == null) {
  40447. // ( types, fn )
  40448. fn = selector;
  40449. data = selector = undefined;
  40450. } else if (fn == null) {
  40451. if (typeof selector === "string") {
  40452. // ( types, selector, fn )
  40453. fn = data;
  40454. data = undefined;
  40455. } else {
  40456. // ( types, data, fn )
  40457. fn = data;
  40458. data = selector;
  40459. selector = undefined;
  40460. }
  40461. }
  40462. if (fn === false) {
  40463. fn = returnFalse;
  40464. } else if (!fn) {
  40465. return elem;
  40466. }
  40467. if (one === 1) {
  40468. origFn = fn;
  40469. fn = function fn(event) {
  40470. // Can use an empty set, since event contains the info
  40471. jQuery().off(event);
  40472. return origFn.apply(this, arguments);
  40473. };
  40474. // Use same guid so caller can remove using origFn
  40475. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40476. }
  40477. return elem.each(function () {
  40478. jQuery.event.add(this, types, fn, data, selector);
  40479. });
  40480. }
  40481. /*
  40482. * Helper functions for managing events -- not part of the public interface.
  40483. * Props to Dean Edwards' addEvent library for many of the ideas.
  40484. */
  40485. jQuery.event = {
  40486. global: {},
  40487. add: function add(elem, types, handler, data, selector) {
  40488. var handleObjIn,
  40489. eventHandle,
  40490. tmp,
  40491. events,
  40492. t,
  40493. handleObj,
  40494. special,
  40495. handlers,
  40496. type,
  40497. namespaces,
  40498. origType,
  40499. elemData = dataPriv.get(elem);
  40500. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40501. if (!elemData) {
  40502. return;
  40503. }
  40504. // Caller can pass in an object of custom data in lieu of the handler
  40505. if (handler.handler) {
  40506. handleObjIn = handler;
  40507. handler = handleObjIn.handler;
  40508. selector = handleObjIn.selector;
  40509. }
  40510. // Ensure that invalid selectors throw exceptions at attach time
  40511. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  40512. if (selector) {
  40513. jQuery.find.matchesSelector(documentElement, selector);
  40514. }
  40515. // Make sure that the handler has a unique ID, used to find/remove it later
  40516. if (!handler.guid) {
  40517. handler.guid = jQuery.guid++;
  40518. }
  40519. // Init the element's event structure and main handler, if this is the first
  40520. if (!(events = elemData.events)) {
  40521. events = elemData.events = {};
  40522. }
  40523. if (!(eventHandle = elemData.handle)) {
  40524. eventHandle = elemData.handle = function (e) {
  40525. // Discard the second event of a jQuery.event.trigger() and
  40526. // when an event is called after a page has unloaded
  40527. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  40528. };
  40529. }
  40530. // Handle multiple events separated by a space
  40531. types = (types || "").match(rnothtmlwhite) || [""];
  40532. t = types.length;
  40533. while (t--) {
  40534. tmp = rtypenamespace.exec(types[t]) || [];
  40535. type = origType = tmp[1];
  40536. namespaces = (tmp[2] || "").split(".").sort();
  40537. // There *must* be a type, no attaching namespace-only handlers
  40538. if (!type) {
  40539. continue;
  40540. }
  40541. // If event changes its type, use the special event handlers for the changed type
  40542. special = jQuery.event.special[type] || {};
  40543. // If selector defined, determine special event api type, otherwise given type
  40544. type = (selector ? special.delegateType : special.bindType) || type;
  40545. // Update special based on newly reset type
  40546. special = jQuery.event.special[type] || {};
  40547. // handleObj is passed to all event handlers
  40548. handleObj = jQuery.extend({
  40549. type: type,
  40550. origType: origType,
  40551. data: data,
  40552. handler: handler,
  40553. guid: handler.guid,
  40554. selector: selector,
  40555. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  40556. namespace: namespaces.join(".")
  40557. }, handleObjIn);
  40558. // Init the event handler queue if we're the first
  40559. if (!(handlers = events[type])) {
  40560. handlers = events[type] = [];
  40561. handlers.delegateCount = 0;
  40562. // Only use addEventListener if the special events handler returns false
  40563. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  40564. if (elem.addEventListener) {
  40565. elem.addEventListener(type, eventHandle);
  40566. }
  40567. }
  40568. }
  40569. if (special.add) {
  40570. special.add.call(elem, handleObj);
  40571. if (!handleObj.handler.guid) {
  40572. handleObj.handler.guid = handler.guid;
  40573. }
  40574. }
  40575. // Add to the element's handler list, delegates in front
  40576. if (selector) {
  40577. handlers.splice(handlers.delegateCount++, 0, handleObj);
  40578. } else {
  40579. handlers.push(handleObj);
  40580. }
  40581. // Keep track of which events have ever been used, for event optimization
  40582. jQuery.event.global[type] = true;
  40583. }
  40584. },
  40585. // Detach an event or set of events from an element
  40586. remove: function remove(elem, types, handler, selector, mappedTypes) {
  40587. var j,
  40588. origCount,
  40589. tmp,
  40590. events,
  40591. t,
  40592. handleObj,
  40593. special,
  40594. handlers,
  40595. type,
  40596. namespaces,
  40597. origType,
  40598. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  40599. if (!elemData || !(events = elemData.events)) {
  40600. return;
  40601. }
  40602. // Once for each type.namespace in types; type may be omitted
  40603. types = (types || "").match(rnothtmlwhite) || [""];
  40604. t = types.length;
  40605. while (t--) {
  40606. tmp = rtypenamespace.exec(types[t]) || [];
  40607. type = origType = tmp[1];
  40608. namespaces = (tmp[2] || "").split(".").sort();
  40609. // Unbind all events (on this namespace, if provided) for the element
  40610. if (!type) {
  40611. for (type in events) {
  40612. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  40613. }
  40614. continue;
  40615. }
  40616. special = jQuery.event.special[type] || {};
  40617. type = (selector ? special.delegateType : special.bindType) || type;
  40618. handlers = events[type] || [];
  40619. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  40620. // Remove matching events
  40621. origCount = j = handlers.length;
  40622. while (j--) {
  40623. handleObj = handlers[j];
  40624. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  40625. handlers.splice(j, 1);
  40626. if (handleObj.selector) {
  40627. handlers.delegateCount--;
  40628. }
  40629. if (special.remove) {
  40630. special.remove.call(elem, handleObj);
  40631. }
  40632. }
  40633. }
  40634. // Remove generic event handler if we removed something and no more handlers exist
  40635. // (avoids potential for endless recursion during removal of special event handlers)
  40636. if (origCount && !handlers.length) {
  40637. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  40638. jQuery.removeEvent(elem, type, elemData.handle);
  40639. }
  40640. delete events[type];
  40641. }
  40642. }
  40643. // Remove data and the expando if it's no longer used
  40644. if (jQuery.isEmptyObject(events)) {
  40645. dataPriv.remove(elem, "handle events");
  40646. }
  40647. },
  40648. dispatch: function dispatch(nativeEvent) {
  40649. // Make a writable jQuery.Event from the native event object
  40650. var event = jQuery.event.fix(nativeEvent);
  40651. var i,
  40652. j,
  40653. ret,
  40654. matched,
  40655. handleObj,
  40656. handlerQueue,
  40657. args = new Array(arguments.length),
  40658. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  40659. special = jQuery.event.special[event.type] || {};
  40660. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  40661. args[0] = event;
  40662. for (i = 1; i < arguments.length; i++) {
  40663. args[i] = arguments[i];
  40664. }
  40665. event.delegateTarget = this;
  40666. // Call the preDispatch hook for the mapped type, and let it bail if desired
  40667. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  40668. return;
  40669. }
  40670. // Determine handlers
  40671. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  40672. // Run delegates first; they may want to stop propagation beneath us
  40673. i = 0;
  40674. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  40675. event.currentTarget = matched.elem;
  40676. j = 0;
  40677. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  40678. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  40679. // a subset or equal to those in the bound event (both can have no namespace).
  40680. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  40681. event.handleObj = handleObj;
  40682. event.data = handleObj.data;
  40683. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  40684. if (ret !== undefined) {
  40685. if ((event.result = ret) === false) {
  40686. event.preventDefault();
  40687. event.stopPropagation();
  40688. }
  40689. }
  40690. }
  40691. }
  40692. }
  40693. // Call the postDispatch hook for the mapped type
  40694. if (special.postDispatch) {
  40695. special.postDispatch.call(this, event);
  40696. }
  40697. return event.result;
  40698. },
  40699. handlers: function handlers(event, _handlers) {
  40700. var i,
  40701. handleObj,
  40702. sel,
  40703. matchedHandlers,
  40704. matchedSelectors,
  40705. handlerQueue = [],
  40706. delegateCount = _handlers.delegateCount,
  40707. cur = event.target;
  40708. // Find delegate handlers
  40709. if (delegateCount &&
  40710. // Support: IE <=9
  40711. // Black-hole SVG <use> instance trees (trac-13180)
  40712. cur.nodeType &&
  40713. // Support: Firefox <=42
  40714. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  40715. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  40716. // Support: IE 11 only
  40717. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  40718. !(event.type === "click" && event.button >= 1)) {
  40719. for (; cur !== this; cur = cur.parentNode || this) {
  40720. // Don't check non-elements (#13208)
  40721. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  40722. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  40723. matchedHandlers = [];
  40724. matchedSelectors = {};
  40725. for (i = 0; i < delegateCount; i++) {
  40726. handleObj = _handlers[i];
  40727. // Don't conflict with Object.prototype properties (#13203)
  40728. sel = handleObj.selector + " ";
  40729. if (matchedSelectors[sel] === undefined) {
  40730. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  40731. }
  40732. if (matchedSelectors[sel]) {
  40733. matchedHandlers.push(handleObj);
  40734. }
  40735. }
  40736. if (matchedHandlers.length) {
  40737. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  40738. }
  40739. }
  40740. }
  40741. }
  40742. // Add the remaining (directly-bound) handlers
  40743. cur = this;
  40744. if (delegateCount < _handlers.length) {
  40745. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  40746. }
  40747. return handlerQueue;
  40748. },
  40749. addProp: function addProp(name, hook) {
  40750. Object.defineProperty(jQuery.Event.prototype, name, {
  40751. enumerable: true,
  40752. configurable: true,
  40753. get: isFunction(hook) ? function () {
  40754. if (this.originalEvent) {
  40755. return hook(this.originalEvent);
  40756. }
  40757. } : function () {
  40758. if (this.originalEvent) {
  40759. return this.originalEvent[name];
  40760. }
  40761. },
  40762. set: function set(value) {
  40763. Object.defineProperty(this, name, {
  40764. enumerable: true,
  40765. configurable: true,
  40766. writable: true,
  40767. value: value
  40768. });
  40769. }
  40770. });
  40771. },
  40772. fix: function fix(originalEvent) {
  40773. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  40774. },
  40775. special: {
  40776. load: {
  40777. // Prevent triggered image.load events from bubbling to window.load
  40778. noBubble: true
  40779. },
  40780. focus: {
  40781. // Fire native event if possible so blur/focus sequence is correct
  40782. trigger: function trigger() {
  40783. if (this !== safeActiveElement() && this.focus) {
  40784. this.focus();
  40785. return false;
  40786. }
  40787. },
  40788. delegateType: "focusin"
  40789. },
  40790. blur: {
  40791. trigger: function trigger() {
  40792. if (this === safeActiveElement() && this.blur) {
  40793. this.blur();
  40794. return false;
  40795. }
  40796. },
  40797. delegateType: "focusout"
  40798. },
  40799. click: {
  40800. // For checkbox, fire native event so checked state will be right
  40801. trigger: function trigger() {
  40802. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  40803. this.click();
  40804. return false;
  40805. }
  40806. },
  40807. // For cross-browser consistency, don't fire native .click() on links
  40808. _default: function _default(event) {
  40809. return nodeName(event.target, "a");
  40810. }
  40811. },
  40812. beforeunload: {
  40813. postDispatch: function postDispatch(event) {
  40814. // Support: Firefox 20+
  40815. // Firefox doesn't alert if the returnValue field is not set.
  40816. if (event.result !== undefined && event.originalEvent) {
  40817. event.originalEvent.returnValue = event.result;
  40818. }
  40819. }
  40820. }
  40821. }
  40822. };
  40823. jQuery.removeEvent = function (elem, type, handle) {
  40824. // This "if" is needed for plain objects
  40825. if (elem.removeEventListener) {
  40826. elem.removeEventListener(type, handle);
  40827. }
  40828. };
  40829. jQuery.Event = function (src, props) {
  40830. // Allow instantiation without the 'new' keyword
  40831. if (!(this instanceof jQuery.Event)) {
  40832. return new jQuery.Event(src, props);
  40833. }
  40834. // Event object
  40835. if (src && src.type) {
  40836. this.originalEvent = src;
  40837. this.type = src.type;
  40838. // Events bubbling up the document may have been marked as prevented
  40839. // by a handler lower down the tree; reflect the correct value.
  40840. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  40841. // Support: Android <=2.3 only
  40842. src.returnValue === false ? returnTrue : returnFalse;
  40843. // Create target properties
  40844. // Support: Safari <=6 - 7 only
  40845. // Target should not be a text node (#504, #13143)
  40846. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  40847. this.currentTarget = src.currentTarget;
  40848. this.relatedTarget = src.relatedTarget;
  40849. // Event type
  40850. } else {
  40851. this.type = src;
  40852. }
  40853. // Put explicitly provided properties onto the event object
  40854. if (props) {
  40855. jQuery.extend(this, props);
  40856. }
  40857. // Create a timestamp if incoming event doesn't have one
  40858. this.timeStamp = src && src.timeStamp || Date.now();
  40859. // Mark it as fixed
  40860. this[jQuery.expando] = true;
  40861. };
  40862. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  40863. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  40864. jQuery.Event.prototype = {
  40865. constructor: jQuery.Event,
  40866. isDefaultPrevented: returnFalse,
  40867. isPropagationStopped: returnFalse,
  40868. isImmediatePropagationStopped: returnFalse,
  40869. isSimulated: false,
  40870. preventDefault: function preventDefault() {
  40871. var e = this.originalEvent;
  40872. this.isDefaultPrevented = returnTrue;
  40873. if (e && !this.isSimulated) {
  40874. e.preventDefault();
  40875. }
  40876. },
  40877. stopPropagation: function stopPropagation() {
  40878. var e = this.originalEvent;
  40879. this.isPropagationStopped = returnTrue;
  40880. if (e && !this.isSimulated) {
  40881. e.stopPropagation();
  40882. }
  40883. },
  40884. stopImmediatePropagation: function stopImmediatePropagation() {
  40885. var e = this.originalEvent;
  40886. this.isImmediatePropagationStopped = returnTrue;
  40887. if (e && !this.isSimulated) {
  40888. e.stopImmediatePropagation();
  40889. }
  40890. this.stopPropagation();
  40891. }
  40892. };
  40893. // Includes all common event props including KeyEvent and MouseEvent specific props
  40894. jQuery.each({
  40895. altKey: true,
  40896. bubbles: true,
  40897. cancelable: true,
  40898. changedTouches: true,
  40899. ctrlKey: true,
  40900. detail: true,
  40901. eventPhase: true,
  40902. metaKey: true,
  40903. pageX: true,
  40904. pageY: true,
  40905. shiftKey: true,
  40906. view: true,
  40907. "char": true,
  40908. charCode: true,
  40909. key: true,
  40910. keyCode: true,
  40911. button: true,
  40912. buttons: true,
  40913. clientX: true,
  40914. clientY: true,
  40915. offsetX: true,
  40916. offsetY: true,
  40917. pointerId: true,
  40918. pointerType: true,
  40919. screenX: true,
  40920. screenY: true,
  40921. targetTouches: true,
  40922. toElement: true,
  40923. touches: true,
  40924. which: function which(event) {
  40925. var button = event.button;
  40926. // Add which for key events
  40927. if (event.which == null && rkeyEvent.test(event.type)) {
  40928. return event.charCode != null ? event.charCode : event.keyCode;
  40929. }
  40930. // Add which for click: 1 === left; 2 === middle; 3 === right
  40931. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  40932. if (button & 1) {
  40933. return 1;
  40934. }
  40935. if (button & 2) {
  40936. return 3;
  40937. }
  40938. if (button & 4) {
  40939. return 2;
  40940. }
  40941. return 0;
  40942. }
  40943. return event.which;
  40944. }
  40945. }, jQuery.event.addProp);
  40946. // Create mouseenter/leave events using mouseover/out and event-time checks
  40947. // so that event delegation works in jQuery.
  40948. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  40949. //
  40950. // Support: Safari 7 only
  40951. // Safari sends mouseenter too often; see:
  40952. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  40953. // for the description of the bug (it existed in older Chrome versions as well).
  40954. jQuery.each({
  40955. mouseenter: "mouseover",
  40956. mouseleave: "mouseout",
  40957. pointerenter: "pointerover",
  40958. pointerleave: "pointerout"
  40959. }, function (orig, fix) {
  40960. jQuery.event.special[orig] = {
  40961. delegateType: fix,
  40962. bindType: fix,
  40963. handle: function handle(event) {
  40964. var ret,
  40965. target = this,
  40966. related = event.relatedTarget,
  40967. handleObj = event.handleObj;
  40968. // For mouseenter/leave call the handler if related is outside the target.
  40969. // NB: No relatedTarget if the mouse left/entered the browser window
  40970. if (!related || related !== target && !jQuery.contains(target, related)) {
  40971. event.type = handleObj.origType;
  40972. ret = handleObj.handler.apply(this, arguments);
  40973. event.type = fix;
  40974. }
  40975. return ret;
  40976. }
  40977. };
  40978. });
  40979. jQuery.fn.extend({
  40980. on: function on(types, selector, data, fn) {
  40981. return _on(this, types, selector, data, fn);
  40982. },
  40983. one: function one(types, selector, data, fn) {
  40984. return _on(this, types, selector, data, fn, 1);
  40985. },
  40986. off: function off(types, selector, fn) {
  40987. var handleObj, type;
  40988. if (types && types.preventDefault && types.handleObj) {
  40989. // ( event ) dispatched jQuery.Event
  40990. handleObj = types.handleObj;
  40991. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  40992. return this;
  40993. }
  40994. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40995. // ( types-object [, selector] )
  40996. for (type in types) {
  40997. this.off(type, selector, types[type]);
  40998. }
  40999. return this;
  41000. }
  41001. if (selector === false || typeof selector === "function") {
  41002. // ( types [, fn] )
  41003. fn = selector;
  41004. selector = undefined;
  41005. }
  41006. if (fn === false) {
  41007. fn = returnFalse;
  41008. }
  41009. return this.each(function () {
  41010. jQuery.event.remove(this, types, fn, selector);
  41011. });
  41012. }
  41013. });
  41014. var
  41015. /* eslint-disable max-len */
  41016. // See https://github.com/eslint/eslint/issues/3229
  41017. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  41018. /* eslint-enable */
  41019. // Support: IE <=10 - 11, Edge 12 - 13 only
  41020. // In IE/Edge using regex groups here causes severe slowdowns.
  41021. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  41022. rnoInnerhtml = /<script|<style|<link/i,
  41023. // checked="checked" or checked
  41024. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  41025. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  41026. // Prefer a tbody over its parent table for containing new rows
  41027. function manipulationTarget(elem, content) {
  41028. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  41029. return jQuery(elem).children("tbody")[0] || elem;
  41030. }
  41031. return elem;
  41032. }
  41033. // Replace/restore the type attribute of script elements for safe DOM manipulation
  41034. function disableScript(elem) {
  41035. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  41036. return elem;
  41037. }
  41038. function restoreScript(elem) {
  41039. if ((elem.type || "").slice(0, 5) === "true/") {
  41040. elem.type = elem.type.slice(5);
  41041. } else {
  41042. elem.removeAttribute("type");
  41043. }
  41044. return elem;
  41045. }
  41046. function cloneCopyEvent(src, dest) {
  41047. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  41048. if (dest.nodeType !== 1) {
  41049. return;
  41050. }
  41051. // 1. Copy private data: events, handlers, etc.
  41052. if (dataPriv.hasData(src)) {
  41053. pdataOld = dataPriv.access(src);
  41054. pdataCur = dataPriv.set(dest, pdataOld);
  41055. events = pdataOld.events;
  41056. if (events) {
  41057. delete pdataCur.handle;
  41058. pdataCur.events = {};
  41059. for (type in events) {
  41060. for (i = 0, l = events[type].length; i < l; i++) {
  41061. jQuery.event.add(dest, type, events[type][i]);
  41062. }
  41063. }
  41064. }
  41065. }
  41066. // 2. Copy user data
  41067. if (dataUser.hasData(src)) {
  41068. udataOld = dataUser.access(src);
  41069. udataCur = jQuery.extend({}, udataOld);
  41070. dataUser.set(dest, udataCur);
  41071. }
  41072. }
  41073. // Fix IE bugs, see support tests
  41074. function fixInput(src, dest) {
  41075. var nodeName = dest.nodeName.toLowerCase();
  41076. // Fails to persist the checked state of a cloned checkbox or radio button.
  41077. if (nodeName === "input" && rcheckableType.test(src.type)) {
  41078. dest.checked = src.checked;
  41079. // Fails to return the selected option to the default selected state when cloning options
  41080. } else if (nodeName === "input" || nodeName === "textarea") {
  41081. dest.defaultValue = src.defaultValue;
  41082. }
  41083. }
  41084. function domManip(collection, args, callback, ignored) {
  41085. // Flatten any nested arrays
  41086. args = concat.apply([], args);
  41087. var fragment,
  41088. first,
  41089. scripts,
  41090. hasScripts,
  41091. node,
  41092. doc,
  41093. i = 0,
  41094. l = collection.length,
  41095. iNoClone = l - 1,
  41096. value = args[0],
  41097. valueIsFunction = isFunction(value);
  41098. // We can't cloneNode fragments that contain checked, in WebKit
  41099. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41100. return collection.each(function (index) {
  41101. var self = collection.eq(index);
  41102. if (valueIsFunction) {
  41103. args[0] = value.call(this, index, self.html());
  41104. }
  41105. domManip(self, args, callback, ignored);
  41106. });
  41107. }
  41108. if (l) {
  41109. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41110. first = fragment.firstChild;
  41111. if (fragment.childNodes.length === 1) {
  41112. fragment = first;
  41113. }
  41114. // Require either new content or an interest in ignored elements to invoke the callback
  41115. if (first || ignored) {
  41116. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41117. hasScripts = scripts.length;
  41118. // Use the original fragment for the last item
  41119. // instead of the first because it can end up
  41120. // being emptied incorrectly in certain situations (#8070).
  41121. for (; i < l; i++) {
  41122. node = fragment;
  41123. if (i !== iNoClone) {
  41124. node = jQuery.clone(node, true, true);
  41125. // Keep references to cloned scripts for later restoration
  41126. if (hasScripts) {
  41127. // Support: Android <=4.0 only, PhantomJS 1 only
  41128. // push.apply(_, arraylike) throws on ancient WebKit
  41129. jQuery.merge(scripts, getAll(node, "script"));
  41130. }
  41131. }
  41132. callback.call(collection[i], node, i);
  41133. }
  41134. if (hasScripts) {
  41135. doc = scripts[scripts.length - 1].ownerDocument;
  41136. // Reenable scripts
  41137. jQuery.map(scripts, restoreScript);
  41138. // Evaluate executable scripts on first document insertion
  41139. for (i = 0; i < hasScripts; i++) {
  41140. node = scripts[i];
  41141. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41142. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41143. // Optional AJAX dependency, but won't run scripts if not present
  41144. if (jQuery._evalUrl) {
  41145. jQuery._evalUrl(node.src);
  41146. }
  41147. } else {
  41148. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41149. }
  41150. }
  41151. }
  41152. }
  41153. }
  41154. }
  41155. return collection;
  41156. }
  41157. function _remove(elem, selector, keepData) {
  41158. var node,
  41159. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41160. i = 0;
  41161. for (; (node = nodes[i]) != null; i++) {
  41162. if (!keepData && node.nodeType === 1) {
  41163. jQuery.cleanData(getAll(node));
  41164. }
  41165. if (node.parentNode) {
  41166. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41167. setGlobalEval(getAll(node, "script"));
  41168. }
  41169. node.parentNode.removeChild(node);
  41170. }
  41171. }
  41172. return elem;
  41173. }
  41174. jQuery.extend({
  41175. htmlPrefilter: function htmlPrefilter(html) {
  41176. return html.replace(rxhtmlTag, "<$1></$2>");
  41177. },
  41178. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41179. var i,
  41180. l,
  41181. srcElements,
  41182. destElements,
  41183. clone = elem.cloneNode(true),
  41184. inPage = jQuery.contains(elem.ownerDocument, elem);
  41185. // Fix IE cloning issues
  41186. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41187. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41188. destElements = getAll(clone);
  41189. srcElements = getAll(elem);
  41190. for (i = 0, l = srcElements.length; i < l; i++) {
  41191. fixInput(srcElements[i], destElements[i]);
  41192. }
  41193. }
  41194. // Copy the events from the original to the clone
  41195. if (dataAndEvents) {
  41196. if (deepDataAndEvents) {
  41197. srcElements = srcElements || getAll(elem);
  41198. destElements = destElements || getAll(clone);
  41199. for (i = 0, l = srcElements.length; i < l; i++) {
  41200. cloneCopyEvent(srcElements[i], destElements[i]);
  41201. }
  41202. } else {
  41203. cloneCopyEvent(elem, clone);
  41204. }
  41205. }
  41206. // Preserve script evaluation history
  41207. destElements = getAll(clone, "script");
  41208. if (destElements.length > 0) {
  41209. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41210. }
  41211. // Return the cloned set
  41212. return clone;
  41213. },
  41214. cleanData: function cleanData(elems) {
  41215. var data,
  41216. elem,
  41217. type,
  41218. special = jQuery.event.special,
  41219. i = 0;
  41220. for (; (elem = elems[i]) !== undefined; i++) {
  41221. if (acceptData(elem)) {
  41222. if (data = elem[dataPriv.expando]) {
  41223. if (data.events) {
  41224. for (type in data.events) {
  41225. if (special[type]) {
  41226. jQuery.event.remove(elem, type);
  41227. // This is a shortcut to avoid jQuery.event.remove's overhead
  41228. } else {
  41229. jQuery.removeEvent(elem, type, data.handle);
  41230. }
  41231. }
  41232. }
  41233. // Support: Chrome <=35 - 45+
  41234. // Assign undefined instead of using delete, see Data#remove
  41235. elem[dataPriv.expando] = undefined;
  41236. }
  41237. if (elem[dataUser.expando]) {
  41238. // Support: Chrome <=35 - 45+
  41239. // Assign undefined instead of using delete, see Data#remove
  41240. elem[dataUser.expando] = undefined;
  41241. }
  41242. }
  41243. }
  41244. }
  41245. });
  41246. jQuery.fn.extend({
  41247. detach: function detach(selector) {
  41248. return _remove(this, selector, true);
  41249. },
  41250. remove: function remove(selector) {
  41251. return _remove(this, selector);
  41252. },
  41253. text: function text(value) {
  41254. return access(this, function (value) {
  41255. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41256. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41257. this.textContent = value;
  41258. }
  41259. });
  41260. }, null, value, arguments.length);
  41261. },
  41262. append: function append() {
  41263. return domManip(this, arguments, function (elem) {
  41264. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41265. var target = manipulationTarget(this, elem);
  41266. target.appendChild(elem);
  41267. }
  41268. });
  41269. },
  41270. prepend: function prepend() {
  41271. return domManip(this, arguments, function (elem) {
  41272. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41273. var target = manipulationTarget(this, elem);
  41274. target.insertBefore(elem, target.firstChild);
  41275. }
  41276. });
  41277. },
  41278. before: function before() {
  41279. return domManip(this, arguments, function (elem) {
  41280. if (this.parentNode) {
  41281. this.parentNode.insertBefore(elem, this);
  41282. }
  41283. });
  41284. },
  41285. after: function after() {
  41286. return domManip(this, arguments, function (elem) {
  41287. if (this.parentNode) {
  41288. this.parentNode.insertBefore(elem, this.nextSibling);
  41289. }
  41290. });
  41291. },
  41292. empty: function empty() {
  41293. var elem,
  41294. i = 0;
  41295. for (; (elem = this[i]) != null; i++) {
  41296. if (elem.nodeType === 1) {
  41297. // Prevent memory leaks
  41298. jQuery.cleanData(getAll(elem, false));
  41299. // Remove any remaining nodes
  41300. elem.textContent = "";
  41301. }
  41302. }
  41303. return this;
  41304. },
  41305. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41306. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41307. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41308. return this.map(function () {
  41309. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41310. });
  41311. },
  41312. html: function html(value) {
  41313. return access(this, function (value) {
  41314. var elem = this[0] || {},
  41315. i = 0,
  41316. l = this.length;
  41317. if (value === undefined && elem.nodeType === 1) {
  41318. return elem.innerHTML;
  41319. }
  41320. // See if we can take a shortcut and just use innerHTML
  41321. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41322. value = jQuery.htmlPrefilter(value);
  41323. try {
  41324. for (; i < l; i++) {
  41325. elem = this[i] || {};
  41326. // Remove element nodes and prevent memory leaks
  41327. if (elem.nodeType === 1) {
  41328. jQuery.cleanData(getAll(elem, false));
  41329. elem.innerHTML = value;
  41330. }
  41331. }
  41332. elem = 0;
  41333. // If using innerHTML throws an exception, use the fallback method
  41334. } catch (e) {}
  41335. }
  41336. if (elem) {
  41337. this.empty().append(value);
  41338. }
  41339. }, null, value, arguments.length);
  41340. },
  41341. replaceWith: function replaceWith() {
  41342. var ignored = [];
  41343. // Make the changes, replacing each non-ignored context element with the new content
  41344. return domManip(this, arguments, function (elem) {
  41345. var parent = this.parentNode;
  41346. if (jQuery.inArray(this, ignored) < 0) {
  41347. jQuery.cleanData(getAll(this));
  41348. if (parent) {
  41349. parent.replaceChild(elem, this);
  41350. }
  41351. }
  41352. // Force callback invocation
  41353. }, ignored);
  41354. }
  41355. });
  41356. jQuery.each({
  41357. appendTo: "append",
  41358. prependTo: "prepend",
  41359. insertBefore: "before",
  41360. insertAfter: "after",
  41361. replaceAll: "replaceWith"
  41362. }, function (name, original) {
  41363. jQuery.fn[name] = function (selector) {
  41364. var elems,
  41365. ret = [],
  41366. insert = jQuery(selector),
  41367. last = insert.length - 1,
  41368. i = 0;
  41369. for (; i <= last; i++) {
  41370. elems = i === last ? this : this.clone(true);
  41371. jQuery(insert[i])[original](elems);
  41372. // Support: Android <=4.0 only, PhantomJS 1 only
  41373. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41374. push.apply(ret, elems.get());
  41375. }
  41376. return this.pushStack(ret);
  41377. };
  41378. });
  41379. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41380. var getStyles = function getStyles(elem) {
  41381. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41382. // IE throws on elements created in popups
  41383. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41384. var view = elem.ownerDocument.defaultView;
  41385. if (!view || !view.opener) {
  41386. view = window;
  41387. }
  41388. return view.getComputedStyle(elem);
  41389. };
  41390. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41391. (function () {
  41392. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41393. // so they're executed at the same time to save the second computation.
  41394. function computeStyleTests() {
  41395. // This is a singleton, we need to execute it only once
  41396. if (!div) {
  41397. return;
  41398. }
  41399. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41400. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41401. documentElement.appendChild(container).appendChild(div);
  41402. var divStyle = window.getComputedStyle(div);
  41403. pixelPositionVal = divStyle.top !== "1%";
  41404. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41405. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41406. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41407. // Some styles come back with percentage values, even though they shouldn't
  41408. div.style.right = "60%";
  41409. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41410. // Support: IE 9 - 11 only
  41411. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41412. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41413. // Support: IE 9 only
  41414. // Detect overflow:scroll screwiness (gh-3699)
  41415. div.style.position = "absolute";
  41416. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41417. documentElement.removeChild(container);
  41418. // Nullify the div so it wouldn't be stored in the memory and
  41419. // it will also be a sign that checks already performed
  41420. div = null;
  41421. }
  41422. function roundPixelMeasures(measure) {
  41423. return Math.round(parseFloat(measure));
  41424. }
  41425. var pixelPositionVal,
  41426. boxSizingReliableVal,
  41427. scrollboxSizeVal,
  41428. pixelBoxStylesVal,
  41429. reliableMarginLeftVal,
  41430. container = document.createElement("div"),
  41431. div = document.createElement("div");
  41432. // Finish early in limited (non-browser) environments
  41433. if (!div.style) {
  41434. return;
  41435. }
  41436. // Support: IE <=9 - 11 only
  41437. // Style of cloned element affects source element cloned (#8908)
  41438. div.style.backgroundClip = "content-box";
  41439. div.cloneNode(true).style.backgroundClip = "";
  41440. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41441. jQuery.extend(support, {
  41442. boxSizingReliable: function boxSizingReliable() {
  41443. computeStyleTests();
  41444. return boxSizingReliableVal;
  41445. },
  41446. pixelBoxStyles: function pixelBoxStyles() {
  41447. computeStyleTests();
  41448. return pixelBoxStylesVal;
  41449. },
  41450. pixelPosition: function pixelPosition() {
  41451. computeStyleTests();
  41452. return pixelPositionVal;
  41453. },
  41454. reliableMarginLeft: function reliableMarginLeft() {
  41455. computeStyleTests();
  41456. return reliableMarginLeftVal;
  41457. },
  41458. scrollboxSize: function scrollboxSize() {
  41459. computeStyleTests();
  41460. return scrollboxSizeVal;
  41461. }
  41462. });
  41463. })();
  41464. function curCSS(elem, name, computed) {
  41465. var width,
  41466. minWidth,
  41467. maxWidth,
  41468. ret,
  41469. // Support: Firefox 51+
  41470. // Retrieving style before computed somehow
  41471. // fixes an issue with getting wrong values
  41472. // on detached elements
  41473. style = elem.style;
  41474. computed = computed || getStyles(elem);
  41475. // getPropertyValue is needed for:
  41476. // .css('filter') (IE 9 only, #12537)
  41477. // .css('--customProperty) (#3144)
  41478. if (computed) {
  41479. ret = computed.getPropertyValue(name) || computed[name];
  41480. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41481. ret = jQuery.style(elem, name);
  41482. }
  41483. // A tribute to the "awesome hack by Dean Edwards"
  41484. // Android Browser returns percentage for some values,
  41485. // but width seems to be reliably pixels.
  41486. // This is against the CSSOM draft spec:
  41487. // https://drafts.csswg.org/cssom/#resolved-values
  41488. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41489. // Remember the original values
  41490. width = style.width;
  41491. minWidth = style.minWidth;
  41492. maxWidth = style.maxWidth;
  41493. // Put in the new values to get a computed value out
  41494. style.minWidth = style.maxWidth = style.width = ret;
  41495. ret = computed.width;
  41496. // Revert the changed values
  41497. style.width = width;
  41498. style.minWidth = minWidth;
  41499. style.maxWidth = maxWidth;
  41500. }
  41501. }
  41502. return ret !== undefined ?
  41503. // Support: IE <=9 - 11 only
  41504. // IE returns zIndex value as an integer.
  41505. ret + "" : ret;
  41506. }
  41507. function addGetHookIf(conditionFn, hookFn) {
  41508. // Define the hook, we'll check on the first run if it's really needed.
  41509. return {
  41510. get: function get() {
  41511. if (conditionFn()) {
  41512. // Hook not needed (or it's not possible to use it due
  41513. // to missing dependency), remove it.
  41514. delete this.get;
  41515. return;
  41516. }
  41517. // Hook needed; redefine it so that the support test is not executed again.
  41518. return (this.get = hookFn).apply(this, arguments);
  41519. }
  41520. };
  41521. }
  41522. var
  41523. // Swappable if display is none or starts with table
  41524. // except "table", "table-cell", or "table-caption"
  41525. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  41526. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  41527. rcustomProp = /^--/,
  41528. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  41529. cssNormalTransform = {
  41530. letterSpacing: "0",
  41531. fontWeight: "400"
  41532. },
  41533. cssPrefixes = ["Webkit", "Moz", "ms"],
  41534. emptyStyle = document.createElement("div").style;
  41535. // Return a css property mapped to a potentially vendor prefixed property
  41536. function vendorPropName(name) {
  41537. // Shortcut for names that are not vendor prefixed
  41538. if (name in emptyStyle) {
  41539. return name;
  41540. }
  41541. // Check for vendor prefixed names
  41542. var capName = name[0].toUpperCase() + name.slice(1),
  41543. i = cssPrefixes.length;
  41544. while (i--) {
  41545. name = cssPrefixes[i] + capName;
  41546. if (name in emptyStyle) {
  41547. return name;
  41548. }
  41549. }
  41550. }
  41551. // Return a property mapped along what jQuery.cssProps suggests or to
  41552. // a vendor prefixed property.
  41553. function finalPropName(name) {
  41554. var ret = jQuery.cssProps[name];
  41555. if (!ret) {
  41556. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  41557. }
  41558. return ret;
  41559. }
  41560. function setPositiveNumber(elem, value, subtract) {
  41561. // Any relative (+/-) values have already been
  41562. // normalized at this point
  41563. var matches = rcssNum.exec(value);
  41564. return matches ?
  41565. // Guard against undefined "subtract", e.g., when used as in cssHooks
  41566. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  41567. }
  41568. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  41569. var i = dimension === "width" ? 1 : 0,
  41570. extra = 0,
  41571. delta = 0;
  41572. // Adjustment may not be necessary
  41573. if (box === (isBorderBox ? "border" : "content")) {
  41574. return 0;
  41575. }
  41576. for (; i < 4; i += 2) {
  41577. // Both box models exclude margin
  41578. if (box === "margin") {
  41579. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  41580. }
  41581. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  41582. if (!isBorderBox) {
  41583. // Add padding
  41584. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41585. // For "border" or "margin", add border
  41586. if (box !== "padding") {
  41587. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41588. // But still keep track of it otherwise
  41589. } else {
  41590. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41591. }
  41592. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  41593. // "padding" or "margin"
  41594. } else {
  41595. // For "content", subtract padding
  41596. if (box === "content") {
  41597. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41598. }
  41599. // For "content" or "padding", subtract border
  41600. if (box !== "margin") {
  41601. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41602. }
  41603. }
  41604. }
  41605. // Account for positive content-box scroll gutter when requested by providing computedVal
  41606. if (!isBorderBox && computedVal >= 0) {
  41607. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  41608. // Assuming integer scroll gutter, subtract the rest and round down
  41609. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  41610. }
  41611. return delta;
  41612. }
  41613. function getWidthOrHeight(elem, dimension, extra) {
  41614. // Start with computed style
  41615. var styles = getStyles(elem),
  41616. val = curCSS(elem, dimension, styles),
  41617. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41618. valueIsBorderBox = isBorderBox;
  41619. // Support: Firefox <=54
  41620. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  41621. if (rnumnonpx.test(val)) {
  41622. if (!extra) {
  41623. return val;
  41624. }
  41625. val = "auto";
  41626. }
  41627. // Check for style in case a browser which returns unreliable values
  41628. // for getComputedStyle silently falls back to the reliable elem.style
  41629. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  41630. // Fall back to offsetWidth/offsetHeight when value is "auto"
  41631. // This happens for inline elements with no explicit setting (gh-3571)
  41632. // Support: Android <=4.1 - 4.3 only
  41633. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  41634. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  41635. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  41636. // offsetWidth/offsetHeight provide border-box values
  41637. valueIsBorderBox = true;
  41638. }
  41639. // Normalize "" and auto
  41640. val = parseFloat(val) || 0;
  41641. // Adjust for the element's box model
  41642. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  41643. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  41644. val) + "px";
  41645. }
  41646. jQuery.extend({
  41647. // Add in style property hooks for overriding the default
  41648. // behavior of getting and setting a style property
  41649. cssHooks: {
  41650. opacity: {
  41651. get: function get(elem, computed) {
  41652. if (computed) {
  41653. // We should always get a number back from opacity
  41654. var ret = curCSS(elem, "opacity");
  41655. return ret === "" ? "1" : ret;
  41656. }
  41657. }
  41658. }
  41659. },
  41660. // Don't automatically add "px" to these possibly-unitless properties
  41661. cssNumber: {
  41662. "animationIterationCount": true,
  41663. "columnCount": true,
  41664. "fillOpacity": true,
  41665. "flexGrow": true,
  41666. "flexShrink": true,
  41667. "fontWeight": true,
  41668. "lineHeight": true,
  41669. "opacity": true,
  41670. "order": true,
  41671. "orphans": true,
  41672. "widows": true,
  41673. "zIndex": true,
  41674. "zoom": true
  41675. },
  41676. // Add in properties whose names you wish to fix before
  41677. // setting or getting the value
  41678. cssProps: {},
  41679. // Get and set the style property on a DOM Node
  41680. style: function style(elem, name, value, extra) {
  41681. // Don't set styles on text and comment nodes
  41682. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  41683. return;
  41684. }
  41685. // Make sure that we're working with the right name
  41686. var ret,
  41687. type,
  41688. hooks,
  41689. origName = camelCase(name),
  41690. isCustomProp = rcustomProp.test(name),
  41691. style = elem.style;
  41692. // Make sure that we're working with the right name. We don't
  41693. // want to query the value if it is a CSS custom property
  41694. // since they are user-defined.
  41695. if (!isCustomProp) {
  41696. name = finalPropName(origName);
  41697. }
  41698. // Gets hook for the prefixed version, then unprefixed version
  41699. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41700. // Check if we're setting a value
  41701. if (value !== undefined) {
  41702. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  41703. // Convert "+=" or "-=" to relative numbers (#7345)
  41704. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  41705. value = adjustCSS(elem, name, ret);
  41706. // Fixes bug #9237
  41707. type = "number";
  41708. }
  41709. // Make sure that null and NaN values aren't set (#7116)
  41710. if (value == null || value !== value) {
  41711. return;
  41712. }
  41713. // If a number was passed in, add the unit (except for certain CSS properties)
  41714. if (type === "number") {
  41715. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  41716. }
  41717. // background-* props affect original clone's values
  41718. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  41719. style[name] = "inherit";
  41720. }
  41721. // If a hook was provided, use that value, otherwise just set the specified value
  41722. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  41723. if (isCustomProp) {
  41724. style.setProperty(name, value);
  41725. } else {
  41726. style[name] = value;
  41727. }
  41728. }
  41729. } else {
  41730. // If a hook was provided get the non-computed value from there
  41731. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  41732. return ret;
  41733. }
  41734. // Otherwise just get the value from the style object
  41735. return style[name];
  41736. }
  41737. },
  41738. css: function css(elem, name, extra, styles) {
  41739. var val,
  41740. num,
  41741. hooks,
  41742. origName = camelCase(name),
  41743. isCustomProp = rcustomProp.test(name);
  41744. // Make sure that we're working with the right name. We don't
  41745. // want to modify the value if it is a CSS custom property
  41746. // since they are user-defined.
  41747. if (!isCustomProp) {
  41748. name = finalPropName(origName);
  41749. }
  41750. // Try prefixed name followed by the unprefixed name
  41751. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41752. // If a hook was provided get the computed value from there
  41753. if (hooks && "get" in hooks) {
  41754. val = hooks.get(elem, true, extra);
  41755. }
  41756. // Otherwise, if a way to get the computed value exists, use that
  41757. if (val === undefined) {
  41758. val = curCSS(elem, name, styles);
  41759. }
  41760. // Convert "normal" to computed value
  41761. if (val === "normal" && name in cssNormalTransform) {
  41762. val = cssNormalTransform[name];
  41763. }
  41764. // Make numeric if forced or a qualifier was provided and val looks numeric
  41765. if (extra === "" || extra) {
  41766. num = parseFloat(val);
  41767. return extra === true || isFinite(num) ? num || 0 : val;
  41768. }
  41769. return val;
  41770. }
  41771. });
  41772. jQuery.each(["height", "width"], function (i, dimension) {
  41773. jQuery.cssHooks[dimension] = {
  41774. get: function get(elem, computed, extra) {
  41775. if (computed) {
  41776. // Certain elements can have dimension info if we invisibly show them
  41777. // but it must have a current display style that would benefit
  41778. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  41779. // Support: Safari 8+
  41780. // Table columns in Safari have non-zero offsetWidth & zero
  41781. // getBoundingClientRect().width unless display is changed.
  41782. // Support: IE <=11 only
  41783. // Running getBoundingClientRect on a disconnected node
  41784. // in IE throws an error.
  41785. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  41786. return getWidthOrHeight(elem, dimension, extra);
  41787. }) : getWidthOrHeight(elem, dimension, extra);
  41788. }
  41789. },
  41790. set: function set(elem, value, extra) {
  41791. var matches,
  41792. styles = getStyles(elem),
  41793. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41794. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  41795. // Account for unreliable border-box dimensions by comparing offset* to computed and
  41796. // faking a content-box to get border and padding (gh-3699)
  41797. if (isBorderBox && support.scrollboxSize() === styles.position) {
  41798. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  41799. }
  41800. // Convert to pixels if value adjustment is needed
  41801. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  41802. elem.style[dimension] = value;
  41803. value = jQuery.css(elem, dimension);
  41804. }
  41805. return setPositiveNumber(elem, value, subtract);
  41806. }
  41807. };
  41808. });
  41809. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  41810. if (computed) {
  41811. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  41812. return elem.getBoundingClientRect().left;
  41813. })) + "px";
  41814. }
  41815. });
  41816. // These hooks are used by animate to expand properties
  41817. jQuery.each({
  41818. margin: "",
  41819. padding: "",
  41820. border: "Width"
  41821. }, function (prefix, suffix) {
  41822. jQuery.cssHooks[prefix + suffix] = {
  41823. expand: function expand(value) {
  41824. var i = 0,
  41825. expanded = {},
  41826. // Assumes a single number if not a string
  41827. parts = typeof value === "string" ? value.split(" ") : [value];
  41828. for (; i < 4; i++) {
  41829. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  41830. }
  41831. return expanded;
  41832. }
  41833. };
  41834. if (prefix !== "margin") {
  41835. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  41836. }
  41837. });
  41838. jQuery.fn.extend({
  41839. css: function css(name, value) {
  41840. return access(this, function (elem, name, value) {
  41841. var styles,
  41842. len,
  41843. map = {},
  41844. i = 0;
  41845. if (Array.isArray(name)) {
  41846. styles = getStyles(elem);
  41847. len = name.length;
  41848. for (; i < len; i++) {
  41849. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  41850. }
  41851. return map;
  41852. }
  41853. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  41854. }, name, value, arguments.length > 1);
  41855. }
  41856. });
  41857. function Tween(elem, options, prop, end, easing) {
  41858. return new Tween.prototype.init(elem, options, prop, end, easing);
  41859. }
  41860. jQuery.Tween = Tween;
  41861. Tween.prototype = {
  41862. constructor: Tween,
  41863. init: function init(elem, options, prop, end, easing, unit) {
  41864. this.elem = elem;
  41865. this.prop = prop;
  41866. this.easing = easing || jQuery.easing._default;
  41867. this.options = options;
  41868. this.start = this.now = this.cur();
  41869. this.end = end;
  41870. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  41871. },
  41872. cur: function cur() {
  41873. var hooks = Tween.propHooks[this.prop];
  41874. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  41875. },
  41876. run: function run(percent) {
  41877. var eased,
  41878. hooks = Tween.propHooks[this.prop];
  41879. if (this.options.duration) {
  41880. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  41881. } else {
  41882. this.pos = eased = percent;
  41883. }
  41884. this.now = (this.end - this.start) * eased + this.start;
  41885. if (this.options.step) {
  41886. this.options.step.call(this.elem, this.now, this);
  41887. }
  41888. if (hooks && hooks.set) {
  41889. hooks.set(this);
  41890. } else {
  41891. Tween.propHooks._default.set(this);
  41892. }
  41893. return this;
  41894. }
  41895. };
  41896. Tween.prototype.init.prototype = Tween.prototype;
  41897. Tween.propHooks = {
  41898. _default: {
  41899. get: function get(tween) {
  41900. var result;
  41901. // Use a property on the element directly when it is not a DOM element,
  41902. // or when there is no matching style property that exists.
  41903. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  41904. return tween.elem[tween.prop];
  41905. }
  41906. // Passing an empty string as a 3rd parameter to .css will automatically
  41907. // attempt a parseFloat and fallback to a string if the parse fails.
  41908. // Simple values such as "10px" are parsed to Float;
  41909. // complex values such as "rotate(1rad)" are returned as-is.
  41910. result = jQuery.css(tween.elem, tween.prop, "");
  41911. // Empty strings, null, undefined and "auto" are converted to 0.
  41912. return !result || result === "auto" ? 0 : result;
  41913. },
  41914. set: function set(tween) {
  41915. // Use step hook for back compat.
  41916. // Use cssHook if its there.
  41917. // Use .style if available and use plain properties where available.
  41918. if (jQuery.fx.step[tween.prop]) {
  41919. jQuery.fx.step[tween.prop](tween);
  41920. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  41921. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  41922. } else {
  41923. tween.elem[tween.prop] = tween.now;
  41924. }
  41925. }
  41926. }
  41927. };
  41928. // Support: IE <=9 only
  41929. // Panic based approach to setting things on disconnected nodes
  41930. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  41931. set: function set(tween) {
  41932. if (tween.elem.nodeType && tween.elem.parentNode) {
  41933. tween.elem[tween.prop] = tween.now;
  41934. }
  41935. }
  41936. };
  41937. jQuery.easing = {
  41938. linear: function linear(p) {
  41939. return p;
  41940. },
  41941. swing: function swing(p) {
  41942. return 0.5 - Math.cos(p * Math.PI) / 2;
  41943. },
  41944. _default: "swing"
  41945. };
  41946. jQuery.fx = Tween.prototype.init;
  41947. // Back compat <1.8 extension point
  41948. jQuery.fx.step = {};
  41949. var fxNow,
  41950. inProgress,
  41951. rfxtypes = /^(?:toggle|show|hide)$/,
  41952. rrun = /queueHooks$/;
  41953. function schedule() {
  41954. if (inProgress) {
  41955. if (document.hidden === false && window.requestAnimationFrame) {
  41956. window.requestAnimationFrame(schedule);
  41957. } else {
  41958. window.setTimeout(schedule, jQuery.fx.interval);
  41959. }
  41960. jQuery.fx.tick();
  41961. }
  41962. }
  41963. // Animations created synchronously will run synchronously
  41964. function createFxNow() {
  41965. window.setTimeout(function () {
  41966. fxNow = undefined;
  41967. });
  41968. return fxNow = Date.now();
  41969. }
  41970. // Generate parameters to create a standard animation
  41971. function genFx(type, includeWidth) {
  41972. var which,
  41973. i = 0,
  41974. attrs = { height: type };
  41975. // If we include width, step value is 1 to do all cssExpand values,
  41976. // otherwise step value is 2 to skip over Left and Right
  41977. includeWidth = includeWidth ? 1 : 0;
  41978. for (; i < 4; i += 2 - includeWidth) {
  41979. which = cssExpand[i];
  41980. attrs["margin" + which] = attrs["padding" + which] = type;
  41981. }
  41982. if (includeWidth) {
  41983. attrs.opacity = attrs.width = type;
  41984. }
  41985. return attrs;
  41986. }
  41987. function createTween(value, prop, animation) {
  41988. var tween,
  41989. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  41990. index = 0,
  41991. length = collection.length;
  41992. for (; index < length; index++) {
  41993. if (tween = collection[index].call(animation, prop, value)) {
  41994. // We're done with this property
  41995. return tween;
  41996. }
  41997. }
  41998. }
  41999. function defaultPrefilter(elem, props, opts) {
  42000. var prop,
  42001. value,
  42002. toggle,
  42003. hooks,
  42004. oldfire,
  42005. propTween,
  42006. restoreDisplay,
  42007. display,
  42008. isBox = "width" in props || "height" in props,
  42009. anim = this,
  42010. orig = {},
  42011. style = elem.style,
  42012. hidden = elem.nodeType && isHiddenWithinTree(elem),
  42013. dataShow = dataPriv.get(elem, "fxshow");
  42014. // Queue-skipping animations hijack the fx hooks
  42015. if (!opts.queue) {
  42016. hooks = jQuery._queueHooks(elem, "fx");
  42017. if (hooks.unqueued == null) {
  42018. hooks.unqueued = 0;
  42019. oldfire = hooks.empty.fire;
  42020. hooks.empty.fire = function () {
  42021. if (!hooks.unqueued) {
  42022. oldfire();
  42023. }
  42024. };
  42025. }
  42026. hooks.unqueued++;
  42027. anim.always(function () {
  42028. // Ensure the complete handler is called before this completes
  42029. anim.always(function () {
  42030. hooks.unqueued--;
  42031. if (!jQuery.queue(elem, "fx").length) {
  42032. hooks.empty.fire();
  42033. }
  42034. });
  42035. });
  42036. }
  42037. // Detect show/hide animations
  42038. for (prop in props) {
  42039. value = props[prop];
  42040. if (rfxtypes.test(value)) {
  42041. delete props[prop];
  42042. toggle = toggle || value === "toggle";
  42043. if (value === (hidden ? "hide" : "show")) {
  42044. // Pretend to be hidden if this is a "show" and
  42045. // there is still data from a stopped show/hide
  42046. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  42047. hidden = true;
  42048. // Ignore all other no-op show/hide data
  42049. } else {
  42050. continue;
  42051. }
  42052. }
  42053. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  42054. }
  42055. }
  42056. // Bail out if this is a no-op like .hide().hide()
  42057. propTween = !jQuery.isEmptyObject(props);
  42058. if (!propTween && jQuery.isEmptyObject(orig)) {
  42059. return;
  42060. }
  42061. // Restrict "overflow" and "display" styles during box animations
  42062. if (isBox && elem.nodeType === 1) {
  42063. // Support: IE <=9 - 11, Edge 12 - 15
  42064. // Record all 3 overflow attributes because IE does not infer the shorthand
  42065. // from identically-valued overflowX and overflowY and Edge just mirrors
  42066. // the overflowX value there.
  42067. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  42068. // Identify a display type, preferring old show/hide data over the CSS cascade
  42069. restoreDisplay = dataShow && dataShow.display;
  42070. if (restoreDisplay == null) {
  42071. restoreDisplay = dataPriv.get(elem, "display");
  42072. }
  42073. display = jQuery.css(elem, "display");
  42074. if (display === "none") {
  42075. if (restoreDisplay) {
  42076. display = restoreDisplay;
  42077. } else {
  42078. // Get nonempty value(s) by temporarily forcing visibility
  42079. showHide([elem], true);
  42080. restoreDisplay = elem.style.display || restoreDisplay;
  42081. display = jQuery.css(elem, "display");
  42082. showHide([elem]);
  42083. }
  42084. }
  42085. // Animate inline elements as inline-block
  42086. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  42087. if (jQuery.css(elem, "float") === "none") {
  42088. // Restore the original display value at the end of pure show/hide animations
  42089. if (!propTween) {
  42090. anim.done(function () {
  42091. style.display = restoreDisplay;
  42092. });
  42093. if (restoreDisplay == null) {
  42094. display = style.display;
  42095. restoreDisplay = display === "none" ? "" : display;
  42096. }
  42097. }
  42098. style.display = "inline-block";
  42099. }
  42100. }
  42101. }
  42102. if (opts.overflow) {
  42103. style.overflow = "hidden";
  42104. anim.always(function () {
  42105. style.overflow = opts.overflow[0];
  42106. style.overflowX = opts.overflow[1];
  42107. style.overflowY = opts.overflow[2];
  42108. });
  42109. }
  42110. // Implement show/hide animations
  42111. propTween = false;
  42112. for (prop in orig) {
  42113. // General show/hide setup for this element animation
  42114. if (!propTween) {
  42115. if (dataShow) {
  42116. if ("hidden" in dataShow) {
  42117. hidden = dataShow.hidden;
  42118. }
  42119. } else {
  42120. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42121. }
  42122. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42123. if (toggle) {
  42124. dataShow.hidden = !hidden;
  42125. }
  42126. // Show elements before animating them
  42127. if (hidden) {
  42128. showHide([elem], true);
  42129. }
  42130. /* eslint-disable no-loop-func */
  42131. anim.done(function () {
  42132. /* eslint-enable no-loop-func */
  42133. // The final step of a "hide" animation is actually hiding the element
  42134. if (!hidden) {
  42135. showHide([elem]);
  42136. }
  42137. dataPriv.remove(elem, "fxshow");
  42138. for (prop in orig) {
  42139. jQuery.style(elem, prop, orig[prop]);
  42140. }
  42141. });
  42142. }
  42143. // Per-property setup
  42144. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42145. if (!(prop in dataShow)) {
  42146. dataShow[prop] = propTween.start;
  42147. if (hidden) {
  42148. propTween.end = propTween.start;
  42149. propTween.start = 0;
  42150. }
  42151. }
  42152. }
  42153. }
  42154. function propFilter(props, specialEasing) {
  42155. var index, name, easing, value, hooks;
  42156. // camelCase, specialEasing and expand cssHook pass
  42157. for (index in props) {
  42158. name = camelCase(index);
  42159. easing = specialEasing[name];
  42160. value = props[index];
  42161. if (Array.isArray(value)) {
  42162. easing = value[1];
  42163. value = props[index] = value[0];
  42164. }
  42165. if (index !== name) {
  42166. props[name] = value;
  42167. delete props[index];
  42168. }
  42169. hooks = jQuery.cssHooks[name];
  42170. if (hooks && "expand" in hooks) {
  42171. value = hooks.expand(value);
  42172. delete props[name];
  42173. // Not quite $.extend, this won't overwrite existing keys.
  42174. // Reusing 'index' because we have the correct "name"
  42175. for (index in value) {
  42176. if (!(index in props)) {
  42177. props[index] = value[index];
  42178. specialEasing[index] = easing;
  42179. }
  42180. }
  42181. } else {
  42182. specialEasing[name] = easing;
  42183. }
  42184. }
  42185. }
  42186. function Animation(elem, properties, options) {
  42187. var result,
  42188. stopped,
  42189. index = 0,
  42190. length = Animation.prefilters.length,
  42191. deferred = jQuery.Deferred().always(function () {
  42192. // Don't match elem in the :animated selector
  42193. delete tick.elem;
  42194. }),
  42195. tick = function tick() {
  42196. if (stopped) {
  42197. return false;
  42198. }
  42199. var currentTime = fxNow || createFxNow(),
  42200. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42201. // Support: Android 2.3 only
  42202. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42203. temp = remaining / animation.duration || 0,
  42204. percent = 1 - temp,
  42205. index = 0,
  42206. length = animation.tweens.length;
  42207. for (; index < length; index++) {
  42208. animation.tweens[index].run(percent);
  42209. }
  42210. deferred.notifyWith(elem, [animation, percent, remaining]);
  42211. // If there's more to do, yield
  42212. if (percent < 1 && length) {
  42213. return remaining;
  42214. }
  42215. // If this was an empty animation, synthesize a final progress notification
  42216. if (!length) {
  42217. deferred.notifyWith(elem, [animation, 1, 0]);
  42218. }
  42219. // Resolve the animation and report its conclusion
  42220. deferred.resolveWith(elem, [animation]);
  42221. return false;
  42222. },
  42223. animation = deferred.promise({
  42224. elem: elem,
  42225. props: jQuery.extend({}, properties),
  42226. opts: jQuery.extend(true, {
  42227. specialEasing: {},
  42228. easing: jQuery.easing._default
  42229. }, options),
  42230. originalProperties: properties,
  42231. originalOptions: options,
  42232. startTime: fxNow || createFxNow(),
  42233. duration: options.duration,
  42234. tweens: [],
  42235. createTween: function createTween(prop, end) {
  42236. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42237. animation.tweens.push(tween);
  42238. return tween;
  42239. },
  42240. stop: function stop(gotoEnd) {
  42241. var index = 0,
  42242. // If we are going to the end, we want to run all the tweens
  42243. // otherwise we skip this part
  42244. length = gotoEnd ? animation.tweens.length : 0;
  42245. if (stopped) {
  42246. return this;
  42247. }
  42248. stopped = true;
  42249. for (; index < length; index++) {
  42250. animation.tweens[index].run(1);
  42251. }
  42252. // Resolve when we played the last frame; otherwise, reject
  42253. if (gotoEnd) {
  42254. deferred.notifyWith(elem, [animation, 1, 0]);
  42255. deferred.resolveWith(elem, [animation, gotoEnd]);
  42256. } else {
  42257. deferred.rejectWith(elem, [animation, gotoEnd]);
  42258. }
  42259. return this;
  42260. }
  42261. }),
  42262. props = animation.props;
  42263. propFilter(props, animation.opts.specialEasing);
  42264. for (; index < length; index++) {
  42265. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42266. if (result) {
  42267. if (isFunction(result.stop)) {
  42268. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42269. }
  42270. return result;
  42271. }
  42272. }
  42273. jQuery.map(props, createTween, animation);
  42274. if (isFunction(animation.opts.start)) {
  42275. animation.opts.start.call(elem, animation);
  42276. }
  42277. // Attach callbacks from options
  42278. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42279. jQuery.fx.timer(jQuery.extend(tick, {
  42280. elem: elem,
  42281. anim: animation,
  42282. queue: animation.opts.queue
  42283. }));
  42284. return animation;
  42285. }
  42286. jQuery.Animation = jQuery.extend(Animation, {
  42287. tweeners: {
  42288. "*": [function (prop, value) {
  42289. var tween = this.createTween(prop, value);
  42290. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42291. return tween;
  42292. }]
  42293. },
  42294. tweener: function tweener(props, callback) {
  42295. if (isFunction(props)) {
  42296. callback = props;
  42297. props = ["*"];
  42298. } else {
  42299. props = props.match(rnothtmlwhite);
  42300. }
  42301. var prop,
  42302. index = 0,
  42303. length = props.length;
  42304. for (; index < length; index++) {
  42305. prop = props[index];
  42306. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42307. Animation.tweeners[prop].unshift(callback);
  42308. }
  42309. },
  42310. prefilters: [defaultPrefilter],
  42311. prefilter: function prefilter(callback, prepend) {
  42312. if (prepend) {
  42313. Animation.prefilters.unshift(callback);
  42314. } else {
  42315. Animation.prefilters.push(callback);
  42316. }
  42317. }
  42318. });
  42319. jQuery.speed = function (speed, easing, fn) {
  42320. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42321. complete: fn || !fn && easing || isFunction(speed) && speed,
  42322. duration: speed,
  42323. easing: fn && easing || easing && !isFunction(easing) && easing
  42324. };
  42325. // Go to the end state if fx are off
  42326. if (jQuery.fx.off) {
  42327. opt.duration = 0;
  42328. } else {
  42329. if (typeof opt.duration !== "number") {
  42330. if (opt.duration in jQuery.fx.speeds) {
  42331. opt.duration = jQuery.fx.speeds[opt.duration];
  42332. } else {
  42333. opt.duration = jQuery.fx.speeds._default;
  42334. }
  42335. }
  42336. }
  42337. // Normalize opt.queue - true/undefined/null -> "fx"
  42338. if (opt.queue == null || opt.queue === true) {
  42339. opt.queue = "fx";
  42340. }
  42341. // Queueing
  42342. opt.old = opt.complete;
  42343. opt.complete = function () {
  42344. if (isFunction(opt.old)) {
  42345. opt.old.call(this);
  42346. }
  42347. if (opt.queue) {
  42348. jQuery.dequeue(this, opt.queue);
  42349. }
  42350. };
  42351. return opt;
  42352. };
  42353. jQuery.fn.extend({
  42354. fadeTo: function fadeTo(speed, to, easing, callback) {
  42355. // Show any hidden elements after setting opacity to 0
  42356. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42357. // Animate to the value specified
  42358. .end().animate({ opacity: to }, speed, easing, callback);
  42359. },
  42360. animate: function animate(prop, speed, easing, callback) {
  42361. var empty = jQuery.isEmptyObject(prop),
  42362. optall = jQuery.speed(speed, easing, callback),
  42363. doAnimation = function doAnimation() {
  42364. // Operate on a copy of prop so per-property easing won't be lost
  42365. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42366. // Empty animations, or finishing resolves immediately
  42367. if (empty || dataPriv.get(this, "finish")) {
  42368. anim.stop(true);
  42369. }
  42370. };
  42371. doAnimation.finish = doAnimation;
  42372. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42373. },
  42374. stop: function stop(type, clearQueue, gotoEnd) {
  42375. var stopQueue = function stopQueue(hooks) {
  42376. var stop = hooks.stop;
  42377. delete hooks.stop;
  42378. stop(gotoEnd);
  42379. };
  42380. if (typeof type !== "string") {
  42381. gotoEnd = clearQueue;
  42382. clearQueue = type;
  42383. type = undefined;
  42384. }
  42385. if (clearQueue && type !== false) {
  42386. this.queue(type || "fx", []);
  42387. }
  42388. return this.each(function () {
  42389. var dequeue = true,
  42390. index = type != null && type + "queueHooks",
  42391. timers = jQuery.timers,
  42392. data = dataPriv.get(this);
  42393. if (index) {
  42394. if (data[index] && data[index].stop) {
  42395. stopQueue(data[index]);
  42396. }
  42397. } else {
  42398. for (index in data) {
  42399. if (data[index] && data[index].stop && rrun.test(index)) {
  42400. stopQueue(data[index]);
  42401. }
  42402. }
  42403. }
  42404. for (index = timers.length; index--;) {
  42405. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42406. timers[index].anim.stop(gotoEnd);
  42407. dequeue = false;
  42408. timers.splice(index, 1);
  42409. }
  42410. }
  42411. // Start the next in the queue if the last step wasn't forced.
  42412. // Timers currently will call their complete callbacks, which
  42413. // will dequeue but only if they were gotoEnd.
  42414. if (dequeue || !gotoEnd) {
  42415. jQuery.dequeue(this, type);
  42416. }
  42417. });
  42418. },
  42419. finish: function finish(type) {
  42420. if (type !== false) {
  42421. type = type || "fx";
  42422. }
  42423. return this.each(function () {
  42424. var index,
  42425. data = dataPriv.get(this),
  42426. queue = data[type + "queue"],
  42427. hooks = data[type + "queueHooks"],
  42428. timers = jQuery.timers,
  42429. length = queue ? queue.length : 0;
  42430. // Enable finishing flag on private data
  42431. data.finish = true;
  42432. // Empty the queue first
  42433. jQuery.queue(this, type, []);
  42434. if (hooks && hooks.stop) {
  42435. hooks.stop.call(this, true);
  42436. }
  42437. // Look for any active animations, and finish them
  42438. for (index = timers.length; index--;) {
  42439. if (timers[index].elem === this && timers[index].queue === type) {
  42440. timers[index].anim.stop(true);
  42441. timers.splice(index, 1);
  42442. }
  42443. }
  42444. // Look for any animations in the old queue and finish them
  42445. for (index = 0; index < length; index++) {
  42446. if (queue[index] && queue[index].finish) {
  42447. queue[index].finish.call(this);
  42448. }
  42449. }
  42450. // Turn off finishing flag
  42451. delete data.finish;
  42452. });
  42453. }
  42454. });
  42455. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42456. var cssFn = jQuery.fn[name];
  42457. jQuery.fn[name] = function (speed, easing, callback) {
  42458. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42459. };
  42460. });
  42461. // Generate shortcuts for custom animations
  42462. jQuery.each({
  42463. slideDown: genFx("show"),
  42464. slideUp: genFx("hide"),
  42465. slideToggle: genFx("toggle"),
  42466. fadeIn: { opacity: "show" },
  42467. fadeOut: { opacity: "hide" },
  42468. fadeToggle: { opacity: "toggle" }
  42469. }, function (name, props) {
  42470. jQuery.fn[name] = function (speed, easing, callback) {
  42471. return this.animate(props, speed, easing, callback);
  42472. };
  42473. });
  42474. jQuery.timers = [];
  42475. jQuery.fx.tick = function () {
  42476. var timer,
  42477. i = 0,
  42478. timers = jQuery.timers;
  42479. fxNow = Date.now();
  42480. for (; i < timers.length; i++) {
  42481. timer = timers[i];
  42482. // Run the timer and safely remove it when done (allowing for external removal)
  42483. if (!timer() && timers[i] === timer) {
  42484. timers.splice(i--, 1);
  42485. }
  42486. }
  42487. if (!timers.length) {
  42488. jQuery.fx.stop();
  42489. }
  42490. fxNow = undefined;
  42491. };
  42492. jQuery.fx.timer = function (timer) {
  42493. jQuery.timers.push(timer);
  42494. jQuery.fx.start();
  42495. };
  42496. jQuery.fx.interval = 13;
  42497. jQuery.fx.start = function () {
  42498. if (inProgress) {
  42499. return;
  42500. }
  42501. inProgress = true;
  42502. schedule();
  42503. };
  42504. jQuery.fx.stop = function () {
  42505. inProgress = null;
  42506. };
  42507. jQuery.fx.speeds = {
  42508. slow: 600,
  42509. fast: 200,
  42510. // Default speed
  42511. _default: 400
  42512. };
  42513. // Based off of the plugin by Clint Helfers, with permission.
  42514. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  42515. jQuery.fn.delay = function (time, type) {
  42516. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  42517. type = type || "fx";
  42518. return this.queue(type, function (next, hooks) {
  42519. var timeout = window.setTimeout(next, time);
  42520. hooks.stop = function () {
  42521. window.clearTimeout(timeout);
  42522. };
  42523. });
  42524. };
  42525. (function () {
  42526. var input = document.createElement("input"),
  42527. select = document.createElement("select"),
  42528. opt = select.appendChild(document.createElement("option"));
  42529. input.type = "checkbox";
  42530. // Support: Android <=4.3 only
  42531. // Default value for a checkbox should be "on"
  42532. support.checkOn = input.value !== "";
  42533. // Support: IE <=11 only
  42534. // Must access selectedIndex to make default options select
  42535. support.optSelected = opt.selected;
  42536. // Support: IE <=11 only
  42537. // An input loses its value after becoming a radio
  42538. input = document.createElement("input");
  42539. input.value = "t";
  42540. input.type = "radio";
  42541. support.radioValue = input.value === "t";
  42542. })();
  42543. var boolHook,
  42544. attrHandle = jQuery.expr.attrHandle;
  42545. jQuery.fn.extend({
  42546. attr: function attr(name, value) {
  42547. return access(this, jQuery.attr, name, value, arguments.length > 1);
  42548. },
  42549. removeAttr: function removeAttr(name) {
  42550. return this.each(function () {
  42551. jQuery.removeAttr(this, name);
  42552. });
  42553. }
  42554. });
  42555. jQuery.extend({
  42556. attr: function attr(elem, name, value) {
  42557. var ret,
  42558. hooks,
  42559. nType = elem.nodeType;
  42560. // Don't get/set attributes on text, comment and attribute nodes
  42561. if (nType === 3 || nType === 8 || nType === 2) {
  42562. return;
  42563. }
  42564. // Fallback to prop when attributes are not supported
  42565. if (typeof elem.getAttribute === "undefined") {
  42566. return jQuery.prop(elem, name, value);
  42567. }
  42568. // Attribute hooks are determined by the lowercase version
  42569. // Grab necessary hook if one is defined
  42570. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42571. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  42572. }
  42573. if (value !== undefined) {
  42574. if (value === null) {
  42575. jQuery.removeAttr(elem, name);
  42576. return;
  42577. }
  42578. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42579. return ret;
  42580. }
  42581. elem.setAttribute(name, value + "");
  42582. return value;
  42583. }
  42584. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42585. return ret;
  42586. }
  42587. ret = jQuery.find.attr(elem, name);
  42588. // Non-existent attributes return null, we normalize to undefined
  42589. return ret == null ? undefined : ret;
  42590. },
  42591. attrHooks: {
  42592. type: {
  42593. set: function set(elem, value) {
  42594. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  42595. var val = elem.value;
  42596. elem.setAttribute("type", value);
  42597. if (val) {
  42598. elem.value = val;
  42599. }
  42600. return value;
  42601. }
  42602. }
  42603. }
  42604. },
  42605. removeAttr: function removeAttr(elem, value) {
  42606. var name,
  42607. i = 0,
  42608. // Attribute names can contain non-HTML whitespace characters
  42609. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  42610. attrNames = value && value.match(rnothtmlwhite);
  42611. if (attrNames && elem.nodeType === 1) {
  42612. while (name = attrNames[i++]) {
  42613. elem.removeAttribute(name);
  42614. }
  42615. }
  42616. }
  42617. });
  42618. // Hooks for boolean attributes
  42619. boolHook = {
  42620. set: function set(elem, value, name) {
  42621. if (value === false) {
  42622. // Remove boolean attributes when set to false
  42623. jQuery.removeAttr(elem, name);
  42624. } else {
  42625. elem.setAttribute(name, name);
  42626. }
  42627. return name;
  42628. }
  42629. };
  42630. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  42631. var getter = attrHandle[name] || jQuery.find.attr;
  42632. attrHandle[name] = function (elem, name, isXML) {
  42633. var ret,
  42634. handle,
  42635. lowercaseName = name.toLowerCase();
  42636. if (!isXML) {
  42637. // Avoid an infinite loop by temporarily removing this function from the getter
  42638. handle = attrHandle[lowercaseName];
  42639. attrHandle[lowercaseName] = ret;
  42640. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  42641. attrHandle[lowercaseName] = handle;
  42642. }
  42643. return ret;
  42644. };
  42645. });
  42646. var rfocusable = /^(?:input|select|textarea|button)$/i,
  42647. rclickable = /^(?:a|area)$/i;
  42648. jQuery.fn.extend({
  42649. prop: function prop(name, value) {
  42650. return access(this, jQuery.prop, name, value, arguments.length > 1);
  42651. },
  42652. removeProp: function removeProp(name) {
  42653. return this.each(function () {
  42654. delete this[jQuery.propFix[name] || name];
  42655. });
  42656. }
  42657. });
  42658. jQuery.extend({
  42659. prop: function prop(elem, name, value) {
  42660. var ret,
  42661. hooks,
  42662. nType = elem.nodeType;
  42663. // Don't get/set properties on text, comment and attribute nodes
  42664. if (nType === 3 || nType === 8 || nType === 2) {
  42665. return;
  42666. }
  42667. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42668. // Fix name and attach hooks
  42669. name = jQuery.propFix[name] || name;
  42670. hooks = jQuery.propHooks[name];
  42671. }
  42672. if (value !== undefined) {
  42673. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42674. return ret;
  42675. }
  42676. return elem[name] = value;
  42677. }
  42678. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42679. return ret;
  42680. }
  42681. return elem[name];
  42682. },
  42683. propHooks: {
  42684. tabIndex: {
  42685. get: function get(elem) {
  42686. // Support: IE <=9 - 11 only
  42687. // elem.tabIndex doesn't always return the
  42688. // correct value when it hasn't been explicitly set
  42689. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  42690. // Use proper attribute retrieval(#12072)
  42691. var tabindex = jQuery.find.attr(elem, "tabindex");
  42692. if (tabindex) {
  42693. return parseInt(tabindex, 10);
  42694. }
  42695. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  42696. return 0;
  42697. }
  42698. return -1;
  42699. }
  42700. }
  42701. },
  42702. propFix: {
  42703. "for": "htmlFor",
  42704. "class": "className"
  42705. }
  42706. });
  42707. // Support: IE <=11 only
  42708. // Accessing the selectedIndex property
  42709. // forces the browser to respect setting selected
  42710. // on the option
  42711. // The getter ensures a default option is selected
  42712. // when in an optgroup
  42713. // eslint rule "no-unused-expressions" is disabled for this code
  42714. // since it considers such accessions noop
  42715. if (!support.optSelected) {
  42716. jQuery.propHooks.selected = {
  42717. get: function get(elem) {
  42718. /* eslint no-unused-expressions: "off" */
  42719. var parent = elem.parentNode;
  42720. if (parent && parent.parentNode) {
  42721. parent.parentNode.selectedIndex;
  42722. }
  42723. return null;
  42724. },
  42725. set: function set(elem) {
  42726. /* eslint no-unused-expressions: "off" */
  42727. var parent = elem.parentNode;
  42728. if (parent) {
  42729. parent.selectedIndex;
  42730. if (parent.parentNode) {
  42731. parent.parentNode.selectedIndex;
  42732. }
  42733. }
  42734. }
  42735. };
  42736. }
  42737. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  42738. jQuery.propFix[this.toLowerCase()] = this;
  42739. });
  42740. // Strip and collapse whitespace according to HTML spec
  42741. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  42742. function stripAndCollapse(value) {
  42743. var tokens = value.match(rnothtmlwhite) || [];
  42744. return tokens.join(" ");
  42745. }
  42746. function getClass(elem) {
  42747. return elem.getAttribute && elem.getAttribute("class") || "";
  42748. }
  42749. function classesToArray(value) {
  42750. if (Array.isArray(value)) {
  42751. return value;
  42752. }
  42753. if (typeof value === "string") {
  42754. return value.match(rnothtmlwhite) || [];
  42755. }
  42756. return [];
  42757. }
  42758. jQuery.fn.extend({
  42759. addClass: function addClass(value) {
  42760. var classes,
  42761. elem,
  42762. cur,
  42763. curValue,
  42764. clazz,
  42765. j,
  42766. finalValue,
  42767. i = 0;
  42768. if (isFunction(value)) {
  42769. return this.each(function (j) {
  42770. jQuery(this).addClass(value.call(this, j, getClass(this)));
  42771. });
  42772. }
  42773. classes = classesToArray(value);
  42774. if (classes.length) {
  42775. while (elem = this[i++]) {
  42776. curValue = getClass(elem);
  42777. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42778. if (cur) {
  42779. j = 0;
  42780. while (clazz = classes[j++]) {
  42781. if (cur.indexOf(" " + clazz + " ") < 0) {
  42782. cur += clazz + " ";
  42783. }
  42784. }
  42785. // Only assign if different to avoid unneeded rendering.
  42786. finalValue = stripAndCollapse(cur);
  42787. if (curValue !== finalValue) {
  42788. elem.setAttribute("class", finalValue);
  42789. }
  42790. }
  42791. }
  42792. }
  42793. return this;
  42794. },
  42795. removeClass: function removeClass(value) {
  42796. var classes,
  42797. elem,
  42798. cur,
  42799. curValue,
  42800. clazz,
  42801. j,
  42802. finalValue,
  42803. i = 0;
  42804. if (isFunction(value)) {
  42805. return this.each(function (j) {
  42806. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  42807. });
  42808. }
  42809. if (!arguments.length) {
  42810. return this.attr("class", "");
  42811. }
  42812. classes = classesToArray(value);
  42813. if (classes.length) {
  42814. while (elem = this[i++]) {
  42815. curValue = getClass(elem);
  42816. // This expression is here for better compressibility (see addClass)
  42817. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42818. if (cur) {
  42819. j = 0;
  42820. while (clazz = classes[j++]) {
  42821. // Remove *all* instances
  42822. while (cur.indexOf(" " + clazz + " ") > -1) {
  42823. cur = cur.replace(" " + clazz + " ", " ");
  42824. }
  42825. }
  42826. // Only assign if different to avoid unneeded rendering.
  42827. finalValue = stripAndCollapse(cur);
  42828. if (curValue !== finalValue) {
  42829. elem.setAttribute("class", finalValue);
  42830. }
  42831. }
  42832. }
  42833. }
  42834. return this;
  42835. },
  42836. toggleClass: function toggleClass(value, stateVal) {
  42837. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  42838. isValidValue = type === "string" || Array.isArray(value);
  42839. if (typeof stateVal === "boolean" && isValidValue) {
  42840. return stateVal ? this.addClass(value) : this.removeClass(value);
  42841. }
  42842. if (isFunction(value)) {
  42843. return this.each(function (i) {
  42844. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  42845. });
  42846. }
  42847. return this.each(function () {
  42848. var className, i, self, classNames;
  42849. if (isValidValue) {
  42850. // Toggle individual class names
  42851. i = 0;
  42852. self = jQuery(this);
  42853. classNames = classesToArray(value);
  42854. while (className = classNames[i++]) {
  42855. // Check each className given, space separated list
  42856. if (self.hasClass(className)) {
  42857. self.removeClass(className);
  42858. } else {
  42859. self.addClass(className);
  42860. }
  42861. }
  42862. // Toggle whole class name
  42863. } else if (value === undefined || type === "boolean") {
  42864. className = getClass(this);
  42865. if (className) {
  42866. // Store className if set
  42867. dataPriv.set(this, "__className__", className);
  42868. }
  42869. // If the element has a class name or if we're passed `false`,
  42870. // then remove the whole classname (if there was one, the above saved it).
  42871. // Otherwise bring back whatever was previously saved (if anything),
  42872. // falling back to the empty string if nothing was stored.
  42873. if (this.setAttribute) {
  42874. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  42875. }
  42876. }
  42877. });
  42878. },
  42879. hasClass: function hasClass(selector) {
  42880. var className,
  42881. elem,
  42882. i = 0;
  42883. className = " " + selector + " ";
  42884. while (elem = this[i++]) {
  42885. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  42886. return true;
  42887. }
  42888. }
  42889. return false;
  42890. }
  42891. });
  42892. var rreturn = /\r/g;
  42893. jQuery.fn.extend({
  42894. val: function val(value) {
  42895. var hooks,
  42896. ret,
  42897. valueIsFunction,
  42898. elem = this[0];
  42899. if (!arguments.length) {
  42900. if (elem) {
  42901. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  42902. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  42903. return ret;
  42904. }
  42905. ret = elem.value;
  42906. // Handle most common string cases
  42907. if (typeof ret === "string") {
  42908. return ret.replace(rreturn, "");
  42909. }
  42910. // Handle cases where value is null/undef or number
  42911. return ret == null ? "" : ret;
  42912. }
  42913. return;
  42914. }
  42915. valueIsFunction = isFunction(value);
  42916. return this.each(function (i) {
  42917. var val;
  42918. if (this.nodeType !== 1) {
  42919. return;
  42920. }
  42921. if (valueIsFunction) {
  42922. val = value.call(this, i, jQuery(this).val());
  42923. } else {
  42924. val = value;
  42925. }
  42926. // Treat null/undefined as ""; convert numbers to string
  42927. if (val == null) {
  42928. val = "";
  42929. } else if (typeof val === "number") {
  42930. val += "";
  42931. } else if (Array.isArray(val)) {
  42932. val = jQuery.map(val, function (value) {
  42933. return value == null ? "" : value + "";
  42934. });
  42935. }
  42936. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  42937. // If set returns undefined, fall back to normal setting
  42938. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  42939. this.value = val;
  42940. }
  42941. });
  42942. }
  42943. });
  42944. jQuery.extend({
  42945. valHooks: {
  42946. option: {
  42947. get: function get(elem) {
  42948. var val = jQuery.find.attr(elem, "value");
  42949. return val != null ? val :
  42950. // Support: IE <=10 - 11 only
  42951. // option.text throws exceptions (#14686, #14858)
  42952. // Strip and collapse whitespace
  42953. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  42954. stripAndCollapse(jQuery.text(elem));
  42955. }
  42956. },
  42957. select: {
  42958. get: function get(elem) {
  42959. var value,
  42960. option,
  42961. i,
  42962. options = elem.options,
  42963. index = elem.selectedIndex,
  42964. one = elem.type === "select-one",
  42965. values = one ? null : [],
  42966. max = one ? index + 1 : options.length;
  42967. if (index < 0) {
  42968. i = max;
  42969. } else {
  42970. i = one ? index : 0;
  42971. }
  42972. // Loop through all the selected options
  42973. for (; i < max; i++) {
  42974. option = options[i];
  42975. // Support: IE <=9 only
  42976. // IE8-9 doesn't update selected after form reset (#2551)
  42977. if ((option.selected || i === index) &&
  42978. // Don't return options that are disabled or in a disabled optgroup
  42979. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  42980. // Get the specific value for the option
  42981. value = jQuery(option).val();
  42982. // We don't need an array for one selects
  42983. if (one) {
  42984. return value;
  42985. }
  42986. // Multi-Selects return an array
  42987. values.push(value);
  42988. }
  42989. }
  42990. return values;
  42991. },
  42992. set: function set(elem, value) {
  42993. var optionSet,
  42994. option,
  42995. options = elem.options,
  42996. values = jQuery.makeArray(value),
  42997. i = options.length;
  42998. while (i--) {
  42999. option = options[i];
  43000. /* eslint-disable no-cond-assign */
  43001. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  43002. optionSet = true;
  43003. }
  43004. /* eslint-enable no-cond-assign */
  43005. }
  43006. // Force browsers to behave consistently when non-matching value is set
  43007. if (!optionSet) {
  43008. elem.selectedIndex = -1;
  43009. }
  43010. return values;
  43011. }
  43012. }
  43013. }
  43014. });
  43015. // Radios and checkboxes getter/setter
  43016. jQuery.each(["radio", "checkbox"], function () {
  43017. jQuery.valHooks[this] = {
  43018. set: function set(elem, value) {
  43019. if (Array.isArray(value)) {
  43020. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  43021. }
  43022. }
  43023. };
  43024. if (!support.checkOn) {
  43025. jQuery.valHooks[this].get = function (elem) {
  43026. return elem.getAttribute("value") === null ? "on" : elem.value;
  43027. };
  43028. }
  43029. });
  43030. // Return jQuery for attributes-only inclusion
  43031. support.focusin = "onfocusin" in window;
  43032. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  43033. stopPropagationCallback = function stopPropagationCallback(e) {
  43034. e.stopPropagation();
  43035. };
  43036. jQuery.extend(jQuery.event, {
  43037. trigger: function trigger(event, data, elem, onlyHandlers) {
  43038. var i,
  43039. cur,
  43040. tmp,
  43041. bubbleType,
  43042. ontype,
  43043. handle,
  43044. special,
  43045. lastElement,
  43046. eventPath = [elem || document],
  43047. type = hasOwn.call(event, "type") ? event.type : event,
  43048. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  43049. cur = lastElement = tmp = elem = elem || document;
  43050. // Don't do events on text and comment nodes
  43051. if (elem.nodeType === 3 || elem.nodeType === 8) {
  43052. return;
  43053. }
  43054. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  43055. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  43056. return;
  43057. }
  43058. if (type.indexOf(".") > -1) {
  43059. // Namespaced trigger; create a regexp to match event type in handle()
  43060. namespaces = type.split(".");
  43061. type = namespaces.shift();
  43062. namespaces.sort();
  43063. }
  43064. ontype = type.indexOf(":") < 0 && "on" + type;
  43065. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  43066. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  43067. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  43068. event.isTrigger = onlyHandlers ? 2 : 3;
  43069. event.namespace = namespaces.join(".");
  43070. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  43071. // Clean up the event in case it is being reused
  43072. event.result = undefined;
  43073. if (!event.target) {
  43074. event.target = elem;
  43075. }
  43076. // Clone any incoming data and prepend the event, creating the handler arg list
  43077. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  43078. // Allow special events to draw outside the lines
  43079. special = jQuery.event.special[type] || {};
  43080. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  43081. return;
  43082. }
  43083. // Determine event propagation path in advance, per W3C events spec (#9951)
  43084. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  43085. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  43086. bubbleType = special.delegateType || type;
  43087. if (!rfocusMorph.test(bubbleType + type)) {
  43088. cur = cur.parentNode;
  43089. }
  43090. for (; cur; cur = cur.parentNode) {
  43091. eventPath.push(cur);
  43092. tmp = cur;
  43093. }
  43094. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43095. if (tmp === (elem.ownerDocument || document)) {
  43096. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43097. }
  43098. }
  43099. // Fire handlers on the event path
  43100. i = 0;
  43101. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43102. lastElement = cur;
  43103. event.type = i > 1 ? bubbleType : special.bindType || type;
  43104. // jQuery handler
  43105. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43106. if (handle) {
  43107. handle.apply(cur, data);
  43108. }
  43109. // Native handler
  43110. handle = ontype && cur[ontype];
  43111. if (handle && handle.apply && acceptData(cur)) {
  43112. event.result = handle.apply(cur, data);
  43113. if (event.result === false) {
  43114. event.preventDefault();
  43115. }
  43116. }
  43117. }
  43118. event.type = type;
  43119. // If nobody prevented the default action, do it now
  43120. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43121. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43122. // Call a native DOM method on the target with the same name as the event.
  43123. // Don't do default actions on window, that's where global variables be (#6170)
  43124. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43125. // Don't re-trigger an onFOO event when we call its FOO() method
  43126. tmp = elem[ontype];
  43127. if (tmp) {
  43128. elem[ontype] = null;
  43129. }
  43130. // Prevent re-triggering of the same event, since we already bubbled it above
  43131. jQuery.event.triggered = type;
  43132. if (event.isPropagationStopped()) {
  43133. lastElement.addEventListener(type, stopPropagationCallback);
  43134. }
  43135. elem[type]();
  43136. if (event.isPropagationStopped()) {
  43137. lastElement.removeEventListener(type, stopPropagationCallback);
  43138. }
  43139. jQuery.event.triggered = undefined;
  43140. if (tmp) {
  43141. elem[ontype] = tmp;
  43142. }
  43143. }
  43144. }
  43145. }
  43146. return event.result;
  43147. },
  43148. // Piggyback on a donor event to simulate a different one
  43149. // Used only for `focus(in | out)` events
  43150. simulate: function simulate(type, elem, event) {
  43151. var e = jQuery.extend(new jQuery.Event(), event, {
  43152. type: type,
  43153. isSimulated: true
  43154. });
  43155. jQuery.event.trigger(e, null, elem);
  43156. }
  43157. });
  43158. jQuery.fn.extend({
  43159. trigger: function trigger(type, data) {
  43160. return this.each(function () {
  43161. jQuery.event.trigger(type, data, this);
  43162. });
  43163. },
  43164. triggerHandler: function triggerHandler(type, data) {
  43165. var elem = this[0];
  43166. if (elem) {
  43167. return jQuery.event.trigger(type, data, elem, true);
  43168. }
  43169. }
  43170. });
  43171. // Support: Firefox <=44
  43172. // Firefox doesn't have focus(in | out) events
  43173. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43174. //
  43175. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43176. // focus(in | out) events fire after focus & blur events,
  43177. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43178. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43179. if (!support.focusin) {
  43180. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43181. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43182. var handler = function handler(event) {
  43183. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43184. };
  43185. jQuery.event.special[fix] = {
  43186. setup: function setup() {
  43187. var doc = this.ownerDocument || this,
  43188. attaches = dataPriv.access(doc, fix);
  43189. if (!attaches) {
  43190. doc.addEventListener(orig, handler, true);
  43191. }
  43192. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43193. },
  43194. teardown: function teardown() {
  43195. var doc = this.ownerDocument || this,
  43196. attaches = dataPriv.access(doc, fix) - 1;
  43197. if (!attaches) {
  43198. doc.removeEventListener(orig, handler, true);
  43199. dataPriv.remove(doc, fix);
  43200. } else {
  43201. dataPriv.access(doc, fix, attaches);
  43202. }
  43203. }
  43204. };
  43205. });
  43206. }
  43207. var location = window.location;
  43208. var nonce = Date.now();
  43209. var rquery = /\?/;
  43210. // Cross-browser xml parsing
  43211. jQuery.parseXML = function (data) {
  43212. var xml;
  43213. if (!data || typeof data !== "string") {
  43214. return null;
  43215. }
  43216. // Support: IE 9 - 11 only
  43217. // IE throws on parseFromString with invalid input.
  43218. try {
  43219. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43220. } catch (e) {
  43221. xml = undefined;
  43222. }
  43223. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43224. jQuery.error("Invalid XML: " + data);
  43225. }
  43226. return xml;
  43227. };
  43228. var rbracket = /\[\]$/,
  43229. rCRLF = /\r?\n/g,
  43230. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43231. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43232. function buildParams(prefix, obj, traditional, add) {
  43233. var name;
  43234. if (Array.isArray(obj)) {
  43235. // Serialize array item.
  43236. jQuery.each(obj, function (i, v) {
  43237. if (traditional || rbracket.test(prefix)) {
  43238. // Treat each array item as a scalar.
  43239. add(prefix, v);
  43240. } else {
  43241. // Item is non-scalar (array or object), encode its numeric index.
  43242. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43243. }
  43244. });
  43245. } else if (!traditional && toType(obj) === "object") {
  43246. // Serialize object item.
  43247. for (name in obj) {
  43248. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43249. }
  43250. } else {
  43251. // Serialize scalar item.
  43252. add(prefix, obj);
  43253. }
  43254. }
  43255. // Serialize an array of form elements or a set of
  43256. // key/values into a query string
  43257. jQuery.param = function (a, traditional) {
  43258. var prefix,
  43259. s = [],
  43260. add = function add(key, valueOrFunction) {
  43261. // If value is a function, invoke it and use its return value
  43262. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43263. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43264. };
  43265. // If an array was passed in, assume that it is an array of form elements.
  43266. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43267. // Serialize the form elements
  43268. jQuery.each(a, function () {
  43269. add(this.name, this.value);
  43270. });
  43271. } else {
  43272. // If traditional, encode the "old" way (the way 1.3.2 or older
  43273. // did it), otherwise encode params recursively.
  43274. for (prefix in a) {
  43275. buildParams(prefix, a[prefix], traditional, add);
  43276. }
  43277. }
  43278. // Return the resulting serialization
  43279. return s.join("&");
  43280. };
  43281. jQuery.fn.extend({
  43282. serialize: function serialize() {
  43283. return jQuery.param(this.serializeArray());
  43284. },
  43285. serializeArray: function serializeArray() {
  43286. return this.map(function () {
  43287. // Can add propHook for "elements" to filter or add form elements
  43288. var elements = jQuery.prop(this, "elements");
  43289. return elements ? jQuery.makeArray(elements) : this;
  43290. }).filter(function () {
  43291. var type = this.type;
  43292. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43293. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43294. }).map(function (i, elem) {
  43295. var val = jQuery(this).val();
  43296. if (val == null) {
  43297. return null;
  43298. }
  43299. if (Array.isArray(val)) {
  43300. return jQuery.map(val, function (val) {
  43301. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43302. });
  43303. }
  43304. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43305. }).get();
  43306. }
  43307. });
  43308. var r20 = /%20/g,
  43309. rhash = /#.*$/,
  43310. rantiCache = /([?&])_=[^&]*/,
  43311. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43312. // #7653, #8125, #8152: local protocol detection
  43313. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43314. rnoContent = /^(?:GET|HEAD)$/,
  43315. rprotocol = /^\/\//,
  43316. /* Prefilters
  43317. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43318. * 2) These are called:
  43319. * - BEFORE asking for a transport
  43320. * - AFTER param serialization (s.data is a string if s.processData is true)
  43321. * 3) key is the dataType
  43322. * 4) the catchall symbol "*" can be used
  43323. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43324. */
  43325. prefilters = {},
  43326. /* Transports bindings
  43327. * 1) key is the dataType
  43328. * 2) the catchall symbol "*" can be used
  43329. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43330. */
  43331. transports = {},
  43332. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43333. allTypes = "*/".concat("*"),
  43334. // Anchor tag for parsing the document origin
  43335. originAnchor = document.createElement("a");
  43336. originAnchor.href = location.href;
  43337. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43338. function addToPrefiltersOrTransports(structure) {
  43339. // dataTypeExpression is optional and defaults to "*"
  43340. return function (dataTypeExpression, func) {
  43341. if (typeof dataTypeExpression !== "string") {
  43342. func = dataTypeExpression;
  43343. dataTypeExpression = "*";
  43344. }
  43345. var dataType,
  43346. i = 0,
  43347. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43348. if (isFunction(func)) {
  43349. // For each dataType in the dataTypeExpression
  43350. while (dataType = dataTypes[i++]) {
  43351. // Prepend if requested
  43352. if (dataType[0] === "+") {
  43353. dataType = dataType.slice(1) || "*";
  43354. (structure[dataType] = structure[dataType] || []).unshift(func);
  43355. // Otherwise append
  43356. } else {
  43357. (structure[dataType] = structure[dataType] || []).push(func);
  43358. }
  43359. }
  43360. }
  43361. };
  43362. }
  43363. // Base inspection function for prefilters and transports
  43364. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43365. var inspected = {},
  43366. seekingTransport = structure === transports;
  43367. function inspect(dataType) {
  43368. var selected;
  43369. inspected[dataType] = true;
  43370. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43371. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43372. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43373. options.dataTypes.unshift(dataTypeOrTransport);
  43374. inspect(dataTypeOrTransport);
  43375. return false;
  43376. } else if (seekingTransport) {
  43377. return !(selected = dataTypeOrTransport);
  43378. }
  43379. });
  43380. return selected;
  43381. }
  43382. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43383. }
  43384. // A special extend for ajax options
  43385. // that takes "flat" options (not to be deep extended)
  43386. // Fixes #9887
  43387. function ajaxExtend(target, src) {
  43388. var key,
  43389. deep,
  43390. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43391. for (key in src) {
  43392. if (src[key] !== undefined) {
  43393. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43394. }
  43395. }
  43396. if (deep) {
  43397. jQuery.extend(true, target, deep);
  43398. }
  43399. return target;
  43400. }
  43401. /* Handles responses to an ajax request:
  43402. * - finds the right dataType (mediates between content-type and expected dataType)
  43403. * - returns the corresponding response
  43404. */
  43405. function ajaxHandleResponses(s, jqXHR, responses) {
  43406. var ct,
  43407. type,
  43408. finalDataType,
  43409. firstDataType,
  43410. contents = s.contents,
  43411. dataTypes = s.dataTypes;
  43412. // Remove auto dataType and get content-type in the process
  43413. while (dataTypes[0] === "*") {
  43414. dataTypes.shift();
  43415. if (ct === undefined) {
  43416. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43417. }
  43418. }
  43419. // Check if we're dealing with a known content-type
  43420. if (ct) {
  43421. for (type in contents) {
  43422. if (contents[type] && contents[type].test(ct)) {
  43423. dataTypes.unshift(type);
  43424. break;
  43425. }
  43426. }
  43427. }
  43428. // Check to see if we have a response for the expected dataType
  43429. if (dataTypes[0] in responses) {
  43430. finalDataType = dataTypes[0];
  43431. } else {
  43432. // Try convertible dataTypes
  43433. for (type in responses) {
  43434. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43435. finalDataType = type;
  43436. break;
  43437. }
  43438. if (!firstDataType) {
  43439. firstDataType = type;
  43440. }
  43441. }
  43442. // Or just use first one
  43443. finalDataType = finalDataType || firstDataType;
  43444. }
  43445. // If we found a dataType
  43446. // We add the dataType to the list if needed
  43447. // and return the corresponding response
  43448. if (finalDataType) {
  43449. if (finalDataType !== dataTypes[0]) {
  43450. dataTypes.unshift(finalDataType);
  43451. }
  43452. return responses[finalDataType];
  43453. }
  43454. }
  43455. /* Chain conversions given the request and the original response
  43456. * Also sets the responseXXX fields on the jqXHR instance
  43457. */
  43458. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43459. var conv2,
  43460. current,
  43461. conv,
  43462. tmp,
  43463. prev,
  43464. converters = {},
  43465. // Work with a copy of dataTypes in case we need to modify it for conversion
  43466. dataTypes = s.dataTypes.slice();
  43467. // Create converters map with lowercased keys
  43468. if (dataTypes[1]) {
  43469. for (conv in s.converters) {
  43470. converters[conv.toLowerCase()] = s.converters[conv];
  43471. }
  43472. }
  43473. current = dataTypes.shift();
  43474. // Convert to each sequential dataType
  43475. while (current) {
  43476. if (s.responseFields[current]) {
  43477. jqXHR[s.responseFields[current]] = response;
  43478. }
  43479. // Apply the dataFilter if provided
  43480. if (!prev && isSuccess && s.dataFilter) {
  43481. response = s.dataFilter(response, s.dataType);
  43482. }
  43483. prev = current;
  43484. current = dataTypes.shift();
  43485. if (current) {
  43486. // There's only work to do if current dataType is non-auto
  43487. if (current === "*") {
  43488. current = prev;
  43489. // Convert response if prev dataType is non-auto and differs from current
  43490. } else if (prev !== "*" && prev !== current) {
  43491. // Seek a direct converter
  43492. conv = converters[prev + " " + current] || converters["* " + current];
  43493. // If none found, seek a pair
  43494. if (!conv) {
  43495. for (conv2 in converters) {
  43496. // If conv2 outputs current
  43497. tmp = conv2.split(" ");
  43498. if (tmp[1] === current) {
  43499. // If prev can be converted to accepted input
  43500. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43501. if (conv) {
  43502. // Condense equivalence converters
  43503. if (conv === true) {
  43504. conv = converters[conv2];
  43505. // Otherwise, insert the intermediate dataType
  43506. } else if (converters[conv2] !== true) {
  43507. current = tmp[0];
  43508. dataTypes.unshift(tmp[1]);
  43509. }
  43510. break;
  43511. }
  43512. }
  43513. }
  43514. }
  43515. // Apply converter (if not an equivalence)
  43516. if (conv !== true) {
  43517. // Unless errors are allowed to bubble, catch and return them
  43518. if (conv && s.throws) {
  43519. response = conv(response);
  43520. } else {
  43521. try {
  43522. response = conv(response);
  43523. } catch (e) {
  43524. return {
  43525. state: "parsererror",
  43526. error: conv ? e : "No conversion from " + prev + " to " + current
  43527. };
  43528. }
  43529. }
  43530. }
  43531. }
  43532. }
  43533. }
  43534. return { state: "success", data: response };
  43535. }
  43536. jQuery.extend({
  43537. // Counter for holding the number of active queries
  43538. active: 0,
  43539. // Last-Modified header cache for next request
  43540. lastModified: {},
  43541. etag: {},
  43542. ajaxSettings: {
  43543. url: location.href,
  43544. type: "GET",
  43545. isLocal: rlocalProtocol.test(location.protocol),
  43546. global: true,
  43547. processData: true,
  43548. async: true,
  43549. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  43550. /*
  43551. timeout: 0,
  43552. data: null,
  43553. dataType: null,
  43554. username: null,
  43555. password: null,
  43556. cache: null,
  43557. throws: false,
  43558. traditional: false,
  43559. headers: {},
  43560. */
  43561. accepts: {
  43562. "*": allTypes,
  43563. text: "text/plain",
  43564. html: "text/html",
  43565. xml: "application/xml, text/xml",
  43566. json: "application/json, text/javascript"
  43567. },
  43568. contents: {
  43569. xml: /\bxml\b/,
  43570. html: /\bhtml/,
  43571. json: /\bjson\b/
  43572. },
  43573. responseFields: {
  43574. xml: "responseXML",
  43575. text: "responseText",
  43576. json: "responseJSON"
  43577. },
  43578. // Data converters
  43579. // Keys separate source (or catchall "*") and destination types with a single space
  43580. converters: {
  43581. // Convert anything to text
  43582. "* text": String,
  43583. // Text to html (true = no transformation)
  43584. "text html": true,
  43585. // Evaluate text as a json expression
  43586. "text json": JSON.parse,
  43587. // Parse text as xml
  43588. "text xml": jQuery.parseXML
  43589. },
  43590. // For options that shouldn't be deep extended:
  43591. // you can add your own custom options here if
  43592. // and when you create one that shouldn't be
  43593. // deep extended (see ajaxExtend)
  43594. flatOptions: {
  43595. url: true,
  43596. context: true
  43597. }
  43598. },
  43599. // Creates a full fledged settings object into target
  43600. // with both ajaxSettings and settings fields.
  43601. // If target is omitted, writes into ajaxSettings.
  43602. ajaxSetup: function ajaxSetup(target, settings) {
  43603. return settings ?
  43604. // Building a settings object
  43605. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  43606. // Extending ajaxSettings
  43607. ajaxExtend(jQuery.ajaxSettings, target);
  43608. },
  43609. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  43610. ajaxTransport: addToPrefiltersOrTransports(transports),
  43611. // Main method
  43612. ajax: function ajax(url, options) {
  43613. // If url is an object, simulate pre-1.5 signature
  43614. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  43615. options = url;
  43616. url = undefined;
  43617. }
  43618. // Force options to be an object
  43619. options = options || {};
  43620. var transport,
  43621. // URL without anti-cache param
  43622. cacheURL,
  43623. // Response headers
  43624. responseHeadersString,
  43625. responseHeaders,
  43626. // timeout handle
  43627. timeoutTimer,
  43628. // Url cleanup var
  43629. urlAnchor,
  43630. // Request state (becomes false upon send and true upon completion)
  43631. completed,
  43632. // To know if global events are to be dispatched
  43633. fireGlobals,
  43634. // Loop variable
  43635. i,
  43636. // uncached part of the url
  43637. uncached,
  43638. // Create the final options object
  43639. s = jQuery.ajaxSetup({}, options),
  43640. // Callbacks context
  43641. callbackContext = s.context || s,
  43642. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  43643. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  43644. // Deferreds
  43645. deferred = jQuery.Deferred(),
  43646. completeDeferred = jQuery.Callbacks("once memory"),
  43647. // Status-dependent callbacks
  43648. _statusCode = s.statusCode || {},
  43649. // Headers (they are sent all at once)
  43650. requestHeaders = {},
  43651. requestHeadersNames = {},
  43652. // Default abort message
  43653. strAbort = "canceled",
  43654. // Fake xhr
  43655. jqXHR = {
  43656. readyState: 0,
  43657. // Builds headers hashtable if needed
  43658. getResponseHeader: function getResponseHeader(key) {
  43659. var match;
  43660. if (completed) {
  43661. if (!responseHeaders) {
  43662. responseHeaders = {};
  43663. while (match = rheaders.exec(responseHeadersString)) {
  43664. responseHeaders[match[1].toLowerCase()] = match[2];
  43665. }
  43666. }
  43667. match = responseHeaders[key.toLowerCase()];
  43668. }
  43669. return match == null ? null : match;
  43670. },
  43671. // Raw string
  43672. getAllResponseHeaders: function getAllResponseHeaders() {
  43673. return completed ? responseHeadersString : null;
  43674. },
  43675. // Caches the header
  43676. setRequestHeader: function setRequestHeader(name, value) {
  43677. if (completed == null) {
  43678. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  43679. requestHeaders[name] = value;
  43680. }
  43681. return this;
  43682. },
  43683. // Overrides response content-type header
  43684. overrideMimeType: function overrideMimeType(type) {
  43685. if (completed == null) {
  43686. s.mimeType = type;
  43687. }
  43688. return this;
  43689. },
  43690. // Status-dependent callbacks
  43691. statusCode: function statusCode(map) {
  43692. var code;
  43693. if (map) {
  43694. if (completed) {
  43695. // Execute the appropriate callbacks
  43696. jqXHR.always(map[jqXHR.status]);
  43697. } else {
  43698. // Lazy-add the new callbacks in a way that preserves old ones
  43699. for (code in map) {
  43700. _statusCode[code] = [_statusCode[code], map[code]];
  43701. }
  43702. }
  43703. }
  43704. return this;
  43705. },
  43706. // Cancel the request
  43707. abort: function abort(statusText) {
  43708. var finalText = statusText || strAbort;
  43709. if (transport) {
  43710. transport.abort(finalText);
  43711. }
  43712. done(0, finalText);
  43713. return this;
  43714. }
  43715. };
  43716. // Attach deferreds
  43717. deferred.promise(jqXHR);
  43718. // Add protocol if not provided (prefilters might expect it)
  43719. // Handle falsy url in the settings object (#10093: consistency with old signature)
  43720. // We also use the url parameter if available
  43721. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  43722. // Alias method option to type as per ticket #12004
  43723. s.type = options.method || options.type || s.method || s.type;
  43724. // Extract dataTypes list
  43725. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  43726. // A cross-domain request is in order when the origin doesn't match the current origin.
  43727. if (s.crossDomain == null) {
  43728. urlAnchor = document.createElement("a");
  43729. // Support: IE <=8 - 11, Edge 12 - 15
  43730. // IE throws exception on accessing the href property if url is malformed,
  43731. // e.g. http://example.com:80x/
  43732. try {
  43733. urlAnchor.href = s.url;
  43734. // Support: IE <=8 - 11 only
  43735. // Anchor's host property isn't correctly set when s.url is relative
  43736. urlAnchor.href = urlAnchor.href;
  43737. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  43738. } catch (e) {
  43739. // If there is an error parsing the URL, assume it is crossDomain,
  43740. // it can be rejected by the transport if it is invalid
  43741. s.crossDomain = true;
  43742. }
  43743. }
  43744. // Convert data if not already a string
  43745. if (s.data && s.processData && typeof s.data !== "string") {
  43746. s.data = jQuery.param(s.data, s.traditional);
  43747. }
  43748. // Apply prefilters
  43749. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  43750. // If request was aborted inside a prefilter, stop there
  43751. if (completed) {
  43752. return jqXHR;
  43753. }
  43754. // We can fire global events as of now if asked to
  43755. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  43756. fireGlobals = jQuery.event && s.global;
  43757. // Watch for a new set of requests
  43758. if (fireGlobals && jQuery.active++ === 0) {
  43759. jQuery.event.trigger("ajaxStart");
  43760. }
  43761. // Uppercase the type
  43762. s.type = s.type.toUpperCase();
  43763. // Determine if request has content
  43764. s.hasContent = !rnoContent.test(s.type);
  43765. // Save the URL in case we're toying with the If-Modified-Since
  43766. // and/or If-None-Match header later on
  43767. // Remove hash to simplify url manipulation
  43768. cacheURL = s.url.replace(rhash, "");
  43769. // More options handling for requests with no content
  43770. if (!s.hasContent) {
  43771. // Remember the hash so we can put it back
  43772. uncached = s.url.slice(cacheURL.length);
  43773. // If data is available and should be processed, append data to url
  43774. if (s.data && (s.processData || typeof s.data === "string")) {
  43775. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  43776. // #9682: remove data so that it's not used in an eventual retry
  43777. delete s.data;
  43778. }
  43779. // Add or update anti-cache param if needed
  43780. if (s.cache === false) {
  43781. cacheURL = cacheURL.replace(rantiCache, "$1");
  43782. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  43783. }
  43784. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  43785. s.url = cacheURL + uncached;
  43786. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  43787. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  43788. s.data = s.data.replace(r20, "+");
  43789. }
  43790. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43791. if (s.ifModified) {
  43792. if (jQuery.lastModified[cacheURL]) {
  43793. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  43794. }
  43795. if (jQuery.etag[cacheURL]) {
  43796. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  43797. }
  43798. }
  43799. // Set the correct header, if data is being sent
  43800. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  43801. jqXHR.setRequestHeader("Content-Type", s.contentType);
  43802. }
  43803. // Set the Accepts header for the server, depending on the dataType
  43804. 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["*"]);
  43805. // Check for headers option
  43806. for (i in s.headers) {
  43807. jqXHR.setRequestHeader(i, s.headers[i]);
  43808. }
  43809. // Allow custom headers/mimetypes and early abort
  43810. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  43811. // Abort if not done already and return
  43812. return jqXHR.abort();
  43813. }
  43814. // Aborting is no longer a cancellation
  43815. strAbort = "abort";
  43816. // Install callbacks on deferreds
  43817. completeDeferred.add(s.complete);
  43818. jqXHR.done(s.success);
  43819. jqXHR.fail(s.error);
  43820. // Get transport
  43821. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  43822. // If no transport, we auto-abort
  43823. if (!transport) {
  43824. done(-1, "No Transport");
  43825. } else {
  43826. jqXHR.readyState = 1;
  43827. // Send global event
  43828. if (fireGlobals) {
  43829. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  43830. }
  43831. // If request was aborted inside ajaxSend, stop there
  43832. if (completed) {
  43833. return jqXHR;
  43834. }
  43835. // Timeout
  43836. if (s.async && s.timeout > 0) {
  43837. timeoutTimer = window.setTimeout(function () {
  43838. jqXHR.abort("timeout");
  43839. }, s.timeout);
  43840. }
  43841. try {
  43842. completed = false;
  43843. transport.send(requestHeaders, done);
  43844. } catch (e) {
  43845. // Rethrow post-completion exceptions
  43846. if (completed) {
  43847. throw e;
  43848. }
  43849. // Propagate others as results
  43850. done(-1, e);
  43851. }
  43852. }
  43853. // Callback for when everything is done
  43854. function done(status, nativeStatusText, responses, headers) {
  43855. var isSuccess,
  43856. success,
  43857. error,
  43858. response,
  43859. modified,
  43860. statusText = nativeStatusText;
  43861. // Ignore repeat invocations
  43862. if (completed) {
  43863. return;
  43864. }
  43865. completed = true;
  43866. // Clear timeout if it exists
  43867. if (timeoutTimer) {
  43868. window.clearTimeout(timeoutTimer);
  43869. }
  43870. // Dereference transport for early garbage collection
  43871. // (no matter how long the jqXHR object will be used)
  43872. transport = undefined;
  43873. // Cache response headers
  43874. responseHeadersString = headers || "";
  43875. // Set readyState
  43876. jqXHR.readyState = status > 0 ? 4 : 0;
  43877. // Determine if successful
  43878. isSuccess = status >= 200 && status < 300 || status === 304;
  43879. // Get response data
  43880. if (responses) {
  43881. response = ajaxHandleResponses(s, jqXHR, responses);
  43882. }
  43883. // Convert no matter what (that way responseXXX fields are always set)
  43884. response = ajaxConvert(s, response, jqXHR, isSuccess);
  43885. // If successful, handle type chaining
  43886. if (isSuccess) {
  43887. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43888. if (s.ifModified) {
  43889. modified = jqXHR.getResponseHeader("Last-Modified");
  43890. if (modified) {
  43891. jQuery.lastModified[cacheURL] = modified;
  43892. }
  43893. modified = jqXHR.getResponseHeader("etag");
  43894. if (modified) {
  43895. jQuery.etag[cacheURL] = modified;
  43896. }
  43897. }
  43898. // if no content
  43899. if (status === 204 || s.type === "HEAD") {
  43900. statusText = "nocontent";
  43901. // if not modified
  43902. } else if (status === 304) {
  43903. statusText = "notmodified";
  43904. // If we have data, let's convert it
  43905. } else {
  43906. statusText = response.state;
  43907. success = response.data;
  43908. error = response.error;
  43909. isSuccess = !error;
  43910. }
  43911. } else {
  43912. // Extract error from statusText and normalize for non-aborts
  43913. error = statusText;
  43914. if (status || !statusText) {
  43915. statusText = "error";
  43916. if (status < 0) {
  43917. status = 0;
  43918. }
  43919. }
  43920. }
  43921. // Set data for the fake xhr object
  43922. jqXHR.status = status;
  43923. jqXHR.statusText = (nativeStatusText || statusText) + "";
  43924. // Success/Error
  43925. if (isSuccess) {
  43926. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  43927. } else {
  43928. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  43929. }
  43930. // Status-dependent callbacks
  43931. jqXHR.statusCode(_statusCode);
  43932. _statusCode = undefined;
  43933. if (fireGlobals) {
  43934. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  43935. }
  43936. // Complete
  43937. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  43938. if (fireGlobals) {
  43939. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  43940. // Handle the global AJAX counter
  43941. if (! --jQuery.active) {
  43942. jQuery.event.trigger("ajaxStop");
  43943. }
  43944. }
  43945. }
  43946. return jqXHR;
  43947. },
  43948. getJSON: function getJSON(url, data, callback) {
  43949. return jQuery.get(url, data, callback, "json");
  43950. },
  43951. getScript: function getScript(url, callback) {
  43952. return jQuery.get(url, undefined, callback, "script");
  43953. }
  43954. });
  43955. jQuery.each(["get", "post"], function (i, method) {
  43956. jQuery[method] = function (url, data, callback, type) {
  43957. // Shift arguments if data argument was omitted
  43958. if (isFunction(data)) {
  43959. type = type || callback;
  43960. callback = data;
  43961. data = undefined;
  43962. }
  43963. // The url can be an options object (which then must have .url)
  43964. return jQuery.ajax(jQuery.extend({
  43965. url: url,
  43966. type: method,
  43967. dataType: type,
  43968. data: data,
  43969. success: callback
  43970. }, jQuery.isPlainObject(url) && url));
  43971. };
  43972. });
  43973. jQuery._evalUrl = function (url) {
  43974. return jQuery.ajax({
  43975. url: url,
  43976. // Make this explicit, since user can override this through ajaxSetup (#11264)
  43977. type: "GET",
  43978. dataType: "script",
  43979. cache: true,
  43980. async: false,
  43981. global: false,
  43982. "throws": true
  43983. });
  43984. };
  43985. jQuery.fn.extend({
  43986. wrapAll: function wrapAll(html) {
  43987. var wrap;
  43988. if (this[0]) {
  43989. if (isFunction(html)) {
  43990. html = html.call(this[0]);
  43991. }
  43992. // The elements to wrap the target around
  43993. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  43994. if (this[0].parentNode) {
  43995. wrap.insertBefore(this[0]);
  43996. }
  43997. wrap.map(function () {
  43998. var elem = this;
  43999. while (elem.firstElementChild) {
  44000. elem = elem.firstElementChild;
  44001. }
  44002. return elem;
  44003. }).append(this);
  44004. }
  44005. return this;
  44006. },
  44007. wrapInner: function wrapInner(html) {
  44008. if (isFunction(html)) {
  44009. return this.each(function (i) {
  44010. jQuery(this).wrapInner(html.call(this, i));
  44011. });
  44012. }
  44013. return this.each(function () {
  44014. var self = jQuery(this),
  44015. contents = self.contents();
  44016. if (contents.length) {
  44017. contents.wrapAll(html);
  44018. } else {
  44019. self.append(html);
  44020. }
  44021. });
  44022. },
  44023. wrap: function wrap(html) {
  44024. var htmlIsFunction = isFunction(html);
  44025. return this.each(function (i) {
  44026. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  44027. });
  44028. },
  44029. unwrap: function unwrap(selector) {
  44030. this.parent(selector).not("body").each(function () {
  44031. jQuery(this).replaceWith(this.childNodes);
  44032. });
  44033. return this;
  44034. }
  44035. });
  44036. jQuery.expr.pseudos.hidden = function (elem) {
  44037. return !jQuery.expr.pseudos.visible(elem);
  44038. };
  44039. jQuery.expr.pseudos.visible = function (elem) {
  44040. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  44041. };
  44042. jQuery.ajaxSettings.xhr = function () {
  44043. try {
  44044. return new window.XMLHttpRequest();
  44045. } catch (e) {}
  44046. };
  44047. var xhrSuccessStatus = {
  44048. // File protocol always yields status code 0, assume 200
  44049. 0: 200,
  44050. // Support: IE <=9 only
  44051. // #1450: sometimes IE returns 1223 when it should be 204
  44052. 1223: 204
  44053. },
  44054. xhrSupported = jQuery.ajaxSettings.xhr();
  44055. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  44056. support.ajax = xhrSupported = !!xhrSupported;
  44057. jQuery.ajaxTransport(function (options) {
  44058. var _callback, errorCallback;
  44059. // Cross domain only allowed if supported through XMLHttpRequest
  44060. if (support.cors || xhrSupported && !options.crossDomain) {
  44061. return {
  44062. send: function send(headers, complete) {
  44063. var i,
  44064. xhr = options.xhr();
  44065. xhr.open(options.type, options.url, options.async, options.username, options.password);
  44066. // Apply custom fields if provided
  44067. if (options.xhrFields) {
  44068. for (i in options.xhrFields) {
  44069. xhr[i] = options.xhrFields[i];
  44070. }
  44071. }
  44072. // Override mime type if needed
  44073. if (options.mimeType && xhr.overrideMimeType) {
  44074. xhr.overrideMimeType(options.mimeType);
  44075. }
  44076. // X-Requested-With header
  44077. // For cross-domain requests, seeing as conditions for a preflight are
  44078. // akin to a jigsaw puzzle, we simply never set it to be sure.
  44079. // (it can always be set on a per-request basis or even using ajaxSetup)
  44080. // For same-domain requests, won't change header if already provided.
  44081. if (!options.crossDomain && !headers["X-Requested-With"]) {
  44082. headers["X-Requested-With"] = "XMLHttpRequest";
  44083. }
  44084. // Set headers
  44085. for (i in headers) {
  44086. xhr.setRequestHeader(i, headers[i]);
  44087. }
  44088. // Callback
  44089. _callback = function callback(type) {
  44090. return function () {
  44091. if (_callback) {
  44092. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  44093. if (type === "abort") {
  44094. xhr.abort();
  44095. } else if (type === "error") {
  44096. // Support: IE <=9 only
  44097. // On a manual native abort, IE9 throws
  44098. // errors on any property access that is not readyState
  44099. if (typeof xhr.status !== "number") {
  44100. complete(0, "error");
  44101. } else {
  44102. complete(
  44103. // File: protocol always yields status 0; see #8605, #14207
  44104. xhr.status, xhr.statusText);
  44105. }
  44106. } else {
  44107. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44108. // Support: IE <=9 only
  44109. // IE9 has no XHR2 but throws on binary (trac-11426)
  44110. // For XHR2 non-text, let the caller handle it (gh-2498)
  44111. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44112. }
  44113. }
  44114. };
  44115. };
  44116. // Listen to events
  44117. xhr.onload = _callback();
  44118. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44119. // Support: IE 9 only
  44120. // Use onreadystatechange to replace onabort
  44121. // to handle uncaught aborts
  44122. if (xhr.onabort !== undefined) {
  44123. xhr.onabort = errorCallback;
  44124. } else {
  44125. xhr.onreadystatechange = function () {
  44126. // Check readyState before timeout as it changes
  44127. if (xhr.readyState === 4) {
  44128. // Allow onerror to be called first,
  44129. // but that will not handle a native abort
  44130. // Also, save errorCallback to a variable
  44131. // as xhr.onerror cannot be accessed
  44132. window.setTimeout(function () {
  44133. if (_callback) {
  44134. errorCallback();
  44135. }
  44136. });
  44137. }
  44138. };
  44139. }
  44140. // Create the abort callback
  44141. _callback = _callback("abort");
  44142. try {
  44143. // Do send the request (this may raise an exception)
  44144. xhr.send(options.hasContent && options.data || null);
  44145. } catch (e) {
  44146. // #14683: Only rethrow if this hasn't been notified as an error yet
  44147. if (_callback) {
  44148. throw e;
  44149. }
  44150. }
  44151. },
  44152. abort: function abort() {
  44153. if (_callback) {
  44154. _callback();
  44155. }
  44156. }
  44157. };
  44158. }
  44159. });
  44160. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44161. jQuery.ajaxPrefilter(function (s) {
  44162. if (s.crossDomain) {
  44163. s.contents.script = false;
  44164. }
  44165. });
  44166. // Install script dataType
  44167. jQuery.ajaxSetup({
  44168. accepts: {
  44169. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44170. },
  44171. contents: {
  44172. script: /\b(?:java|ecma)script\b/
  44173. },
  44174. converters: {
  44175. "text script": function textScript(text) {
  44176. jQuery.globalEval(text);
  44177. return text;
  44178. }
  44179. }
  44180. });
  44181. // Handle cache's special case and crossDomain
  44182. jQuery.ajaxPrefilter("script", function (s) {
  44183. if (s.cache === undefined) {
  44184. s.cache = false;
  44185. }
  44186. if (s.crossDomain) {
  44187. s.type = "GET";
  44188. }
  44189. });
  44190. // Bind script tag hack transport
  44191. jQuery.ajaxTransport("script", function (s) {
  44192. // This transport only deals with cross domain requests
  44193. if (s.crossDomain) {
  44194. var script, _callback2;
  44195. return {
  44196. send: function send(_, complete) {
  44197. script = jQuery("<script>").prop({
  44198. charset: s.scriptCharset,
  44199. src: s.url
  44200. }).on("load error", _callback2 = function callback(evt) {
  44201. script.remove();
  44202. _callback2 = null;
  44203. if (evt) {
  44204. complete(evt.type === "error" ? 404 : 200, evt.type);
  44205. }
  44206. });
  44207. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44208. document.head.appendChild(script[0]);
  44209. },
  44210. abort: function abort() {
  44211. if (_callback2) {
  44212. _callback2();
  44213. }
  44214. }
  44215. };
  44216. }
  44217. });
  44218. var oldCallbacks = [],
  44219. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44220. // Default jsonp settings
  44221. jQuery.ajaxSetup({
  44222. jsonp: "callback",
  44223. jsonpCallback: function jsonpCallback() {
  44224. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44225. this[callback] = true;
  44226. return callback;
  44227. }
  44228. });
  44229. // Detect, normalize options and install callbacks for jsonp requests
  44230. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44231. var callbackName,
  44232. overwritten,
  44233. responseContainer,
  44234. 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");
  44235. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44236. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44237. // Get callback name, remembering preexisting value associated with it
  44238. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44239. // Insert callback into url or form data
  44240. if (jsonProp) {
  44241. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44242. } else if (s.jsonp !== false) {
  44243. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44244. }
  44245. // Use data converter to retrieve json after script execution
  44246. s.converters["script json"] = function () {
  44247. if (!responseContainer) {
  44248. jQuery.error(callbackName + " was not called");
  44249. }
  44250. return responseContainer[0];
  44251. };
  44252. // Force json dataType
  44253. s.dataTypes[0] = "json";
  44254. // Install callback
  44255. overwritten = window[callbackName];
  44256. window[callbackName] = function () {
  44257. responseContainer = arguments;
  44258. };
  44259. // Clean-up function (fires after converters)
  44260. jqXHR.always(function () {
  44261. // If previous value didn't exist - remove it
  44262. if (overwritten === undefined) {
  44263. jQuery(window).removeProp(callbackName);
  44264. // Otherwise restore preexisting value
  44265. } else {
  44266. window[callbackName] = overwritten;
  44267. }
  44268. // Save back as free
  44269. if (s[callbackName]) {
  44270. // Make sure that re-using the options doesn't screw things around
  44271. s.jsonpCallback = originalSettings.jsonpCallback;
  44272. // Save the callback name for future use
  44273. oldCallbacks.push(callbackName);
  44274. }
  44275. // Call if it was a function and we have a response
  44276. if (responseContainer && isFunction(overwritten)) {
  44277. overwritten(responseContainer[0]);
  44278. }
  44279. responseContainer = overwritten = undefined;
  44280. });
  44281. // Delegate to script
  44282. return "script";
  44283. }
  44284. });
  44285. // Support: Safari 8 only
  44286. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44287. // collapse sibling forms: the second one becomes a child of the first one.
  44288. // Because of that, this security measure has to be disabled in Safari 8.
  44289. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44290. support.createHTMLDocument = function () {
  44291. var body = document.implementation.createHTMLDocument("").body;
  44292. body.innerHTML = "<form></form><form></form>";
  44293. return body.childNodes.length === 2;
  44294. }();
  44295. // Argument "data" should be string of html
  44296. // context (optional): If specified, the fragment will be created in this context,
  44297. // defaults to document
  44298. // keepScripts (optional): If true, will include scripts passed in the html string
  44299. jQuery.parseHTML = function (data, context, keepScripts) {
  44300. if (typeof data !== "string") {
  44301. return [];
  44302. }
  44303. if (typeof context === "boolean") {
  44304. keepScripts = context;
  44305. context = false;
  44306. }
  44307. var base, parsed, scripts;
  44308. if (!context) {
  44309. // Stop scripts or inline event handlers from being executed immediately
  44310. // by using document.implementation
  44311. if (support.createHTMLDocument) {
  44312. context = document.implementation.createHTMLDocument("");
  44313. // Set the base href for the created document
  44314. // so any parsed elements with URLs
  44315. // are based on the document's URL (gh-2965)
  44316. base = context.createElement("base");
  44317. base.href = document.location.href;
  44318. context.head.appendChild(base);
  44319. } else {
  44320. context = document;
  44321. }
  44322. }
  44323. parsed = rsingleTag.exec(data);
  44324. scripts = !keepScripts && [];
  44325. // Single tag
  44326. if (parsed) {
  44327. return [context.createElement(parsed[1])];
  44328. }
  44329. parsed = buildFragment([data], context, scripts);
  44330. if (scripts && scripts.length) {
  44331. jQuery(scripts).remove();
  44332. }
  44333. return jQuery.merge([], parsed.childNodes);
  44334. };
  44335. /**
  44336. * Load a url into a page
  44337. */
  44338. jQuery.fn.load = function (url, params, callback) {
  44339. var selector,
  44340. type,
  44341. response,
  44342. self = this,
  44343. off = url.indexOf(" ");
  44344. if (off > -1) {
  44345. selector = stripAndCollapse(url.slice(off));
  44346. url = url.slice(0, off);
  44347. }
  44348. // If it's a function
  44349. if (isFunction(params)) {
  44350. // We assume that it's the callback
  44351. callback = params;
  44352. params = undefined;
  44353. // Otherwise, build a param string
  44354. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44355. type = "POST";
  44356. }
  44357. // If we have elements to modify, make the request
  44358. if (self.length > 0) {
  44359. jQuery.ajax({
  44360. url: url,
  44361. // If "type" variable is undefined, then "GET" method will be used.
  44362. // Make value of this field explicit since
  44363. // user can override it through ajaxSetup method
  44364. type: type || "GET",
  44365. dataType: "html",
  44366. data: params
  44367. }).done(function (responseText) {
  44368. // Save response for use in complete callback
  44369. response = arguments;
  44370. self.html(selector ?
  44371. // If a selector was specified, locate the right elements in a dummy div
  44372. // Exclude scripts to avoid IE 'Permission Denied' errors
  44373. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44374. // Otherwise use the full result
  44375. responseText);
  44376. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44377. // but they are ignored because response was set above.
  44378. // If it fails, this function gets "jqXHR", "status", "error"
  44379. }).always(callback && function (jqXHR, status) {
  44380. self.each(function () {
  44381. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44382. });
  44383. });
  44384. }
  44385. return this;
  44386. };
  44387. // Attach a bunch of functions for handling common AJAX events
  44388. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44389. jQuery.fn[type] = function (fn) {
  44390. return this.on(type, fn);
  44391. };
  44392. });
  44393. jQuery.expr.pseudos.animated = function (elem) {
  44394. return jQuery.grep(jQuery.timers, function (fn) {
  44395. return elem === fn.elem;
  44396. }).length;
  44397. };
  44398. jQuery.offset = {
  44399. setOffset: function setOffset(elem, options, i) {
  44400. var curPosition,
  44401. curLeft,
  44402. curCSSTop,
  44403. curTop,
  44404. curOffset,
  44405. curCSSLeft,
  44406. calculatePosition,
  44407. position = jQuery.css(elem, "position"),
  44408. curElem = jQuery(elem),
  44409. props = {};
  44410. // Set position first, in-case top/left are set even on static elem
  44411. if (position === "static") {
  44412. elem.style.position = "relative";
  44413. }
  44414. curOffset = curElem.offset();
  44415. curCSSTop = jQuery.css(elem, "top");
  44416. curCSSLeft = jQuery.css(elem, "left");
  44417. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44418. // Need to be able to calculate position if either
  44419. // top or left is auto and position is either absolute or fixed
  44420. if (calculatePosition) {
  44421. curPosition = curElem.position();
  44422. curTop = curPosition.top;
  44423. curLeft = curPosition.left;
  44424. } else {
  44425. curTop = parseFloat(curCSSTop) || 0;
  44426. curLeft = parseFloat(curCSSLeft) || 0;
  44427. }
  44428. if (isFunction(options)) {
  44429. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44430. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44431. }
  44432. if (options.top != null) {
  44433. props.top = options.top - curOffset.top + curTop;
  44434. }
  44435. if (options.left != null) {
  44436. props.left = options.left - curOffset.left + curLeft;
  44437. }
  44438. if ("using" in options) {
  44439. options.using.call(elem, props);
  44440. } else {
  44441. curElem.css(props);
  44442. }
  44443. }
  44444. };
  44445. jQuery.fn.extend({
  44446. // offset() relates an element's border box to the document origin
  44447. offset: function offset(options) {
  44448. // Preserve chaining for setter
  44449. if (arguments.length) {
  44450. return options === undefined ? this : this.each(function (i) {
  44451. jQuery.offset.setOffset(this, options, i);
  44452. });
  44453. }
  44454. var rect,
  44455. win,
  44456. elem = this[0];
  44457. if (!elem) {
  44458. return;
  44459. }
  44460. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44461. // Support: IE <=11 only
  44462. // Running getBoundingClientRect on a
  44463. // disconnected node in IE throws an error
  44464. if (!elem.getClientRects().length) {
  44465. return { top: 0, left: 0 };
  44466. }
  44467. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44468. rect = elem.getBoundingClientRect();
  44469. win = elem.ownerDocument.defaultView;
  44470. return {
  44471. top: rect.top + win.pageYOffset,
  44472. left: rect.left + win.pageXOffset
  44473. };
  44474. },
  44475. // position() relates an element's margin box to its offset parent's padding box
  44476. // This corresponds to the behavior of CSS absolute positioning
  44477. position: function position() {
  44478. if (!this[0]) {
  44479. return;
  44480. }
  44481. var offsetParent,
  44482. offset,
  44483. doc,
  44484. elem = this[0],
  44485. parentOffset = { top: 0, left: 0 };
  44486. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44487. if (jQuery.css(elem, "position") === "fixed") {
  44488. // Assume position:fixed implies availability of getBoundingClientRect
  44489. offset = elem.getBoundingClientRect();
  44490. } else {
  44491. offset = this.offset();
  44492. // Account for the *real* offset parent, which can be the document or its root element
  44493. // when a statically positioned element is identified
  44494. doc = elem.ownerDocument;
  44495. offsetParent = elem.offsetParent || doc.documentElement;
  44496. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44497. offsetParent = offsetParent.parentNode;
  44498. }
  44499. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44500. // Incorporate borders into its offset, since they are outside its content origin
  44501. parentOffset = jQuery(offsetParent).offset();
  44502. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  44503. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  44504. }
  44505. }
  44506. // Subtract parent offsets and element margins
  44507. return {
  44508. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  44509. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  44510. };
  44511. },
  44512. // This method will return documentElement in the following cases:
  44513. // 1) For the element inside the iframe without offsetParent, this method will return
  44514. // documentElement of the parent window
  44515. // 2) For the hidden or detached element
  44516. // 3) For body or html element, i.e. in case of the html node - it will return itself
  44517. //
  44518. // but those exceptions were never presented as a real life use-cases
  44519. // and might be considered as more preferable results.
  44520. //
  44521. // This logic, however, is not guaranteed and can change at any point in the future
  44522. offsetParent: function offsetParent() {
  44523. return this.map(function () {
  44524. var offsetParent = this.offsetParent;
  44525. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  44526. offsetParent = offsetParent.offsetParent;
  44527. }
  44528. return offsetParent || documentElement;
  44529. });
  44530. }
  44531. });
  44532. // Create scrollLeft and scrollTop methods
  44533. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  44534. var top = "pageYOffset" === prop;
  44535. jQuery.fn[method] = function (val) {
  44536. return access(this, function (elem, method, val) {
  44537. // Coalesce documents and windows
  44538. var win;
  44539. if (isWindow(elem)) {
  44540. win = elem;
  44541. } else if (elem.nodeType === 9) {
  44542. win = elem.defaultView;
  44543. }
  44544. if (val === undefined) {
  44545. return win ? win[prop] : elem[method];
  44546. }
  44547. if (win) {
  44548. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  44549. } else {
  44550. elem[method] = val;
  44551. }
  44552. }, method, val, arguments.length);
  44553. };
  44554. });
  44555. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  44556. // Add the top/left cssHooks using jQuery.fn.position
  44557. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  44558. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  44559. // getComputedStyle returns percent when specified for top/left/bottom/right;
  44560. // rather than make the css module depend on the offset module, just check for it here
  44561. jQuery.each(["top", "left"], function (i, prop) {
  44562. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  44563. if (computed) {
  44564. computed = curCSS(elem, prop);
  44565. // If curCSS returns percentage, fallback to offset
  44566. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  44567. }
  44568. });
  44569. });
  44570. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  44571. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  44572. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  44573. // Margin is only for outerHeight, outerWidth
  44574. jQuery.fn[funcName] = function (margin, value) {
  44575. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  44576. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  44577. return access(this, function (elem, type, value) {
  44578. var doc;
  44579. if (isWindow(elem)) {
  44580. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  44581. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  44582. }
  44583. // Get document width or height
  44584. if (elem.nodeType === 9) {
  44585. doc = elem.documentElement;
  44586. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  44587. // whichever is greatest
  44588. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  44589. }
  44590. return value === undefined ?
  44591. // Get width or height on the element, requesting but not forcing parseFloat
  44592. jQuery.css(elem, type, extra) :
  44593. // Set width or height on the element
  44594. jQuery.style(elem, type, value, extra);
  44595. }, type, chainable ? margin : undefined, chainable);
  44596. };
  44597. });
  44598. });
  44599. 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) {
  44600. // Handle event binding
  44601. jQuery.fn[name] = function (data, fn) {
  44602. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  44603. };
  44604. });
  44605. jQuery.fn.extend({
  44606. hover: function hover(fnOver, fnOut) {
  44607. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  44608. }
  44609. });
  44610. jQuery.fn.extend({
  44611. bind: function bind(types, data, fn) {
  44612. return this.on(types, null, data, fn);
  44613. },
  44614. unbind: function unbind(types, fn) {
  44615. return this.off(types, null, fn);
  44616. },
  44617. delegate: function delegate(selector, types, data, fn) {
  44618. return this.on(types, selector, data, fn);
  44619. },
  44620. undelegate: function undelegate(selector, types, fn) {
  44621. // ( namespace ) or ( selector, types [, fn] )
  44622. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  44623. }
  44624. });
  44625. // Bind a function to a context, optionally partially applying any
  44626. // arguments.
  44627. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  44628. // However, it is not slated for removal any time soon
  44629. jQuery.proxy = function (fn, context) {
  44630. var tmp, args, proxy;
  44631. if (typeof context === "string") {
  44632. tmp = fn[context];
  44633. context = fn;
  44634. fn = tmp;
  44635. }
  44636. // Quick check to determine if target is callable, in the spec
  44637. // this throws a TypeError, but we will just return undefined.
  44638. if (!isFunction(fn)) {
  44639. return undefined;
  44640. }
  44641. // Simulated bind
  44642. args = _slice.call(arguments, 2);
  44643. proxy = function proxy() {
  44644. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  44645. };
  44646. // Set the guid of unique handler to the same of original handler, so it can be removed
  44647. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  44648. return proxy;
  44649. };
  44650. jQuery.holdReady = function (hold) {
  44651. if (hold) {
  44652. jQuery.readyWait++;
  44653. } else {
  44654. jQuery.ready(true);
  44655. }
  44656. };
  44657. jQuery.isArray = Array.isArray;
  44658. jQuery.parseJSON = JSON.parse;
  44659. jQuery.nodeName = nodeName;
  44660. jQuery.isFunction = isFunction;
  44661. jQuery.isWindow = isWindow;
  44662. jQuery.camelCase = camelCase;
  44663. jQuery.type = toType;
  44664. jQuery.now = Date.now;
  44665. jQuery.isNumeric = function (obj) {
  44666. // As of jQuery 3.0, isNumeric is limited to
  44667. // strings and numbers (primitives or objects)
  44668. // that can be coerced to finite numbers (gh-2662)
  44669. var type = jQuery.type(obj);
  44670. return (type === "number" || type === "string") &&
  44671. // parseFloat NaNs numeric-cast false positives ("")
  44672. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  44673. // subtraction forces infinities to NaN
  44674. !isNaN(obj - parseFloat(obj));
  44675. };
  44676. // Register as a named AMD module, since jQuery can be concatenated with other
  44677. // files that may use define, but not via a proper concatenation script that
  44678. // understands anonymous AMD modules. A named AMD is safest and most robust
  44679. // way to register. Lowercase jquery is used because AMD module names are
  44680. // derived from file names, and jQuery is normally delivered in a lowercase
  44681. // file name. Do this after creating the global so that if an AMD module wants
  44682. // to call noConflict to hide this version of jQuery, it will work.
  44683. // Note that for maximum portability, libraries that are not jQuery should
  44684. // declare themselves as anonymous modules, and avoid setting a global if an
  44685. // AMD loader is present. jQuery is a special case. For more information, see
  44686. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  44687. if (true) {
  44688. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  44689. return jQuery;
  44690. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  44691. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44692. }
  44693. var
  44694. // Map over jQuery in case of overwrite
  44695. _jQuery = window.jQuery,
  44696. // Map over the $ in case of overwrite
  44697. _$ = window.$;
  44698. jQuery.noConflict = function (deep) {
  44699. if (window.$ === jQuery) {
  44700. window.$ = _$;
  44701. }
  44702. if (deep && window.jQuery === jQuery) {
  44703. window.jQuery = _jQuery;
  44704. }
  44705. return jQuery;
  44706. };
  44707. // Expose jQuery and $ identifiers, even in AMD
  44708. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  44709. // and CommonJS for browser emulators (#13566)
  44710. if (!noGlobal) {
  44711. window.jQuery = window.$ = jQuery;
  44712. }
  44713. return jQuery;
  44714. });
  44715. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  44716. /***/ }),
  44717. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  44718. /*!********************************************************!*\
  44719. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  44720. \********************************************************/
  44721. /*! no static exports found */
  44722. /***/ (function(module, exports, __webpack_require__) {
  44723. "use strict";
  44724. Object.defineProperty(exports, "__esModule", {
  44725. value: true
  44726. });
  44727. var LanguageService = /** @class */function () {
  44728. function LanguageService(lsKey, defaultLang) {
  44729. if (defaultLang === void 0) {
  44730. defaultLang = 'pt';
  44731. }
  44732. this.lsKey = lsKey;
  44733. this.defaultLang = defaultLang;
  44734. this.listeners = [];
  44735. this.document = document;
  44736. this.setupListener();
  44737. }
  44738. LanguageService.prototype.setupListener = function () {
  44739. var _this = this;
  44740. if (this.document !== null) {
  44741. this.document.addEventListener("storage", function (event) {
  44742. var e = event;
  44743. if (e.key === _this.lsKey) {
  44744. _this.listeners.forEach(function (l) {
  44745. return l();
  44746. });
  44747. }
  44748. });
  44749. }
  44750. };
  44751. LanguageService.prototype.getLang = function () {
  44752. var lang = localStorage.getItem(this.lsKey);
  44753. if (lang === null || lang === undefined) {
  44754. console.warn("Internal Error: User language information has not been set. Returning default...");
  44755. return this.getDefaultLang();
  44756. }
  44757. return lang;
  44758. };
  44759. LanguageService.prototype.getDefaultLang = function () {
  44760. return this.defaultLang;
  44761. };
  44762. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  44763. this.listeners.push(listener);
  44764. };
  44765. return LanguageService;
  44766. }();
  44767. exports.LanguageService = LanguageService;
  44768. /***/ }),
  44769. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  44770. /*!************************************************************!*\
  44771. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  44772. \************************************************************/
  44773. /*! no static exports found */
  44774. /***/ (function(module, exports, __webpack_require__) {
  44775. "use strict";
  44776. Object.defineProperty(exports, "__esModule", {
  44777. value: true
  44778. });
  44779. var LanguageServiceNoLS = /** @class */function () {
  44780. function LanguageServiceNoLS(lang) {
  44781. this.lang = lang;
  44782. this.listeners = [];
  44783. }
  44784. LanguageServiceNoLS.prototype.setupListener = function () {};
  44785. LanguageServiceNoLS.prototype.notifyChange = function () {
  44786. this.listeners.forEach(function (l) {
  44787. return l();
  44788. });
  44789. };
  44790. LanguageServiceNoLS.prototype.setLang = function (lang) {
  44791. this.lang = lang;
  44792. this.notifyChange();
  44793. };
  44794. LanguageServiceNoLS.prototype.getLang = function () {
  44795. return this.lang;
  44796. };
  44797. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  44798. return this.lang;
  44799. };
  44800. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  44801. this.listeners.push(listener);
  44802. };
  44803. return LanguageServiceNoLS;
  44804. }();
  44805. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  44806. /***/ }),
  44807. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  44808. /*!*********************************************************!*\
  44809. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  44810. \*********************************************************/
  44811. /*! no static exports found */
  44812. /***/ (function(module, exports, __webpack_require__) {
  44813. "use strict";
  44814. Object.defineProperty(exports, "__esModule", {
  44815. value: true
  44816. });
  44817. exports.LocalizedStrings = undefined;
  44818. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44819. var LocalizedStrings = /** @class */function () {
  44820. function LocalizedStrings(service, i18nData, listenToChange) {
  44821. if (listenToChange === void 0) {
  44822. listenToChange = false;
  44823. }
  44824. var _this = this;
  44825. this.service = service;
  44826. this.i18nData = i18nData;
  44827. this.listenToChange = listenToChange;
  44828. this.document = document;
  44829. if (this.listenToChange) {
  44830. service.registerLanguageChangeListener(function () {
  44831. _this.updateTagText();
  44832. });
  44833. }
  44834. }
  44835. LocalizedStrings.prototype.getString = function (id, type) {
  44836. var i18nObj = this.i18nData[this.service.getLang()];
  44837. if (!!!i18nObj) {
  44838. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  44839. i18nObj = this.i18nData[this.service.getDefaultLang()];
  44840. }
  44841. if (!!!i18nObj[type]) {
  44842. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  44843. } else if (!!!i18nObj[type][id]) {
  44844. return "{MISSING_I18N_IDENTIFIER}";
  44845. } else {
  44846. return i18nObj[type][id];
  44847. }
  44848. };
  44849. LocalizedStrings.prototype.getOR = function () {
  44850. return this.getUI('join_or');
  44851. };
  44852. LocalizedStrings.prototype.getError = function (id, context) {
  44853. if (context === void 0) {
  44854. context = [];
  44855. }
  44856. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  44857. return this.processString(text, context);
  44858. };
  44859. LocalizedStrings.prototype.getMessage = function (id, context) {
  44860. if (context === void 0) {
  44861. context = [];
  44862. }
  44863. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  44864. return this.processString(text, context);
  44865. };
  44866. LocalizedStrings.prototype.getUI = function (id, context) {
  44867. if (context === void 0) {
  44868. context = [];
  44869. }
  44870. var text = this.getString(id, _StringTypes.StringTypes.UI);
  44871. return this.processString(text, context);
  44872. };
  44873. LocalizedStrings.prototype.processString = function (text, context) {
  44874. for (var i = 0; i < context.length; i++) {
  44875. var v = context[i];
  44876. text = text.replace('\$' + i, v);
  44877. }
  44878. return text;
  44879. };
  44880. LocalizedStrings.prototype.updateTagText = function (func) {
  44881. var _this = this;
  44882. if (func === void 0) {
  44883. func = null;
  44884. }
  44885. if (this.document !== null) {
  44886. var list = this.document.querySelectorAll("data.i18n");
  44887. list.forEach(function (node) {
  44888. if (func === null) {
  44889. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  44890. } else {
  44891. node.innerHTML = func(node.getAttribute("value"));
  44892. }
  44893. });
  44894. }
  44895. };
  44896. LocalizedStrings.prototype.processTagTex = function (text) {
  44897. if (text === null) {
  44898. return "<Invalid i18n identifier>";
  44899. }
  44900. var opts = text.split(':');
  44901. var type = opts[0].toLowerCase();
  44902. var id = opts[1];
  44903. if (_StringTypes.StringTypes.ERROR === type) {
  44904. return this.getError(id);
  44905. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  44906. return this.getMessage(id);
  44907. } else if (_StringTypes.StringTypes.UI === type) {
  44908. return this.getUI(id);
  44909. } else {
  44910. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  44911. return this.getString(id, type);
  44912. }
  44913. };
  44914. return LocalizedStrings;
  44915. }();
  44916. exports.LocalizedStrings = LocalizedStrings;
  44917. /***/ }),
  44918. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  44919. /*!****************************************************!*\
  44920. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  44921. \****************************************************/
  44922. /*! no static exports found */
  44923. /***/ (function(module, exports, __webpack_require__) {
  44924. "use strict";
  44925. Object.defineProperty(exports, "__esModule", {
  44926. value: true
  44927. });
  44928. var StringTypes = exports.StringTypes = undefined;
  44929. (function (StringTypes) {
  44930. StringTypes["ERROR"] = "error";
  44931. StringTypes["MESSAGE"] = "message";
  44932. StringTypes["UI"] = "ui";
  44933. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  44934. /***/ }),
  44935. /***/ "./node_modules/line-i18n/dist/index.js":
  44936. /*!**********************************************!*\
  44937. !*** ./node_modules/line-i18n/dist/index.js ***!
  44938. \**********************************************/
  44939. /*! no static exports found */
  44940. /***/ (function(module, exports, __webpack_require__) {
  44941. "use strict";
  44942. Object.defineProperty(exports, "__esModule", {
  44943. value: true
  44944. });
  44945. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  44946. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  44947. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44948. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  44949. exports.default = {
  44950. LanguageService: _LanguageService.LanguageService,
  44951. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  44952. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  44953. StringTypes: _StringTypes.StringTypes
  44954. };
  44955. /***/ }),
  44956. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  44957. /*!***************************************************!*\
  44958. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  44959. \***************************************************/
  44960. /*! no static exports found */
  44961. /***/ (function(module, exports, __webpack_require__) {
  44962. "use strict";
  44963. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  44964. * DEVELOPED BY
  44965. * GIL LOPES BUENO
  44966. * gilbueno.mail@gmail.com
  44967. *
  44968. * WORKS WITH:
  44969. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  44970. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  44971. *
  44972. * FORK:
  44973. * https://github.com/melanke/Watch.JS
  44974. *
  44975. * LICENSE: MIT
  44976. */
  44977. 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; };
  44978. (function (factory) {
  44979. if (( false ? undefined : _typeof(exports)) === 'object') {
  44980. // Node. Does not work with strict CommonJS, but
  44981. // only CommonJS-like enviroments that support module.exports,
  44982. // like Node.
  44983. module.exports = factory();
  44984. } else if (true) {
  44985. // AMD. Register as an anonymous module.
  44986. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  44987. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  44988. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  44989. __WEBPACK_AMD_DEFINE_FACTORY__),
  44990. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44991. } else {}
  44992. })(function () {
  44993. var WatchJS = {
  44994. noMore: false, // use WatchJS.suspend(obj) instead
  44995. useDirtyCheck: false, // use only dirty checking to track changes.
  44996. preserveExistingSetters: false
  44997. },
  44998. lengthsubjects = [];
  44999. var dirtyChecklist = [];
  45000. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  45001. var supportDefineProperty = false;
  45002. try {
  45003. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  45004. } catch (ex) {/* not supported */}
  45005. var isFunction = function isFunction(functionToCheck) {
  45006. var getType = {};
  45007. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  45008. };
  45009. var isInt = function isInt(x) {
  45010. return x % 1 === 0;
  45011. };
  45012. var isArray = function isArray(obj) {
  45013. return Object.prototype.toString.call(obj) === '[object Array]';
  45014. };
  45015. var isObject = function isObject(obj) {
  45016. return {}.toString.apply(obj) === '[object Object]';
  45017. };
  45018. var getObjDiff = function getObjDiff(a, b) {
  45019. var aplus = [],
  45020. bplus = [];
  45021. if (!(typeof a == "string") && !(typeof b == "string")) {
  45022. if (isArray(a) && b) {
  45023. for (var i = 0; i < a.length; i++) {
  45024. if (b[i] === undefined) aplus.push(i);
  45025. }
  45026. } else {
  45027. for (var i in a) {
  45028. if (a.hasOwnProperty(i)) {
  45029. if (b && !b.hasOwnProperty(i)) {
  45030. aplus.push(i);
  45031. }
  45032. }
  45033. }
  45034. }
  45035. if (isArray(b) && a) {
  45036. for (var j = 0; j < b.length; j++) {
  45037. if (a[j] === undefined) bplus.push(j);
  45038. }
  45039. } else {
  45040. for (var j in b) {
  45041. if (b.hasOwnProperty(j)) {
  45042. if (a && !a.hasOwnProperty(j)) {
  45043. bplus.push(j);
  45044. }
  45045. }
  45046. }
  45047. }
  45048. }
  45049. return {
  45050. added: aplus,
  45051. removed: bplus
  45052. };
  45053. };
  45054. var clone = function clone(obj) {
  45055. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  45056. return obj;
  45057. }
  45058. var copy = obj.constructor();
  45059. for (var attr in obj) {
  45060. copy[attr] = obj[attr];
  45061. }
  45062. return copy;
  45063. };
  45064. var getExistingSetter = function getExistingSetter(obj, propName) {
  45065. if (WatchJS.preserveExistingSetters) {
  45066. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  45067. return existing.set;
  45068. }
  45069. return undefined;
  45070. };
  45071. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  45072. try {
  45073. var existingSetter = getExistingSetter(obj, propName);
  45074. Object.defineProperty(obj, propName, {
  45075. get: getter,
  45076. set: function set(value) {
  45077. setter.call(this, value, true); // coalesce changes
  45078. if (existingSetter) {
  45079. existingSetter(value);
  45080. }
  45081. },
  45082. enumerable: true,
  45083. configurable: true
  45084. });
  45085. } catch (e1) {
  45086. try {
  45087. Object.prototype.__defineGetter__.call(obj, propName, getter);
  45088. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  45089. setter.call(this, value, true); // coalesce changes
  45090. });
  45091. } catch (e2) {
  45092. observeDirtyChanges(obj, propName, setter);
  45093. //throw new Error("watchJS error: browser not supported :/")
  45094. }
  45095. }
  45096. };
  45097. var defineProp = function defineProp(obj, propName, value) {
  45098. try {
  45099. Object.defineProperty(obj, propName, {
  45100. enumerable: false,
  45101. configurable: true,
  45102. writable: false,
  45103. value: value
  45104. });
  45105. } catch (error) {
  45106. obj[propName] = value;
  45107. }
  45108. };
  45109. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45110. dirtyChecklist[dirtyChecklist.length] = {
  45111. prop: propName,
  45112. object: obj,
  45113. orig: clone(obj[propName]),
  45114. callback: setter
  45115. };
  45116. };
  45117. var watch = function watch() {
  45118. if (isFunction(arguments[1])) {
  45119. watchAll.apply(this, arguments);
  45120. } else if (isArray(arguments[1])) {
  45121. watchMany.apply(this, arguments);
  45122. } else {
  45123. watchOne.apply(this, arguments);
  45124. }
  45125. };
  45126. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45127. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45128. //accepts only objects and array (not string)
  45129. return;
  45130. }
  45131. if (isArray(obj)) {
  45132. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45133. if (level === undefined || level > 0) {
  45134. for (var prop = 0; prop < obj.length; prop++) {
  45135. // watch objects in array
  45136. watchAll(obj[prop], watcher, level, addNRemove);
  45137. }
  45138. }
  45139. } else {
  45140. var prop,
  45141. props = [];
  45142. for (prop in obj) {
  45143. //for each attribute if obj is an object
  45144. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45145. continue;
  45146. }
  45147. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45148. props.push(prop); //put in the props
  45149. }
  45150. }
  45151. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45152. }
  45153. if (addNRemove) {
  45154. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45155. }
  45156. };
  45157. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45158. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45159. //accepts only objects and array (not string)
  45160. return;
  45161. }
  45162. for (var i = 0; i < props.length; i++) {
  45163. //watch each property
  45164. var prop = props[i];
  45165. watchOne(obj, prop, watcher, level, addNRemove);
  45166. }
  45167. };
  45168. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45169. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45170. //accepts only objects and array (not string)
  45171. return;
  45172. }
  45173. if (isFunction(obj[prop])) {
  45174. //dont watch if it is a function
  45175. return;
  45176. }
  45177. if (obj[prop] != null && (level === undefined || level > 0)) {
  45178. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45179. }
  45180. defineWatcher(obj, prop, watcher, level);
  45181. if (addNRemove && (level === undefined || level > 0)) {
  45182. pushToLengthSubjects(obj, prop, watcher, level);
  45183. }
  45184. };
  45185. var unwatch = function unwatch() {
  45186. if (isFunction(arguments[1])) {
  45187. unwatchAll.apply(this, arguments);
  45188. } else if (isArray(arguments[1])) {
  45189. unwatchMany.apply(this, arguments);
  45190. } else {
  45191. unwatchOne.apply(this, arguments);
  45192. }
  45193. };
  45194. var unwatchAll = function unwatchAll(obj, watcher) {
  45195. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45196. //accepts only objects and array (not string)
  45197. return;
  45198. }
  45199. if (isArray(obj)) {
  45200. var props = ['__watchall__'];
  45201. for (var prop = 0; prop < obj.length; prop++) {
  45202. //for each item if obj is an array
  45203. props.push(prop); //put in the props
  45204. }
  45205. unwatchMany(obj, props, watcher); //watch all itens of the props
  45206. } else {
  45207. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45208. var props = [];
  45209. for (var prop2 in obj2) {
  45210. //for each attribute if obj is an object
  45211. if (obj2.hasOwnProperty(prop2)) {
  45212. if (obj2[prop2] instanceof Object) {
  45213. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45214. } else {
  45215. props.push(prop2); //put in the props
  45216. }
  45217. }
  45218. }
  45219. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45220. };
  45221. unwatchPropsInObject(obj);
  45222. }
  45223. };
  45224. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45225. for (var prop2 in props) {
  45226. //watch each attribute of "props" if is an object
  45227. if (props.hasOwnProperty(prop2)) {
  45228. unwatchOne(obj, props[prop2], watcher);
  45229. }
  45230. }
  45231. };
  45232. var timeouts = [],
  45233. timerID = null;
  45234. function clearTimerID() {
  45235. timerID = null;
  45236. for (var i = 0; i < timeouts.length; i++) {
  45237. timeouts[i]();
  45238. }
  45239. timeouts.length = 0;
  45240. }
  45241. var getTimerID = function getTimerID() {
  45242. if (!timerID) {
  45243. timerID = setTimeout(clearTimerID);
  45244. }
  45245. return timerID;
  45246. };
  45247. var registerTimeout = function registerTimeout(fn) {
  45248. // register function to be called on timeout
  45249. if (timerID == null) getTimerID();
  45250. timeouts[timeouts.length] = fn;
  45251. };
  45252. // Track changes made to an array, object or an object's property
  45253. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45254. // Syntax:
  45255. // trackChange(obj, callback, recursive, addNRemove)
  45256. // trackChange(obj, prop, callback, recursive, addNRemove)
  45257. var trackChange = function trackChange() {
  45258. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45259. fn.apply(this, arguments);
  45260. };
  45261. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45262. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45263. var change = null,
  45264. lastTimerID = -1;
  45265. var isArr = isArray(obj);
  45266. var level,
  45267. fn = function fn(prop, action, newValue, oldValue) {
  45268. var timerID = getTimerID();
  45269. if (lastTimerID !== timerID) {
  45270. // check if timer has changed since last update
  45271. lastTimerID = timerID;
  45272. change = {
  45273. type: 'update'
  45274. };
  45275. change['value'] = obj;
  45276. change['splices'] = null;
  45277. registerTimeout(function () {
  45278. callback.call(this, change);
  45279. change = null;
  45280. });
  45281. }
  45282. // create splices for array changes
  45283. if (isArr && obj === this && change !== null) {
  45284. if (action === 'pop' || action === 'shift') {
  45285. newValue = [];
  45286. oldValue = [oldValue];
  45287. } else if (action === 'push' || action === 'unshift') {
  45288. newValue = [newValue];
  45289. oldValue = [];
  45290. } else if (action !== 'splice') {
  45291. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45292. }
  45293. if (!change.splices) change.splices = [];
  45294. change.splices[change.splices.length] = {
  45295. index: prop,
  45296. deleteCount: oldValue ? oldValue.length : 0,
  45297. addedCount: newValue ? newValue.length : 0,
  45298. added: newValue,
  45299. deleted: oldValue
  45300. };
  45301. }
  45302. };
  45303. level = recursive == true ? undefined : 0;
  45304. watchAll(obj, fn, level, addNRemove);
  45305. };
  45306. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45307. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45308. if (obj && prop) {
  45309. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45310. var change = {
  45311. type: 'update'
  45312. };
  45313. change['value'] = newvalue;
  45314. change['oldvalue'] = oldvalue;
  45315. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45316. trackObject(newvalue, callback, recursive, addNRemove);
  45317. }
  45318. callback.call(this, change);
  45319. }, 0);
  45320. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45321. trackObject(obj[prop], callback, recursive, addNRemove);
  45322. }
  45323. }
  45324. };
  45325. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45326. var newWatcher = false;
  45327. var isArr = isArray(obj);
  45328. if (!obj.watchers) {
  45329. defineProp(obj, "watchers", {});
  45330. if (isArr) {
  45331. // watch array functions
  45332. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45333. addPendingChange(obj, index, action, newValue, oldValue);
  45334. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45335. var i,
  45336. n,
  45337. ln,
  45338. wAll,
  45339. watchList = obj.watchers[prop];
  45340. if (wAll = obj.watchers['__watchall__']) {
  45341. watchList = watchList ? watchList.concat(wAll) : wAll;
  45342. }
  45343. ln = watchList ? watchList.length : 0;
  45344. for (i = 0; i < ln; i++) {
  45345. if (action !== 'splice') {
  45346. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45347. } else {
  45348. // watch spliced values
  45349. for (n = 0; n < newValue.length; n++) {
  45350. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45351. }
  45352. }
  45353. }
  45354. }
  45355. });
  45356. }
  45357. }
  45358. if (!obj.watchers[prop]) {
  45359. obj.watchers[prop] = [];
  45360. if (!isArr) newWatcher = true;
  45361. }
  45362. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45363. if (obj.watchers[prop][i] === watcher) {
  45364. return;
  45365. }
  45366. }
  45367. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45368. if (newWatcher) {
  45369. var val = obj[prop];
  45370. var getter = function getter() {
  45371. return val;
  45372. };
  45373. var setter = function setter(newval, delayWatcher) {
  45374. var oldval = val;
  45375. val = newval;
  45376. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45377. // watch sub properties
  45378. var i,
  45379. ln = obj.watchers[prop].length;
  45380. for (i = 0; i < ln; i++) {
  45381. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45382. }
  45383. }
  45384. //watchFunctions(obj, prop);
  45385. if (isSuspended(obj, prop)) {
  45386. resume(obj, prop);
  45387. return;
  45388. }
  45389. if (!WatchJS.noMore) {
  45390. // this does not work with Object.observe
  45391. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45392. if (oldval !== newval) {
  45393. if (!delayWatcher) {
  45394. callWatchers(obj, prop, "set", newval, oldval);
  45395. } else {
  45396. addPendingChange(obj, prop, "set", newval, oldval);
  45397. }
  45398. WatchJS.noMore = false;
  45399. }
  45400. }
  45401. };
  45402. if (WatchJS.useDirtyCheck) {
  45403. observeDirtyChanges(obj, prop, setter);
  45404. } else {
  45405. defineGetAndSet(obj, prop, getter, setter);
  45406. }
  45407. }
  45408. };
  45409. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45410. if (prop !== undefined) {
  45411. var ln,
  45412. wl,
  45413. watchList = obj.watchers[prop];
  45414. if (wl = obj.watchers['__watchall__']) {
  45415. watchList = watchList ? watchList.concat(wl) : wl;
  45416. }
  45417. ln = watchList ? watchList.length : 0;
  45418. for (var wr = 0; wr < ln; wr++) {
  45419. watchList[wr].call(obj, prop, action, newval, oldval);
  45420. }
  45421. } else {
  45422. for (var prop in obj) {
  45423. //call all
  45424. if (obj.hasOwnProperty(prop)) {
  45425. callWatchers(obj, prop, action, newval, oldval);
  45426. }
  45427. }
  45428. }
  45429. };
  45430. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45431. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45432. defineProp(obj, methodName, function () {
  45433. var index = 0;
  45434. var i, newValue, oldValue, response;
  45435. // get values before splicing array
  45436. if (methodName === 'splice') {
  45437. var start = arguments[0];
  45438. var end = start + arguments[1];
  45439. oldValue = obj.slice(start, end);
  45440. newValue = [];
  45441. for (i = 2; i < arguments.length; i++) {
  45442. newValue[i - 2] = arguments[i];
  45443. }
  45444. index = start;
  45445. } else {
  45446. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45447. }
  45448. response = original.apply(obj, arguments);
  45449. if (methodName !== 'slice') {
  45450. if (methodName === 'pop') {
  45451. oldValue = response;
  45452. index = obj.length;
  45453. } else if (methodName === 'push') {
  45454. index = obj.length - 1;
  45455. } else if (methodName === 'shift') {
  45456. oldValue = response;
  45457. } else if (methodName !== 'unshift' && newValue === undefined) {
  45458. newValue = response;
  45459. }
  45460. callback.call(obj, index, methodName, newValue, oldValue);
  45461. }
  45462. return response;
  45463. });
  45464. };
  45465. var watchFunctions = function watchFunctions(obj, callback) {
  45466. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45467. return;
  45468. }
  45469. for (var i = methodNames.length, methodName; i--;) {
  45470. methodName = methodNames[i];
  45471. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45472. }
  45473. };
  45474. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45475. if (prop) {
  45476. if (obj.watchers && obj.watchers[prop]) {
  45477. if (watcher === undefined) {
  45478. delete obj.watchers[prop]; // remove all property watchers
  45479. } else {
  45480. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45481. var w = obj.watchers[prop][i];
  45482. if (w == watcher) {
  45483. obj.watchers[prop].splice(i, 1);
  45484. }
  45485. }
  45486. }
  45487. }
  45488. } else {
  45489. delete obj.watchers;
  45490. }
  45491. removeFromLengthSubjects(obj, prop, watcher);
  45492. removeFromDirtyChecklist(obj, prop);
  45493. };
  45494. // suspend watchers until next update cycle
  45495. var suspend = function suspend(obj, prop) {
  45496. if (obj.watchers) {
  45497. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45498. obj.watchers[name] = true;
  45499. }
  45500. };
  45501. var isSuspended = function isSuspended(obj, prop) {
  45502. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  45503. };
  45504. // resumes preivously suspended watchers
  45505. var resume = function resume(obj, prop) {
  45506. registerTimeout(function () {
  45507. delete obj.watchers['__wjs_suspend__'];
  45508. delete obj.watchers['__wjs_suspend__' + prop];
  45509. });
  45510. };
  45511. var pendingTimerID = null;
  45512. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  45513. pendingChanges[pendingChanges.length] = {
  45514. obj: obj,
  45515. prop: prop,
  45516. mode: mode,
  45517. newval: newval,
  45518. oldval: oldval
  45519. };
  45520. if (pendingTimerID === null) {
  45521. pendingTimerID = setTimeout(applyPendingChanges);
  45522. }
  45523. };
  45524. var applyPendingChanges = function applyPendingChanges() {
  45525. // apply pending changes
  45526. var change = null;
  45527. pendingTimerID = null;
  45528. for (var i = 0; i < pendingChanges.length; i++) {
  45529. change = pendingChanges[i];
  45530. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  45531. }
  45532. if (change) {
  45533. pendingChanges = [];
  45534. change = null;
  45535. }
  45536. };
  45537. var loop = function loop() {
  45538. // check for new or deleted props
  45539. for (var i = 0; i < lengthsubjects.length; i++) {
  45540. var subj = lengthsubjects[i];
  45541. if (subj.prop === "$$watchlengthsubjectroot") {
  45542. var difference = getObjDiff(subj.obj, subj.actual);
  45543. if (difference.added.length || difference.removed.length) {
  45544. if (difference.added.length) {
  45545. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  45546. }
  45547. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  45548. }
  45549. subj.actual = clone(subj.obj);
  45550. } else {
  45551. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  45552. if (difference.added.length || difference.removed.length) {
  45553. if (difference.added.length) {
  45554. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  45555. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  45556. }
  45557. }
  45558. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  45559. }
  45560. subj.actual = clone(subj.obj[subj.prop]);
  45561. }
  45562. }
  45563. // start dirty check
  45564. var n, value;
  45565. if (dirtyChecklist.length > 0) {
  45566. for (var i = 0; i < dirtyChecklist.length; i++) {
  45567. n = dirtyChecklist[i];
  45568. value = n.object[n.prop];
  45569. if (!compareValues(n.orig, value)) {
  45570. n.orig = clone(value);
  45571. n.callback(value);
  45572. }
  45573. }
  45574. }
  45575. };
  45576. var compareValues = function compareValues(a, b) {
  45577. var i,
  45578. state = true;
  45579. if (a !== b) {
  45580. if (isObject(a)) {
  45581. for (i in a) {
  45582. if (!supportDefineProperty && i === 'watchers') continue;
  45583. if (a[i] !== b[i]) {
  45584. state = false;
  45585. break;
  45586. };
  45587. }
  45588. } else {
  45589. state = false;
  45590. }
  45591. }
  45592. return state;
  45593. };
  45594. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  45595. var actual;
  45596. if (prop === "$$watchlengthsubjectroot") {
  45597. actual = clone(obj);
  45598. } else {
  45599. actual = clone(obj[prop]);
  45600. }
  45601. lengthsubjects.push({
  45602. obj: obj,
  45603. prop: prop,
  45604. actual: actual,
  45605. watcher: watcher,
  45606. level: level
  45607. });
  45608. };
  45609. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  45610. for (var i = 0; i < lengthsubjects.length; i++) {
  45611. var subj = lengthsubjects[i];
  45612. if (subj.obj == obj) {
  45613. if (!prop || subj.prop == prop) {
  45614. if (!watcher || subj.watcher == watcher) {
  45615. // if we splice off one item at position i
  45616. // we need to decrement i as the array is one item shorter
  45617. // so when we increment i in the loop statement we
  45618. // will land at the correct index.
  45619. // if it's not decremented, you won't delete all length subjects
  45620. lengthsubjects.splice(i--, 1);
  45621. }
  45622. }
  45623. }
  45624. }
  45625. };
  45626. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  45627. var notInUse;
  45628. for (var i = 0; i < dirtyChecklist.length; i++) {
  45629. var n = dirtyChecklist[i];
  45630. var watchers = n.object.watchers;
  45631. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  45632. if (notInUse) {
  45633. // we use the same syntax as in removeFromLengthSubjects
  45634. dirtyChecklist.splice(i--, 1);
  45635. }
  45636. }
  45637. };
  45638. setInterval(loop, 50);
  45639. WatchJS.watch = watch;
  45640. WatchJS.unwatch = unwatch;
  45641. WatchJS.callWatchers = callWatchers;
  45642. WatchJS.suspend = suspend; // suspend watchers
  45643. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  45644. return WatchJS;
  45645. });
  45646. /***/ }),
  45647. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  45648. /*!******************************************************!*\
  45649. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  45650. \******************************************************/
  45651. /*! no static exports found */
  45652. /***/ (function(module, exports, __webpack_require__) {
  45653. "use strict";
  45654. /***/ }),
  45655. /***/ "./node_modules/webpack/buildin/module.js":
  45656. /*!***********************************!*\
  45657. !*** (webpack)/buildin/module.js ***!
  45658. \***********************************/
  45659. /*! no static exports found */
  45660. /***/ (function(module, exports, __webpack_require__) {
  45661. "use strict";
  45662. module.exports = function (module) {
  45663. if (!module.webpackPolyfill) {
  45664. module.deprecate = function () {};
  45665. module.paths = [];
  45666. // module.parent = undefined by default
  45667. if (!module.children) module.children = [];
  45668. Object.defineProperty(module, "loaded", {
  45669. enumerable: true,
  45670. get: function get() {
  45671. return module.l;
  45672. }
  45673. });
  45674. Object.defineProperty(module, "id", {
  45675. enumerable: true,
  45676. get: function get() {
  45677. return module.i;
  45678. }
  45679. });
  45680. module.webpackPolyfill = 1;
  45681. }
  45682. return module;
  45683. };
  45684. /***/ })
  45685. /******/ });
  45686. });
  45687. //# sourceMappingURL=ivprog.bundle.js.map