ivprog.bundle.js 2.0 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298
  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-85364ifhdHrTFavt/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: "numero_elementos",
  601. $matrixLines: "matriz_linhas",
  602. $matrixColumns: "matriz_colunas",
  603. $substring: "subcadeia",
  604. $length: "comprimento",
  605. $uppercase: "caixa_alta",
  606. $lowercase: "caixa_baixa",
  607. $charAt: "char_at",
  608. $isReal: "e_real",
  609. $isInt: "e_inteiro",
  610. $isBool: "e_logico",
  611. $castReal: "como_real",
  612. $castInt: "como_inteiro",
  613. $castBool: "como_logico",
  614. $castString: "como_cadeia",
  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: "IV"
  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-8536OBchj5po7IMG/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: "numero_elementos",
  1160. $matrixLines: "matriz_linhas",
  1161. $matrixColumns: "matriz_colunas",
  1162. $substring: "subcadeia",
  1163. $length: "comprimento",
  1164. $uppercase: "caixa_alta",
  1165. $lowercase: "caixa_baixa",
  1166. $charAt: "char_at",
  1167. $isReal: "e_real",
  1168. $isInt: "e_inteiro",
  1169. $isBool: "e_logico",
  1170. $castReal: "como_real",
  1171. $castInt: "como_inteiro",
  1172. $castBool: "como_logico",
  1173. $castString: "como_cadeia",
  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: "IV"
  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-8536rtngVqZH47ZG/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: "numero_elementos",
  1750. $matrixLines: "matriz_linhas",
  1751. $matrixColumns: "matriz_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: "IV"
  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, 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":"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_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"};
  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, 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"};
  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, 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"};
  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. console.log('debugging removeCommand');
  15720. console.log('command');
  15721. console.log(command);
  15722. console.log('function_obj');
  15723. console.log(function_obj);
  15724. console.log('dom_obj');
  15725. console.log(dom_obj);
  15726. if (function_obj.commands.indexOf(command) > -1) {
  15727. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  15728. return true;
  15729. }
  15730. // Utilize dois parantNode, pois o primeiro é o div de comandos
  15731. try {
  15732. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  15733. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  15734. return true;
  15735. }
  15736. } catch (err) {}
  15737. try {
  15738. if (dom_obj.parent().parent().data('command').type == Models.COMMAND_TYPES.iftrue) {
  15739. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  15740. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  15741. return true;
  15742. }
  15743. }
  15744. } catch (err) {}
  15745. console.log('veja: ');
  15746. console.log(dom_obj.parent());
  15747. if (dom_obj.parent().data('switchcase')) {
  15748. console.log("o que encontrei: ");
  15749. console.log(dom_obj.parent().data('switchcase'));
  15750. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  15751. return true;
  15752. }
  15753. return false;
  15754. }
  15755. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  15756. var floatingObject;
  15757. switch (command_type) {
  15758. case Models.COMMAND_TYPES.break:
  15759. floatingObject = BreaksManagement.createFloatingCommand();
  15760. break;
  15761. case Models.COMMAND_TYPES.comment:
  15762. floatingObject = CommentsManagement.createFloatingCommand();
  15763. break;
  15764. case Models.COMMAND_TYPES.reader:
  15765. floatingObject = ReadersManagement.createFloatingCommand();
  15766. break;
  15767. case Models.COMMAND_TYPES.writer:
  15768. floatingObject = WritersManagement.createFloatingCommand();
  15769. break;
  15770. case Models.COMMAND_TYPES.attribution:
  15771. floatingObject = AttributionsManagement.createFloatingCommand();
  15772. break;
  15773. case Models.COMMAND_TYPES.iftrue:
  15774. floatingObject = IftruesManagement.createFloatingCommand();
  15775. break;
  15776. case Models.COMMAND_TYPES.repeatNtimes:
  15777. floatingObject = RepeatNtimesManagement.createFloatingCommand();
  15778. break;
  15779. case Models.COMMAND_TYPES.whiletrue:
  15780. floatingObject = WhiletruesManagement.createFloatingCommand();
  15781. break;
  15782. case Models.COMMAND_TYPES.dowhiletrue:
  15783. floatingObject = DowhiletruesManagement.createFloatingCommand();
  15784. break;
  15785. case Models.COMMAND_TYPES.switch:
  15786. floatingObject = SwitchesManagement.createFloatingCommand();
  15787. break;
  15788. case Models.COMMAND_TYPES.functioncall:
  15789. floatingObject = FunctioncallsManagement.createFloatingCommand();
  15790. break;
  15791. case Models.COMMAND_TYPES.return:
  15792. floatingObject = ReturnsManagement.createFloatingCommand();
  15793. break;
  15794. }
  15795. floatingObject.draggable().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. // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  15807. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  15808. var createdElement;
  15809. switch (command.type) {
  15810. case Models.COMMAND_TYPES.comment:
  15811. createdElement = CommentsManagement.renderCommand(command, function_obj);
  15812. break;
  15813. case Models.COMMAND_TYPES.break:
  15814. createdElement = BreaksManagement.renderCommand(command, function_obj);
  15815. break;
  15816. case Models.COMMAND_TYPES.reader:
  15817. createdElement = ReadersManagement.renderCommand(command, function_obj);
  15818. break;
  15819. case Models.COMMAND_TYPES.writer:
  15820. createdElement = WritersManagement.renderCommand(command, function_obj);
  15821. break;
  15822. case Models.COMMAND_TYPES.attribution:
  15823. createdElement = AttributionsManagement.renderCommand(command, function_obj);
  15824. break;
  15825. case Models.COMMAND_TYPES.functioncall:
  15826. createdElement = FunctioncallsManagement.renderCommand(command, function_obj);
  15827. break;
  15828. case Models.COMMAND_TYPES.iftrue:
  15829. createdElement = IftruesManagement.renderCommand(command, function_obj);
  15830. break;
  15831. case Models.COMMAND_TYPES.repeatNtimes:
  15832. createdElement = RepeatNtimesManagement.renderCommand(command, function_obj);
  15833. break;
  15834. case Models.COMMAND_TYPES.whiletrue:
  15835. createdElement = WhiletruesManagement.renderCommand(command, function_obj);
  15836. break;
  15837. case Models.COMMAND_TYPES.dowhiletrue:
  15838. createdElement = DowhiletruesManagement.renderCommand(command, function_obj);
  15839. break;
  15840. case Models.COMMAND_TYPES.switch:
  15841. createdElement = SwitchesManagement.renderCommand(command, function_obj);
  15842. break;
  15843. case Models.COMMAND_TYPES.return:
  15844. createdElement = ReturnsManagement.renderCommand(command, function_obj);
  15845. break;
  15846. }
  15847. switch (before_after_inside) {
  15848. case 1:
  15849. createdElement.insertBefore(element_reference);
  15850. break;
  15851. case 2:
  15852. createdElement.insertAfter(element_reference);
  15853. break;
  15854. case 3:
  15855. element_reference.append(createdElement);
  15856. break;
  15857. }
  15858. }
  15859. function genericCreateCommand(command_type) {
  15860. switch (command_type) {
  15861. case Models.COMMAND_TYPES.break:
  15862. return new Models.Break();
  15863. case Models.COMMAND_TYPES.comment:
  15864. return new Models.Comment(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_value, _localizedStringsService.LocalizedStrings.getUI('text_comment'), null, null, false));
  15865. case Models.COMMAND_TYPES.reader:
  15866. return new Models.Reader(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false));
  15867. case Models.COMMAND_TYPES.writer:
  15868. return new Models.Writer([new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  15869. case Models.COMMAND_TYPES.attribution:
  15870. return new Models.Attribution(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_variable, null, null, null, false), []);
  15871. case Models.COMMAND_TYPES.functioncall:
  15872. return new Models.FunctionCall(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.only_function, null, null, null, false), null);
  15873. case Models.COMMAND_TYPES.iftrue:
  15874. return new Models.IfTrue(new Models.ConditionalExpression(null), null, null);
  15875. case Models.COMMAND_TYPES.repeatNtimes:
  15876. 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);
  15877. case Models.COMMAND_TYPES.whiletrue:
  15878. return new Models.WhileTrue(new Models.ConditionalExpression(null), null);
  15879. case Models.COMMAND_TYPES.dowhiletrue:
  15880. return new Models.DoWhileTrue(new Models.ConditionalExpression(null), null);
  15881. case Models.COMMAND_TYPES.switch:
  15882. var sc = [new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true))];
  15883. return new Models.Switch(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true), sc);
  15884. case Models.COMMAND_TYPES.return:
  15885. return new Models.Return(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  15886. }
  15887. }
  15888. function manageCommand(function_obj, function_container, event, command_type) {
  15889. (0, _jquery2.default)(".created_element").each(function (index) {
  15890. (0, _jquery2.default)(this).remove();
  15891. });
  15892. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  15893. console.log('soltou no: ');
  15894. console.log(el);
  15895. console.log(el.data('fun'));
  15896. // Primeiro verificar se ele soltou no espaço da função correta:
  15897. var hier = el.parentsUntil(".all_functions");
  15898. var esta_correto = false;
  15899. var esta_na_div_correta = false;
  15900. if (el.hasClass("commands_list_div")) {
  15901. esta_na_div_correta = true;
  15902. }
  15903. for (var i = 0; i < hier.length; i++) {
  15904. var temp = (0, _jquery2.default)(hier[i]);
  15905. if (temp.hasClass("commands_list_div")) {
  15906. esta_na_div_correta = true;
  15907. }
  15908. if (temp.data('fun') == function_obj) {
  15909. esta_correto = true;
  15910. break;
  15911. }
  15912. }
  15913. if (!esta_correto) {
  15914. has_element_created_draged = false;
  15915. which_element_is_draged = null;
  15916. return;
  15917. } else {
  15918. if (!esta_na_div_correta) {
  15919. has_element_created_draged = false;
  15920. which_element_is_draged = null;
  15921. return;
  15922. }
  15923. }
  15924. // Agora é descobrir qual o escopo para adicionar o comando:
  15925. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  15926. if (typeof el.data('fun') !== 'undefined') {
  15927. // Se a lista de comandos estiver vazia, então é o primeiro.
  15928. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  15929. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  15930. // pode adicionar
  15931. el.data('fun').commands = [];
  15932. var new_cmd = genericCreateCommand(command_type);
  15933. el.data('fun').commands.push(new_cmd);
  15934. renderCommand(new_cmd, (0, _jquery2.default)(function_container).find('.commands_list_div'), 3, function_obj);
  15935. } else {
  15936. // Entra nesse else, caso já existam outros comandos no bloco:
  15937. findNearbyCommandToAddInFunctionScope(el, event, (0, _jquery2.default)(function_container).find('.commands_list_div'), function_obj, command_type);
  15938. }
  15939. } else {
  15940. console.log("soltou em um comando");
  15941. // descobrir em qual comando ele soltou:
  15942. var hier_find = el.parentsUntil(".commands_list_div");
  15943. var hierarquia_bottom_up = [];
  15944. if (typeof el.data('command') !== 'undefined') {
  15945. hierarquia_bottom_up.push(el.data('command'));
  15946. }
  15947. for (var i = 0; i < hier_find.length; i++) {
  15948. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15949. hierarquia_bottom_up.push((0, _jquery2.default)(hier_find[i]).data('command'));
  15950. }
  15951. }
  15952. console.log("comando em que soltou: ");
  15953. console.log(hierarquia_bottom_up[0]);
  15954. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  15955. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15956. console.log(hierarquia_bottom_up[i]);
  15957. }
  15958. // Se for do tipo break, verificar se está no contexto correto:
  15959. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  15960. var is_correct_context = false;
  15961. if (command_type == Models.COMMAND_TYPES.break) {
  15962. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  15963. 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) {
  15964. is_correct_context = true;
  15965. break;
  15966. }
  15967. }
  15968. if (!is_correct_context) {
  15969. console.error("Context not allowed to insert BREAK COMMAND!");
  15970. return;
  15971. }
  15972. }
  15973. // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  15974. if (hierarquia_bottom_up.length == 1) {
  15975. console.log('QQ1');
  15976. var sub_elemento = false;
  15977. for (var i = 0; i < hier_find.length; i++) {
  15978. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  15979. console.log('QQ2');
  15980. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  15981. sub_elemento = true;
  15982. break;
  15983. }
  15984. }
  15985. if (!sub_elemento) {
  15986. console.log('QQ3');
  15987. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  15988. }
  15989. } else {
  15990. console.log('QQ4');
  15991. // caso exista mais de um elemento na hierarquia:
  15992. if (typeof (0, _jquery2.default)(el).data('command') !== 'undefined') {
  15993. console.log('QQ5');
  15994. console.log("PPP1");
  15995. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  15996. } else {
  15997. console.log('QQ6');
  15998. var sub_elemento = false;
  15999. for (var i = 0; i < hier_find.length; i++) {
  16000. if (typeof (0, _jquery2.default)(hier_find[i]).data('command') !== 'undefined') {
  16001. console.log('QQ7');
  16002. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  16003. sub_elemento = true;
  16004. break;
  16005. }
  16006. }
  16007. }
  16008. }
  16009. }
  16010. has_element_created_draged = false;
  16011. which_element_is_draged = null;
  16012. }
  16013. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  16014. var el_jq = (0, _jquery2.default)(el);
  16015. var command_parent = el_jq.data('command');
  16016. 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) {
  16017. console.log('QQ17');
  16018. 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) {
  16019. console.log('QQ18');
  16020. // Se não tiver outro comando ainda no bloco, só adiciona:
  16021. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16022. command_parent.commands_block = [];
  16023. var recentComand = genericCreateCommand(command_type);
  16024. command_parent.commands_block.push(recentComand);
  16025. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16026. } else {
  16027. // Se já tem algum comando no bloco:
  16028. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  16029. }
  16030. } else {
  16031. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  16032. addCommandToSwitchCase(event, function_obj, command_type);
  16033. }
  16034. } else {
  16035. console.log('QQ19');
  16036. // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  16037. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  16038. }
  16039. }
  16040. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  16041. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16042. var menor_distancia = 999999999;
  16043. var elemento_menor_distancia = null;
  16044. var antes = true;
  16045. var t_bot;
  16046. var t_top;
  16047. // Descobrindo o elemento mais próximo:
  16048. for (var i = 0; i < all_sub.length; i++) {
  16049. t_top = all_sub[i].getBoundingClientRect().top;
  16050. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16051. if (t_top - event.clientY < menor_distancia) {
  16052. menor_distancia = event.clientY - t_top;
  16053. elemento_menor_distancia = all_sub[i];
  16054. }
  16055. }
  16056. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16057. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16058. if (borda_inferior - event.clientY < menor_distancia) {
  16059. var recentComand = genericCreateCommand(command_type);
  16060. command_parent.commands_block.push(recentComand);
  16061. //
  16062. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16063. } else {
  16064. var recentComand = genericCreateCommand(command_type);
  16065. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16066. if (index > -1) {
  16067. command_parent.commands_block.splice(index, 0, recentComand);
  16068. }
  16069. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16070. }
  16071. }
  16072. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  16073. var el_jq = (0, _jquery2.default)(el);
  16074. var command_parent = (0, _jquery2.default)(el.parentNode.parentNode).data('command');
  16075. var command_target = el_jq.data('command');
  16076. var temp_parent = (0, _jquery2.default)(el.parentNode.parentNode);
  16077. var is_in_else = false;
  16078. if (!command_parent) {
  16079. command_parent = el_jq.data('command');
  16080. temp_parent = el_jq;
  16081. var hier = el_jq.parentsUntil(".command_container");
  16082. for (var i = 0; i < hier.length; i++) {
  16083. var temp = (0, _jquery2.default)(hier[i]);
  16084. if (typeof temp.data('else') != 'undefined') {
  16085. is_in_else = true;
  16086. }
  16087. if (typeof temp.data('command') != 'undefined') {
  16088. command_parent = temp.data('command');
  16089. temp_parent = temp;
  16090. }
  16091. }
  16092. }
  16093. var hier = el_jq.parentsUntil(".command_container");
  16094. for (var i = 0; i < hier.length; i++) {
  16095. var temp = (0, _jquery2.default)(hier[i]);
  16096. if (typeof temp.data('else') != 'undefined') {
  16097. is_in_else = true;
  16098. }
  16099. }
  16100. if (command_parent == command_target) {
  16101. var hier = el_jq.parentsUntil(".command_container");
  16102. for (var i = 0; i < hier.length; i++) {
  16103. var temp = (0, _jquery2.default)(hier[i]);
  16104. if (typeof temp.data('else') !== 'undefined') {
  16105. is_in_else = true;
  16106. break;
  16107. }
  16108. }
  16109. }
  16110. if (command_parent.type != Models.COMMAND_TYPES.iftrue && command_parent.type != Models.COMMAND_TYPES.switch) {
  16111. var hier = temp_parent.parentsUntil(".all_cases_div");
  16112. console.log("vou procurar!!");
  16113. for (var i = 0; i < hier.length; i++) {
  16114. console.log("estou vasculhando...");
  16115. var temp = (0, _jquery2.default)(hier[i]);
  16116. if (typeof temp.data('switchcase') !== 'undefined') {
  16117. console.log("encontrei");
  16118. command_parent = temp.data('switchcase');
  16119. is_in_else = false;
  16120. break;
  16121. }
  16122. }
  16123. }
  16124. console.log('debugging:');
  16125. console.log('el_jq');
  16126. console.log(el_jq);
  16127. console.log('command_parent');
  16128. console.log(command_parent);
  16129. console.log('command_target');
  16130. console.log(command_target);
  16131. var menor_distancia = 999999999;
  16132. var antes = true;
  16133. var t_bot;
  16134. var t_top;
  16135. t_top = el.getBoundingClientRect().top;
  16136. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16137. var d_top = event.clientY - t_top; // distancia topo
  16138. var d_bot = t_bot - event.clientY; // distancia baixo
  16139. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16140. if (d_top < d_bot) {
  16141. var recentComand = genericCreateCommand(command_type);
  16142. console.log('MMM1');
  16143. if (is_in_else) {
  16144. console.log('MMM2');
  16145. if (command_parent == command_target) {
  16146. console.log('MMM3');
  16147. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16148. command_parent.commands_else = [];
  16149. var recentComand = genericCreateCommand(command_type);
  16150. command_parent.commands_else.push(recentComand);
  16151. renderCommand(recentComand, el_jq, 3, function_obj);
  16152. } else {
  16153. // Se já tem algum comando no bloco:
  16154. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16155. }
  16156. return;
  16157. }
  16158. console.log('MMM7');
  16159. var index = command_parent.commands_else.indexOf(command_target);
  16160. if (index > -1) {
  16161. command_parent.commands_else.splice(index, 0, recentComand);
  16162. }
  16163. renderCommand(recentComand, el, 1, function_obj);
  16164. } else {
  16165. console.log('MMM4');
  16166. if (command_parent == command_target) {
  16167. console.log('Nxxxx5');
  16168. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16169. command_parent.commands_block = [];
  16170. console.log('SSS4');
  16171. var recentComand = genericCreateCommand(command_type);
  16172. command_parent.commands_block.push(recentComand);
  16173. renderCommand(recentComand, el_jq, 3, function_obj);
  16174. } else {
  16175. console.log('SSS5');
  16176. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16177. }
  16178. return;
  16179. }
  16180. console.log('MMM6');
  16181. var index = command_parent.commands_block.indexOf(command_target);
  16182. if (index > -1) {
  16183. command_parent.commands_block.splice(index, 0, recentComand);
  16184. }
  16185. renderCommand(recentComand, el, 1, function_obj);
  16186. }
  16187. } else {
  16188. console.log('XXX1');
  16189. var recentComand = genericCreateCommand(command_type);
  16190. if (is_in_else) {
  16191. if (command_parent == command_target) {
  16192. console.log('MMM3');
  16193. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16194. command_parent.commands_else = [];
  16195. console.log('SSS1');
  16196. var recentComand = genericCreateCommand(command_type);
  16197. command_parent.commands_else.push(recentComand);
  16198. renderCommand(recentComand, el_jq, 3, function_obj);
  16199. } else {
  16200. // Se já tem algum comando no bloco:
  16201. console.log('SSS2');
  16202. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  16203. }
  16204. return;
  16205. }
  16206. console.log('XXX2');
  16207. var index = command_parent.commands_else.indexOf(command_target);
  16208. if (index > -1) {
  16209. command_parent.commands_else.splice(index + 1, 0, recentComand);
  16210. }
  16211. renderCommand(recentComand, el, 2, function_obj);
  16212. } else {
  16213. if (command_parent == command_target) {
  16214. console.log('Nxxxx78');
  16215. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16216. command_parent.commands_block = [];
  16217. var recentComand = genericCreateCommand(command_type);
  16218. command_parent.commands_block.push(recentComand);
  16219. console.log('SSS6');
  16220. renderCommand(recentComand, el_jq, 3, function_obj);
  16221. } else {
  16222. console.log('SSS7');
  16223. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  16224. }
  16225. return;
  16226. }
  16227. console.log('XXX3');
  16228. var index = command_parent.commands_block.indexOf(command_target);
  16229. if (index > -1) {
  16230. command_parent.commands_block.splice(index + 1, 0, recentComand);
  16231. }
  16232. renderCommand(recentComand, el, 2, function_obj);
  16233. }
  16234. }
  16235. }
  16236. function insertCommandInBlock(el, event, function_obj, command_type) {
  16237. var el_jq = (0, _jquery2.default)(el);
  16238. var command_parent = el_jq.data('command');
  16239. 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) {
  16240. // Se não tiver outro comando ainda no bloco, só adiciona:
  16241. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16242. command_parent.commands_block = [];
  16243. var recentComand = genericCreateCommand(command_type);
  16244. command_parent.commands_block.push(recentComand);
  16245. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  16246. } else {
  16247. // Se já tem algum comando no bloco:
  16248. findInBlockCorrectPlace(el, event, function_obj, command_type);
  16249. }
  16250. } else if (el_jq.data('command').type == Models.COMMAND_TYPES.iftrue) {
  16251. console.log('QQ9');
  16252. // no if ou no else?
  16253. var correct_div = (0, _jquery2.default)(document.elementFromPoint(event.pageX, event.pageY));
  16254. var is_in_if = true;
  16255. if (correct_div.data('if')) {
  16256. is_in_if = true;
  16257. } else if (correct_div.data('else')) {
  16258. is_in_if = false;
  16259. } else {
  16260. var hier = correct_div.parentsUntil(".command_container");
  16261. for (var i = 0; i < hier.length; i++) {
  16262. var temp = (0, _jquery2.default)(hier[i]);
  16263. if (typeof temp.data('if') !== 'undefined') {
  16264. is_in_if = true;
  16265. break;
  16266. }
  16267. if (typeof temp.data('else') !== 'undefined') {
  16268. is_in_if = false;
  16269. break;
  16270. }
  16271. }
  16272. }
  16273. if (is_in_if) {
  16274. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  16275. command_parent.commands_block = [];
  16276. var recentComand = genericCreateCommand(command_type);
  16277. command_parent.commands_block.push(recentComand);
  16278. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  16279. } else {
  16280. // Se já tem algum comando no bloco:
  16281. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  16282. }
  16283. } else {
  16284. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  16285. command_parent.commands_else = [];
  16286. var recentComand = genericCreateCommand(command_type);
  16287. command_parent.commands_else.push(recentComand);
  16288. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  16289. } else {
  16290. // Se já tem algum comando no bloco:
  16291. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  16292. }
  16293. }
  16294. } else {
  16295. // é do tipo switch
  16296. console.log("está tentando inserir em um switch que está na raiz!");
  16297. addCommandToSwitchCase(event, function_obj, command_type);
  16298. }
  16299. }
  16300. function addCommandToSwitchCase(event, function_obj, command_type) {
  16301. var el = (0, _jquery2.default)(document.elementFromPoint(event.clientX, event.clientY));
  16302. var which_case = el.data('switchcase');
  16303. var case_div = el;
  16304. if (!which_case) {
  16305. var hier_find = el.parentsUntil(".all_cases_div");
  16306. for (var i = 0; i < hier_find.length; i++) {
  16307. if (typeof (0, _jquery2.default)(hier_find[i]).data('switchcase') !== 'undefined') {
  16308. which_case = (0, _jquery2.default)(hier_find[i]).data('switchcase');
  16309. case_div = (0, _jquery2.default)(hier_find[i]);
  16310. break;
  16311. }
  16312. }
  16313. }
  16314. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  16315. which_case.commands_block = [];
  16316. var recentComand = genericCreateCommand(command_type);
  16317. which_case.commands_block.push(recentComand);
  16318. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  16319. } else {
  16320. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  16321. }
  16322. }
  16323. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  16324. var all_sub = case_div.find('div.command_container');
  16325. var menor_distancia = 999999999;
  16326. var elemento_menor_distancia = null;
  16327. var antes = true;
  16328. var t_bot;
  16329. var t_top;
  16330. // Descobrindo o elemento mais próximo:
  16331. for (var i = 0; i < all_sub.length; i++) {
  16332. t_top = all_sub[i].getBoundingClientRect().top;
  16333. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16334. if (t_top - event.clientY < menor_distancia) {
  16335. menor_distancia = event.clientY - t_top;
  16336. elemento_menor_distancia = all_sub[i];
  16337. }
  16338. }
  16339. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16340. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16341. if (borda_inferior - event.clientY < menor_distancia) {
  16342. var recentComand = genericCreateCommand(command_type);
  16343. which_case.commands_block.push(recentComand);
  16344. renderCommand(recentComand, (0, _jquery2.default)(case_div.find('.case_commands_block')[0]), 3, function_obj);
  16345. } else {
  16346. var recentComand = genericCreateCommand(command_type);
  16347. var index = which_case.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16348. if (index > -1) {
  16349. which_case.commands_block.splice(index, 0, recentComand);
  16350. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16351. }
  16352. }
  16353. }
  16354. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  16355. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  16356. var el_jq = (0, _jquery2.default)(el);
  16357. var all_sub = el_jq.find('div.command_container');
  16358. var menor_distancia = 999999999;
  16359. var elemento_menor_distancia = null;
  16360. var antes = true;
  16361. var t_bot;
  16362. var t_top;
  16363. // Descobrindo o elemento mais próximo:
  16364. for (var i = 0; i < all_sub.length; i++) {
  16365. t_top = all_sub[i].getBoundingClientRect().top;
  16366. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16367. if (t_top - event.clientY < menor_distancia) {
  16368. menor_distancia = event.clientY - t_top;
  16369. elemento_menor_distancia = all_sub[i];
  16370. }
  16371. }
  16372. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16373. console.log("menor_distancia: ");
  16374. console.log(elemento_menor_distancia);
  16375. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16376. if (borda_inferior - event.clientY < menor_distancia) {
  16377. console.log('QQ11');
  16378. var recentComand = genericCreateCommand(command_type);
  16379. var command_parent = el_jq.data('command');
  16380. if (is_in_else) {
  16381. console.log('QQ15');
  16382. command_parent.commands_else.push(recentComand);
  16383. console.log('el_jq');
  16384. console.log(el_jq);
  16385. console.log("$(el_jq.find('.commands_else')[0]):: ");
  16386. console.log((0, _jquery2.default)(el_jq.find('.commands_else')[0]));
  16387. renderCommand(recentComand, el_jq, 3, function_obj);
  16388. } else {
  16389. console.log('QQ16');
  16390. command_parent.commands_block.push(recentComand);
  16391. renderCommand(recentComand, (0, _jquery2.default)(el_jq.find('.block_commands')[0]), 3, function_obj);
  16392. }
  16393. } else {
  16394. console.log('QQ12');
  16395. var recentComand = genericCreateCommand(command_type);
  16396. var command_parent = el_jq.data('command');
  16397. if (is_in_else) {
  16398. var index = command_parent.commands_else.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16399. if (index > -1) {
  16400. command_parent.commands_else.splice(index, 0, recentComand);
  16401. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16402. }
  16403. } else {
  16404. var index = command_parent.commands_block.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16405. if (index > -1) {
  16406. command_parent.commands_block.splice(index, 0, recentComand);
  16407. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16408. }
  16409. }
  16410. }
  16411. }
  16412. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  16413. switch ((0, _jquery2.default)(el).data('command').type) {
  16414. case Models.COMMAND_TYPES.iftrue:
  16415. case Models.COMMAND_TYPES.switch:
  16416. case Models.COMMAND_TYPES.repeatNtimes:
  16417. case Models.COMMAND_TYPES.whiletrue:
  16418. case Models.COMMAND_TYPES.dowhiletrue:
  16419. insertCommandInBlock(el, event, function_obj, command_type);
  16420. return;
  16421. }
  16422. var menor_distancia = 999999999;
  16423. var antes = true;
  16424. var t_bot;
  16425. var t_top;
  16426. t_top = el.getBoundingClientRect().top;
  16427. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  16428. var d_top = event.clientY - t_top; // distancia topo
  16429. var d_bot = t_bot - event.clientY; // distancia baixo
  16430. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16431. if (d_top < d_bot) {
  16432. var recentComand = genericCreateCommand(command_type);
  16433. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16434. if (index > -1) {
  16435. function_obj.commands.splice(index, 0, recentComand);
  16436. }
  16437. renderCommand(recentComand, el, 1, function_obj);
  16438. } else {
  16439. var recentComand = genericCreateCommand(command_type);
  16440. var index = function_obj.commands.indexOf((0, _jquery2.default)(el).data('command'));
  16441. if (index > -1) {
  16442. function_obj.commands.splice(index + 1, 0, recentComand);
  16443. }
  16444. renderCommand(recentComand, el, 2, function_obj);
  16445. }
  16446. }
  16447. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  16448. var all_sub = (0, _jquery2.default)(node_list_commands).find('div.command_container');
  16449. var menor_distancia = 999999999;
  16450. var elemento_menor_distancia = null;
  16451. var antes = true;
  16452. var t_bot;
  16453. var t_top;
  16454. // Descobrindo o elemento mais próximo:
  16455. for (var i = 0; i < all_sub.length; i++) {
  16456. t_top = all_sub[i].getBoundingClientRect().top;
  16457. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  16458. if (t_top - event.clientY < menor_distancia) {
  16459. menor_distancia = event.clientY - t_top;
  16460. elemento_menor_distancia = all_sub[i];
  16461. }
  16462. }
  16463. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  16464. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  16465. if (borda_inferior - event.clientY < menor_distancia) {
  16466. var recentComand = genericCreateCommand(command_type);
  16467. function_obj.commands.push(recentComand);
  16468. //
  16469. renderCommand(recentComand, node_list_commands, 3, function_obj);
  16470. } else {
  16471. var recentComand = genericCreateCommand(command_type);
  16472. var index = function_obj.commands.indexOf((0, _jquery2.default)(elemento_menor_distancia).data('command'));
  16473. if (index > -1) {
  16474. function_obj.commands.splice(index, 0, recentComand);
  16475. }
  16476. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  16477. }
  16478. }
  16479. /***/ }),
  16480. /***/ "./js/visualUI/commands/attribution.js":
  16481. /*!*********************************************!*\
  16482. !*** ./js/visualUI/commands/attribution.js ***!
  16483. \*********************************************/
  16484. /*! no static exports found */
  16485. /***/ (function(module, exports, __webpack_require__) {
  16486. "use strict";
  16487. Object.defineProperty(exports, "__esModule", {
  16488. value: true
  16489. });
  16490. exports.createFloatingCommand = createFloatingCommand;
  16491. exports.renderCommand = renderCommand;
  16492. exports.manageExpressionElements = manageExpressionElements;
  16493. exports.renderMenuOperations = renderMenuOperations;
  16494. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16495. var _jquery2 = _interopRequireDefault(_jquery);
  16496. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16497. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16498. var Models = _interopRequireWildcard(_ivprog_elements);
  16499. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16500. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16501. var GlobalsManagement = _interopRequireWildcard(_globals);
  16502. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16503. var VariablesManagement = _interopRequireWildcard(_variables);
  16504. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16505. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16506. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16507. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16508. var CommandsManagement = _interopRequireWildcard(_commands);
  16509. 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; } }
  16510. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16511. function createFloatingCommand() {
  16512. return (0, _jquery2.default)('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  16513. }
  16514. function renderCommand(command, function_obj) {
  16515. 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>');
  16516. el.data('command', command);
  16517. VariableValueMenu.renderMenu(command, command.variable, el.find('.var_attributed'), function_obj);
  16518. if (!command.expression || command.expression.length < 1) {
  16519. 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)]);
  16520. command.expression.push(exp);
  16521. }
  16522. addHandlers(command, function_obj, el);
  16523. renderExpressionElements(command, function_obj, el);
  16524. return el;
  16525. }
  16526. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  16527. var index_to_move = expression_element.itens.indexOf(ref_object);
  16528. switch (selectedItem.data('exp')) {
  16529. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16530. 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)]);
  16531. expression_element.itens[index_to_move] = exp;
  16532. break;
  16533. case Models.EXPRESSION_ELEMENTS.op_exp:
  16534. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.op_exp, [Models.ARITHMETIC_TYPES.plus, expression_element.itens[index_to_move]]);
  16535. expression_element.itens[index_to_move] = exp;
  16536. break;
  16537. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16538. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [expression_element.itens[index_to_move]]);
  16539. expression_element.itens[index_to_move] = exp;
  16540. break;
  16541. }
  16542. renderExpressionElements(command, function_obj, dom_object);
  16543. }
  16544. function renderExpressionElements(command, function_obj, el) {
  16545. var expression_div = el.find('.expression_elements');
  16546. var command_container;
  16547. if (el.hasClass("command_container") == false) {
  16548. var hier = el.parentsUntil(".command_container");
  16549. for (var i = 0; i < hier.length; i++) {
  16550. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16551. command_container = (0, _jquery2.default)(hier[i]);
  16552. break;
  16553. }
  16554. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16555. expression_div = (0, _jquery2.default)(hier[i]);
  16556. break;
  16557. }
  16558. }
  16559. }
  16560. if (command_container) {
  16561. expression_div = command_container.find('.expression_elements');
  16562. }
  16563. expression_div.text('');
  16564. for (var i = 0; i < command.expression.length; i++) {
  16565. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16566. temp.data('ref_element', command.expression[i]);
  16567. temp.data('ref_index', i);
  16568. expression_div.append(temp);
  16569. renderElement(command, function_obj, temp, command.expression[i]);
  16570. }
  16571. }
  16572. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  16573. var context_menu = '<div class="ui dropdown"><div class="text">';
  16574. switch (expression_element.itens[index_op]) {
  16575. case Models.ARITHMETIC_TYPES.plus:
  16576. context_menu += '+';
  16577. break;
  16578. case Models.ARITHMETIC_TYPES.minus:
  16579. context_menu += '-';
  16580. break;
  16581. case Models.ARITHMETIC_TYPES.multiplication:
  16582. context_menu += '*';
  16583. break;
  16584. case Models.ARITHMETIC_TYPES.division:
  16585. context_menu += '/';
  16586. break;
  16587. case Models.ARITHMETIC_TYPES.module:
  16588. context_menu += '%';
  16589. break;
  16590. case Models.ARITHMETIC_TYPES.none:
  16591. context_menu += '...';
  16592. break;
  16593. }
  16594. context_menu += '</div><div class="menu">';
  16595. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.plus + '">+</div>';
  16596. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.minus + '">-</div>';
  16597. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.multiplication + '">*</div>';
  16598. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.division + '">/</div>';
  16599. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.module + '">%</div>';
  16600. context_menu += '<div class="item" data-value="' + Models.ARITHMETIC_TYPES.none + '" data-text="...">Nenhum</div>';
  16601. context_menu += '</div></div>';
  16602. context_menu = (0, _jquery2.default)(context_menu);
  16603. temp_op.append(context_menu);
  16604. context_menu.dropdown({
  16605. onChange: function onChange(value, text, $selectedItem) {
  16606. expression_element.itens[index_op] = value;
  16607. }
  16608. });
  16609. }
  16610. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  16611. if (el.hasClass("command_container") == false) {
  16612. var hier = el.parentsUntil(".commands_list_div");
  16613. for (var i = 0; i < hier.length; i++) {
  16614. if ((0, _jquery2.default)(hier[i]).hasClass("command_container")) {
  16615. el = (0, _jquery2.default)(hier[i]);
  16616. break;
  16617. }
  16618. }
  16619. }
  16620. if (dom_append_menu.hasClass("expression_elements") == false) {
  16621. var hier = el.parentsUntil(".commands_list_div");
  16622. for (var i = 0; i < hier.length; i++) {
  16623. if ((0, _jquery2.default)(hier[i]).hasClass("expression_elements")) {
  16624. dom_append_menu = (0, _jquery2.default)(hier[i]);
  16625. break;
  16626. }
  16627. }
  16628. }
  16629. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  16630. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  16631. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  16632. context_menu += '<div class="item" data-value="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  16633. context_menu += '</div></div>';
  16634. context_menu = (0, _jquery2.default)(context_menu);
  16635. dom_append_menu.append(context_menu);
  16636. context_menu.dropdown({
  16637. onChange: function onChange(value, text, $selectedItem) {
  16638. switch (value) {
  16639. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16640. 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)]);
  16641. expression_append_new_expression.push(exp);
  16642. break;
  16643. case Models.EXPRESSION_ELEMENTS.op_exp:
  16644. 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)]);
  16645. expression_append_new_expression.push(exp);
  16646. break;
  16647. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16648. var exp = new Models.ExpressionElement(Models.EXPRESSION_ELEMENTS.par_exp_par, [new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true)]);
  16649. expression_append_new_expression.push(exp);
  16650. break;
  16651. }
  16652. renderExpressionElements(command, function_obj, el);
  16653. }
  16654. });
  16655. }
  16656. function renderElement(command, function_obj, el, expression_element) {
  16657. switch (expression_element.type_exp) {
  16658. case Models.EXPRESSION_ELEMENTS.exp_op_exp:
  16659. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16660. var temp_exp_1 = (0, _jquery2.default)('<div class="component_element"></div>');
  16661. var temp_exp_2 = (0, _jquery2.default)('<div class="component_element"></div>');
  16662. el.append(temp_exp_1);
  16663. el.append(temp_op);
  16664. el.append(temp_exp_2);
  16665. if (expression_element.itens[0].type) {
  16666. VariableValueMenu.renderMenu(command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  16667. } else {
  16668. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  16669. }
  16670. renderOperator(command, function_obj, temp_op, expression_element, 1);
  16671. if (expression_element.itens[2].type) {
  16672. VariableValueMenu.renderMenu(command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  16673. } else {
  16674. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  16675. }
  16676. break;
  16677. case Models.EXPRESSION_ELEMENTS.op_exp:
  16678. var temp_op = (0, _jquery2.default)('<div class="component_element"></div>');
  16679. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16680. el.append(temp_op);
  16681. el.append(temp_exp);
  16682. renderOperator(command, function_obj, temp_op, expression_element, 0);
  16683. if (expression_element.itens[1].type) {
  16684. VariableValueMenu.renderMenu(command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  16685. } else {
  16686. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  16687. }
  16688. break;
  16689. case Models.EXPRESSION_ELEMENTS.par_exp_par:
  16690. var temp_par_1 = (0, _jquery2.default)('<div class="component_element"> ( </div>');
  16691. var temp_exp = (0, _jquery2.default)('<div class="component_element"></div>');
  16692. var temp_par_2 = (0, _jquery2.default)('<div class="component_element"> ) </div>');
  16693. el.append(temp_par_1);
  16694. el.append(temp_exp);
  16695. for (var j = 0; j < expression_element.itens.length; j++) {
  16696. if (expression_element.itens[j].type) {
  16697. VariableValueMenu.renderMenu(command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  16698. } else {
  16699. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  16700. }
  16701. }
  16702. //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  16703. el.append(temp_par_2);
  16704. break;
  16705. }
  16706. }
  16707. function renderExpression(command, function_obj, el) {
  16708. var expression_div = el.find('.expression_elements');
  16709. expression_div.text('');
  16710. var menu_add_item = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16711. menu_add_item.data('index_add', 0);
  16712. expression_div.append(menu_add_item);
  16713. for (var i = 0; i < command.expression.length; i++) {
  16714. if (command.expression[i].type) {
  16715. var temp = (0, _jquery2.default)('<div class="expression_element"></div>');
  16716. temp.data('ref_element', command.expression[i]);
  16717. temp.data('ref_index', i);
  16718. expression_div.append(temp);
  16719. VariableValueMenu.renderMenu(command, command.expression[i], temp, function_obj);
  16720. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  16721. var temp = (0, _jquery2.default)('<div class="expression_element">' + command.expression[i] + '</div>');
  16722. temp.data('ref_element', command.expression[i]);
  16723. temp.data('ref_index', i);
  16724. expression_div.append(temp);
  16725. } else {
  16726. var temp = '<div class="expression_element">';
  16727. switch (command.expression[i]) {
  16728. case Models.ARITHMETIC_TYPES.plus:
  16729. temp += '+';
  16730. break;
  16731. case Models.ARITHMETIC_TYPES.minus:
  16732. temp += '-';
  16733. break;
  16734. case Models.ARITHMETIC_TYPES.multiplication:
  16735. temp += '*';
  16736. break;
  16737. case Models.ARITHMETIC_TYPES.division:
  16738. temp += '/';
  16739. break;
  16740. case Models.ARITHMETIC_TYPES.module:
  16741. temp += '%';
  16742. break;
  16743. }
  16744. temp += '</div>';
  16745. temp = (0, _jquery2.default)(temp);
  16746. temp.data('ref_element', command.expression[i]);
  16747. temp.data('ref_index', i);
  16748. expression_div.append(temp);
  16749. }
  16750. var menu_add_item_seq = (0, _jquery2.default)('<div class="menu_add_item"></div>');
  16751. var index_temp = i + 1;
  16752. menu_add_item_seq.data('index_add', index_temp);
  16753. expression_div.append(menu_add_item_seq);
  16754. }
  16755. addMenuItens(command, function_obj, el);
  16756. }
  16757. function addMenuItens(command, function_obj, expression_div) {
  16758. var divs_expression = expression_div.find('.menu_add_item');
  16759. for (var i = 0; i < divs_expression.length; i++) {
  16760. var temp = (0, _jquery2.default)(divs_expression[i]).data('index_add');
  16761. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  16762. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  16763. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_operator') + '</div>';
  16764. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _localizedStringsService.LocalizedStrings.getUI('text_parentheses') + '</div>';
  16765. context_menu += '</div></div>';
  16766. context_menu = (0, _jquery2.default)(context_menu);
  16767. (0, _jquery2.default)(divs_expression[i]).append(context_menu);
  16768. context_menu.dropdown({
  16769. on: 'hover',
  16770. onChange: function onChange(value, text, $selectedItem) {
  16771. switch ($selectedItem.data('option')) {
  16772. case "value":
  16773. command.expression.splice($selectedItem.data('index'), 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16774. renderExpression(command, function_obj, expression_div);
  16775. break;
  16776. case "operator":
  16777. command.expression.splice($selectedItem.data('index'), 0, Models.ARITHMETIC_TYPES.plus);
  16778. renderExpression(command, function_obj, expression_div);
  16779. break;
  16780. case "parentheses":
  16781. command.expression.splice($selectedItem.data('index'), 0, "(");
  16782. command.expression.splice($selectedItem.data('index') + 1, 0, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  16783. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  16784. renderExpression(command, function_obj, expression_div);
  16785. break;
  16786. }
  16787. }
  16788. });
  16789. }
  16790. }
  16791. function addHandlers(command, function_obj, attribution_dom) {
  16792. attribution_dom.find('.button_remove_command').on('click', function () {
  16793. if (CommandsManagement.removeCommand(command, function_obj, attribution_dom)) {
  16794. attribution_dom.remove();
  16795. }
  16796. });
  16797. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  16798. renderExpressionElements(command, function_obj, attribution_dom);
  16799. });
  16800. }
  16801. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  16802. /*console.log("recebido o seguinte DOM: ");
  16803. console.log(dom_object);
  16804. if (dom_object.hasClass('var_attributed')) {
  16805. return;
  16806. } else {
  16807. var hier = dom_object.parentsUntil(".command_container");
  16808. for (var i = 0; i < hier.length; i++) {
  16809. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  16810. return;
  16811. }
  16812. }
  16813. }
  16814. dom_object.find('.context_menu_clear').remove();
  16815. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  16816. for (var tm in Models.ARITHMETIC_TYPES) {
  16817. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  16818. }
  16819. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  16820. menu_operations += '</div></div>';
  16821. menu_operations = $(menu_operations);
  16822. dom_object.append(menu_operations);
  16823. menu_operations.dropdown({
  16824. onChange: function(value, text, $selectedItem) {
  16825. switch ($($selectedItem).data('option')) {
  16826. case "clear":
  16827. $(dom_object).text('');
  16828. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  16829. break;
  16830. default:
  16831. createExpressionAround(command, ref_object, dom_object, function_obj);
  16832. menu_operations.find('.text').text('');
  16833. }
  16834. }
  16835. });*/
  16836. }
  16837. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  16838. (0, _jquery2.default)('<span> ( </span>').insertBefore(dom_object);
  16839. (0, _jquery2.default)('<span> ) </span>').insertAfter(dom_object);
  16840. VariableValueMenu.renderMenu(command, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true), dom_object, function_obj);
  16841. }
  16842. /***/ }),
  16843. /***/ "./js/visualUI/commands/break.js":
  16844. /*!***************************************!*\
  16845. !*** ./js/visualUI/commands/break.js ***!
  16846. \***************************************/
  16847. /*! no static exports found */
  16848. /***/ (function(module, exports, __webpack_require__) {
  16849. "use strict";
  16850. Object.defineProperty(exports, "__esModule", {
  16851. value: true
  16852. });
  16853. exports.createFloatingCommand = createFloatingCommand;
  16854. exports.renderCommand = renderCommand;
  16855. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16856. var _jquery2 = _interopRequireDefault(_jquery);
  16857. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16858. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16859. var Models = _interopRequireWildcard(_ivprog_elements);
  16860. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16861. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16862. var CommandsManagement = _interopRequireWildcard(_commands);
  16863. 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; } }
  16864. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16865. function createFloatingCommand() {
  16866. 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>');
  16867. }
  16868. function renderCommand(command, function_obj) {
  16869. 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>');
  16870. el.data('command', command);
  16871. addHandlers(command, function_obj, el);
  16872. return el;
  16873. }
  16874. function addHandlers(command, function_obj, break_dom) {
  16875. break_dom.find('.button_remove_command').on('click', function () {
  16876. if (CommandsManagement.removeCommand(command, function_obj, break_dom)) {
  16877. break_dom.remove();
  16878. }
  16879. });
  16880. }
  16881. /***/ }),
  16882. /***/ "./js/visualUI/commands/comment.js":
  16883. /*!*****************************************!*\
  16884. !*** ./js/visualUI/commands/comment.js ***!
  16885. \*****************************************/
  16886. /*! no static exports found */
  16887. /***/ (function(module, exports, __webpack_require__) {
  16888. "use strict";
  16889. Object.defineProperty(exports, "__esModule", {
  16890. value: true
  16891. });
  16892. exports.createFloatingCommand = createFloatingCommand;
  16893. exports.renderCommand = renderCommand;
  16894. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16895. var _jquery2 = _interopRequireDefault(_jquery);
  16896. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16897. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16898. var Models = _interopRequireWildcard(_ivprog_elements);
  16899. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16900. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16901. var GlobalsManagement = _interopRequireWildcard(_globals);
  16902. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16903. var VariablesManagement = _interopRequireWildcard(_variables);
  16904. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16905. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  16906. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  16907. var CommandsManagement = _interopRequireWildcard(_commands);
  16908. 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; } }
  16909. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16910. function createFloatingCommand() {
  16911. 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>');
  16912. }
  16913. function renderCommand(command, function_obj) {
  16914. 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> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  16915. el.data('command', command);
  16916. addHandlers(command, function_obj, el);
  16917. renderTextComment(command, function_obj, el);
  16918. return el;
  16919. }
  16920. function renderTextComment(command, function_obj, el) {
  16921. VariableValueMenu.renderMenu(command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  16922. }
  16923. function addHandlers(command, function_obj, comment_dom) {
  16924. comment_dom.find('.button_remove_command').on('click', function () {
  16925. if (CommandsManagement.removeCommand(command, function_obj, comment_dom)) {
  16926. comment_dom.remove();
  16927. }
  16928. });
  16929. }
  16930. /***/ }),
  16931. /***/ "./js/visualUI/commands/conditional_expression.js":
  16932. /*!********************************************************!*\
  16933. !*** ./js/visualUI/commands/conditional_expression.js ***!
  16934. \********************************************************/
  16935. /*! no static exports found */
  16936. /***/ (function(module, exports, __webpack_require__) {
  16937. "use strict";
  16938. Object.defineProperty(exports, "__esModule", {
  16939. value: true
  16940. });
  16941. exports.renderExpression = renderExpression;
  16942. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  16943. var _jquery2 = _interopRequireDefault(_jquery);
  16944. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  16945. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  16946. var Models = _interopRequireWildcard(_ivprog_elements);
  16947. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  16948. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  16949. var GlobalsManagement = _interopRequireWildcard(_globals);
  16950. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  16951. var VariablesManagement = _interopRequireWildcard(_variables);
  16952. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  16953. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  16954. 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; } }
  16955. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  16956. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  16957. if (expression.expression == null || expression.expression.length < 1) {
  16958. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  16959. } else {
  16960. var main_div = (0, _jquery2.default)('<div class="expression_elements"></div>');
  16961. switch (expression.expression.type) {
  16962. case Models.EXPRESSION_TYPES.exp_logic:
  16963. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  16964. break;
  16965. case Models.EXPRESSION_TYPES.exp_arithmetic:
  16966. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  16967. break;
  16968. }
  16969. initial_el_to_render.append(main_div);
  16970. }
  16971. }
  16972. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  16973. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  16974. menu_operator.dropdown({
  16975. values: [{
  16976. name: '>',
  16977. value: Models.ARITHMETIC_COMPARISON.greater_than,
  16978. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than
  16979. }, {
  16980. name: '<',
  16981. value: Models.ARITHMETIC_COMPARISON.less_than,
  16982. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than
  16983. }, {
  16984. name: '==',
  16985. value: Models.ARITHMETIC_COMPARISON.equals_to,
  16986. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.equals_to
  16987. }, {
  16988. name: '!=',
  16989. value: Models.ARITHMETIC_COMPARISON.not_equals_to,
  16990. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.not_equals_to
  16991. }, {
  16992. name: '>=',
  16993. value: Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to,
  16994. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.greater_than_or_equals_to
  16995. }, {
  16996. name: '<=',
  16997. value: Models.ARITHMETIC_COMPARISON.less_than_or_equals_to,
  16998. selected: arithmetic_operator == Models.ARITHMETIC_COMPARISON.less_than_or_equals_to
  16999. }],
  17000. onChange: function onChange(value, text, $selectedItem) {
  17001. expression_arithmetic.operator = value;
  17002. }
  17003. });
  17004. element_to_append.append(menu_operator);
  17005. }
  17006. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  17007. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  17008. menu_operator.dropdown({
  17009. values: [{
  17010. name: '==',
  17011. value: Models.LOGIC_COMPARISON.equals_to,
  17012. selected: logic_operator == Models.LOGIC_COMPARISON.equals_to
  17013. }, {
  17014. name: '!=',
  17015. value: Models.LOGIC_COMPARISON.not_equals_to,
  17016. selected: logic_operator == Models.LOGIC_COMPARISON.not_equals_to
  17017. }, {
  17018. name: '&&',
  17019. value: Models.LOGIC_COMPARISON.and,
  17020. selected: logic_operator == Models.LOGIC_COMPARISON.and
  17021. }, {
  17022. name: '||',
  17023. value: Models.LOGIC_COMPARISON.or,
  17024. selected: logic_operator == Models.LOGIC_COMPARISON.or
  17025. }],
  17026. onChange: function onChange(value, text, $selectedItem) {
  17027. if ($selectedItem) {
  17028. expression_logic.operator = value;
  17029. if (expression_logic.second_operand == null) {
  17030. expression_logic.second_operand = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  17031. initial_el_to_render.empty();
  17032. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  17033. }
  17034. }
  17035. }
  17036. });
  17037. element_to_append.append(menu_operator);
  17038. }
  17039. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  17040. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17041. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17042. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17043. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17044. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17045. if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17046. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17047. } else if (expression_logic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17048. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  17049. } else {
  17050. VariableValueMenuManagement.renderMenu(command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  17051. }
  17052. element_to_append.append(exp_el_par_1);
  17053. element_to_append.append(exp_el_expr_el_1);
  17054. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  17055. element_to_append.append(exp_el_expr_operand);
  17056. if (expression_logic.second_operand) {
  17057. if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17058. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17059. } else if (expression_logic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17060. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  17061. } else {
  17062. VariableValueMenuManagement.renderMenu(command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  17063. }
  17064. element_to_append.append(exp_el_expr_el_2);
  17065. }
  17066. element_to_append.append(exp_el_par_2);
  17067. }
  17068. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  17069. var exp_el_par_1 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17070. var exp_el_expr_el_1 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17071. var exp_el_expr_operand = (0, _jquery2.default)('<div class="expression_element"></div>');
  17072. var exp_el_expr_el_2 = (0, _jquery2.default)('<div class="expression_element"></div>');
  17073. var exp_el_par_2 = (0, _jquery2.default)(' <span class="span_command_spec"> </span> ');
  17074. if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17075. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17076. } else if (expression_arithmetic.first_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17077. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  17078. } else {
  17079. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  17080. }
  17081. if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_logic) {
  17082. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17083. } else if (expression_arithmetic.second_operand.type == Models.EXPRESSION_TYPES.exp_arithmetic) {
  17084. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  17085. } else {
  17086. VariableValueMenuManagement.renderMenu(command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  17087. }
  17088. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  17089. element_to_append.append(exp_el_par_1);
  17090. element_to_append.append(exp_el_expr_el_1);
  17091. element_to_append.append(exp_el_expr_operand);
  17092. element_to_append.append(exp_el_expr_el_2);
  17093. element_to_append.append(exp_el_par_2);
  17094. }
  17095. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  17096. var start_menu = '';
  17097. 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">';
  17098. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_logic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_logic_expression') + '</div>';
  17099. start_menu += '<div class="item" data-exp="' + Models.EXPRESSION_TYPES.exp_arithmetic + '">' + _localizedStringsService.LocalizedStrings.getUI('text_arithmetic_expression') + '</div>';
  17100. start_menu += '</div></div>';
  17101. start_menu = (0, _jquery2.default)(start_menu);
  17102. start_menu.dropdown({
  17103. onChange: function onChange(value, text, $selectedItem) {
  17104. switch ($selectedItem.data('exp')) {
  17105. case Models.EXPRESSION_TYPES.exp_logic:
  17106. expression.expression = new Models.LogicExpression(false, new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17107. break;
  17108. case Models.EXPRESSION_TYPES.exp_arithmetic:
  17109. 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);
  17110. break;
  17111. }
  17112. initial_el_to_render.html('');
  17113. renderExpression(command, expression, function_obj, initial_el_to_render);
  17114. }
  17115. });
  17116. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17117. initial_el_to_render.append(start_menu);
  17118. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  17119. }
  17120. /***/ }),
  17121. /***/ "./js/visualUI/commands/contextualized_menu.js":
  17122. /*!*****************************************************!*\
  17123. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  17124. \*****************************************************/
  17125. /*! no static exports found */
  17126. /***/ (function(module, exports, __webpack_require__) {
  17127. "use strict";
  17128. Object.defineProperty(exports, "__esModule", {
  17129. value: true
  17130. });
  17131. exports.renderMenu = renderMenu;
  17132. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17133. var _jquery2 = _interopRequireDefault(_jquery);
  17134. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17135. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17136. var Models = _interopRequireWildcard(_ivprog_elements);
  17137. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17138. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17139. var CommandsManagement = _interopRequireWildcard(_commands);
  17140. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17141. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  17142. var _switch = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  17143. var SwitchManagement = _interopRequireWildcard(_switch);
  17144. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17145. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17146. 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; } }
  17147. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17148. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  17149. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  17150. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17151. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17152. } else {
  17153. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.break + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_break') + ' </a>';
  17154. menu_div += '<a class="item" data-command="' + Models.COMMAND_TYPES.switchcase + '"><i class="download icon"></i> ' + _localizedStringsService.LocalizedStrings.getUI('btn_case') + ' </a>';
  17155. }
  17156. menu_div += '</div></div>';
  17157. menu_div = (0, _jquery2.default)(menu_div);
  17158. dom_where_render.append(menu_div);
  17159. addHandlers(command, dom_where_render, function_obj, dom_command);
  17160. }
  17161. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  17162. dom_where_render.find('.menu_commands').dropdown({
  17163. on: 'hover'
  17164. });
  17165. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  17166. if (command.type == Models.COMMAND_TYPES.repeatNtimes || command.type == Models.COMMAND_TYPES.whiletrue || command.type == Models.COMMAND_TYPES.dowhiletrue) {
  17167. if (command.commands_block == null || command.commands_block.length == 0) {
  17168. command.commands_block = [];
  17169. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  17170. command.commands_block.push(new_cmd);
  17171. CommandsManagement.renderCommand(new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  17172. } else {
  17173. CommandsManagement.createFloatingCommand(function_obj, dom_command.find('.block_commands'), (0, _jquery2.default)(this).data('command'), evt);
  17174. }
  17175. } else {
  17176. switch ((0, _jquery2.default)(this).data('command')) {
  17177. case Models.COMMAND_TYPES.break:
  17178. CommandsManagement.createFloatingCommand(function_obj, null, (0, _jquery2.default)(this).data('command'), evt);
  17179. break;
  17180. case Models.COMMAND_TYPES.switchcase:
  17181. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  17182. break;
  17183. }
  17184. }
  17185. });
  17186. }
  17187. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  17188. if (command.cases == null) {
  17189. command.cases = [];
  17190. }
  17191. var sc = new Models.SwitchCase(new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17192. command.cases.push(sc);
  17193. SwitchManagement.renderCase(sc, command, function_obj, dom_command.find('.all_cases_div'));
  17194. }
  17195. /***/ }),
  17196. /***/ "./js/visualUI/commands/dowhiletrue.js":
  17197. /*!*********************************************!*\
  17198. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  17199. \*********************************************/
  17200. /*! no static exports found */
  17201. /***/ (function(module, exports, __webpack_require__) {
  17202. "use strict";
  17203. Object.defineProperty(exports, "__esModule", {
  17204. value: true
  17205. });
  17206. exports.createFloatingCommand = createFloatingCommand;
  17207. exports.renderCommand = renderCommand;
  17208. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17209. var _jquery2 = _interopRequireDefault(_jquery);
  17210. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17211. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17212. var Models = _interopRequireWildcard(_ivprog_elements);
  17213. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17214. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17215. var GlobalsManagement = _interopRequireWildcard(_globals);
  17216. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17217. var VariablesManagement = _interopRequireWildcard(_variables);
  17218. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17219. var CommandsManagement = _interopRequireWildcard(_commands);
  17220. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17221. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17222. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17223. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17224. 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; } }
  17225. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17226. function createFloatingCommand() {
  17227. 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>');
  17228. }
  17229. function renderCommand(command, function_obj) {
  17230. var ret = '';
  17231. 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>';
  17232. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  17233. ret += '</div>';
  17234. 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>';
  17235. ret += '</div>';
  17236. var el = (0, _jquery2.default)(ret);
  17237. el.data('command', command);
  17238. addHandlers(command, function_obj, el);
  17239. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17240. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17241. if (command.commands_block) {
  17242. for (var j = 0; j < command.commands_block.length; j++) {
  17243. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17244. }
  17245. }
  17246. return el;
  17247. }
  17248. function addHandlers(command, function_obj, dowhiletrue_dom) {
  17249. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  17250. if (CommandsManagement.removeCommand(command, function_obj, dowhiletrue_dom)) {
  17251. dowhiletrue_dom.remove();
  17252. }
  17253. });
  17254. }
  17255. /***/ }),
  17256. /***/ "./js/visualUI/commands/functioncall.js":
  17257. /*!**********************************************!*\
  17258. !*** ./js/visualUI/commands/functioncall.js ***!
  17259. \**********************************************/
  17260. /*! no static exports found */
  17261. /***/ (function(module, exports, __webpack_require__) {
  17262. "use strict";
  17263. Object.defineProperty(exports, "__esModule", {
  17264. value: true
  17265. });
  17266. exports.createFloatingCommand = createFloatingCommand;
  17267. exports.renderCommand = renderCommand;
  17268. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17269. var _jquery2 = _interopRequireDefault(_jquery);
  17270. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17271. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17272. var Models = _interopRequireWildcard(_ivprog_elements);
  17273. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17274. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17275. var GlobalsManagement = _interopRequireWildcard(_globals);
  17276. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17277. var VariablesManagement = _interopRequireWildcard(_variables);
  17278. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17279. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17280. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17281. var CommandsManagement = _interopRequireWildcard(_commands);
  17282. 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; } }
  17283. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17284. function createFloatingCommand() {
  17285. return (0, _jquery2.default)('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  17286. }
  17287. function renderCommand(command, function_obj) {
  17288. 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>');
  17289. el.data('command', command);
  17290. VariableValueMenu.renderMenu(command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  17291. addHandlers(command, function_obj, el);
  17292. return el;
  17293. }
  17294. function addHandlers(command, function_obj, functioncall_dom) {
  17295. functioncall_dom.find('.button_remove_command').on('click', function () {
  17296. if (CommandsManagement.removeCommand(command, function_obj, functioncall_dom)) {
  17297. functioncall_dom.remove();
  17298. }
  17299. });
  17300. }
  17301. /***/ }),
  17302. /***/ "./js/visualUI/commands/iftrue.js":
  17303. /*!****************************************!*\
  17304. !*** ./js/visualUI/commands/iftrue.js ***!
  17305. \****************************************/
  17306. /*! no static exports found */
  17307. /***/ (function(module, exports, __webpack_require__) {
  17308. "use strict";
  17309. Object.defineProperty(exports, "__esModule", {
  17310. value: true
  17311. });
  17312. exports.createFloatingCommand = createFloatingCommand;
  17313. exports.renderCommand = renderCommand;
  17314. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17315. var _jquery2 = _interopRequireDefault(_jquery);
  17316. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17317. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17318. var Models = _interopRequireWildcard(_ivprog_elements);
  17319. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17320. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17321. var GlobalsManagement = _interopRequireWildcard(_globals);
  17322. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17323. var VariablesManagement = _interopRequireWildcard(_variables);
  17324. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17325. var CommandsManagement = _interopRequireWildcard(_commands);
  17326. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17327. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17328. 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; } }
  17329. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17330. function createFloatingCommand() {
  17331. return (0, _jquery2.default)('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  17332. }
  17333. function renderCommand(command, function_obj) {
  17334. var ret = '';
  17335. 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>';
  17336. ret += '<span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_if') + '</span>';
  17337. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  17338. ret += '<span> </span> ';
  17339. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  17340. ret += '</div></div>';
  17341. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _localizedStringsService.LocalizedStrings.getUI('text_else') + ' </span>';
  17342. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  17343. ret += '</div>';
  17344. ret += '<span></span></div>';
  17345. ret += '</div>';
  17346. var el = (0, _jquery2.default)(ret);
  17347. el.data('command', command);
  17348. el.find('.block_commands').data('command', command);
  17349. el.find('.data_block_if').data('command', command);
  17350. el.find('.data_block_else').data('command', command);
  17351. addHandlers(command, function_obj, el);
  17352. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  17353. if (command.commands_block) {
  17354. for (var j = 0; j < command.commands_block.length; j++) {
  17355. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.commands_if')[0]), 3, function_obj);
  17356. }
  17357. }
  17358. if (command.commands_else) {
  17359. for (var j = 0; j < command.commands_else.length; j++) {
  17360. CommandsManagement.renderCommand(command.commands_else[j], (0, _jquery2.default)(el.find('.commands_else')[0]), 3, function_obj);
  17361. }
  17362. }
  17363. return el;
  17364. }
  17365. function addHandlers(command, function_obj, iftrue_dom) {
  17366. iftrue_dom.find('.button_remove_command').on('click', function () {
  17367. if (CommandsManagement.removeCommand(command, function_obj, iftrue_dom)) {
  17368. iftrue_dom.remove();
  17369. }
  17370. });
  17371. }
  17372. /***/ }),
  17373. /***/ "./js/visualUI/commands/reader.js":
  17374. /*!****************************************!*\
  17375. !*** ./js/visualUI/commands/reader.js ***!
  17376. \****************************************/
  17377. /*! no static exports found */
  17378. /***/ (function(module, exports, __webpack_require__) {
  17379. "use strict";
  17380. Object.defineProperty(exports, "__esModule", {
  17381. value: true
  17382. });
  17383. exports.createFloatingCommand = createFloatingCommand;
  17384. exports.renderCommand = renderCommand;
  17385. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17386. var _jquery2 = _interopRequireDefault(_jquery);
  17387. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17388. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17389. var Models = _interopRequireWildcard(_ivprog_elements);
  17390. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17391. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17392. var GlobalsManagement = _interopRequireWildcard(_globals);
  17393. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17394. var VariablesManagement = _interopRequireWildcard(_variables);
  17395. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17396. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17397. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17398. var CommandsManagement = _interopRequireWildcard(_commands);
  17399. 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; } }
  17400. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17401. function createFloatingCommand() {
  17402. 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>');
  17403. }
  17404. function renderCommand(command, function_obj) {
  17405. 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>';
  17406. el = (0, _jquery2.default)(el);
  17407. el.data('command', command);
  17408. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17409. addHandlers(command, function_obj, el);
  17410. return el;
  17411. }
  17412. function addHandlers(command, function_obj, reader_dom) {
  17413. reader_dom.find('.button_remove_command').on('click', function () {
  17414. if (CommandsManagement.removeCommand(command, function_obj, reader_dom)) {
  17415. reader_dom.remove();
  17416. }
  17417. });
  17418. }
  17419. /***/ }),
  17420. /***/ "./js/visualUI/commands/repeatNtimes.js":
  17421. /*!**********************************************!*\
  17422. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  17423. \**********************************************/
  17424. /*! no static exports found */
  17425. /***/ (function(module, exports, __webpack_require__) {
  17426. "use strict";
  17427. Object.defineProperty(exports, "__esModule", {
  17428. value: true
  17429. });
  17430. exports.createFloatingCommand = createFloatingCommand;
  17431. exports.renderCommand = renderCommand;
  17432. exports.manageExpressionElements = manageExpressionElements;
  17433. exports.manageClearExpressionElements = manageClearExpressionElements;
  17434. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17435. var _jquery2 = _interopRequireDefault(_jquery);
  17436. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17437. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17438. var Models = _interopRequireWildcard(_ivprog_elements);
  17439. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17440. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17441. var GlobalsManagement = _interopRequireWildcard(_globals);
  17442. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17443. var VariablesManagement = _interopRequireWildcard(_variables);
  17444. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17445. var CommandsManagement = _interopRequireWildcard(_commands);
  17446. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  17447. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  17448. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17449. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17450. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17451. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17452. 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; } }
  17453. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17454. function createFloatingCommand() {
  17455. 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>');
  17456. }
  17457. function renderCommand(command, function_obj) {
  17458. 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>';
  17459. ret += '<div class="ui block_commands">';
  17460. ret += '</div>';
  17461. ret += '<span> </span>';
  17462. ret += '</div>';
  17463. var el = (0, _jquery2.default)(ret);
  17464. el.data('command', command);
  17465. addHandlers(command, function_obj, el);
  17466. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17467. VariableValueMenu.renderMenu(command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  17468. ConditionalExpressionManagement.renderExpression(command, command.expression2, function_obj, el.find('.conditional_expression'));
  17469. VariableValueMenu.renderMenu(command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  17470. if (command.expression1) {
  17471. el.find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17472. VariableValueMenu.renderMenu(command, command.expression1, el.find('.var_value_expression'), function_obj);
  17473. }
  17474. if (command.expression3) {
  17475. el.find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17476. VariableValueMenu.renderMenu(command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  17477. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  17478. VariableValueMenu.renderMenu(command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  17479. }
  17480. if (command.commands_block) {
  17481. for (var j = 0; j < command.commands_block.length; j++) {
  17482. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  17483. }
  17484. }
  17485. return el;
  17486. }
  17487. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17488. if (dom_object.hasClass('variable_attribution')) {
  17489. if (!command.expression3) {
  17490. 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)]);
  17491. command.expression3 = exp;
  17492. command.var_incrementation = command.var_attribution;
  17493. 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);
  17494. command.expression2.expression = cond_exp;
  17495. }
  17496. dom_object.parent().find('.text_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17497. command.expression1 = new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.all, "0", null, null, true);
  17498. dom_object.parent().find('.var_value_expression').empty();
  17499. VariableValueMenu.renderMenu(command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  17500. renderAlgorithm();
  17501. }
  17502. if (dom_object.hasClass('incrementation_variable')) {
  17503. dom_object.parent().find('.text_inc_receives').text(_localizedStringsService.LocalizedStrings.getUI('text_receives'));
  17504. 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)]);
  17505. command.expression3 = exp;
  17506. VariableValueMenu.renderMenu(command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  17507. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  17508. VariableValueMenu.renderMenu(command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  17509. }
  17510. }
  17511. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  17512. if (dom_object.hasClass('variable_attribution')) {
  17513. (0, _jquery2.default)(dom_object).parent().find('.text_receives').text('');
  17514. command.expression1 = null;
  17515. (0, _jquery2.default)(dom_object).parent().find('.var_value_expression').empty();
  17516. }
  17517. if (dom_object.hasClass('incrementation_variable')) {
  17518. (0, _jquery2.default)(dom_object).parent().find('.text_inc_receives').text('');
  17519. command.expression3 = null;
  17520. (0, _jquery2.default)(dom_object).parent().find('.first_operand').empty();
  17521. (0, _jquery2.default)(dom_object).parent().find('.operator').empty();
  17522. (0, _jquery2.default)(dom_object).parent().find('.second_operand').empty();
  17523. }
  17524. }
  17525. function addHandlers(command, function_obj, repeatNtimes_dom) {
  17526. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  17527. if (CommandsManagement.removeCommand(command, function_obj, repeatNtimes_dom)) {
  17528. repeatNtimes_dom.remove();
  17529. }
  17530. });
  17531. }
  17532. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  17533. var menu_operator = (0, _jquery2.default)('<div class="ui dropdown"><div class="text"></div></div>');
  17534. menu_operator.dropdown({
  17535. values: [{
  17536. name: '+',
  17537. value: Models.ARITHMETIC_TYPES.plus,
  17538. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.plus
  17539. }, {
  17540. name: '-',
  17541. value: Models.ARITHMETIC_TYPES.minus,
  17542. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.minus
  17543. }, {
  17544. name: '*',
  17545. value: Models.ARITHMETIC_TYPES.multiplication,
  17546. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.multiplication
  17547. }, {
  17548. name: '/',
  17549. value: Models.ARITHMETIC_TYPES.division,
  17550. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.division
  17551. }, {
  17552. name: '%',
  17553. value: Models.ARITHMETIC_TYPES.module,
  17554. selected: expression_element.itens[index_op] == Models.ARITHMETIC_TYPES.module
  17555. }],
  17556. onChange: function onChange(value, text, $selectedItem) {
  17557. expression_element.itens[index_op] = value;
  17558. }
  17559. });
  17560. temp_op.append(menu_operator);
  17561. }
  17562. /***/ }),
  17563. /***/ "./js/visualUI/commands/return.js":
  17564. /*!****************************************!*\
  17565. !*** ./js/visualUI/commands/return.js ***!
  17566. \****************************************/
  17567. /*! no static exports found */
  17568. /***/ (function(module, exports, __webpack_require__) {
  17569. "use strict";
  17570. Object.defineProperty(exports, "__esModule", {
  17571. value: true
  17572. });
  17573. exports.createFloatingCommand = createFloatingCommand;
  17574. exports.renderCommand = renderCommand;
  17575. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17576. var _jquery2 = _interopRequireDefault(_jquery);
  17577. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17578. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17579. var Models = _interopRequireWildcard(_ivprog_elements);
  17580. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17581. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17582. var GlobalsManagement = _interopRequireWildcard(_globals);
  17583. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17584. var VariablesManagement = _interopRequireWildcard(_variables);
  17585. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17586. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17587. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17588. var CommandsManagement = _interopRequireWildcard(_commands);
  17589. 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; } }
  17590. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17591. function createFloatingCommand() {
  17592. 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>');
  17593. }
  17594. function renderCommand(command, function_obj) {
  17595. var el = (0, _jquery2.default)('<div class="ui return command_container"> <i class="ui icon small reply"></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>');
  17596. el.data('command', command);
  17597. addHandlers(command, function_obj, el);
  17598. VariableValueMenu.renderMenu(command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  17599. return el;
  17600. }
  17601. function addHandlers(command, function_obj, return_dom) {
  17602. return_dom.find('.button_remove_command').on('click', function () {
  17603. if (CommandsManagement.removeCommand(command, function_obj, return_dom)) {
  17604. return_dom.remove();
  17605. }
  17606. });
  17607. }
  17608. /***/ }),
  17609. /***/ "./js/visualUI/commands/switch.js":
  17610. /*!****************************************!*\
  17611. !*** ./js/visualUI/commands/switch.js ***!
  17612. \****************************************/
  17613. /*! no static exports found */
  17614. /***/ (function(module, exports, __webpack_require__) {
  17615. "use strict";
  17616. Object.defineProperty(exports, "__esModule", {
  17617. value: true
  17618. });
  17619. exports.createFloatingCommand = createFloatingCommand;
  17620. exports.renderCommand = renderCommand;
  17621. exports.renderCase = renderCase;
  17622. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17623. var _jquery2 = _interopRequireDefault(_jquery);
  17624. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17625. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17626. var Models = _interopRequireWildcard(_ivprog_elements);
  17627. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17628. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17629. var GlobalsManagement = _interopRequireWildcard(_globals);
  17630. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17631. var VariablesManagement = _interopRequireWildcard(_variables);
  17632. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  17633. var CommandsManagement = _interopRequireWildcard(_commands);
  17634. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  17635. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  17636. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  17637. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  17638. 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; } }
  17639. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17640. function createFloatingCommand() {
  17641. 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>');
  17642. }
  17643. function renderCommand(command, function_obj) {
  17644. var ret = '';
  17645. 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>';
  17646. ret += '</div>';
  17647. var el = (0, _jquery2.default)(ret);
  17648. el.data('command', command);
  17649. addHandlers(command, function_obj, el);
  17650. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  17651. VariableValueMenu.renderMenu(command, command.variable, el.find('.variable_to_switch'), function_obj);
  17652. if (command.cases) {
  17653. for (var i = 0; i < command.cases.length; i++) {
  17654. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  17655. }
  17656. }
  17657. return el;
  17658. }
  17659. function renderCase(switchcase, command, function_obj, el) {
  17660. 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>');
  17661. VariableValueMenu.renderMenu(command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  17662. casediv.data('switchcase', switchcase);
  17663. casediv.find('.case_commands_block').data('switchcase', switchcase);
  17664. el.append(casediv);
  17665. if (switchcase.commands_block) {
  17666. for (var j = 0; j < switchcase.commands_block.length; j++) {
  17667. CommandsManagement.renderCommand(switchcase.commands_block[j], (0, _jquery2.default)(casediv.find('.case_commands_block')[0]), 3, function_obj);
  17668. }
  17669. }
  17670. casediv.find('.button_remove_command').on('click', function () {
  17671. for (var i = 0; i < command.cases.length; i++) {
  17672. if (switchcase == command.cases[i]) {
  17673. delete command.cases[i];
  17674. command.cases.splice(i, 1);
  17675. casediv.remove();
  17676. break;
  17677. }
  17678. }
  17679. });
  17680. }
  17681. function addHandlers(command, function_obj, switch_dom) {
  17682. switch_dom.find('.button_remove_command').on('click', function () {
  17683. if (CommandsManagement.removeCommand(command, function_obj, switch_dom)) {
  17684. switch_dom.remove();
  17685. }
  17686. });
  17687. }
  17688. /***/ }),
  17689. /***/ "./js/visualUI/commands/variable_value_menu.js":
  17690. /*!*****************************************************!*\
  17691. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  17692. \*****************************************************/
  17693. /*! no static exports found */
  17694. /***/ (function(module, exports, __webpack_require__) {
  17695. "use strict";
  17696. Object.defineProperty(exports, "__esModule", {
  17697. value: true
  17698. });
  17699. exports.VAR_OR_VALUE_TYPES = undefined;
  17700. exports.renderMenu = renderMenu;
  17701. exports.refreshMenu = refreshMenu;
  17702. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  17703. var _jquery2 = _interopRequireDefault(_jquery);
  17704. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  17705. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  17706. var Models = _interopRequireWildcard(_ivprog_elements);
  17707. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  17708. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  17709. var GlobalsManagement = _interopRequireWildcard(_globals);
  17710. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  17711. var VariablesManagement = _interopRequireWildcard(_variables);
  17712. var _attribution = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  17713. var AttribuitionsManagement = _interopRequireWildcard(_attribution);
  17714. var _writer = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  17715. var WritersManagement = _interopRequireWildcard(_writer);
  17716. var _repeatNtimes = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  17717. var RepeatNTimesManagement = _interopRequireWildcard(_repeatNtimes);
  17718. 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; } }
  17719. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  17720. 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,
  17721. value_and_function: 6, all: 7 });
  17722. function renderMenu(command, ref_object, dom_object, function_obj) {
  17723. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  17724. var expression_element = arguments[5];
  17725. console.log('\n\ndebugging: ');
  17726. console.log(command);
  17727. console.log(ref_object);
  17728. console.log(dom_object);
  17729. console.log(function_obj);
  17730. console.log(size_field);
  17731. console.log(expression_element);
  17732. console.log('fim\n\n');
  17733. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  17734. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  17735. if (ref_object.function_called) {
  17736. if (ref_object.function_called.parameters_list) {
  17737. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  17738. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  17739. ref_object.parameters_list.pop();
  17740. } else {
  17741. ref_object.parameters_list.push(new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true));
  17742. }
  17743. }
  17744. }
  17745. }
  17746. 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">';
  17747. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  17748. 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">';
  17749. menu_var_or_value += '</div>';
  17750. }
  17751. 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) {
  17752. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('variable');
  17753. menu_var_or_value += '<div class="menu menu_only_vars">';
  17754. menu_var_or_value += '</div></div>';
  17755. }
  17756. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  17757. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  17758. }
  17759. 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) {
  17760. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _localizedStringsService.LocalizedStrings.getUI('text_value') + '</div>';
  17761. }
  17762. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  17763. 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">';
  17764. menu_var_or_value += '</div>';
  17765. }
  17766. 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) {
  17767. 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');
  17768. menu_var_or_value += '<div class="menu menu_only_functions">';
  17769. menu_var_or_value += '</div></div>';
  17770. if (command.type == Models.COMMAND_TYPES.attribution) {
  17771. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17772. menu_var_or_value += '<div class="menu">';
  17773. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17774. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17775. menu_var_or_value += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17776. menu_var_or_value += '</div></div>';
  17777. }
  17778. }
  17779. menu_var_or_value += '</div></div>';
  17780. menu_var_or_value = (0, _jquery2.default)(menu_var_or_value);
  17781. dom_object.append(menu_var_or_value);
  17782. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  17783. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17784. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17785. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  17786. if (ref_object.content || ref_object.function_called) {
  17787. if (ref_object.content) {
  17788. // Verificar se a variável ainda existe:
  17789. if (isVarInProgram(ref_object.content, function_obj)) {
  17790. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17791. } else {
  17792. if (ref_object.content && ref_object.content.type) {
  17793. ref_object.content = null;
  17794. appendSelectText(ref_object, menu_var_or_value);
  17795. } else {
  17796. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17797. }
  17798. }
  17799. } else if (ref_object.function_called) {
  17800. // Verificar se a função ainda existe:
  17801. if (isFunctionInProgram(ref_object.function_called)) {
  17802. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  17803. } else {
  17804. ref_object.content = null;
  17805. ref_object.row = null;
  17806. ref_object.column = null;
  17807. delete ref_object.function_called;
  17808. delete ref_object.parameters_list;
  17809. appendSelectText(ref_object, menu_var_or_value);
  17810. }
  17811. }
  17812. } else {
  17813. appendSelectText(ref_object, menu_var_or_value);
  17814. }
  17815. }
  17816. function appendSelectText(ref_object, menu_var_or_value) {
  17817. switch (ref_object.variable_and_value) {
  17818. case VAR_OR_VALUE_TYPES.only_variable:
  17819. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_var') + '</i>');
  17820. break;
  17821. case VAR_OR_VALUE_TYPES.all:
  17822. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17823. break;
  17824. case VAR_OR_VALUE_TYPES.variable_and_function:
  17825. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_all') + '</i>');
  17826. break;
  17827. case VAR_OR_VALUE_TYPES.only_function:
  17828. menu_var_or_value.find('.text').append('<i>' + _localizedStringsService.LocalizedStrings.getUI('var_menu_select_function') + '</i>');
  17829. break;
  17830. }
  17831. }
  17832. function isFunctionInProgram(function_called_obj) {
  17833. if (window.program_obj.functions) {
  17834. for (var i = 0; i < window.program_obj.functions.length; i++) {
  17835. if (window.program_obj.functions[i] == function_called_obj) {
  17836. return true;
  17837. }
  17838. }
  17839. }
  17840. return false;
  17841. }
  17842. function isVarInProgram(var_obj, function_obj) {
  17843. // Verify in locals:
  17844. if (function_obj.variables_list) {
  17845. for (var i = 0; i < function_obj.variables_list.length; i++) {
  17846. if (function_obj.variables_list[i] == var_obj) {
  17847. return true;
  17848. }
  17849. }
  17850. }
  17851. // Verify in parameters:
  17852. if (function_obj.parameters_list) {
  17853. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  17854. if (function_obj.parameters_list[i] == var_obj) {
  17855. return true;
  17856. }
  17857. }
  17858. }
  17859. // Verify in globals:
  17860. if (window.program_obj.globals) {
  17861. for (var i = 0; i < window.program_obj.globals.length; i++) {
  17862. if (window.program_obj.globals[i] == var_obj) {
  17863. return true;
  17864. }
  17865. }
  17866. }
  17867. return false;
  17868. }
  17869. function refreshMenu(menu_var_or_value_dom) {
  17870. console.log('\n\n');
  17871. console.log(menu_var_or_value_dom);
  17872. console.log("olá, fui chamado! note alguns DATAS recuperados: ");
  17873. console.log(menu_var_or_value_dom.data());
  17874. console.log('\n\n\n');
  17875. }
  17876. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  17877. if (ref_object.function_called) {
  17878. menu_var_or_value.remove();
  17879. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17880. } else if (ref_object.content.type) {
  17881. menu_var_or_value.remove();
  17882. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17883. } else {
  17884. menu_var_or_value.remove();
  17885. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  17886. }
  17887. }
  17888. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  17889. if (variable_obj.content || variable_obj.function_called) {
  17890. // Verificar se a variável ainda existe:
  17891. if (isVarInProgram(variable_obj.content, function_obj)) {} else {
  17892. if (variable_obj.content && variable_obj.content.type) {
  17893. variable_obj.content = null;
  17894. appendSelectText(variable_obj, menu_var_or_value);
  17895. }
  17896. }
  17897. } else {
  17898. appendSelectText(variable_obj, menu_var_or_value);
  17899. }
  17900. if (variable_obj.content == null && variable_obj.function_called == null) {
  17901. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17902. return;
  17903. }
  17904. var ret = '';
  17905. if (variable_obj.function_called) {
  17906. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  17907. menu_var_or_value.find('.text').text(' ');
  17908. dom_object.find('.menu_var_or_value_dom').remove();
  17909. var parameters_menu;
  17910. if (variable_obj.function_called.name) {
  17911. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17912. } else {
  17913. 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>';
  17914. }
  17915. parameters_menu += '<span> ) </span></div>';
  17916. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17917. dom_object.append(parameters_menu);
  17918. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17919. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17920. if (command.type == Models.COMMAND_TYPES.attribution) {
  17921. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17922. context_menu += '<div class="menu">';
  17923. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17924. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17925. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17926. context_menu += '</div></div>';
  17927. }
  17928. context_menu += '</div></div>';
  17929. context_menu = (0, _jquery2.default)(context_menu);
  17930. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  17931. context_menu.dropdown({
  17932. onChange: function onChange(value, text, $selectedItem) {
  17933. console.log('S1');
  17934. if ($selectedItem.data('clear')) {
  17935. console.log('PP1');
  17936. dom_object.text('');
  17937. variable_obj.content = null;
  17938. variable_obj.row = null;
  17939. variable_obj.column = null;
  17940. delete variable_obj.function_called;
  17941. delete variable_obj.parameters_list;
  17942. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17943. }
  17944. if ($selectedItem.data('exp')) {
  17945. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  17946. }
  17947. }
  17948. });
  17949. } else {
  17950. menu_var_or_value.find('.text').text(' ');
  17951. dom_object.find('.menu_var_or_value_dom').remove();
  17952. var parameters_menu;
  17953. if (variable_obj.function_called.name) {
  17954. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  17955. } else {
  17956. 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>';
  17957. }
  17958. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17959. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  17960. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  17961. parameters_menu += ' , ';
  17962. }
  17963. }
  17964. parameters_menu += '<span> ) </span></div>';
  17965. parameters_menu = (0, _jquery2.default)(parameters_menu);
  17966. dom_object.append(parameters_menu);
  17967. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  17968. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  17969. }
  17970. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  17971. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  17972. if (command.type == Models.COMMAND_TYPES.attribution) {
  17973. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  17974. context_menu += '<div class="menu">';
  17975. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  17976. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  17977. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  17978. context_menu += '</div></div>';
  17979. }
  17980. context_menu += '</div></div>';
  17981. context_menu = (0, _jquery2.default)(context_menu);
  17982. context_menu.insertAfter(parameters_menu);
  17983. context_menu.dropdown({
  17984. onChange: function onChange(value, text, $selectedItem) {
  17985. console.log('S2');
  17986. if ($selectedItem.data('clear')) {
  17987. console.log('PP2');
  17988. dom_object.text('');
  17989. variable_obj.content = null;
  17990. variable_obj.row = null;
  17991. variable_obj.column = null;
  17992. delete variable_obj.function_called;
  17993. delete variable_obj.parameters_list;
  17994. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  17995. }
  17996. if ($selectedItem.data('exp')) {
  17997. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  17998. }
  17999. }
  18000. });
  18001. }
  18002. } else if (variable_obj.content.type) {
  18003. var variable_render = "";
  18004. if (variable_obj.content.dimensions == 1) {
  18005. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18006. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18007. variable_render += '</div>';
  18008. variable_render = (0, _jquery2.default)(variable_render);
  18009. dom_object.append(variable_render);
  18010. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18011. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18012. if (command.type == Models.COMMAND_TYPES.attribution) {
  18013. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18014. context_menu += '<div class="menu">';
  18015. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18016. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18017. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18018. context_menu += '</div></div>';
  18019. }
  18020. context_menu += '</div></div>';
  18021. context_menu = (0, _jquery2.default)(context_menu);
  18022. variable_render.append(context_menu);
  18023. context_menu.dropdown({
  18024. onChange: function onChange(value, text, $selectedItem) {
  18025. console.log('S3');
  18026. if ($selectedItem.data('clear')) {
  18027. console.log('PP3');
  18028. dom_object.text('');
  18029. variable_obj.content = null;
  18030. variable_obj.row = null;
  18031. variable_obj.column = null;
  18032. delete variable_obj.function_called;
  18033. delete variable_obj.parameters_list;
  18034. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18035. }
  18036. if ($selectedItem.data('exp')) {
  18037. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18038. }
  18039. }
  18040. });
  18041. if (!variable_obj.column) {
  18042. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18043. }
  18044. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18045. } else if (variable_obj.content.dimensions == 2) {
  18046. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18047. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  18048. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  18049. variable_render += '</div>';
  18050. variable_render = (0, _jquery2.default)(variable_render);
  18051. dom_object.append(variable_render);
  18052. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18053. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18054. if (command.type == Models.COMMAND_TYPES.attribution) {
  18055. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18056. context_menu += '<div class="menu">';
  18057. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18058. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18059. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18060. context_menu += '</div></div>';
  18061. }
  18062. context_menu += '</div></div>';
  18063. context_menu = (0, _jquery2.default)(context_menu);
  18064. variable_render.append(context_menu);
  18065. context_menu.dropdown({
  18066. onChange: function onChange(value, text, $selectedItem) {
  18067. console.log('S4');
  18068. if ($selectedItem.data('clear')) {
  18069. console.log('PP4');
  18070. dom_object.text('');
  18071. variable_obj.content = null;
  18072. variable_obj.row = null;
  18073. variable_obj.column = null;
  18074. delete variable_obj.function_called;
  18075. delete variable_obj.parameters_list;
  18076. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18077. }
  18078. if ($selectedItem.data('exp')) {
  18079. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18080. }
  18081. }
  18082. });
  18083. if (!variable_obj.column) {
  18084. variable_obj.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18085. }
  18086. if (!variable_obj.row) {
  18087. variable_obj.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18088. }
  18089. variableValueMenuCode(command, variable_obj.row, (0, _jquery2.default)(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  18090. variableValueMenuCode(command, variable_obj.column, (0, _jquery2.default)(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  18091. } else {
  18092. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  18093. variable_render += '</div>';
  18094. variable_render = (0, _jquery2.default)(variable_render);
  18095. dom_object.append(variable_render);
  18096. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18097. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18098. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18099. console.log('dom_object6');
  18100. console.log(dom_object);
  18101. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18102. context_menu += '<div class="menu">';
  18103. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18104. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18105. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18106. context_menu += '</div></div>';
  18107. }
  18108. context_menu += '</div></div>';
  18109. context_menu = (0, _jquery2.default)(context_menu);
  18110. variable_render.append(context_menu);
  18111. context_menu.dropdown({
  18112. onChange: function onChange(value, text, $selectedItem) {
  18113. console.log('S5');
  18114. if ($selectedItem.data('clear')) {
  18115. console.log('PP5');
  18116. dom_object.text('');
  18117. variable_obj.content = null;
  18118. variable_obj.row = null;
  18119. variable_obj.column = null;
  18120. delete variable_obj.function_called;
  18121. delete variable_obj.parameters_list;
  18122. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18123. }
  18124. if ($selectedItem.data('exp')) {
  18125. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18126. }
  18127. }
  18128. });
  18129. }
  18130. } else {
  18131. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  18132. variable_render += '</div>';
  18133. variable_render = (0, _jquery2.default)(variable_render);
  18134. dom_object.append(variable_render);
  18135. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18136. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18137. if (command.type == Models.COMMAND_TYPES.attribution) {
  18138. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18139. context_menu += '<div class="menu">';
  18140. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18141. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18142. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18143. context_menu += '</div></div>';
  18144. }
  18145. context_menu += '</div></div>';
  18146. context_menu = (0, _jquery2.default)(context_menu);
  18147. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18148. context_menu.insertAfter(variable_render);
  18149. }
  18150. context_menu.dropdown({
  18151. onChange: function onChange(value, text, $selectedItem) {
  18152. console.log('S6');
  18153. if ($selectedItem.data('clear')) {
  18154. console.log('PP6');
  18155. dom_object.text('');
  18156. variable_obj.content = null;
  18157. variable_obj.row = null;
  18158. variable_obj.column = null;
  18159. delete variable_obj.function_called;
  18160. delete variable_obj.parameters_list;
  18161. dom_object.find('.value_rendered').remove();
  18162. dom_object.find('.context_menu_clear').remove();
  18163. dom_object.find('.width-dynamic-minus').remove();
  18164. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  18165. }
  18166. if ($selectedItem.data('exp')) {
  18167. AttribuitionsManagement.manageExpressionElements(command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18168. }
  18169. }
  18170. });
  18171. variable_render.on('click', function (e) {
  18172. variable_render.remove();
  18173. variable_render.empty();
  18174. variable_render.remove();
  18175. dom_object.empty();
  18176. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18177. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  18178. });
  18179. }
  18180. }
  18181. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18182. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18183. sub_menu.append('<div class="divider"></div><div class="header">' + _localizedStringsService.LocalizedStrings.getUI('text_header_ivprog_functions') + '</div>');
  18184. 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>');
  18185. 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>');
  18186. 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>');
  18187. 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>');
  18188. // Insert Math functions:
  18189. for (var i = 0; i < window.system_functions.length; i++) {
  18190. var t = (0, _jquery2.default)('<div class="item"></div>');
  18191. t.data('function_reference', window.system_functions[i]);
  18192. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  18193. t.text(_localizedStringsService.LocalizedStrings.getUI(window.system_functions[i].identifier));
  18194. switch (window.system_functions[i].category) {
  18195. case Models.SYSTEM_FUNCTIONS_CATEGORIES.math:
  18196. sub_menu.find('.menu_math_functions').append(t);
  18197. break;
  18198. case Models.SYSTEM_FUNCTIONS_CATEGORIES.text:
  18199. sub_menu.find('.menu_text_functions').append(t);
  18200. break;
  18201. case Models.SYSTEM_FUNCTIONS_CATEGORIES.arrangement:
  18202. sub_menu.find('.menu_arrangement_functions').append(t);
  18203. break;
  18204. case Models.SYSTEM_FUNCTIONS_CATEGORIES.conversion:
  18205. sub_menu.find('.menu_conversion_functions').append(t);
  18206. break;
  18207. }
  18208. }
  18209. }
  18210. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18211. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  18212. sub_menu.text('');
  18213. for (var i = 0; i < window.program_obj.functions.length; i++) {
  18214. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  18215. temp.data('function_reference', window.program_obj.functions[i]);
  18216. sub_menu.append(temp);
  18217. }
  18218. }
  18219. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  18220. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  18221. sub_menu.text('');
  18222. if (window.program_obj.globals) {
  18223. if (ref_object.include_constant) {
  18224. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18225. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18226. temp.data('variable_reference', window.program_obj.globals[i]);
  18227. sub_menu.append(temp);
  18228. }
  18229. } else {
  18230. for (var i = 0; i < window.program_obj.globals.length; i++) {
  18231. if (!window.program_obj.globals[i].is_constant) {
  18232. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  18233. temp.data('variable_reference', window.program_obj.globals[i]);
  18234. sub_menu.append(temp);
  18235. }
  18236. }
  18237. }
  18238. }
  18239. if (function_obj.parameters_list) {
  18240. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  18241. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  18242. temp.data('variable_reference', function_obj.parameters_list[i]);
  18243. sub_menu.append(temp);
  18244. }
  18245. }
  18246. if (function_obj.variables_list) {
  18247. for (var i = 0; i < function_obj.variables_list.length; i++) {
  18248. var temp = (0, _jquery2.default)('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  18249. temp.data('variable_reference', function_obj.variables_list[i]);
  18250. sub_menu.append(temp);
  18251. }
  18252. }
  18253. }
  18254. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18255. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18256. menu_var_or_value.dropdown({
  18257. onChange: function onChange(value, text, $selectedItem) {
  18258. console.log('S7');
  18259. dom_object.find('.var_name').remove();
  18260. switch ($selectedItem.data('option')) {
  18261. case VAR_OR_VALUE_TYPES.only_function:
  18262. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('function_reference'), expression_element);
  18263. break;
  18264. case VAR_OR_VALUE_TYPES.only_value:
  18265. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18266. break;
  18267. case VAR_OR_VALUE_TYPES.only_variable:
  18268. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, (0, _jquery2.default)($selectedItem).data('variable_reference'), expression_element);
  18269. break;
  18270. }
  18271. if ($selectedItem.data('exp')) {
  18272. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18273. }
  18274. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18275. RepeatNTimesManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18276. }
  18277. }
  18278. });
  18279. }
  18280. dom_object.find('.width-dynamic').on('input', function () {
  18281. var inputWidth = (0, _jquery2.default)(this).textWidth() + 10;
  18282. (0, _jquery2.default)(this).focus();
  18283. var tmpStr = (0, _jquery2.default)(this).val();
  18284. (0, _jquery2.default)(this).val('');
  18285. (0, _jquery2.default)(this).val(tmpStr);
  18286. (0, _jquery2.default)(this).css({
  18287. width: inputWidth
  18288. });
  18289. }).trigger('input');
  18290. if (command.type == Models.COMMAND_TYPES.comment) {
  18291. dom_object.parent().on('click', function (e) {
  18292. dom_object.find('.value_rendered').remove();
  18293. dom_object.find('.value_rendered').empty();
  18294. dom_object.find('.value_rendered').remove();
  18295. dom_object.empty();
  18296. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18297. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18298. });
  18299. }
  18300. }
  18301. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  18302. ref_object.function_called = function_selected;
  18303. ref_object.parameters_list = [];
  18304. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  18305. menu_var_or_value.find('.text').text(' ');
  18306. dom_object.find('.menu_var_or_value_dom').remove();
  18307. var parameters_menu;
  18308. if (function_selected.name) {
  18309. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18310. } else {
  18311. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18312. }
  18313. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18314. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  18315. if (j + 1 != function_selected.parameters_list.length) {
  18316. parameters_menu += ' , ';
  18317. }
  18318. }
  18319. parameters_menu += '<span> ) </span></div>';
  18320. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18321. dom_object.append(parameters_menu);
  18322. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  18323. var temp = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18324. ref_object.parameters_list.push(temp);
  18325. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  18326. }
  18327. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18328. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18329. if (command.type == Models.COMMAND_TYPES.attribution) {
  18330. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18331. context_menu += '<div class="menu">';
  18332. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18333. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18334. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18335. context_menu += '</div></div>';
  18336. }
  18337. context_menu += '</div></div>';
  18338. context_menu = (0, _jquery2.default)(context_menu);
  18339. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18340. context_menu.dropdown({
  18341. onChange: function onChange(value, text, $selectedItem) {
  18342. console.log('S8');
  18343. if ($selectedItem.data('clear')) {
  18344. console.log('PP7');
  18345. dom_object.text('');
  18346. ref_object.content = null;
  18347. ref_object.row = null;
  18348. ref_object.column = null;
  18349. delete ref_object.function_called;
  18350. delete ref_object.parameters_list;
  18351. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18352. }
  18353. if ($selectedItem.data('exp')) {
  18354. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18355. }
  18356. }
  18357. });
  18358. } else {
  18359. menu_var_or_value.find('.text').text(' ');
  18360. dom_object.find('.menu_var_or_value_dom').remove();
  18361. var parameters_menu;
  18362. if (function_selected.name) {
  18363. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  18364. } else {
  18365. parameters_menu = '<div class="parameters_function_called"> <i>' + _localizedStringsService.LocalizedStrings.getUI(function_selected.category) + '.' + _localizedStringsService.LocalizedStrings.getUI(function_selected.identifier) + '</i> <span> ( </span>';
  18366. }
  18367. parameters_menu += '<span> ) </span></div>';
  18368. parameters_menu = (0, _jquery2.default)(parameters_menu);
  18369. dom_object.append(parameters_menu);
  18370. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18371. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18372. if (command.type == Models.COMMAND_TYPES.attribution) {
  18373. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18374. context_menu += '<div class="menu">';
  18375. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18376. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18377. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18378. context_menu += '</div></div>';
  18379. }
  18380. context_menu += '</div></div>';
  18381. context_menu = (0, _jquery2.default)(context_menu);
  18382. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  18383. context_menu.dropdown({
  18384. onChange: function onChange(value, text, $selectedItem) {
  18385. console.log('S9');
  18386. if ($selectedItem.data('clear')) {
  18387. console.log('PP8');
  18388. dom_object.text('');
  18389. ref_object.content = null;
  18390. ref_object.row = null;
  18391. ref_object.column = null;
  18392. delete ref_object.function_called;
  18393. delete ref_object.parameters_list;
  18394. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18395. }
  18396. if ($selectedItem.data('exp')) {
  18397. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18398. }
  18399. }
  18400. });
  18401. }
  18402. if (command.type == Models.COMMAND_TYPES.attribution) {
  18403. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18404. }
  18405. }
  18406. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  18407. ref_object.content = variable_selected;
  18408. menu_var_or_value.find('.text').text(' ');
  18409. dom_object.find('.menu_var_or_value_dom').remove();
  18410. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  18411. if (variable_selected.dimensions == 1) {
  18412. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18413. }
  18414. if (variable_selected.dimensions == 2) {
  18415. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  18416. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  18417. }
  18418. variable_render += '</div>';
  18419. variable_render = (0, _jquery2.default)(variable_render);
  18420. dom_object.append(variable_render);
  18421. if (variable_selected.dimensions == 1) {
  18422. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18423. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18424. }
  18425. if (variable_selected.dimensions == 2) {
  18426. ref_object.row = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18427. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  18428. ref_object.column = new Models.VariableValueMenu(VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18429. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  18430. }
  18431. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18432. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18433. if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  18434. console.log("dom_object 10: ");
  18435. console.log(dom_object);
  18436. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18437. context_menu += '<div class="menu">';
  18438. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18439. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18440. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18441. context_menu += '</div></div>';
  18442. }
  18443. context_menu += '</div></div>';
  18444. context_menu = (0, _jquery2.default)(context_menu);
  18445. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  18446. context_menu.dropdown({
  18447. onChange: function onChange(value, text, $selectedItem) {
  18448. console.log('S10');
  18449. if ($selectedItem.data('clear')) {
  18450. console.log('PP9');
  18451. dom_object.text('');
  18452. ref_object.content = null;
  18453. ref_object.row = null;
  18454. ref_object.column = null;
  18455. delete ref_object.function_called;
  18456. delete ref_object.parameters_list;
  18457. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18458. }
  18459. if ($selectedItem.data('exp')) {
  18460. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18461. }
  18462. if (command.type == Models.COMMAND_TYPES.repeatNtimes) {
  18463. RepeatNTimesManagement.manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18464. }
  18465. }
  18466. });
  18467. if (command.type == Models.COMMAND_TYPES.attribution) {
  18468. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  18469. }
  18470. }
  18471. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  18472. if (ref_object.content == null) {
  18473. ref_object.content = "";
  18474. }
  18475. menu_var_or_value.find('.text').text(' ');
  18476. var field = (0, _jquery2.default)('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  18477. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  18478. var rendered = (0, _jquery2.default)('<div class="value_rendered"></div>');
  18479. rendered.insertBefore(field);
  18480. field.focus();
  18481. field.val(ref_object.content);
  18482. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  18483. context_menu += '<div class="item" data-clear="true">' + _localizedStringsService.LocalizedStrings.getUI('btn_clear') + '</div>';
  18484. if (command.type == Models.COMMAND_TYPES.attribution) {
  18485. context_menu += '<div class="item"><i class="dropdown icon"></i>' + _localizedStringsService.LocalizedStrings.getUI('text_change');
  18486. context_menu += '<div class="menu">';
  18487. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.exp_op_exp + '">EXP OP EXP</div>';
  18488. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.op_exp + '">OP EXP</div>';
  18489. context_menu += '<div class="item" data-exp="' + Models.EXPRESSION_ELEMENTS.par_exp_par + '">( EXP )</div>';
  18490. context_menu += '</div></div>';
  18491. }
  18492. context_menu += '</div></div>';
  18493. context_menu = (0, _jquery2.default)(context_menu);
  18494. dom_object.find('.menu_var_or_value_dom').remove();
  18495. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  18496. context_menu.insertAfter(field);
  18497. }
  18498. context_menu.dropdown({
  18499. onChange: function onChange(value, text, $selectedItem) {
  18500. console.log('S11');
  18501. if ($selectedItem.data('clear')) {
  18502. console.log('PP10');
  18503. dom_object.text('');
  18504. dom_object.find('.value_rendered').remove();
  18505. dom_object.find('.context_menu_clear').remove();
  18506. dom_object.find('.width-dynamic-minus').remove();
  18507. ref_object.content = null;
  18508. ref_object.row = null;
  18509. ref_object.column = null;
  18510. delete ref_object.function_called;
  18511. delete ref_object.parameters_list;
  18512. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  18513. }
  18514. if ($selectedItem.data('exp')) {
  18515. AttribuitionsManagement.manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  18516. }
  18517. }
  18518. });
  18519. dom_object.find('.width-dynamic-minus').focusout(function () {
  18520. if ((0, _jquery2.default)(this).val().trim()) {
  18521. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18522. }
  18523. rendered.text(ref_object.content);
  18524. (0, _jquery2.default)(this).remove();
  18525. });
  18526. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  18527. var code = e.keyCode || e.which;
  18528. if (code == 13) {
  18529. if ((0, _jquery2.default)(this).val().trim()) {
  18530. ref_object.content = (0, _jquery2.default)(this).val().trim();
  18531. }
  18532. rendered.text(ref_object.content);
  18533. (0, _jquery2.default)(this).remove();
  18534. }
  18535. if (code == 27) {
  18536. rendered.text(ref_object.content);
  18537. (0, _jquery2.default)(this).remove();
  18538. }
  18539. });
  18540. if (command.type == Models.COMMAND_TYPES.comment) {
  18541. rendered.parent().on('click', function (e) {
  18542. console.log("TTT14");
  18543. rendered.remove();
  18544. rendered.empty();
  18545. rendered.remove();
  18546. dom_object.empty();
  18547. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18548. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18549. });
  18550. }
  18551. rendered.on('click', function (e) {
  18552. console.log("TTT2");
  18553. rendered.remove();
  18554. rendered.empty();
  18555. rendered.remove();
  18556. dom_object.empty();
  18557. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  18558. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  18559. });
  18560. if (command.type == Models.COMMAND_TYPES.attribution) {
  18561. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  18562. }
  18563. }
  18564. _jquery2.default.fn.textWidth = function (text, font) {
  18565. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  18566. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  18567. return _jquery2.default.fn.textWidth.fakeEl.width();
  18568. };
  18569. /***/ }),
  18570. /***/ "./js/visualUI/commands/whiletrue.js":
  18571. /*!*******************************************!*\
  18572. !*** ./js/visualUI/commands/whiletrue.js ***!
  18573. \*******************************************/
  18574. /*! no static exports found */
  18575. /***/ (function(module, exports, __webpack_require__) {
  18576. "use strict";
  18577. Object.defineProperty(exports, "__esModule", {
  18578. value: true
  18579. });
  18580. exports.createFloatingCommand = createFloatingCommand;
  18581. exports.renderCommand = renderCommand;
  18582. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18583. var _jquery2 = _interopRequireDefault(_jquery);
  18584. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18585. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18586. var Models = _interopRequireWildcard(_ivprog_elements);
  18587. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18588. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18589. var GlobalsManagement = _interopRequireWildcard(_globals);
  18590. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18591. var VariablesManagement = _interopRequireWildcard(_variables);
  18592. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18593. var CommandsManagement = _interopRequireWildcard(_commands);
  18594. var _conditional_expression = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  18595. var ConditionalExpressionManagement = _interopRequireWildcard(_conditional_expression);
  18596. var _contextualized_menu = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  18597. var ContextualizedMenu = _interopRequireWildcard(_contextualized_menu);
  18598. 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; } }
  18599. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18600. function createFloatingCommand() {
  18601. 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>');
  18602. }
  18603. function renderCommand(command, function_obj) {
  18604. var ret = '';
  18605. 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>';
  18606. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  18607. ret += ' </span>';
  18608. ret += '<div class="ui block_commands">';
  18609. ret += '</div>';
  18610. ret += '<span> </span>';
  18611. ret += '</div>';
  18612. var el = (0, _jquery2.default)(ret);
  18613. el.data('command', command);
  18614. addHandlers(command, function_obj, el);
  18615. ContextualizedMenu.renderMenu(command, el.find('.context_menu'), function_obj, el);
  18616. ConditionalExpressionManagement.renderExpression(command, command.expression, function_obj, el.find('.conditional_expression'));
  18617. if (command.commands_block) {
  18618. for (var j = 0; j < command.commands_block.length; j++) {
  18619. CommandsManagement.renderCommand(command.commands_block[j], (0, _jquery2.default)(el.find('.block_commands')[0]), 3, function_obj);
  18620. }
  18621. }
  18622. return el;
  18623. }
  18624. function addHandlers(command, function_obj, whiletrue_dom) {
  18625. whiletrue_dom.find('.button_remove_command').on('click', function () {
  18626. if (CommandsManagement.removeCommand(command, function_obj, whiletrue_dom)) {
  18627. whiletrue_dom.remove();
  18628. }
  18629. });
  18630. }
  18631. /***/ }),
  18632. /***/ "./js/visualUI/commands/writer.js":
  18633. /*!****************************************!*\
  18634. !*** ./js/visualUI/commands/writer.js ***!
  18635. \****************************************/
  18636. /*! no static exports found */
  18637. /***/ (function(module, exports, __webpack_require__) {
  18638. "use strict";
  18639. Object.defineProperty(exports, "__esModule", {
  18640. value: true
  18641. });
  18642. exports.createFloatingCommand = createFloatingCommand;
  18643. exports.renderCommand = renderCommand;
  18644. exports.addContent = addContent;
  18645. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18646. var _jquery2 = _interopRequireDefault(_jquery);
  18647. var _types = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  18648. var _ivprog_elements = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18649. var Models = _interopRequireWildcard(_ivprog_elements);
  18650. var _localizedStringsService = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18651. var _globals = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  18652. var GlobalsManagement = _interopRequireWildcard(_globals);
  18653. var _variables = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  18654. var VariablesManagement = _interopRequireWildcard(_variables);
  18655. var _variable_value_menu = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18656. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18657. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  18658. var _commands = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  18659. var CommandsManagement = _interopRequireWildcard(_commands);
  18660. 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; } }
  18661. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18662. function createFloatingCommand() {
  18663. 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>');
  18664. }
  18665. function renderCommand(command, function_obj) {
  18666. var ret = '';
  18667. 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>';
  18668. var el = (0, _jquery2.default)(ret);
  18669. el.data('command', command);
  18670. for (var i = 0; i < command.content.length; i++) {
  18671. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18672. el.find('.all_elements_write').append(new_div_item);
  18673. VariableValueMenu.renderMenu(command, command.content[i], new_div_item, function_obj);
  18674. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  18675. }
  18676. addHandlers(command, function_obj, el);
  18677. return el;
  18678. }
  18679. function addHandlers(command, function_obj, writer_dom) {
  18680. writer_dom.find('.button_remove_command').on('click', function () {
  18681. if (CommandsManagement.removeCommand(command, function_obj, writer_dom)) {
  18682. writer_dom.remove();
  18683. }
  18684. });
  18685. }
  18686. function addHandlerIconAdd(dom_object, command, function_obj) {
  18687. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  18688. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  18689. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18690. if (!insert_after) {
  18691. dom_object.append(icon_add_item);
  18692. } else {
  18693. icon_add_item.insertAfter(after_which);
  18694. }
  18695. icon_add_item.on('click', function (e) {
  18696. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div" style="display:none;"></div>');
  18697. new_div_item.insertAfter(icon_add_item);
  18698. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18699. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18700. addHandlerIconAdd(dom_object, command, function_obj, true, new_div_item);
  18701. var pos = 1;
  18702. dom_object.find('.icon_add_item_to_writer').each(function () {
  18703. if ((0, _jquery2.default)(this).get(0) === icon_add_item.get(0)) {
  18704. command.content.splice(pos, 0, new_related_menu);
  18705. } else {
  18706. pos++;
  18707. }
  18708. });
  18709. new_div_item.fadeIn();
  18710. });
  18711. }
  18712. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  18713. if (dom_object.hasClass('var_value_menu_div')) {
  18714. var icon_add_item = (0, _jquery2.default)('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  18715. icon_add_item.insertAfter(dom_object);
  18716. icon_add_item.on('click', function (e) {
  18717. var new_div_item = (0, _jquery2.default)('<div class="var_value_menu_div"></div>');
  18718. new_div_item.insertAfter(icon_add_item);
  18719. var new_related_menu = new Models.VariableValueMenu(VariableValueMenuManagement.VAR_OR_VALUE_TYPES.all, null, null, null, true);
  18720. VariableValueMenu.renderMenu(command, new_related_menu, new_div_item, function_obj);
  18721. command.content.push(new_related_menu);
  18722. });
  18723. }
  18724. }
  18725. /***/ }),
  18726. /***/ "./js/visualUI/functions.js":
  18727. /*!**********************************!*\
  18728. !*** ./js/visualUI/functions.js ***!
  18729. \**********************************/
  18730. /*! no static exports found */
  18731. /***/ (function(module, exports, __webpack_require__) {
  18732. "use strict";
  18733. Object.defineProperty(exports, "__esModule", {
  18734. value: true
  18735. });
  18736. exports.renderFunction = renderFunction;
  18737. exports.initVisualUI = initVisualUI;
  18738. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  18739. var _jquery2 = _interopRequireDefault(_jquery);
  18740. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  18741. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  18742. var Models = _interopRequireWildcard(_ivprog_elements);
  18743. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  18744. var _globals = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  18745. var GlobalsManagement = _interopRequireWildcard(_globals);
  18746. var _variables = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  18747. var VariablesManagement = _interopRequireWildcard(_variables);
  18748. var _commands = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  18749. var CommandsManagement = _interopRequireWildcard(_commands);
  18750. var _code_generator = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  18751. var CodeManagement = _interopRequireWildcard(_code_generator);
  18752. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  18753. var VariableValueMenu = _interopRequireWildcard(_variable_value_menu);
  18754. var _domConsole = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  18755. var _ivprogParser = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  18756. var _ivprogProcessor = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  18757. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  18758. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  18759. var _semanticAnalyser = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  18760. var _ivprogAssessment = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  18761. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  18762. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  18763. __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  18764. 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; } }
  18765. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  18766. var counter_new_functions = 0;
  18767. var counter_new_parameters = 0;
  18768. var studentTemp = null;
  18769. var domConsole = null;
  18770. window.studentGrade = null;
  18771. var program = new Models.Program();
  18772. window.system_functions = [];
  18773. // Adding math functions:
  18774. 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));
  18775. 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));
  18776. 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));
  18777. 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));
  18778. 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));
  18779. 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));
  18780. 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));
  18781. 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));
  18782. 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));
  18783. 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));
  18784. 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));
  18785. // Adding text functions:
  18786. 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));
  18787. 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));
  18788. 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));
  18789. 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));
  18790. 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));
  18791. // Adding arrangement functions:
  18792. 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));
  18793. 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));
  18794. 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));
  18795. // Adding conversion functions:
  18796. 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));
  18797. 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));
  18798. 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));
  18799. 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));
  18800. 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));
  18801. 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));
  18802. 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));
  18803. /*const variable1 = new Models.Variable(Types.INTEGER, "a", 1);
  18804. const parameter1 = new Models.Variable(Types.INTEGER, "par_1", 1);
  18805. const command1 = new Models.Comment(new Models.VariableValueMenu(VariableValueMenu.VAR_OR_VALUE_TYPES.only_value, "Testing rendering commands"));
  18806. const sumFunction = new Models.Function("soma", Types.INTEGER, 0, [parameter1], false, false, [], null, [command1]);
  18807. program.addFunction(sumFunction);
  18808. */
  18809. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ ');
  18810. var mainFunction = new Models.Function(_localizedStringsService.LocalizedStrings.getUI("start"), _types.Types.VOID, 0, [], true, false);
  18811. mainFunction.function_comment = new Models.Comment(_localizedStringsService.LocalizedStrings.getUI('text_comment_main'));
  18812. program.addFunction(mainFunction);
  18813. window.program_obj = program;
  18814. window.generator = CodeManagement.generate;
  18815. window.runCodeAssessment = runCodeAssessment;
  18816. window.renderAlgorithm = AlgorithmManagement.renderAlgorithm;
  18817. window.insertContext = false;
  18818. _melankeWatchjs2.default.watch(program.globals, function () {
  18819. if (window.insertContext) {
  18820. setTimeout(function () {
  18821. AlgorithmManagement.renderAlgorithm();
  18822. }, 300);
  18823. window.insertContext = false;
  18824. } else {
  18825. AlgorithmManagement.renderAlgorithm();
  18826. }
  18827. }, 1);
  18828. function addFunctionHandler() {
  18829. 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')));
  18830. program.addFunction(new_function);
  18831. counter_new_functions++;
  18832. renderFunction(new_function);
  18833. }
  18834. function addParameter(function_obj, function_container) {
  18835. if (function_obj.parameters_list == null) {
  18836. function_obj.parameters_list = [];
  18837. }
  18838. var new_parameter = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI("new_parameter") + "_" + counter_new_parameters);
  18839. function_obj.parameters_list.push(new_parameter);
  18840. counter_new_parameters++;
  18841. renderParameter(function_obj, new_parameter, function_container);
  18842. }
  18843. function updateReturnType(function_obj, new_type) {
  18844. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  18845. function_obj.return_type = new_type;
  18846. function_obj.return_dimensions = new_dimensions;
  18847. }
  18848. function removeFunction(function_obj) {
  18849. var index = program.functions.indexOf(function_obj);
  18850. if (index > -1) {
  18851. program.functions.splice(index, 1);
  18852. }
  18853. }
  18854. function minimizeFunction(function_obj) {
  18855. function_obj.is_hidden = !function_obj.is_hidden;
  18856. }
  18857. function addHandlers(function_obj, function_container) {
  18858. function_container.find('.ui.dropdown.function_return').dropdown({
  18859. onChange: function onChange(value, text, $selectedItem) {
  18860. if ($selectedItem.data('dimensions')) {
  18861. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  18862. } else {
  18863. updateReturnType(function_obj, _types.Types[$selectedItem.data('type')]);
  18864. }
  18865. }
  18866. });
  18867. function_container.find(".name_function_updated").on('click', function (e) {
  18868. enableNameFunctionUpdate(function_obj, function_container);
  18869. });
  18870. function_container.find(".add_parameter_button").on('click', function (e) {
  18871. addParameter(function_obj, function_container);
  18872. });
  18873. function_container.find('.menu_commands').dropdown({
  18874. on: 'hover'
  18875. });
  18876. function_container.find('.menu_commands a').on('click', function (evt) {
  18877. if (function_obj.commands == null || function_obj.commands.length == 0) {
  18878. function_obj.commands = [];
  18879. var new_cmd = CommandsManagement.genericCreateCommand((0, _jquery2.default)(this).data('command'));
  18880. function_obj.commands.push(new_cmd);
  18881. CommandsManagement.renderCommand(new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  18882. } else {
  18883. CommandsManagement.createFloatingCommand(function_obj, function_container, (0, _jquery2.default)(this).data('command'), evt);
  18884. }
  18885. });
  18886. function_container.find('.add_var_button_function').on('click', function (e) {
  18887. window.insertContext = true;
  18888. VariablesManagement.addVariable(function_obj, function_container, true);
  18889. });
  18890. function_container.find('.remove_function_button').on('click', function (e) {
  18891. removeFunction(function_obj);
  18892. function_container.slideUp(400);
  18893. });
  18894. function_container.find('.minimize_function_button').on('click', function (e) {
  18895. minimizeFunction(function_obj);
  18896. function_container.find(".function_area").toggle();
  18897. function_container.find(".add_var_top_button").toggle();
  18898. });
  18899. }
  18900. // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  18901. function renderFunctionReturn(function_obj, function_element) {
  18902. var ret = '<div class="ui dropdown function_return">';
  18903. if (function_obj.return_dimensions > 0) {
  18904. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI("vector") + ':' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type);
  18905. if (function_obj.return_dimensions == 1) {
  18906. ret += ' [ ] ';
  18907. } else {
  18908. ret += ' [ ] [ ] ';
  18909. }
  18910. ret += '</div>';
  18911. } else {
  18912. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(function_obj.return_type) + '</div>';
  18913. }
  18914. ret += '<div class="menu">';
  18915. for (var tm in _types.Types) {
  18916. 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>';
  18917. }
  18918. for (var tm in _types.Types) {
  18919. if (tm == _types.Types.VOID.toUpperCase()) {
  18920. continue;
  18921. }
  18922. 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>';
  18923. }
  18924. ret += '</div></div>';
  18925. ret = (0, _jquery2.default)(ret);
  18926. function_element.find('.function_return').append(ret);
  18927. }
  18928. function renderFunction(function_obj) {
  18929. var appender = '<div class="ui secondary segment function_div list-group-item">';
  18930. if (function_obj.function_comment) {
  18931. //appender += renderComment(function_obj.function_comment, sequence, true, -1);
  18932. }
  18933. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  18934. 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>';
  18935. appender += '<div class="function_signature_div">' + _localizedStringsService.LocalizedStrings.getUI("function") + ' ';
  18936. if (function_obj.is_main) {
  18937. 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">';
  18938. } else {
  18939. appender += '<div class="ui function_return"></div>';
  18940. 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">';
  18941. }
  18942. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  18943. 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>';
  18944. appender += '<div class="ui top attached segment variables_list_div"></div>';
  18945. 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"> ';
  18946. 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>';
  18947. appender += '<div class="ui bottom attached segment commands_list_div" id="function_drag_cmd_"></div>';
  18948. appender += '</div></div>';
  18949. appender = (0, _jquery2.default)(appender);
  18950. (0, _jquery2.default)('.all_functions').append(appender);
  18951. appender.data('fun', function_obj);
  18952. appender.find('.commands_list_div').data('fun', function_obj);
  18953. renderFunctionReturn(function_obj, appender);
  18954. addHandlers(function_obj, appender);
  18955. // Rendering parameters:
  18956. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  18957. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  18958. }
  18959. // Rendering variables:
  18960. for (var j = 0; j < function_obj.variables_list.length; j++) {
  18961. VariablesManagement.renderVariable(appender, function_obj.variables_list[j], function_obj);
  18962. }
  18963. // Rendering commands:
  18964. for (var j = 0; j < function_obj.commands.length; j++) {
  18965. CommandsManagement.renderCommand(function_obj.commands[j], (0, _jquery2.default)(appender.find('.commands_list_div')[0]), 3, function_obj);
  18966. }
  18967. (0, _jquery2.default)('.minimize_function_button').popup({
  18968. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_minimize"),
  18969. delay: {
  18970. show: 750,
  18971. hide: 0
  18972. }
  18973. });
  18974. }
  18975. function initVisualUI() {
  18976. // MUST USE CONST, LET, OR VAR !!!!!!
  18977. var mainDiv = (0, _jquery2.default)('#visual-main-div');
  18978. // fill mainDiv with functions and globals...
  18979. // renderAlgorithm()...
  18980. (0, _jquery2.default)('.add_function_button').on('click', function () {
  18981. addFunctionHandler();
  18982. });
  18983. (0, _jquery2.default)('.add_global_button').on('click', function () {
  18984. window.insertContext = true;
  18985. GlobalsManagement.addGlobal(program, true);
  18986. });
  18987. (0, _jquery2.default)('.run_button').on('click', function () {
  18988. runCode();
  18989. });
  18990. (0, _jquery2.default)('.visual_coding_button').on('click', function () {
  18991. toggleVisualCoding();
  18992. });
  18993. (0, _jquery2.default)('.textual_coding_button').on('click', function () {
  18994. toggleTextualCoding();
  18995. });
  18996. (0, _jquery2.default)('.assessment').on('click', function () {
  18997. runCodeAssessment();
  18998. is_iassign = true;
  18999. });
  19000. (0, _jquery2.default)('.div_toggle_console').on('click', function () {
  19001. toggleConsole();
  19002. });
  19003. }
  19004. var is_iassign = false;
  19005. (0, _jquery2.default)(document).ready(function () {
  19006. for (var i = 0; i < program.functions.length; i++) {
  19007. renderFunction(program.functions[i]);
  19008. }
  19009. var time_show = 750;
  19010. (0, _jquery2.default)('.visual_coding_button').popup({
  19011. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_visual"),
  19012. delay: {
  19013. show: time_show,
  19014. hide: 0
  19015. }
  19016. });
  19017. (0, _jquery2.default)('.textual_coding_button').popup({
  19018. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_textual"),
  19019. delay: {
  19020. show: time_show,
  19021. hide: 0
  19022. }
  19023. });
  19024. (0, _jquery2.default)('.upload_file_button').popup({
  19025. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_upload"),
  19026. delay: {
  19027. show: time_show,
  19028. hide: 0
  19029. }
  19030. });
  19031. (0, _jquery2.default)('.download_file_button').popup({
  19032. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_download"),
  19033. delay: {
  19034. show: time_show,
  19035. hide: 0
  19036. }
  19037. });
  19038. (0, _jquery2.default)('.undo_button').popup({
  19039. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_undo"),
  19040. delay: {
  19041. show: time_show,
  19042. hide: 0
  19043. }
  19044. });
  19045. (0, _jquery2.default)('.redo_button').popup({
  19046. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_redo"),
  19047. delay: {
  19048. show: time_show,
  19049. hide: 0
  19050. }
  19051. });
  19052. (0, _jquery2.default)('.run_button').popup({
  19053. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_run"),
  19054. delay: {
  19055. show: time_show,
  19056. hide: 0
  19057. }
  19058. });
  19059. (0, _jquery2.default)('.assessment_button').popup({
  19060. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_evaluate"),
  19061. delay: {
  19062. show: time_show,
  19063. hide: 0
  19064. }
  19065. });
  19066. (0, _jquery2.default)('.help_button').popup({
  19067. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_help"),
  19068. delay: {
  19069. show: time_show,
  19070. hide: 0
  19071. }
  19072. });
  19073. (0, _jquery2.default)('.add_global_button').popup({
  19074. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_add_global"),
  19075. delay: {
  19076. show: time_show,
  19077. hide: 0
  19078. }
  19079. });
  19080. (0, _jquery2.default)('.div_toggle_console').popup({
  19081. content: _localizedStringsService.LocalizedStrings.getUI("tooltip_console"),
  19082. delay: {
  19083. show: time_show,
  19084. hide: 0
  19085. }
  19086. });
  19087. Sortable.create(listWithHandle, {
  19088. handle: '.glyphicon-move',
  19089. animation: 100,
  19090. ghostClass: 'ghost',
  19091. group: 'functions_divs_drag',
  19092. onEnd: function onEnd(evt) {
  19093. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  19094. }
  19095. });
  19096. });
  19097. function updateSequenceFunction(oldIndex, newIndex) {
  19098. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  19099. }
  19100. function runCodeAssessment() {
  19101. toggleConsole(true);
  19102. window.studentGrade = null;
  19103. studentTemp = null;
  19104. var strCode = CodeManagement.generate();
  19105. if (strCode == null) {
  19106. return;
  19107. }
  19108. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19109. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19110. var runner = new _ivprogAssessment.IVProgAssessment(strCode, testCases, domConsole);
  19111. runner.runTest().then(function (grade) {
  19112. if (!is_iassign) {
  19113. parent.getEvaluationCallback(grade);
  19114. } else {
  19115. is_iassign = false;
  19116. }
  19117. }).catch(function (err) {
  19118. return domConsole.err(err.message);
  19119. });
  19120. }
  19121. function runCode() {
  19122. toggleConsole(true);
  19123. var strCode = CodeManagement.generate();
  19124. if (strCode == null) {
  19125. return;
  19126. }
  19127. if (domConsole == null) domConsole = new _domConsole.DOMConsole("#ivprog-term");
  19128. (0, _jquery2.default)("#ivprog-term").slideDown(500);
  19129. try {
  19130. var parser = _ivprogParser.IVProgParser.createParser(strCode);
  19131. var analyser = new _semanticAnalyser.SemanticAnalyser(parser.parseTree());
  19132. var data = analyser.analyseTree();
  19133. var proc = new _ivprogProcessor.IVProgProcessor(data);
  19134. proc.registerInput(domConsole);
  19135. proc.registerOutput(domConsole);
  19136. (0, _jquery2.default)("#ivprog-term").addClass('ivprog-term-active');
  19137. proc.interpretAST().then(function (_) {
  19138. domConsole.info("Programa executado com sucesso!");
  19139. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19140. }).catch(function (err) {
  19141. domConsole.err(err.message);
  19142. (0, _jquery2.default)("#ivprog-term").removeClass('ivprog-term-active');
  19143. });
  19144. } catch (error) {
  19145. domConsole.err(error.message);
  19146. console.log(error);
  19147. }
  19148. }
  19149. function toggleConsole(is_running) {
  19150. if (is_running) {
  19151. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19152. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19153. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19154. return;
  19155. }
  19156. if ((0, _jquery2.default)('#ivprog-term').css('min-height') == '160px') {
  19157. // esconder
  19158. (0, _jquery2.default)('.ivprog-term-div').css('display', 'none');
  19159. (0, _jquery2.default)('#ivprog-term').css('min-height', '0');
  19160. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-30px');
  19161. (0, _jquery2.default)('#ivprog-term').css('padding', '5px');
  19162. } else {
  19163. // mostrar
  19164. (0, _jquery2.default)('.ivprog-term-div').css('display', 'block');
  19165. (0, _jquery2.default)('#ivprog-term').css('min-height', '160px');
  19166. (0, _jquery2.default)('#ivprog-term').css('margin-top', '-170px');
  19167. }
  19168. }
  19169. function waitToCloseConsole() {
  19170. domConsole.info("Aperte qualquer tecla para fechar...");
  19171. var p = new Promise(function (resolve, _) {
  19172. domConsole.requestInput(resolve, true);
  19173. });
  19174. p.then(function (_) {
  19175. domConsole.dispose();
  19176. domConsole = null;
  19177. (0, _jquery2.default)("#ivprog-term").hide();
  19178. });
  19179. }
  19180. function toggleTextualCoding() {
  19181. var code = CodeManagement.generate();
  19182. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'none');
  19183. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'block');
  19184. (0, _jquery2.default)('.ivprog_textual_panel').removeClass('loading');
  19185. (0, _jquery2.default)('.ivprog_textual_code').text(code);
  19186. (0, _jquery2.default)('.visual_coding_button').removeClass('active');
  19187. (0, _jquery2.default)('.textual_coding_button').addClass('active');
  19188. }
  19189. function toggleVisualCoding() {
  19190. (0, _jquery2.default)('.ivprog_textual_panel').addClass('loading');
  19191. (0, _jquery2.default)('.ivprog_textual_panel').css('display', 'none');
  19192. (0, _jquery2.default)('.ivprog_visual_panel').css('display', 'block');
  19193. (0, _jquery2.default)('.textual_coding_button').removeClass('active');
  19194. (0, _jquery2.default)('.visual_coding_button').addClass('active');
  19195. }
  19196. function removeParameter(function_obj, parameter_obj, parameter_container) {
  19197. var index = function_obj.parameters_list.indexOf(parameter_obj);
  19198. if (index > -1) {
  19199. function_obj.parameters_list.splice(index, 1);
  19200. }
  19201. (0, _jquery2.default)(parameter_container).remove();
  19202. }
  19203. function updateParameterType(parameter_obj, new_type) {
  19204. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19205. parameter_obj.type = new_type;
  19206. parameter_obj.dimensions = new_dimensions;
  19207. if (new_dimensions > 0) {
  19208. parameter_obj.rows = new_dimensions;
  19209. parameter_obj.columns = 2;
  19210. }
  19211. }
  19212. function renderParameter(function_obj, parameter_obj, function_container) {
  19213. var ret = "";
  19214. ret += '<div class="ui label function_name_parameter">';
  19215. ret += '<div class="ui dropdown parameter_type">';
  19216. if (parameter_obj.dimensions > 0) {
  19217. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type);
  19218. if (parameter_obj.dimensions == 1) {
  19219. ret += ' [ ] ';
  19220. } else {
  19221. ret += ' [ ] [ ] ';
  19222. }
  19223. ret += '</div>';
  19224. } else {
  19225. ret += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(parameter_obj.type) + '</div>';
  19226. }
  19227. ret += '<div class="menu">';
  19228. for (var tm in _types.Types) {
  19229. if (tm == _types.Types.VOID.toUpperCase()) {
  19230. continue;
  19231. }
  19232. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19233. }
  19234. for (var tm in _types.Types) {
  19235. if (tm == _types.Types.VOID.toUpperCase()) {
  19236. continue;
  19237. }
  19238. 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>';
  19239. }
  19240. ret += '</div></div>';
  19241. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  19242. ret += ' <i class="red icon times remove_parameter"></i></div>';
  19243. ret = (0, _jquery2.default)(ret);
  19244. function_container.find('.container_parameters_list').append(ret);
  19245. ret.find('.remove_parameter').on('click', function (e) {
  19246. removeParameter(function_obj, parameter_obj, ret);
  19247. });
  19248. ret.find('.ui.dropdown.parameter_type').dropdown({
  19249. onChange: function onChange(value, text, $selectedItem) {
  19250. if ($selectedItem.data('dimensions')) {
  19251. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19252. } else {
  19253. updateParameterType(parameter_obj, _types.Types[$selectedItem.data('type')]);
  19254. }
  19255. }
  19256. });
  19257. ret.find('.label_enable_name_parameter').on('click', function (e) {
  19258. enableNameParameterUpdate(parameter_obj, ret);
  19259. });
  19260. }
  19261. var opened_name_parameter = false;
  19262. var opened_input_parameter = null;
  19263. function enableNameParameterUpdate(parameter_obj, parent_node) {
  19264. if (opened_name_parameter) {
  19265. opened_input_parameter.focus();
  19266. return;
  19267. }
  19268. opened_name_parameter = true;
  19269. parent_node = (0, _jquery2.default)(parent_node);
  19270. var input_field;
  19271. parent_node.find('.span_name_parameter').text('');
  19272. 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 + "' />");
  19273. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  19274. input_field.on('input', function () {
  19275. var inputWidth = input_field.textWidth() + 10;
  19276. opened_input_parameter = input_field;
  19277. input_field.focus();
  19278. var tmpStr = input_field.val();
  19279. input_field.val('');
  19280. input_field.val(tmpStr);
  19281. input_field.css({
  19282. width: inputWidth
  19283. });
  19284. }).trigger('input');
  19285. input_field.focusout(function () {
  19286. /// update array:
  19287. if (input_field.val().trim()) {
  19288. parameter_obj.name = input_field.val().trim();
  19289. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19290. }
  19291. input_field.off();
  19292. input_field.remove();
  19293. /// update elements:
  19294. opened_name_parameter = false;
  19295. opened_input_parameter = false;
  19296. });
  19297. input_field.on('keydown', function (e) {
  19298. var code = e.keyCode || e.which;
  19299. if (code == 13) {
  19300. if (input_field.val().trim()) {
  19301. parameter_obj.name = input_field.val().trim();
  19302. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19303. }
  19304. input_field.off();
  19305. input_field.remove();
  19306. /// update elements:
  19307. opened_name_parameter = false;
  19308. opened_input_parameter = false;
  19309. }
  19310. if (code == 27) {
  19311. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  19312. input_field.off();
  19313. input_field.remove();
  19314. /// update elements:
  19315. opened_name_parameter = false;
  19316. opened_input_parameter = false;
  19317. }
  19318. });
  19319. input_field.select();
  19320. }
  19321. var opened_name_function = false;
  19322. var opened_input = null;
  19323. var previousPadding = null;
  19324. function enableNameFunctionUpdate(function_obj, parent_node) {
  19325. if (opened_name_function) {
  19326. opened_input.focus();
  19327. return;
  19328. }
  19329. parent_node = (0, _jquery2.default)(parent_node);
  19330. parent_node.find('.span_name_function').text('');
  19331. var input_field;
  19332. if (!previousPadding) {
  19333. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  19334. }
  19335. parent_node.find('.span_name_function').css('padding-left', '0');
  19336. parent_node.find('.span_name_function').css('padding-right', '0');
  19337. 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 + "' />");
  19338. input_field.insertBefore(parent_node.find('.span_name_function'));
  19339. input_field.on('input', function () {
  19340. var inputWidth = input_field.textWidth() + 10;
  19341. opened_input = input_field;
  19342. input_field.focus();
  19343. var tmpStr = input_field.val();
  19344. input_field.val('');
  19345. input_field.val(tmpStr);
  19346. input_field.css({
  19347. width: inputWidth
  19348. });
  19349. }).trigger('input');
  19350. input_field.focusout(function () {
  19351. /// update array:
  19352. if (input_field.val().trim()) {
  19353. function_obj.name = input_field.val().trim();
  19354. }
  19355. input_field.off();
  19356. input_field.remove();
  19357. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19358. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19359. parent_node.find('.span_name_function').text(function_obj.name);
  19360. /// update elements:
  19361. opened_name_function = false;
  19362. opened_input = false;
  19363. });
  19364. input_field.on('keydown', function (e) {
  19365. var code = e.keyCode || e.which;
  19366. if (code == 13) {
  19367. if (input_field.val().trim()) {
  19368. function_obj.name = input_field.val().trim();
  19369. }
  19370. input_field.off();
  19371. input_field.remove();
  19372. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19373. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19374. parent_node.find('.span_name_function').text(function_obj.name);
  19375. /// update elements:
  19376. opened_name_function = false;
  19377. opened_input = false;
  19378. }
  19379. if (code == 27) {
  19380. input_field.off();
  19381. input_field.remove();
  19382. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  19383. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  19384. parent_node.find('.span_name_function').text(function_obj.name);
  19385. /// update elements:
  19386. opened_name_function = false;
  19387. opened_input = false;
  19388. }
  19389. });
  19390. input_field.select();
  19391. }
  19392. /***/ }),
  19393. /***/ "./js/visualUI/globals.js":
  19394. /*!********************************!*\
  19395. !*** ./js/visualUI/globals.js ***!
  19396. \********************************/
  19397. /*! no static exports found */
  19398. /***/ (function(module, exports, __webpack_require__) {
  19399. "use strict";
  19400. Object.defineProperty(exports, "__esModule", {
  19401. value: true
  19402. });
  19403. exports.addGlobal = addGlobal;
  19404. exports.renderGlobal = renderGlobal;
  19405. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19406. var _jquery2 = _interopRequireDefault(_jquery);
  19407. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19408. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19409. var Models = _interopRequireWildcard(_ivprog_elements);
  19410. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19411. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  19412. 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; } }
  19413. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  19414. window.jQuery = _jquery2.default;
  19415. var counter_new_globals = 0;
  19416. function addGlobal(program) {
  19417. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  19418. var new_global = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_global') + '_' + counter_new_globals, 1);
  19419. counter_new_globals++;
  19420. program.addGlobal(new_global);
  19421. var newe = renderGlobal(new_global);
  19422. if (is_from_click) {
  19423. newe.css('display', 'none');
  19424. newe.fadeIn();
  19425. }
  19426. }
  19427. function toggleConstant(global_var) {
  19428. global_var.is_constant = !global_var.is_constant;
  19429. }
  19430. function updateName(global_var, new_name) {
  19431. global_var.name = new_name;
  19432. }
  19433. function updateType(global_var, new_type) {
  19434. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  19435. global_var.type = new_type;
  19436. global_var.dimensions = new_dimensions;
  19437. if (new_dimensions > 0) {
  19438. global_var.rows = new_dimensions;
  19439. global_var.columns = 2;
  19440. }
  19441. updateInitialValues(global_var);
  19442. }
  19443. function removeGlobal(global_var, global_container) {
  19444. var index = window.program_obj.globals.indexOf(global_var);
  19445. if (index > -1) {
  19446. window.program_obj.globals.splice(index, 1);
  19447. }
  19448. global_container.children().off();
  19449. global_container.off();
  19450. global_container.remove();
  19451. }
  19452. function updateInitialValues(global_var) {
  19453. if (global_var.type == _types.Types.INTEGER) {
  19454. if (global_var.dimensions == 0) {
  19455. global_var.value = 1;
  19456. }
  19457. if (global_var.dimensions == 1) {
  19458. global_var.value = [1, 1];
  19459. }
  19460. if (global_var.dimensions == 2) {
  19461. global_var.value = [[1, 1], [1, 1]];
  19462. }
  19463. }
  19464. if (global_var.type == _types.Types.REAL) {
  19465. if (global_var.dimensions == 0) {
  19466. global_var.value = 1.0;
  19467. }
  19468. if (global_var.dimensions == 1) {
  19469. global_var.value = [1.0, 1.0];
  19470. }
  19471. if (global_var.dimensions == 2) {
  19472. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  19473. }
  19474. }
  19475. if (global_var.type == _types.Types.TEXT) {
  19476. if (global_var.dimensions == 0) {
  19477. global_var.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  19478. }
  19479. if (global_var.dimensions == 1) {
  19480. global_var.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  19481. }
  19482. if (global_var.dimensions == 2) {
  19483. global_var.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  19484. }
  19485. }
  19486. if (global_var.type == _types.Types.BOOLEAN) {
  19487. if (global_var.dimensions == 0) {
  19488. global_var.value = true;
  19489. }
  19490. if (global_var.dimensions == 1) {
  19491. global_var.value = [true, true];
  19492. }
  19493. if (global_var.dimensions == 2) {
  19494. global_var.value = [[true, true], [true, true]];
  19495. }
  19496. }
  19497. }
  19498. function alternateBooleanGlobalValue(global_var, value_container) {
  19499. global_var.value = !global_var.value;
  19500. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value));
  19501. }
  19502. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  19503. global_var.value[index] = !global_var.value[index];
  19504. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[index]));
  19505. }
  19506. function removeGlobalColumnVector(global_var) {
  19507. if (global_var.columns == 0) {
  19508. return;
  19509. }
  19510. global_var.columns--;
  19511. global_var.value.splice(global_var.value.length - 1, 1);
  19512. }
  19513. function addGlobalColumnVector(global_var) {
  19514. global_var.columns++;
  19515. if (global_var.type == _types.Types.INTEGER) {
  19516. global_var.value.push(1);
  19517. }
  19518. if (global_var.type == _types.Types.REAL) {
  19519. global_var.value.push(1.0);
  19520. }
  19521. if (global_var.type == _types.Types.TEXT) {
  19522. global_var.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19523. }
  19524. if (global_var.type == _types.Types.BOOLEAN) {
  19525. global_var.value.push(true);
  19526. }
  19527. }
  19528. function removeColumnGlobalMatrix(global_var) {
  19529. if (global_var.columns == 0) {
  19530. return;
  19531. }
  19532. global_var.columns--;
  19533. for (var i = 0; i < global_var.rows; i++) {
  19534. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  19535. }
  19536. }
  19537. function addColumnGlobalMatrix(global_var) {
  19538. global_var.columns++;
  19539. if (global_var.type == _types.Types.INTEGER) {
  19540. for (var i = 0; i < global_var.rows; i++) {
  19541. global_var.value[i].push(1);
  19542. }
  19543. }
  19544. if (global_var.type == _types.Types.REAL) {
  19545. for (var i = 0; i < global_var.rows; i++) {
  19546. global_var.value[i].push(1.0);
  19547. }
  19548. }
  19549. if (global_var.type == _types.Types.TEXT) {
  19550. for (var i = 0; i < global_var.rows; i++) {
  19551. global_var.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19552. }
  19553. }
  19554. if (global_var.type == _types.Types.BOOLEAN) {
  19555. for (var i = 0; i < global_var.rows; i++) {
  19556. global_var.value[i].push(true);
  19557. }
  19558. }
  19559. }
  19560. function removeLineGlobalMatrix(global_var) {
  19561. if (global_var.rows == 0) {
  19562. return;
  19563. }
  19564. global_var.rows--;
  19565. global_var.value.splice(global_var.value.length - 1, 1);
  19566. }
  19567. function addLineGlobalMatrix(global_var) {
  19568. global_var.rows++;
  19569. if (global_var.type == _types.Types.INTEGER) {
  19570. var n_l = [];
  19571. for (var i = 0; i < global_var.columns; i++) {
  19572. n_l.push(1);
  19573. }
  19574. global_var.value.push(n_l);
  19575. }
  19576. if (global_var.type == _types.Types.REAL) {
  19577. var n_l = [];
  19578. for (i = 0; i < global_var.columns; i++) {
  19579. n_l.push(1.0);
  19580. }
  19581. global_var.value.push(n_l);
  19582. }
  19583. if (global_var.type == _types.Types.TEXT) {
  19584. var n_l = [];
  19585. for (i = 0; i < global_var.columns; i++) {
  19586. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  19587. }
  19588. global_var.value.push(n_l);
  19589. }
  19590. if (global_var.type == _types.Types.BOOLEAN) {
  19591. var n_l = [];
  19592. for (i = 0; i < global_var.columns; i++) {
  19593. n_l.push(true);
  19594. }
  19595. global_var.value.push(n_l);
  19596. }
  19597. }
  19598. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  19599. global_var.value[row][index] = !global_var.value[row][index];
  19600. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(global_var.value[row][index]));
  19601. }
  19602. function renderValues(global_var, global_container) {
  19603. var ret = "";
  19604. var j = 0;
  19605. if (global_var.dimensions == 0) {
  19606. if (global_var.type == _types.Types.REAL) {
  19607. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  19608. } else {
  19609. if (global_var.type == _types.Types.BOOLEAN) {
  19610. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value) + '</span> </div> ';
  19611. } else {
  19612. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  19613. }
  19614. }
  19615. } else {
  19616. ret += '<table class="tabela_var">';
  19617. if (global_var.dimensions == 1) {
  19618. ret += '<tr>';
  19619. if (global_var.type == _types.Types.REAL) {
  19620. for (var k = 0; k < global_var.columns; k++) {
  19621. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  19622. }
  19623. } else {
  19624. for (var k = 0; k < global_var.columns; k++) {
  19625. if (global_var.type == _types.Types.BOOLEAN) {
  19626. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(global_var.value[k]) + '</span></td>';
  19627. } else {
  19628. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  19629. }
  19630. }
  19631. }
  19632. ret += '</tr>';
  19633. ret += '</table>';
  19634. 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>';
  19635. }
  19636. if (global_var.dimensions == 2) {
  19637. if (global_var.type == _types.Types.REAL) {
  19638. for (var l = 0; l < global_var.rows; l++) {
  19639. ret += '<tr>';
  19640. for (var k = 0; k < global_var.columns; k++) {
  19641. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  19642. }
  19643. ret += '</tr>';
  19644. }
  19645. } else {
  19646. for (var l = 0; l < global_var.rows; l++) {
  19647. ret += '<tr>';
  19648. for (var k = 0; k < global_var.columns; k++) {
  19649. if (global_var.type == _types.Types.BOOLEAN) {
  19650. 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>';
  19651. } else {
  19652. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  19653. }
  19654. }
  19655. ret += '</tr>';
  19656. }
  19657. }
  19658. if (global_var.rows == 0) {
  19659. ret += '<tr><td></td></tr>';
  19660. }
  19661. 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>';
  19662. ret += '</table>';
  19663. 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>';
  19664. }
  19665. }
  19666. global_container.find(".div_valor_var").html('');
  19667. ret = (0, _jquery2.default)(ret);
  19668. ret.find('.span_value_variable').data('associatedOject', global_var);
  19669. ret.find(".boolean_simple_type").on('click', function (e) {
  19670. alternateBooleanGlobalValue(global_var, this.parentNode);
  19671. });
  19672. ret.find(".simple_var").on('click', function (e) {
  19673. enableGlobalValueUpdate(global_var, this.parentNode);
  19674. });
  19675. ret.find(".boolean_vector_var").on('click', function (e) {
  19676. alternateBooleanGlobalVectorValue(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19677. });
  19678. ret.find(".vector_var").on('click', function (e) {
  19679. enableGlobalVectorValueUpdate(global_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  19680. });
  19681. ret.find(".remove_global_vector_column").on('click', function (e) {
  19682. removeGlobalColumnVector(global_var);
  19683. global_container.find(".div_valor_var").html('');
  19684. renderValues(global_var, global_container);
  19685. });
  19686. ret.find(".add_global_vector_column").on('click', function (e) {
  19687. addGlobalColumnVector(global_var);
  19688. global_container.find(".div_valor_var").html('');
  19689. renderValues(global_var, global_container);
  19690. });
  19691. ret.find(".remove_global_matrix_column").on('click', function (e) {
  19692. removeColumnGlobalMatrix(global_var);
  19693. global_container.find(".div_valor_var").html('');
  19694. renderValues(global_var, global_container);
  19695. });
  19696. ret.find(".add_global_matrix_column").on('click', function (e) {
  19697. addColumnGlobalMatrix(global_var);
  19698. global_container.find(".div_valor_var").html('');
  19699. renderValues(global_var, global_container);
  19700. });
  19701. ret.find(".remove_global_matrix_line").on('click', function (e) {
  19702. removeLineGlobalMatrix(global_var);
  19703. global_container.find(".div_valor_var").html('');
  19704. renderValues(global_var, global_container);
  19705. });
  19706. ret.find(".add_global_matrix_line").on('click', function (e) {
  19707. addLineGlobalMatrix(global_var);
  19708. global_container.find(".div_valor_var").html('');
  19709. renderValues(global_var, global_container);
  19710. });
  19711. ret.find(".boolean_matrix_var").on('click', function (e) {
  19712. alternateBooleanGlobalMatrixValue(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19713. });
  19714. ret.find(".matrix_var").on('click', function (e) {
  19715. enableGlobalMatrixValueUpdate(global_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  19716. });
  19717. global_container.find(".div_valor_var").append(ret);
  19718. updateColumnsAndRowsText(global_container, global_var);
  19719. }
  19720. function addHandlers(global_container) {
  19721. var global_var = global_container.data('associatedOject');
  19722. // Manage constant option:
  19723. global_container.find(".alternate_constant").on('click', function (e) {
  19724. toggleConstant(global_var);
  19725. (0, _jquery2.default)(this).removeClass("on off");
  19726. if (global_var.is_constant) {
  19727. (0, _jquery2.default)(this).addClass("on");
  19728. } else {
  19729. (0, _jquery2.default)(this).addClass("off");
  19730. }
  19731. });
  19732. // Manage global name:
  19733. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  19734. enableNameUpdate(global_container);
  19735. });
  19736. // Menu to change type:
  19737. global_container.find('.ui.dropdown.global_type').dropdown({
  19738. onChange: function onChange(value, text, $selectedItem) {
  19739. if ($selectedItem.data('dimensions')) {
  19740. updateType(global_var, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  19741. } else {
  19742. updateType(global_var, _types.Types[$selectedItem.data('type')]);
  19743. }
  19744. renderValues(global_var, global_container);
  19745. }
  19746. });
  19747. // Remove global:
  19748. global_container.find(".remove_global").on('click', function (e) {
  19749. removeGlobal(global_var, global_container);
  19750. });
  19751. }
  19752. function updateColumnsAndRowsText(global_container, global_var) {
  19753. var prev = global_container.find('.text').text().split('[');
  19754. if (prev.length == 2) {
  19755. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  19756. global_container.find('.text').empty();
  19757. global_container.find('.text').text(ff);
  19758. }
  19759. if (prev.length == 3) {
  19760. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  19761. global_container.find('.text').empty();
  19762. global_container.find('.text').text(ff);
  19763. }
  19764. }
  19765. function renderGlobal(global_var) {
  19766. var element = '<div class="ui label global_container pink"><div class="global_const">const: ';
  19767. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  19768. element += '<div class="ui dropdown global_type">';
  19769. if (global_var.dimensions > 0) {
  19770. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(global_var.type);
  19771. for (var i = 0; i < global_var.dimensions; i++) {
  19772. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  19773. }
  19774. element += '</div>';
  19775. } else {
  19776. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(global_var.type.toLowerCase()) + '</div>';
  19777. }
  19778. element += '<div class="menu">';
  19779. for (var tm in _types.Types) {
  19780. if (tm == _types.Types.VOID.toUpperCase()) {
  19781. continue;
  19782. }
  19783. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  19784. }
  19785. for (var tm in _types.Types) {
  19786. if (tm == _types.Types.VOID.toUpperCase()) {
  19787. continue;
  19788. }
  19789. 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>';
  19790. }
  19791. 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> ';
  19792. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  19793. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  19794. var complete_element = (0, _jquery2.default)(element);
  19795. complete_element.data('associatedOject', global_var);
  19796. (0, _jquery2.default)('.list_globals').append(complete_element);
  19797. addHandlers(complete_element);
  19798. renderValues(global_var, complete_element);
  19799. if (global_var.dimensions == 1) {
  19800. complete_element.find('.dimensions_0').text(global_var.columns);
  19801. }
  19802. if (global_var.dimensions == 2) {
  19803. complete_element.find('.dimensions_0').text(global_var.columns);
  19804. complete_element.find('.dimensions_1').text(global_var.rows);
  19805. }
  19806. return complete_element;
  19807. }
  19808. var opened_name_value_matrix_global_v = false;
  19809. var opened_input_value_matrix_global_v = null;
  19810. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  19811. if (opened_name_value_matrix_global_v) {
  19812. opened_input_value_matrix_global_v.focus();
  19813. return;
  19814. }
  19815. parent_node = (0, _jquery2.default)(parent_node);
  19816. opened_name_value_matrix_global_v = true;
  19817. parent_node.find('.span_value_variable').text('');
  19818. var input_field;
  19819. if (global_var.type == _types.Types.REAL) {
  19820. 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) + "' />");
  19821. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19822. } else {
  19823. 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] + "' />");
  19824. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19825. }
  19826. input_field.on('input', function () {
  19827. var inputWidth = input_field.textWidth() + 10;
  19828. opened_input_value_matrix_global_v = input_field;
  19829. input_field.focus();
  19830. var tmpStr = input_field.val();
  19831. input_field.val('');
  19832. input_field.val(tmpStr);
  19833. input_field.css({
  19834. width: inputWidth
  19835. });
  19836. }).trigger('input');
  19837. input_field.focusout(function () {
  19838. /// update array:
  19839. if (input_field.val().trim()) {
  19840. if (global_var.type == _types.Types.REAL) {
  19841. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19842. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19843. } else {
  19844. if (global_var.type == _types.Types.INTEGER) {
  19845. global_var.value[row][index] = parseInt(input_field.val().trim());
  19846. } else {
  19847. global_var.value[row][index] = input_field.val().trim();
  19848. }
  19849. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19850. }
  19851. } else {
  19852. if (global_var.type == _types.Types.REAL) {
  19853. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19854. } else {
  19855. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19856. }
  19857. }
  19858. if (global_var.type == _types.Types.TEXT) {
  19859. global_var.value[row][index] = input_field.val();
  19860. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19861. }
  19862. input_field.off();
  19863. input_field.remove();
  19864. /// update elements:
  19865. opened_name_value_matrix_global_v = false;
  19866. opened_input_value_matrix_global_v = false;
  19867. });
  19868. input_field.on('keydown', function (e) {
  19869. var code = e.keyCode || e.which;
  19870. if (code == 13) {
  19871. if (input_field.val().trim()) {
  19872. if (global_var.type == _types.Types.REAL) {
  19873. global_var.value[row][index] = parseFloat(input_field.val().trim());
  19874. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19875. } else {
  19876. if (global_var.type == _types.Types.INTEGER) {
  19877. global_var.value[row][index] = parseInt(input_field.val().trim());
  19878. } else {
  19879. global_var.value[row][index] = input_field.val().trim();
  19880. }
  19881. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19882. }
  19883. } else {
  19884. if (global_var.type == _types.Types.REAL) {
  19885. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19886. } else {
  19887. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19888. }
  19889. }
  19890. if (global_var.type == _types.Types.TEXT) {
  19891. global_var.value[row][index] = input_field.val();
  19892. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19893. }
  19894. input_field.off();
  19895. input_field.remove();
  19896. /// update elements:
  19897. opened_name_value_matrix_global_v = false;
  19898. opened_input_value_matrix_global_v = false;
  19899. }
  19900. if (code == 27) {
  19901. if (global_var.type == _types.Types.REAL) {
  19902. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  19903. } else {
  19904. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  19905. }
  19906. input_field.off();
  19907. input_field.remove();
  19908. /// update elements:
  19909. opened_name_value_matrix_global_v = false;
  19910. opened_input_value_matrix_global_v = false;
  19911. }
  19912. });
  19913. input_field.select();
  19914. }
  19915. var opened_name_value_global_var = false;
  19916. var opened_input_value_global_ar = null;
  19917. function enableGlobalValueUpdate(global_var, parent_node) {
  19918. if (opened_name_value_global_var) {
  19919. opened_input_value_global_ar.focus();
  19920. return;
  19921. }
  19922. parent_node = (0, _jquery2.default)(parent_node);
  19923. opened_name_value_global_var = true;
  19924. parent_node.find('.span_value_variable').text('');
  19925. var input_field;
  19926. if (global_var.type == _types.Types.REAL) {
  19927. 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) + "' />");
  19928. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19929. } else {
  19930. 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 + "' />");
  19931. input_field.insertBefore(parent_node.find('.span_value_variable'));
  19932. }
  19933. input_field.on('input', function () {
  19934. var inputWidth = input_field.textWidth() + 10;
  19935. opened_input_value_global_ar = input_field;
  19936. input_field.focus();
  19937. var tmpStr = input_field.val();
  19938. input_field.val('');
  19939. input_field.val(tmpStr);
  19940. input_field.css({
  19941. width: inputWidth
  19942. });
  19943. }).trigger('input');
  19944. input_field.focusout(function () {
  19945. /// update array:
  19946. if (input_field.val().trim()) {
  19947. if (global_var.type == _types.Types.REAL) {
  19948. global_var.value = parseFloat(input_field.val().trim());
  19949. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  19950. } else {
  19951. if (global_var.type == _types.Types.INTEGER) {
  19952. global_var.value = parseInt(input_field.val().trim());
  19953. } else {
  19954. global_var.value = input_field.val().trim();
  19955. }
  19956. parent_node.find('.span_value_variable').text(global_var.value);
  19957. }
  19958. } else {
  19959. if (global_var.type == _types.Types.REAL) {
  19960. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  19961. } else {
  19962. parent_node.find('.span_value_variable').text(global_var.value);
  19963. }
  19964. }
  19965. if (global_var.type == _types.Types.TEXT) {
  19966. global_var.value = input_field.val();
  19967. parent_node.find('.span_value_variable').text(global_var.value);
  19968. }
  19969. input_field.off();
  19970. input_field.remove();
  19971. /// update elements:
  19972. opened_name_value_global_var = false;
  19973. opened_input_value_global_ar = false;
  19974. });
  19975. input_field.on('keydown', function (e) {
  19976. var code = e.keyCode || e.which;
  19977. if (code == 13) {
  19978. if (input_field.val().trim()) {
  19979. if (global_var.type == _types.Types.REAL) {
  19980. global_var.value = parseFloat(input_field.val().trim());
  19981. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  19982. } else {
  19983. if (global_var.type == _types.Types.INTEGER) {
  19984. global_var.value = parseInt(input_field.val().trim());
  19985. } else {
  19986. global_var.value = input_field.val().trim();
  19987. }
  19988. parent_node.find('.span_value_variable').text(global_var.value);
  19989. }
  19990. } else {
  19991. if (global_var.type == _types.Types.REAL) {
  19992. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  19993. } else {
  19994. parent_node.find('.span_value_variable').text(global_var.value);
  19995. }
  19996. }
  19997. if (global_var.type == _types.Types.TEXT) {
  19998. global_var.value = input_field.val();
  19999. parent_node.find('.span_value_variable').text(global_var.value);
  20000. }
  20001. input_field.off();
  20002. input_field.remove();
  20003. /// update elements:
  20004. opened_name_value_global_var = false;
  20005. opened_input_value_global_ar = false;
  20006. }
  20007. if (code == 27) {
  20008. if (global_var.type == _types.Types.REAL) {
  20009. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  20010. } else {
  20011. parent_node.find('.span_value_variable').text(global_var.value);
  20012. }
  20013. input_field.off();
  20014. input_field.remove();
  20015. /// update elements:
  20016. opened_name_value_global_var = false;
  20017. opened_input_value_global_ar = false;
  20018. }
  20019. });
  20020. input_field.select();
  20021. }
  20022. var opened_name_global = false;
  20023. var opened_input_global = null;
  20024. function enableNameUpdate(global_container) {
  20025. var global_var = global_container.data('associatedOject');
  20026. if (opened_name_global) {
  20027. opened_input_global.focus();
  20028. return;
  20029. }
  20030. opened_name_global = true;
  20031. global_container.find('.span_name_variable').text('');
  20032. 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 + "' />");
  20033. input_name.insertBefore(global_container.find('.span_name_variable'));
  20034. input_name.on('input', function () {
  20035. var inputWidth = input_name.textWidth() + 10;
  20036. opened_input_global = input_name;
  20037. opened_input_global.focus();
  20038. opened_input_global.css({
  20039. width: inputWidth
  20040. });
  20041. }).trigger('input');
  20042. input_name.focusout(function () {
  20043. /// update array:
  20044. if (input_name.val().trim().length > 0) {
  20045. updateName(global_var, input_name.val().trim());
  20046. global_container.find('.span_name_variable').text(global_var.name);
  20047. } else {
  20048. global_container.find('.span_name_variable').text(global_var.name);
  20049. }
  20050. input_name.off();
  20051. input_name.remove();
  20052. /// update elements:
  20053. opened_name_global = false;
  20054. opened_input_global = false;
  20055. });
  20056. input_name.on('keydown', function (e) {
  20057. var code = e.keyCode || e.which;
  20058. if (code == 13) {
  20059. if (input_name.val().trim()) {
  20060. updateName(global_var, input_name.val().trim());
  20061. global_container.find('.span_name_variable').text(global_var.name);
  20062. } else {
  20063. global_container.find('.span_name_variable').text(global_var.name);
  20064. }
  20065. input_name.off();
  20066. input_name.remove();
  20067. /// update elements:
  20068. opened_name_global = false;
  20069. opened_input_global = false;
  20070. }
  20071. if (code == 27) {
  20072. global_container.find('.span_name_variable').text(global_var.name);
  20073. input_name.off();
  20074. input_name.remove();
  20075. /// update elements:
  20076. opened_name_global = false;
  20077. opened_input_global = false;
  20078. }
  20079. });
  20080. input_name.select();
  20081. }
  20082. var opened_name_value_vector_global_ = false;
  20083. var opened_input_value_vector_global_ = null;
  20084. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  20085. if (opened_name_value_vector_global_) {
  20086. opened_input_value_vector_global_.focus();
  20087. return;
  20088. }
  20089. parent_node = (0, _jquery2.default)(parent_node);
  20090. opened_name_value_vector_global_ = true;
  20091. parent_node.find('.span_value_variable').text('');
  20092. var input_field;
  20093. if (global_var.type == _types.Types.REAL) {
  20094. 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) + "' />");
  20095. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20096. } else {
  20097. 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] + "' />");
  20098. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20099. }
  20100. input_field.on('input', function () {
  20101. var inputWidth = input_field.textWidth() + 10;
  20102. opened_input_value_vector_global_ = input_field;
  20103. input_field.focus();
  20104. var tmpStr = input_field.val();
  20105. input_field.val('');
  20106. input_field.val(tmpStr);
  20107. input_field.css({
  20108. width: inputWidth
  20109. });
  20110. }).trigger('input');
  20111. input_field.focusout(function () {
  20112. /// update array:
  20113. if (input_field.val().trim()) {
  20114. if (global_var.type == _types.Types.REAL) {
  20115. global_var.value[index] = parseFloat(input_field.val().trim());
  20116. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20117. } else {
  20118. if (global_var.type == _types.Types.INTEGER) {
  20119. global_var.value[index] = parseInt(input_field.val().trim());
  20120. } else {
  20121. global_var.value[index] = input_field.val().trim();
  20122. }
  20123. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20124. }
  20125. } else {
  20126. if (global_var.type == _types.Types.REAL) {
  20127. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20128. } else {
  20129. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20130. }
  20131. }
  20132. if (global_var.type == _types.Types.TEXT) {
  20133. global_var.value[index] = input_field.val();
  20134. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20135. }
  20136. input_field.off();
  20137. input_field.remove();
  20138. /// update elements:
  20139. opened_name_value_vector_global_ = false;
  20140. opened_input_value_vector_global_ = false;
  20141. });
  20142. input_field.on('keydown', function (e) {
  20143. var code = e.keyCode || e.which;
  20144. if (code == 13) {
  20145. if (input_field.val().trim()) {
  20146. if (global_var.type == _types.Types.REAL) {
  20147. global_var.value[index] = parseFloat(input_field.val().trim());
  20148. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20149. } else {
  20150. if (global_var.type == _types.Types.INTEGER) {
  20151. global_var.value[index] = parseInt(input_field.val().trim());
  20152. } else {
  20153. global_var.value[index] = input_field.val().trim();
  20154. }
  20155. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20156. }
  20157. } else {
  20158. if (global_var.type == _types.Types.REAL) {
  20159. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20160. } else {
  20161. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20162. }
  20163. }
  20164. if (global_var.type == _types.Types.TEXT) {
  20165. global_var.value[index] = input_field.val();
  20166. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20167. }
  20168. input_field.off();
  20169. input_field.remove();
  20170. /// update elements:
  20171. opened_name_value_vector_global_ = false;
  20172. opened_input_value_vector_global_ = false;
  20173. }
  20174. if (code == 27) {
  20175. if (global_var.type == _types.Types.REAL) {
  20176. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  20177. } else {
  20178. parent_node.find('.span_value_variable').text(global_var.value[index]);
  20179. }
  20180. input_field.off();
  20181. input_field.remove();
  20182. /// update elements:
  20183. opened_name_value_vector_global_ = false;
  20184. opened_input_value_vector_global_ = false;
  20185. }
  20186. });
  20187. input_field.select();
  20188. }
  20189. _jquery2.default.fn.textWidth = function (text, font) {
  20190. if (!_jquery2.default.fn.textWidth.fakeEl) _jquery2.default.fn.textWidth.fakeEl = (0, _jquery2.default)('<span>').hide().appendTo(document.body);
  20191. _jquery2.default.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  20192. return _jquery2.default.fn.textWidth.fakeEl.width();
  20193. };
  20194. /***/ }),
  20195. /***/ "./js/visualUI/ivprog_elements.js":
  20196. /*!****************************************!*\
  20197. !*** ./js/visualUI/ivprog_elements.js ***!
  20198. \****************************************/
  20199. /*! no static exports found */
  20200. /***/ (function(module, exports, __webpack_require__) {
  20201. "use strict";
  20202. Object.defineProperty(exports, "__esModule", {
  20203. value: true
  20204. });
  20205. 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;
  20206. 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; }; }();
  20207. var _variable_value_menu = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20208. var VariableValueMenuManagement = _interopRequireWildcard(_variable_value_menu);
  20209. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20210. var _melankeWatchjs = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  20211. var _melankeWatchjs2 = _interopRequireDefault(_melankeWatchjs);
  20212. var _algorithm = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  20213. var AlgorithmManagement = _interopRequireWildcard(_algorithm);
  20214. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20215. 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; } }
  20216. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  20217. var COMMAND_TYPES = exports.COMMAND_TYPES = Object.freeze({ function: "function", comment: "comment", reader: "reader", writer: "writer", attribution: "attribution", iftrue: "iftrue",
  20218. repeatNtimes: "repeatNtimes", whiletrue: "whiletrue", dowhiletrue: "dowhiletrue", switch: "switch", switchcase: "switchcase", functioncall: "functioncall", break: "break",
  20219. return: "return" });
  20220. var ARITHMETIC_TYPES = exports.ARITHMETIC_TYPES = Object.freeze({ plus: "plus", minus: "minus", multiplication: "multiplication", division: "division", module: "module", none: "none" });
  20221. 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" });
  20222. var EXPRESSION_TYPES = exports.EXPRESSION_TYPES = Object.freeze({ exp_conditional: "exp_conditional", exp_logic: "exp_logic", exp_arithmetic: "exp_arithmetic" });
  20223. 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" });
  20224. var LOGIC_COMPARISON = exports.LOGIC_COMPARISON = Object.freeze({ equals_to: "equals_to", not_equals_to: "not_equals_to", and: "and", or: "or" });
  20225. var SYSTEM_FUNCTIONS_CATEGORIES = exports.SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({ math: "math", text: "text_t", arrangement: "arrangement", conversion: "conversion" });
  20226. var Variable = exports.Variable = function Variable(type, name, value) {
  20227. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  20228. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20229. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  20230. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  20231. _classCallCheck(this, Variable);
  20232. this.type = type;
  20233. this.name = name;
  20234. this.value = value;
  20235. this.dimensions = dimensions;
  20236. this.is_constant = is_constant;
  20237. this.rows = rows;
  20238. this.columns = columns;
  20239. };
  20240. var Function = exports.Function = function Function(name) {
  20241. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types.Types.VOID;
  20242. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20243. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  20244. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  20245. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  20246. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  20247. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  20248. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  20249. _classCallCheck(this, Function);
  20250. this.type = COMMAND_TYPES.function;
  20251. this.name = name;
  20252. this.return_type = return_type;
  20253. this.return_dimensions = return_dimensions;
  20254. this.parameters_list = parameters_list;
  20255. this.is_main = is_main;
  20256. this.is_hidden = is_hidden;
  20257. this.variables_list = variables_list;
  20258. this.function_comment = function_comment;
  20259. this.commands = commands;
  20260. };
  20261. var SystemFunction = exports.SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  20262. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  20263. var category = arguments[5];
  20264. _classCallCheck(this, SystemFunction);
  20265. this.type = COMMAND_TYPES.function;
  20266. this.identifier = identifier;
  20267. this.return_type = return_type;
  20268. this.return_dimensions = return_dimensions;
  20269. this.parameters_list = parameters_list;
  20270. this.function_comment = function_comment;
  20271. this.category = category;
  20272. };
  20273. var Comment = exports.Comment = function Comment(comment_text) {
  20274. _classCallCheck(this, Comment);
  20275. this.type = COMMAND_TYPES.comment;
  20276. this.comment_text = comment_text;
  20277. };
  20278. var Break = exports.Break = function Break() {
  20279. _classCallCheck(this, Break);
  20280. this.type = COMMAND_TYPES.break;
  20281. };
  20282. var Reader = exports.Reader = function Reader() {
  20283. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  20284. _classCallCheck(this, Reader);
  20285. this.type = COMMAND_TYPES.reader;
  20286. this.variable_value_menu = variable_value_menu;
  20287. };
  20288. var Writer = exports.Writer = function Writer(content) {
  20289. _classCallCheck(this, Writer);
  20290. this.type = COMMAND_TYPES.writer;
  20291. this.content = content;
  20292. };
  20293. var Attribution = exports.Attribution = function Attribution(variable) {
  20294. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20295. _classCallCheck(this, Attribution);
  20296. this.type = COMMAND_TYPES.attribution;
  20297. this.variable = variable;
  20298. this.expression = expression;
  20299. };
  20300. var ExpressionElement = exports.ExpressionElement = function ExpressionElement(type_exp) {
  20301. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20302. _classCallCheck(this, ExpressionElement);
  20303. this.type_exp = type_exp;
  20304. this.itens = itens;
  20305. };
  20306. var ConditionalExpression = exports.ConditionalExpression = function ConditionalExpression(expression) {
  20307. _classCallCheck(this, ConditionalExpression);
  20308. this.type = EXPRESSION_TYPES.exp_conditional;
  20309. this.expression = expression;
  20310. };
  20311. var LogicExpression = exports.LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  20312. _classCallCheck(this, LogicExpression);
  20313. this.type = EXPRESSION_TYPES.exp_logic;
  20314. this.has_neg = has_neg;
  20315. this.first_operand = first_operand;
  20316. this.second_operand = second_operand;
  20317. this.operator = operator;
  20318. };
  20319. var ArithmeticExpression = exports.ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  20320. _classCallCheck(this, ArithmeticExpression);
  20321. this.type = EXPRESSION_TYPES.exp_arithmetic;
  20322. this.first_operand = first_operand;
  20323. this.second_operand = second_operand;
  20324. this.operator = operator;
  20325. };
  20326. var IfTrue = exports.IfTrue = function IfTrue(expression, commands_block, commands_else) {
  20327. _classCallCheck(this, IfTrue);
  20328. this.type = COMMAND_TYPES.iftrue;
  20329. this.expression = expression;
  20330. this.commands_block = commands_block;
  20331. this.commands_else = commands_else;
  20332. };
  20333. var RepeatNTimes = exports.RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  20334. _classCallCheck(this, RepeatNTimes);
  20335. this.type = COMMAND_TYPES.repeatNtimes;
  20336. this.var_attribution = var_attribution;
  20337. this.var_incrementation = var_incrementation;
  20338. this.expression1 = expression1;
  20339. this.expression2 = expression2;
  20340. this.expression3 = expression3;
  20341. this.commands_block = commands_block;
  20342. };
  20343. var WhileTrue = exports.WhileTrue = function WhileTrue(expression, commands_block) {
  20344. _classCallCheck(this, WhileTrue);
  20345. this.type = COMMAND_TYPES.whiletrue;
  20346. this.expression = expression;
  20347. this.commands_block = commands_block;
  20348. };
  20349. var DoWhileTrue = exports.DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  20350. _classCallCheck(this, DoWhileTrue);
  20351. this.type = COMMAND_TYPES.dowhiletrue;
  20352. this.expression = expression;
  20353. this.commands_block = commands_block;
  20354. };
  20355. var Switch = exports.Switch = function Switch(variable) {
  20356. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20357. _classCallCheck(this, Switch);
  20358. this.type = COMMAND_TYPES.switch;
  20359. this.variable = variable;
  20360. this.cases = cases;
  20361. };
  20362. var Return = exports.Return = function Return(variable_value_menu) {
  20363. _classCallCheck(this, Return);
  20364. this.type = COMMAND_TYPES.return;
  20365. this.variable_value_menu = variable_value_menu;
  20366. };
  20367. var SwitchCase = exports.SwitchCase = function SwitchCase(variable_value_menu) {
  20368. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20369. _classCallCheck(this, SwitchCase);
  20370. this.type = COMMAND_TYPES.switchcase;
  20371. this.variable_value_menu = variable_value_menu;
  20372. this.commands_block = commands_block;
  20373. };
  20374. var FunctionCall = exports.FunctionCall = function FunctionCall(function_called, parameters_list) {
  20375. _classCallCheck(this, FunctionCall);
  20376. this.type = COMMAND_TYPES.functioncall;
  20377. this.function_called = function_called;
  20378. this.parameters_list = parameters_list;
  20379. };
  20380. var VariableValueMenu = exports.VariableValueMenu = function VariableValueMenu() {
  20381. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  20382. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  20383. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  20384. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  20385. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  20386. _classCallCheck(this, VariableValueMenu);
  20387. this.type = "var_value";
  20388. this.variable_and_value = variable_and_value;
  20389. this.content = content;
  20390. this.row = row;
  20391. this.column = column;
  20392. this.include_constant = include_constant;
  20393. };
  20394. var FunctionCallMenu = exports.FunctionCallMenu = function FunctionCallMenu() {
  20395. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  20396. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  20397. _classCallCheck(this, FunctionCallMenu);
  20398. this.type = "function_call";
  20399. this.function_called = function_called;
  20400. this.parameters_list = parameters_list;
  20401. };
  20402. var Program = exports.Program = function () {
  20403. function Program() {
  20404. _classCallCheck(this, Program);
  20405. this.functions = [];
  20406. this.globals = [];
  20407. }
  20408. _createClass(Program, [{
  20409. key: 'addFunction',
  20410. value: function addFunction(function_to_add) {
  20411. _melankeWatchjs2.default.watch(function_to_add.parameters_list, function () {
  20412. AlgorithmManagement.renderAlgorithm();
  20413. }, 1);
  20414. _melankeWatchjs2.default.watch(function_to_add.variables_list, function () {
  20415. if (window.insertContext) {
  20416. setTimeout(function () {
  20417. AlgorithmManagement.renderAlgorithm();
  20418. }, 300);
  20419. window.insertContext = false;
  20420. } else {
  20421. AlgorithmManagement.renderAlgorithm();
  20422. }
  20423. }, 1);
  20424. this.functions.push(function_to_add);
  20425. }
  20426. }, {
  20427. key: 'addVariable',
  20428. value: function addVariable(function_to_receive, variable) {
  20429. if (this.functions[function_to_receive].variable === null) {
  20430. this.functions[function_to_receive].variables_list = [];
  20431. }
  20432. this.functions[function_to_receive].variables_list.push(variable);
  20433. }
  20434. }, {
  20435. key: 'addGlobal',
  20436. value: function addGlobal(variable) {
  20437. this.globals.push(variable);
  20438. }
  20439. }]);
  20440. return Program;
  20441. }();
  20442. /***/ }),
  20443. /***/ "./js/visualUI/types.js":
  20444. /*!******************************!*\
  20445. !*** ./js/visualUI/types.js ***!
  20446. \******************************/
  20447. /*! no static exports found */
  20448. /***/ (function(module, exports, __webpack_require__) {
  20449. "use strict";
  20450. Object.defineProperty(exports, "__esModule", {
  20451. value: true
  20452. });
  20453. var Types = exports.Types = Object.freeze({
  20454. INTEGER: "integer",
  20455. REAL: "real",
  20456. TEXT: "text",
  20457. BOOLEAN: "boolean",
  20458. VOID: "void"
  20459. });
  20460. /***/ }),
  20461. /***/ "./js/visualUI/variables.js":
  20462. /*!**********************************!*\
  20463. !*** ./js/visualUI/variables.js ***!
  20464. \**********************************/
  20465. /*! no static exports found */
  20466. /***/ (function(module, exports, __webpack_require__) {
  20467. "use strict";
  20468. Object.defineProperty(exports, "__esModule", {
  20469. value: true
  20470. });
  20471. exports.addVariable = addVariable;
  20472. exports.renderVariable = renderVariable;
  20473. var _jquery = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20474. var _jquery2 = _interopRequireDefault(_jquery);
  20475. var _types = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20476. var _ivprog_elements = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20477. var Models = _interopRequireWildcard(_ivprog_elements);
  20478. var _localizedStringsService = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20479. __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  20480. 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; } }
  20481. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  20482. window.jQuery = _jquery2.default;
  20483. var counter_new_variables = 0;
  20484. function addVariable(function_obj, function_container) {
  20485. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  20486. var new_var = new Models.Variable(_types.Types.INTEGER, _localizedStringsService.LocalizedStrings.getUI('new_variable') + '_' + counter_new_variables, 1);
  20487. if (function_obj.variables_list == null) {
  20488. function_obj.variables_list = [];
  20489. }
  20490. function_obj.variables_list.push(new_var);
  20491. counter_new_variables++;
  20492. var newe = renderVariable(function_container, new_var, function_obj);
  20493. if (is_in_click) {
  20494. newe.css('display', 'none');
  20495. newe.fadeIn();
  20496. }
  20497. }
  20498. function updateName(variable_obj, new_name) {
  20499. variable_obj.name = new_name;
  20500. }
  20501. function removeVariable(variable_obj, variable_container) {
  20502. var function_associated = variable_container.data('associatedFunction');
  20503. var index = function_associated.variables_list.indexOf(variable_obj);
  20504. if (index > -1) {
  20505. //function_associated.variables_list[index] = null;
  20506. delete function_associated.variables_list[index];
  20507. function_associated.variables_list.splice(index, 1);
  20508. }
  20509. variable_container.children().off();
  20510. variable_container.off();
  20511. variable_container.remove();
  20512. }
  20513. function updateType(variable_obj, new_type) {
  20514. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  20515. variable_obj.type = new_type;
  20516. variable_obj.dimensions = new_dimensions;
  20517. if (new_dimensions > 0) {
  20518. variable_obj.rows = new_dimensions;
  20519. variable_obj.columns = 2;
  20520. }
  20521. updateInitialValues(variable_obj);
  20522. }
  20523. function addHandlers(variable_obj, variable_container) {
  20524. // Manage variable name:
  20525. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  20526. enableNameUpdate(variable_obj, variable_container);
  20527. });
  20528. // Menu to change type:
  20529. variable_container.find('.ui.dropdown.variable_type').dropdown({
  20530. onChange: function onChange(value, text, $selectedItem) {
  20531. if ($selectedItem.data('dimensions')) {
  20532. updateType(variable_obj, _types.Types[$selectedItem.data('type')], $selectedItem.data('dimensions'));
  20533. } else {
  20534. updateType(variable_obj, _types.Types[$selectedItem.data('type')]);
  20535. }
  20536. renderValues(variable_obj, variable_container);
  20537. }
  20538. });
  20539. // Remove variable:
  20540. variable_container.find(".remove_variable").on('click', function (e) {
  20541. removeVariable(variable_obj, variable_container);
  20542. });
  20543. }
  20544. function renderVariable(function_container, new_var, function_obj) {
  20545. var element = '<div class="ui label variable_container pink">';
  20546. element += '<div class="ui dropdown variable_type">';
  20547. if (new_var.dimensions > 0) {
  20548. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI('vector') + ':' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase());
  20549. for (var i = 0; i < new_var.dimensions; i++) {
  20550. element += ' [ ] ';
  20551. }
  20552. element += '</div>';
  20553. } else {
  20554. element += '<div class="text">' + _localizedStringsService.LocalizedStrings.getUI(new_var.type.toLowerCase()) + '</div>';
  20555. }
  20556. element += '<div class="menu">';
  20557. for (var tm in _types.Types) {
  20558. if (tm == _types.Types.VOID.toUpperCase()) {
  20559. continue;
  20560. }
  20561. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _localizedStringsService.LocalizedStrings.getUI(tm.toLowerCase()) + '</div>';
  20562. }
  20563. for (var tm in _types.Types) {
  20564. if (tm == _types.Types.VOID.toUpperCase()) {
  20565. continue;
  20566. }
  20567. 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>';
  20568. }
  20569. element += '</div></div> ';
  20570. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  20571. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  20572. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  20573. element = (0, _jquery2.default)(element);
  20574. element.data('associatedFunction', function_obj);
  20575. function_container.find('.variables_list_div').append(element);
  20576. addHandlers(new_var, element);
  20577. renderValues(new_var, element);
  20578. return element;
  20579. }
  20580. function updateColumnsAndRowsText(variable_container, variable_var) {
  20581. var prev = variable_container.find('.text').text().split('[');
  20582. if (prev.length == 2) {
  20583. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  20584. variable_container.find('.text').empty();
  20585. variable_container.find('.text').text(ff);
  20586. }
  20587. if (prev.length == 3) {
  20588. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  20589. variable_container.find('.text').empty();
  20590. variable_container.find('.text').text(ff);
  20591. }
  20592. }
  20593. function renderValues(new_var, variable_container) {
  20594. var ret = "";
  20595. var j = 0;
  20596. if (new_var.dimensions == 0) {
  20597. if (new_var.type == _types.Types.REAL) {
  20598. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  20599. } else {
  20600. if (new_var.type == _types.Types.BOOLEAN) {
  20601. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value) + '</span> </div> ';
  20602. } else {
  20603. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  20604. }
  20605. }
  20606. } else {
  20607. ret += '<table class="tabela_var">';
  20608. if (new_var.dimensions == 1) {
  20609. ret += '<tr>';
  20610. if (new_var.type == _types.Types.REAL) {
  20611. for (var k = 0; k < new_var.columns; k++) {
  20612. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  20613. }
  20614. } else {
  20615. for (var k = 0; k < new_var.columns; k++) {
  20616. if (new_var.type == _types.Types.BOOLEAN) {
  20617. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _localizedStringsService.LocalizedStrings.getUI(new_var.value[k]) + '</span></td>';
  20618. } else {
  20619. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  20620. }
  20621. }
  20622. }
  20623. ret += '</tr>';
  20624. ret += '</table>';
  20625. 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>';
  20626. }
  20627. if (new_var.dimensions == 2) {
  20628. if (new_var.type == _types.Types.REAL) {
  20629. for (var l = 0; l < new_var.rows; l++) {
  20630. ret += '<tr>';
  20631. for (var k = 0; k < new_var.columns; k++) {
  20632. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  20633. }
  20634. ret += '</tr>';
  20635. }
  20636. } else {
  20637. for (var l = 0; l < new_var.rows; l++) {
  20638. ret += '<tr>';
  20639. for (var k = 0; k < new_var.columns; k++) {
  20640. if (new_var.type == _types.Types.BOOLEAN) {
  20641. 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>';
  20642. } else {
  20643. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  20644. }
  20645. }
  20646. ret += '</tr>';
  20647. }
  20648. }
  20649. if (new_var.rows == 0) {
  20650. ret += '<tr><td></td></tr>';
  20651. }
  20652. 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>';
  20653. ret += '</table>';
  20654. 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>';
  20655. }
  20656. }
  20657. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20658. ret = (0, _jquery2.default)(ret);
  20659. (0, _jquery2.default)(ret).find('.span_value_variable').data('associatedOject', new_var);
  20660. (0, _jquery2.default)(ret).find(".boolean_simple_type").on('click', function (e) {
  20661. alternateBooleanValue(new_var, this.parentNode);
  20662. });
  20663. (0, _jquery2.default)(ret).find(".simple_var").on('click', function (e) {
  20664. enableValueUpdate(new_var, this.parentNode);
  20665. });
  20666. (0, _jquery2.default)(ret).find(".boolean_vector_var").on('click', function (e) {
  20667. alternateBooleanVectorValue(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20668. });
  20669. (0, _jquery2.default)(ret).find(".vector_var").on('click', function (e) {
  20670. enableVectorValueUpdate(new_var, (0, _jquery2.default)(this).data('index'), this.parentNode);
  20671. });
  20672. (0, _jquery2.default)(ret).find(".remove_global_vector_column").on('click', function (e) {
  20673. removeColumnVector(new_var);
  20674. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20675. renderValues(new_var, variable_container);
  20676. });
  20677. (0, _jquery2.default)(ret).find(".add_global_vector_column").on('click', function (e) {
  20678. addColumnVector(new_var);
  20679. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20680. renderValues(new_var, variable_container);
  20681. });
  20682. (0, _jquery2.default)(ret).find(".remove_global_matrix_column").on('click', function (e) {
  20683. removeColumnMatrix(new_var);
  20684. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20685. renderValues(new_var, variable_container);
  20686. });
  20687. (0, _jquery2.default)(ret).find(".add_global_matrix_column").on('click', function (e) {
  20688. addColumnMatrix(new_var);
  20689. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20690. renderValues(new_var, variable_container);
  20691. });
  20692. (0, _jquery2.default)(ret).find(".remove_global_matrix_line").on('click', function (e) {
  20693. removeLineMatrix(new_var);
  20694. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20695. renderValues(new_var, variable_container);
  20696. });
  20697. (0, _jquery2.default)(ret).find(".add_global_matrix_line").on('click', function (e) {
  20698. addLineMatrix(new_var);
  20699. (0, _jquery2.default)(variable_container).find(".div_valor_var").html('');
  20700. renderValues(new_var, variable_container);
  20701. });
  20702. (0, _jquery2.default)(ret).find(".boolean_matrix_var").on('click', function (e) {
  20703. alternateBooleanMatrixValue(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20704. });
  20705. (0, _jquery2.default)(ret).find(".matrix_var").on('click', function (e) {
  20706. enableMatrixValueUpdate(new_var, (0, _jquery2.default)(this).data('row'), (0, _jquery2.default)(this).data('index'), this.parentNode);
  20707. });
  20708. (0, _jquery2.default)(variable_container).find(".div_valor_var").append(ret);
  20709. updateColumnsAndRowsText(variable_container, new_var);
  20710. }
  20711. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  20712. var_obj.value[row][index] = !var_obj.value[row][index];
  20713. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[row][index]));
  20714. }
  20715. function addLineMatrix(var_obj) {
  20716. var_obj.rows++;
  20717. if (var_obj.type == _types.Types.INTEGER) {
  20718. var n_l = [];
  20719. for (var i = 0; i < var_obj.columns; i++) {
  20720. n_l.push(1);
  20721. }
  20722. var_obj.value.push(n_l);
  20723. }
  20724. if (var_obj.type == _types.Types.REAL) {
  20725. var n_l = [];
  20726. for (i = 0; i < var_obj.columns; i++) {
  20727. n_l.push(1.0);
  20728. }
  20729. var_obj.value.push(n_l);
  20730. }
  20731. if (var_obj.type == _types.Types.TEXT) {
  20732. var n_l = [];
  20733. for (i = 0; i < var_obj.columns; i++) {
  20734. n_l.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20735. }
  20736. var_obj.value.push(n_l);
  20737. }
  20738. if (var_obj.type == _types.Types.BOOLEAN) {
  20739. var n_l = [];
  20740. for (i = 0; i < var_obj.columns; i++) {
  20741. n_l.push(true);
  20742. }
  20743. var_obj.value.push(n_l);
  20744. }
  20745. }
  20746. function removeLineMatrix(var_obj) {
  20747. if (var_obj.rows == 0) {
  20748. return;
  20749. }
  20750. var_obj.rows--;
  20751. var_obj.value.splice(var_obj.value.length - 1, 1);
  20752. }
  20753. function addColumnMatrix(var_obj) {
  20754. var_obj.columns++;
  20755. if (var_obj.type == _types.Types.INTEGER) {
  20756. for (var i = 0; i < var_obj.rows; i++) {
  20757. var_obj.value[i].push(1);
  20758. }
  20759. }
  20760. if (var_obj.type == _types.Types.REAL) {
  20761. for (var i = 0; i < var_obj.rows; i++) {
  20762. var_obj.value[i].push(1.0);
  20763. }
  20764. }
  20765. if (var_obj.type == _types.Types.TEXT) {
  20766. for (var i = 0; i < var_obj.rows; i++) {
  20767. var_obj.value[i].push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20768. }
  20769. }
  20770. if (var_obj.type == _types.Types.BOOLEAN) {
  20771. for (var i = 0; i < var_obj.rows; i++) {
  20772. var_obj.value[i].push(true);
  20773. }
  20774. }
  20775. }
  20776. function removeColumnMatrix(var_obj) {
  20777. if (var_obj.columns == 0) {
  20778. return;
  20779. }
  20780. var_obj.columns--;
  20781. for (var i = 0; i < var_obj.rows; i++) {
  20782. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  20783. }
  20784. }
  20785. function addColumnVector(var_obj) {
  20786. var_obj.columns++;
  20787. if (var_obj.type == _types.Types.INTEGER) {
  20788. var_obj.value.push(1);
  20789. }
  20790. if (var_obj.type == _types.Types.REAL) {
  20791. var_obj.value.push(1.0);
  20792. }
  20793. if (var_obj.type == _types.Types.TEXT) {
  20794. var_obj.value.push(_localizedStringsService.LocalizedStrings.getUI('text_start'));
  20795. }
  20796. if (var_obj.type == _types.Types.BOOLEAN) {
  20797. var_obj.value.push(true);
  20798. }
  20799. }
  20800. function removeColumnVector(var_obj) {
  20801. if (var_obj.columns == 0) {
  20802. return;
  20803. }
  20804. var_obj.columns--;
  20805. var_obj.value.splice(var_obj.value.length - 1, 1);
  20806. }
  20807. function alternateBooleanValue(var_obj, value_container) {
  20808. var_obj.value = !var_obj.value;
  20809. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value));
  20810. }
  20811. function alternateBooleanVectorValue(var_obj, index, value_container) {
  20812. var_obj.value[index] = !var_obj.value[index];
  20813. (0, _jquery2.default)(value_container).find('.span_value_variable').text(_localizedStringsService.LocalizedStrings.getUI(var_obj.value[index]));
  20814. }
  20815. function updateInitialValues(variable_obj) {
  20816. if (variable_obj.type == _types.Types.INTEGER) {
  20817. if (variable_obj.dimensions == 0) {
  20818. variable_obj.value = 1;
  20819. }
  20820. if (variable_obj.dimensions == 1) {
  20821. variable_obj.value = [1, 1];
  20822. }
  20823. if (variable_obj.dimensions == 2) {
  20824. variable_obj.value = [[1, 1], [1, 1]];
  20825. }
  20826. }
  20827. if (variable_obj.type == _types.Types.REAL) {
  20828. if (variable_obj.dimensions == 0) {
  20829. variable_obj.value = 1.0;
  20830. }
  20831. if (variable_obj.dimensions == 1) {
  20832. variable_obj.value = [1.0, 1.0];
  20833. }
  20834. if (variable_obj.dimensions == 2) {
  20835. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  20836. }
  20837. }
  20838. if (variable_obj.type == _types.Types.TEXT) {
  20839. if (variable_obj.dimensions == 0) {
  20840. variable_obj.value = _localizedStringsService.LocalizedStrings.getUI('text_start');
  20841. }
  20842. if (variable_obj.dimensions == 1) {
  20843. variable_obj.value = [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')];
  20844. }
  20845. if (variable_obj.dimensions == 2) {
  20846. variable_obj.value = [[_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')], [_localizedStringsService.LocalizedStrings.getUI('text_start'), _localizedStringsService.LocalizedStrings.getUI('text_start')]];
  20847. }
  20848. }
  20849. if (variable_obj.type == _types.Types.BOOLEAN) {
  20850. if (variable_obj.dimensions == 0) {
  20851. variable_obj.value = true;
  20852. }
  20853. if (variable_obj.dimensions == 1) {
  20854. variable_obj.value = [true, true];
  20855. }
  20856. if (variable_obj.dimensions == 2) {
  20857. variable_obj.value = [[true, true], [true, true]];
  20858. }
  20859. }
  20860. }
  20861. var opened_name_value_vector_global_ = false;
  20862. var opened_input_value_vector_global_ = null;
  20863. function enableVectorValueUpdate(var_obj, index, parent_node) {
  20864. if (opened_name_value_vector_global_) {
  20865. opened_input_value_vector_global_.focus();
  20866. return;
  20867. }
  20868. parent_node = (0, _jquery2.default)(parent_node);
  20869. opened_name_value_vector_global_ = true;
  20870. parent_node.find('.span_value_variable').text('');
  20871. var input_field;
  20872. if (var_obj.type == _types.Types.REAL) {
  20873. 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) + "' />");
  20874. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20875. } else {
  20876. 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] + "' />");
  20877. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20878. }
  20879. input_field.on('input', function () {
  20880. var inputWidth = input_field.textWidth() + 10;
  20881. opened_input_value_vector_global_ = input_field;
  20882. input_field.focus();
  20883. var tmpStr = input_field.val();
  20884. input_field.val('');
  20885. input_field.val(tmpStr);
  20886. input_field.css({
  20887. width: inputWidth
  20888. });
  20889. }).trigger('input');
  20890. input_field.focusout(function () {
  20891. /// update array:
  20892. if (input_field.val().trim()) {
  20893. if (var_obj.type == _types.Types.REAL) {
  20894. var_obj.value[index] = parseFloat(input_field.val().trim());
  20895. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20896. } else {
  20897. if (var_obj.type == _types.Types.INTEGER) {
  20898. var_obj.value[index] = parseInt(input_field.val().trim());
  20899. } else {
  20900. var_obj.value[index] = input_field.val().trim();
  20901. }
  20902. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20903. }
  20904. } else {
  20905. if (var_obj.type == _types.Types.REAL) {
  20906. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20907. } else {
  20908. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20909. }
  20910. }
  20911. if (var_obj.type == _types.Types.TEXT) {
  20912. var_obj.value[index] = input_field.val();
  20913. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20914. }
  20915. input_field.off();
  20916. input_field.remove();
  20917. /// update elements:
  20918. opened_name_value_vector_global_ = false;
  20919. opened_input_value_vector_global_ = false;
  20920. });
  20921. input_field.on('keydown', function (e) {
  20922. var code = e.keyCode || e.which;
  20923. if (code == 13) {
  20924. if (input_field.val().trim()) {
  20925. if (var_obj.type == _types.Types.REAL) {
  20926. var_obj.value[index] = parseFloat(input_field.val().trim());
  20927. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20928. } else {
  20929. if (var_obj.type == _types.Types.INTEGER) {
  20930. var_obj.value[index] = parseInt(input_field.val().trim());
  20931. } else {
  20932. var_obj.value[index] = input_field.val().trim();
  20933. }
  20934. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20935. }
  20936. } else {
  20937. if (var_obj.type == _types.Types.REAL) {
  20938. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20939. } else {
  20940. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20941. }
  20942. }
  20943. if (var_obj.type == _types.Types.TEXT) {
  20944. var_obj.value[index] = input_field.val();
  20945. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20946. }
  20947. input_field.off();
  20948. input_field.remove();
  20949. /// update elements:
  20950. opened_name_value_vector_global_ = false;
  20951. opened_input_value_vector_global_ = false;
  20952. }
  20953. if (code == 27) {
  20954. if (var_obj.type == _types.Types.REAL) {
  20955. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  20956. } else {
  20957. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  20958. }
  20959. input_field.off();
  20960. input_field.remove();
  20961. /// update elements:
  20962. opened_name_value_vector_global_ = false;
  20963. opened_input_value_vector_global_ = false;
  20964. }
  20965. });
  20966. input_field.select();
  20967. }
  20968. var opened_name_value_global_var = false;
  20969. var opened_input_value_global_ar = null;
  20970. function enableValueUpdate(var_obj, parent_node) {
  20971. if (opened_name_value_global_var) {
  20972. opened_input_value_global_ar.focus();
  20973. return;
  20974. }
  20975. parent_node = (0, _jquery2.default)(parent_node);
  20976. opened_name_value_global_var = true;
  20977. var input_field;
  20978. parent_node.find('.span_value_variable').text('');
  20979. if (var_obj.type == _types.Types.REAL) {
  20980. 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) + "' />");
  20981. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20982. } else {
  20983. 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 + "' />");
  20984. input_field.insertBefore(parent_node.find('.span_value_variable'));
  20985. }
  20986. input_field.on('input', function () {
  20987. var inputWidth = input_field.textWidth() + 10;
  20988. opened_input_value_global_ar = input_field;
  20989. input_field.focus();
  20990. var tmpStr = input_field.val();
  20991. input_field.val('');
  20992. input_field.val(tmpStr);
  20993. input_field.css({
  20994. width: inputWidth
  20995. });
  20996. }).trigger('input');
  20997. input_field.focusout(function () {
  20998. /// update array:
  20999. if (input_field.val().trim()) {
  21000. if (var_obj.type == _types.Types.REAL) {
  21001. var_obj.value = parseFloat(input_field.val().trim());
  21002. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21003. } else {
  21004. if (var_obj.type == _types.Types.INTEGER) {
  21005. var_obj.value = parseInt(input_field.val().trim());
  21006. } else {
  21007. var_obj.value = input_field.val().trim();
  21008. }
  21009. parent_node.find('.span_value_variable').text(var_obj.value);
  21010. }
  21011. } else {
  21012. if (var_obj.type == _types.Types.REAL) {
  21013. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21014. } else {
  21015. parent_node.find('.span_value_variable').text(var_obj.value);
  21016. }
  21017. }
  21018. if (var_obj.type == _types.Types.TEXT) {
  21019. var_obj.value = input_field.val();
  21020. parent_node.find('.span_value_variable').text(var_obj.value);
  21021. }
  21022. input_field.off();
  21023. input_field.remove();
  21024. /// update elements:
  21025. opened_name_value_global_var = false;
  21026. opened_input_value_global_ar = false;
  21027. });
  21028. input_field.on('keydown', function (e) {
  21029. var code = e.keyCode || e.which;
  21030. if (code == 13) {
  21031. if (input_field.val().trim()) {
  21032. if (var_obj.type == _types.Types.REAL) {
  21033. var_obj.value = parseFloat(input_field.val().trim());
  21034. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21035. } else {
  21036. if (var_obj.type == _types.Types.INTEGER) {
  21037. var_obj.value = parseInt(input_field.val().trim());
  21038. } else {
  21039. var_obj.value = input_field.val().trim();
  21040. }
  21041. parent_node.find('.span_value_variable').text(var_obj.value);
  21042. }
  21043. } else {
  21044. if (var_obj.type == _types.Types.REAL) {
  21045. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21046. } else {
  21047. parent_node.find('.span_value_variable').text(var_obj.value);
  21048. }
  21049. }
  21050. if (var_obj.type == _types.Types.TEXT) {
  21051. var_obj.value = input_field.val();
  21052. parent_node.find('.span_value_variable').text(var_obj.value);
  21053. }
  21054. input_field.off();
  21055. input_field.remove();
  21056. /// update elements:
  21057. opened_name_value_global_var = false;
  21058. opened_input_value_global_ar = false;
  21059. }
  21060. if (code == 27) {
  21061. if (var_obj.type == _types.Types.REAL) {
  21062. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  21063. } else {
  21064. parent_node.find('.span_value_variable').text(var_obj.value);
  21065. }
  21066. input_field.off();
  21067. input_field.remove();
  21068. /// update elements:
  21069. opened_name_value_global_var = false;
  21070. opened_input_value_global_ar = false;
  21071. }
  21072. });
  21073. input_field.select();
  21074. }
  21075. var opened_name_global = false;
  21076. var opened_input_global = null;
  21077. function enableNameUpdate(variable_obj, variable_container) {
  21078. if (opened_name_global) {
  21079. opened_input_global.focus();
  21080. return;
  21081. }
  21082. opened_name_global = true;
  21083. variable_container.find('.span_name_variable').text('');
  21084. var input_name;
  21085. 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 + "' />");
  21086. input_name.insertBefore(variable_container.find('.span_name_variable'));
  21087. input_name.on('input', function () {
  21088. var inputWidth = input_name.textWidth() + 10;
  21089. opened_input_global = input_name;
  21090. input_name.focus();
  21091. var tmpStr = input_name.val();
  21092. input_name.val('');
  21093. input_name.val(tmpStr);
  21094. input_name.css({
  21095. width: inputWidth
  21096. });
  21097. }).trigger('input');
  21098. input_name.focusout(function () {
  21099. /// update array:
  21100. if (input_name.val().trim().length > 0) {
  21101. updateName(variable_obj, input_name.val().trim());
  21102. variable_container.find('.span_name_variable').text(variable_obj.name);
  21103. } else {
  21104. variable_container.find('.span_name_variable').text(variable_obj.name);
  21105. }
  21106. input_name.off();
  21107. input_name.remove();
  21108. /// update elements:
  21109. opened_name_global = false;
  21110. opened_input_global = false;
  21111. });
  21112. input_name.on('keydown', function (e) {
  21113. var code = e.keyCode || e.which;
  21114. if (code == 13) {
  21115. if (input_name.val().trim().length > 0) {
  21116. updateName(variable_obj, input_name.val().trim());
  21117. variable_container.find('.span_name_variable').text(variable_obj.name);
  21118. } else {
  21119. variable_container.find('.span_name_variable').text(variable_obj.name);
  21120. }
  21121. input_name.off();
  21122. input_name.remove();
  21123. /// update elements:
  21124. opened_name_global = false;
  21125. opened_input_global = false;
  21126. }
  21127. if (code == 27) {
  21128. variable_container.find('.span_name_variable').text(variable_obj.name);
  21129. input_name.off();
  21130. input_name.remove();
  21131. /// update elements:
  21132. opened_name_global = false;
  21133. opened_input_global = false;
  21134. }
  21135. });
  21136. input_name.select();
  21137. }
  21138. var opened_name_value_matrix_global_v = false;
  21139. var opened_input_value_matrix_global_v = null;
  21140. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  21141. if (opened_name_value_matrix_global_v) {
  21142. opened_input_value_matrix_global_v.focus();
  21143. return;
  21144. }
  21145. parent_node = (0, _jquery2.default)(parent_node);
  21146. opened_name_value_matrix_global_v = true;
  21147. parent_node.find('.span_value_variable').text('');
  21148. var input_field;
  21149. if (var_obj.type == _types.Types.REAL) {
  21150. 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) + "' />");
  21151. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21152. } else {
  21153. 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] + "' />");
  21154. input_field.insertBefore(parent_node.find('.span_value_variable'));
  21155. }
  21156. input_field.on('input', function () {
  21157. var inputWidth = input_field.textWidth() + 10;
  21158. opened_input_value_matrix_global_v = input_field;
  21159. input_field.focus();
  21160. var tmpStr = input_field.val();
  21161. input_field.val('');
  21162. input_field.val(tmpStr);
  21163. input_field.css({
  21164. width: inputWidth
  21165. });
  21166. }).trigger('input');
  21167. input_field.focusout(function () {
  21168. /// update array:
  21169. if (input_field.val().trim()) {
  21170. if (var_obj.type == _types.Types.REAL) {
  21171. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21172. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21173. } else {
  21174. if (var_obj.type == _types.Types.INTEGER) {
  21175. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21176. } else {
  21177. var_obj.value[row][index] = input_field.val().trim();
  21178. }
  21179. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21180. }
  21181. } else {
  21182. if (var_obj.type == _types.Types.REAL) {
  21183. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21184. } else {
  21185. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21186. }
  21187. }
  21188. if (var_obj.type == _types.Types.TEXT) {
  21189. var_obj.value[row][index] = input_field.val();
  21190. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21191. }
  21192. input_field.off();
  21193. input_field.remove();
  21194. /// update elements:
  21195. opened_name_value_matrix_global_v = false;
  21196. opened_input_value_matrix_global_v = false;
  21197. });
  21198. input_field.on('keydown', function (e) {
  21199. var code = e.keyCode || e.which;
  21200. if (code == 13) {
  21201. if (input_field.val().trim()) {
  21202. if (var_obj.type == _types.Types.REAL) {
  21203. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  21204. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21205. } else {
  21206. if (var_obj.type == _types.Types.INTEGER) {
  21207. var_obj.value[row][index] = parseInt(input_field.val().trim());
  21208. } else {
  21209. var_obj.value[row][index] = input_field.val().trim();
  21210. }
  21211. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21212. }
  21213. } else {
  21214. if (var_obj.type == _types.Types.REAL) {
  21215. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21216. } else {
  21217. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21218. }
  21219. }
  21220. if (var_obj.type == _types.Types.TEXT) {
  21221. var_obj.value[row][index] = input_field.val();
  21222. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21223. }
  21224. input_field.off();
  21225. input_field.remove();
  21226. /// update elements:
  21227. opened_name_value_matrix_global_v = false;
  21228. opened_input_value_matrix_global_v = false;
  21229. }
  21230. if (code == 27) {
  21231. if (var_obj.type == _types.Types.REAL) {
  21232. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  21233. } else {
  21234. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  21235. }
  21236. input_field.off();
  21237. input_field.remove();
  21238. /// update elements:
  21239. opened_name_value_matrix_global_v = false;
  21240. opened_input_value_matrix_global_v = false;
  21241. }
  21242. });
  21243. input_field.select();
  21244. }
  21245. /***/ }),
  21246. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  21247. /*!****************************************************!*\
  21248. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  21249. \****************************************************/
  21250. /*! no static exports found */
  21251. /***/ (function(module, exports, __webpack_require__) {
  21252. "use strict";
  21253. //
  21254. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21255. * Use of this file is governed by the BSD 3-clause license that
  21256. * can be found in the LICENSE.txt file in the project root.
  21257. */
  21258. // This implementation of {@link TokenStream} loads tokens from a
  21259. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  21260. // access to any previous token by index.
  21261. //
  21262. // <p>
  21263. // This token stream ignores the value of {@link Token//getChannel}. If your
  21264. // parser requires the token stream filter tokens to only those on a particular
  21265. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  21266. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  21267. // {@link CommonTokenStream}.</p>
  21268. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21269. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  21270. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  21271. // this is just to keep meaningful parameter types to Parser
  21272. function TokenStream() {
  21273. return this;
  21274. }
  21275. function BufferedTokenStream(tokenSource) {
  21276. TokenStream.call(this);
  21277. // The {@link TokenSource} from which tokens for this stream are fetched.
  21278. this.tokenSource = tokenSource;
  21279. // A collection of all tokens fetched from the token source. The list is
  21280. // considered a complete view of the input once {@link //fetchedEOF} is set
  21281. // to {@code true}.
  21282. this.tokens = [];
  21283. // The index into {@link //tokens} of the current token (next token to
  21284. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  21285. // be
  21286. // {@link //LT LT(1)}.
  21287. //
  21288. // <p>This field is set to -1 when the stream is first constructed or when
  21289. // {@link //setTokenSource} is called, indicating that the first token has
  21290. // not yet been fetched from the token source. For additional information,
  21291. // see the documentation of {@link IntStream} for a description of
  21292. // Initializing Methods.</p>
  21293. this.index = -1;
  21294. // Indicates whether the {@link Token//EOF} token has been fetched from
  21295. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  21296. // performance for the following cases:
  21297. //
  21298. // <ul>
  21299. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  21300. // prevent
  21301. // consuming the EOF symbol is optimized by checking the values of
  21302. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  21303. // //LA}.</li>
  21304. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  21305. // into
  21306. // {@link //tokens} is trivial with this field.</li>
  21307. // <ul>
  21308. this.fetchedEOF = false;
  21309. return this;
  21310. }
  21311. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  21312. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  21313. BufferedTokenStream.prototype.mark = function () {
  21314. return 0;
  21315. };
  21316. BufferedTokenStream.prototype.release = function (marker) {
  21317. // no resources to release
  21318. };
  21319. BufferedTokenStream.prototype.reset = function () {
  21320. this.seek(0);
  21321. };
  21322. BufferedTokenStream.prototype.seek = function (index) {
  21323. this.lazyInit();
  21324. this.index = this.adjustSeekIndex(index);
  21325. };
  21326. BufferedTokenStream.prototype.get = function (index) {
  21327. this.lazyInit();
  21328. return this.tokens[index];
  21329. };
  21330. BufferedTokenStream.prototype.consume = function () {
  21331. var skipEofCheck = false;
  21332. if (this.index >= 0) {
  21333. if (this.fetchedEOF) {
  21334. // the last token in tokens is EOF. skip check if p indexes any
  21335. // fetched token except the last.
  21336. skipEofCheck = this.index < this.tokens.length - 1;
  21337. } else {
  21338. // no EOF token in tokens. skip check if p indexes a fetched token.
  21339. skipEofCheck = this.index < this.tokens.length;
  21340. }
  21341. } else {
  21342. // not yet initialized
  21343. skipEofCheck = false;
  21344. }
  21345. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  21346. throw "cannot consume EOF";
  21347. }
  21348. if (this.sync(this.index + 1)) {
  21349. this.index = this.adjustSeekIndex(this.index + 1);
  21350. }
  21351. };
  21352. // Make sure index {@code i} in tokens has a token.
  21353. //
  21354. // @return {@code true} if a token is located at index {@code i}, otherwise
  21355. // {@code false}.
  21356. // @see //get(int i)
  21357. // /
  21358. BufferedTokenStream.prototype.sync = function (i) {
  21359. var n = i - this.tokens.length + 1; // how many more elements we need?
  21360. if (n > 0) {
  21361. var fetched = this.fetch(n);
  21362. return fetched >= n;
  21363. }
  21364. return true;
  21365. };
  21366. // Add {@code n} elements to buffer.
  21367. //
  21368. // @return The actual number of elements added to the buffer.
  21369. // /
  21370. BufferedTokenStream.prototype.fetch = function (n) {
  21371. if (this.fetchedEOF) {
  21372. return 0;
  21373. }
  21374. for (var i = 0; i < n; i++) {
  21375. var t = this.tokenSource.nextToken();
  21376. t.tokenIndex = this.tokens.length;
  21377. this.tokens.push(t);
  21378. if (t.type === Token.EOF) {
  21379. this.fetchedEOF = true;
  21380. return i + 1;
  21381. }
  21382. }
  21383. return n;
  21384. };
  21385. // Get all tokens from start..stop inclusively///
  21386. BufferedTokenStream.prototype.getTokens = function (start, stop, types) {
  21387. if (types === undefined) {
  21388. types = null;
  21389. }
  21390. if (start < 0 || stop < 0) {
  21391. return null;
  21392. }
  21393. this.lazyInit();
  21394. var subset = [];
  21395. if (stop >= this.tokens.length) {
  21396. stop = this.tokens.length - 1;
  21397. }
  21398. for (var i = start; i < stop; i++) {
  21399. var t = this.tokens[i];
  21400. if (t.type === Token.EOF) {
  21401. break;
  21402. }
  21403. if (types === null || types.contains(t.type)) {
  21404. subset.push(t);
  21405. }
  21406. }
  21407. return subset;
  21408. };
  21409. BufferedTokenStream.prototype.LA = function (i) {
  21410. return this.LT(i).type;
  21411. };
  21412. BufferedTokenStream.prototype.LB = function (k) {
  21413. if (this.index - k < 0) {
  21414. return null;
  21415. }
  21416. return this.tokens[this.index - k];
  21417. };
  21418. BufferedTokenStream.prototype.LT = function (k) {
  21419. this.lazyInit();
  21420. if (k === 0) {
  21421. return null;
  21422. }
  21423. if (k < 0) {
  21424. return this.LB(-k);
  21425. }
  21426. var i = this.index + k - 1;
  21427. this.sync(i);
  21428. if (i >= this.tokens.length) {
  21429. // return EOF token
  21430. // EOF must be last token
  21431. return this.tokens[this.tokens.length - 1];
  21432. }
  21433. return this.tokens[i];
  21434. };
  21435. // Allowed derived classes to modify the behavior of operations which change
  21436. // the current stream position by adjusting the target token index of a seek
  21437. // operation. The default implementation simply returns {@code i}. If an
  21438. // exception is thrown in this method, the current stream index should not be
  21439. // changed.
  21440. //
  21441. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  21442. // that
  21443. // the seek target is always an on-channel token.</p>
  21444. //
  21445. // @param i The target token index.
  21446. // @return The adjusted target token index.
  21447. BufferedTokenStream.prototype.adjustSeekIndex = function (i) {
  21448. return i;
  21449. };
  21450. BufferedTokenStream.prototype.lazyInit = function () {
  21451. if (this.index === -1) {
  21452. this.setup();
  21453. }
  21454. };
  21455. BufferedTokenStream.prototype.setup = function () {
  21456. this.sync(0);
  21457. this.index = this.adjustSeekIndex(0);
  21458. };
  21459. // Reset this token stream by setting its token source.///
  21460. BufferedTokenStream.prototype.setTokenSource = function (tokenSource) {
  21461. this.tokenSource = tokenSource;
  21462. this.tokens = [];
  21463. this.index = -1;
  21464. this.fetchedEOF = false;
  21465. };
  21466. // Given a starting index, return the index of the next token on channel.
  21467. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21468. // on channel between i and EOF.
  21469. // /
  21470. BufferedTokenStream.prototype.nextTokenOnChannel = function (i, channel) {
  21471. this.sync(i);
  21472. if (i >= this.tokens.length) {
  21473. return -1;
  21474. }
  21475. var token = this.tokens[i];
  21476. while (token.channel !== this.channel) {
  21477. if (token.type === Token.EOF) {
  21478. return -1;
  21479. }
  21480. i += 1;
  21481. this.sync(i);
  21482. token = this.tokens[i];
  21483. }
  21484. return i;
  21485. };
  21486. // Given a starting index, return the index of the previous token on channel.
  21487. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  21488. // on channel between i and 0.
  21489. BufferedTokenStream.prototype.previousTokenOnChannel = function (i, channel) {
  21490. while (i >= 0 && this.tokens[i].channel !== channel) {
  21491. i -= 1;
  21492. }
  21493. return i;
  21494. };
  21495. // Collect all tokens on specified channel to the right of
  21496. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  21497. // EOF. If channel is -1, find any non default channel token.
  21498. BufferedTokenStream.prototype.getHiddenTokensToRight = function (tokenIndex, channel) {
  21499. if (channel === undefined) {
  21500. channel = -1;
  21501. }
  21502. this.lazyInit();
  21503. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21504. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21505. }
  21506. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21507. var from_ = tokenIndex + 1;
  21508. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  21509. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  21510. return this.filterForChannel(from_, to, channel);
  21511. };
  21512. // Collect all tokens on specified channel to the left of
  21513. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  21514. // If channel is -1, find any non default channel token.
  21515. BufferedTokenStream.prototype.getHiddenTokensToLeft = function (tokenIndex, channel) {
  21516. if (channel === undefined) {
  21517. channel = -1;
  21518. }
  21519. this.lazyInit();
  21520. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  21521. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  21522. }
  21523. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  21524. if (prevOnChannel === tokenIndex - 1) {
  21525. return null;
  21526. }
  21527. // if none on channel to left, prevOnChannel=-1 then from=0
  21528. var from_ = prevOnChannel + 1;
  21529. var to = tokenIndex - 1;
  21530. return this.filterForChannel(from_, to, channel);
  21531. };
  21532. BufferedTokenStream.prototype.filterForChannel = function (left, right, channel) {
  21533. var hidden = [];
  21534. for (var i = left; i < right + 1; i++) {
  21535. var t = this.tokens[i];
  21536. if (channel === -1) {
  21537. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  21538. hidden.push(t);
  21539. }
  21540. } else if (t.channel === channel) {
  21541. hidden.push(t);
  21542. }
  21543. }
  21544. if (hidden.length === 0) {
  21545. return null;
  21546. }
  21547. return hidden;
  21548. };
  21549. BufferedTokenStream.prototype.getSourceName = function () {
  21550. return this.tokenSource.getSourceName();
  21551. };
  21552. // Get the text of all tokens in this buffer.///
  21553. BufferedTokenStream.prototype.getText = function (interval) {
  21554. this.lazyInit();
  21555. this.fill();
  21556. if (interval === undefined || interval === null) {
  21557. interval = new Interval(0, this.tokens.length - 1);
  21558. }
  21559. var start = interval.start;
  21560. if (start instanceof Token) {
  21561. start = start.tokenIndex;
  21562. }
  21563. var stop = interval.stop;
  21564. if (stop instanceof Token) {
  21565. stop = stop.tokenIndex;
  21566. }
  21567. if (start === null || stop === null || start < 0 || stop < 0) {
  21568. return "";
  21569. }
  21570. if (stop >= this.tokens.length) {
  21571. stop = this.tokens.length - 1;
  21572. }
  21573. var s = "";
  21574. for (var i = start; i < stop + 1; i++) {
  21575. var t = this.tokens[i];
  21576. if (t.type === Token.EOF) {
  21577. break;
  21578. }
  21579. s = s + t.text;
  21580. }
  21581. return s;
  21582. };
  21583. // Get all tokens from lexer until EOF///
  21584. BufferedTokenStream.prototype.fill = function () {
  21585. this.lazyInit();
  21586. while (this.fetch(1000) === 1000) {
  21587. continue;
  21588. }
  21589. };
  21590. exports.BufferedTokenStream = BufferedTokenStream;
  21591. /***/ }),
  21592. /***/ "./node_modules/antlr4/CharStreams.js":
  21593. /*!********************************************!*\
  21594. !*** ./node_modules/antlr4/CharStreams.js ***!
  21595. \********************************************/
  21596. /*! no static exports found */
  21597. /***/ (function(module, exports, __webpack_require__) {
  21598. "use strict";
  21599. //
  21600. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21601. * Use of this file is governed by the BSD 3-clause license that
  21602. * can be found in the LICENSE.txt file in the project root.
  21603. */
  21604. //
  21605. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21606. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21607. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21608. // Utility functions to create InputStreams from various sources.
  21609. //
  21610. // All returned InputStreams support the full range of Unicode
  21611. // up to U+10FFFF (the default behavior of InputStream only supports
  21612. // code points up to U+FFFF).
  21613. var CharStreams = {
  21614. // Creates an InputStream from a string.
  21615. fromString: function fromString(str) {
  21616. return new InputStream(str, true);
  21617. },
  21618. // Asynchronously creates an InputStream from a blob given the
  21619. // encoding of the bytes in that blob (defaults to 'utf8' if
  21620. // encoding is null).
  21621. //
  21622. // Invokes onLoad(result) on success, onError(error) on
  21623. // failure.
  21624. fromBlob: function fromBlob(blob, encoding, onLoad, onError) {
  21625. var reader = FileReader();
  21626. reader.onload = function (e) {
  21627. var is = new InputStream(e.target.result, true);
  21628. onLoad(is);
  21629. };
  21630. reader.onerror = onError;
  21631. reader.readAsText(blob, encoding);
  21632. },
  21633. // Creates an InputStream from a Buffer given the
  21634. // encoding of the bytes in that buffer (defaults to 'utf8' if
  21635. // encoding is null).
  21636. fromBuffer: function fromBuffer(buffer, encoding) {
  21637. return new InputStream(buffer.toString(encoding), true);
  21638. },
  21639. // Asynchronously creates an InputStream from a file on disk given
  21640. // the encoding of the bytes in that file (defaults to 'utf8' if
  21641. // encoding is null).
  21642. //
  21643. // Invokes callback(error, result) on completion.
  21644. fromPath: function fromPath(path, encoding, callback) {
  21645. fs.readFile(path, encoding, function (err, data) {
  21646. var is = null;
  21647. if (data !== null) {
  21648. is = new InputStream(data, true);
  21649. }
  21650. callback(err, is);
  21651. });
  21652. },
  21653. // Synchronously creates an InputStream given a path to a file
  21654. // on disk and the encoding of the bytes in that file (defaults to
  21655. // 'utf8' if encoding is null).
  21656. fromPathSync: function fromPathSync(path, encoding) {
  21657. var data = fs.readFileSync(path, encoding);
  21658. return new InputStream(data, true);
  21659. }
  21660. };
  21661. exports.CharStreams = CharStreams;
  21662. /***/ }),
  21663. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  21664. /*!***************************************************!*\
  21665. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  21666. \***************************************************/
  21667. /*! no static exports found */
  21668. /***/ (function(module, exports, __webpack_require__) {
  21669. "use strict";
  21670. //
  21671. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21672. * Use of this file is governed by the BSD 3-clause license that
  21673. * can be found in the LICENSE.txt file in the project root.
  21674. */
  21675. //
  21676. //
  21677. // This default implementation of {@link TokenFactory} creates
  21678. // {@link CommonToken} objects.
  21679. //
  21680. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  21681. function TokenFactory() {
  21682. return this;
  21683. }
  21684. function CommonTokenFactory(copyText) {
  21685. TokenFactory.call(this);
  21686. // Indicates whether {@link CommonToken//setText} should be called after
  21687. // constructing tokens to explicitly set the text. This is useful for cases
  21688. // where the input stream might not be able to provide arbitrary substrings
  21689. // of text from the input after the lexer creates a token (e.g. the
  21690. // implementation of {@link CharStream//getText} in
  21691. // {@link UnbufferedCharStream} throws an
  21692. // {@link UnsupportedOperationException}). Explicitly setting the token text
  21693. // allows {@link Token//getText} to be called at any time regardless of the
  21694. // input stream implementation.
  21695. //
  21696. // <p>
  21697. // The default value is {@code false} to avoid the performance and memory
  21698. // overhead of copying text for every token unless explicitly requested.</p>
  21699. //
  21700. this.copyText = copyText === undefined ? false : copyText;
  21701. return this;
  21702. }
  21703. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  21704. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  21705. //
  21706. // The default {@link CommonTokenFactory} instance.
  21707. //
  21708. // <p>
  21709. // This token factory does not explicitly copy token text when constructing
  21710. // tokens.</p>
  21711. //
  21712. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  21713. CommonTokenFactory.prototype.create = function (source, type, text, channel, start, stop, line, column) {
  21714. var t = new CommonToken(source, type, channel, start, stop);
  21715. t.line = line;
  21716. t.column = column;
  21717. if (text !== null) {
  21718. t.text = text;
  21719. } else if (this.copyText && source[1] !== null) {
  21720. t.text = source[1].getText(start, stop);
  21721. }
  21722. return t;
  21723. };
  21724. CommonTokenFactory.prototype.createThin = function (type, text) {
  21725. var t = new CommonToken(null, type);
  21726. t.text = text;
  21727. return t;
  21728. };
  21729. exports.CommonTokenFactory = CommonTokenFactory;
  21730. /***/ }),
  21731. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  21732. /*!**************************************************!*\
  21733. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  21734. \**************************************************/
  21735. /*! no static exports found */
  21736. /***/ (function(module, exports, __webpack_require__) {
  21737. "use strict";
  21738. //
  21739. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21740. * Use of this file is governed by the BSD 3-clause license that
  21741. * can be found in the LICENSE.txt file in the project root.
  21742. */
  21743. ///
  21744. //
  21745. // This class extends {@link BufferedTokenStream} with functionality to filter
  21746. // token streams to tokens on a particular channel (tokens where
  21747. // {@link Token//getChannel} returns a particular value).
  21748. //
  21749. // <p>
  21750. // This token stream provides access to all tokens by index or when calling
  21751. // methods like {@link //getText}. The channel filtering is only used for code
  21752. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  21753. // {@link //LB}.</p>
  21754. //
  21755. // <p>
  21756. // By default, tokens are placed on the default channel
  21757. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  21758. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  21759. // call {@link Lexer//setChannel}.
  21760. // </p>
  21761. //
  21762. // <p>
  21763. // Note: lexer rules which use the {@code ->skip} lexer command or call
  21764. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  21765. // such a rule will not be available as part of the token stream, regardless of
  21766. // channel.</p>
  21767. ///
  21768. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21769. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  21770. function CommonTokenStream(lexer, channel) {
  21771. BufferedTokenStream.call(this, lexer);
  21772. this.channel = channel === undefined ? Token.DEFAULT_CHANNEL : channel;
  21773. return this;
  21774. }
  21775. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  21776. CommonTokenStream.prototype.constructor = CommonTokenStream;
  21777. CommonTokenStream.prototype.adjustSeekIndex = function (i) {
  21778. return this.nextTokenOnChannel(i, this.channel);
  21779. };
  21780. CommonTokenStream.prototype.LB = function (k) {
  21781. if (k === 0 || this.index - k < 0) {
  21782. return null;
  21783. }
  21784. var i = this.index;
  21785. var n = 1;
  21786. // find k good tokens looking backwards
  21787. while (n <= k) {
  21788. // skip off-channel tokens
  21789. i = this.previousTokenOnChannel(i - 1, this.channel);
  21790. n += 1;
  21791. }
  21792. if (i < 0) {
  21793. return null;
  21794. }
  21795. return this.tokens[i];
  21796. };
  21797. CommonTokenStream.prototype.LT = function (k) {
  21798. this.lazyInit();
  21799. if (k === 0) {
  21800. return null;
  21801. }
  21802. if (k < 0) {
  21803. return this.LB(-k);
  21804. }
  21805. var i = this.index;
  21806. var n = 1; // we know tokens[pos] is a good one
  21807. // find k good tokens
  21808. while (n < k) {
  21809. // skip off-channel tokens, but make sure to not look past EOF
  21810. if (this.sync(i + 1)) {
  21811. i = this.nextTokenOnChannel(i + 1, this.channel);
  21812. }
  21813. n += 1;
  21814. }
  21815. return this.tokens[i];
  21816. };
  21817. // Count EOF just once.///
  21818. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function () {
  21819. var n = 0;
  21820. this.fill();
  21821. for (var i = 0; i < this.tokens.length; i++) {
  21822. var t = this.tokens[i];
  21823. if (t.channel === this.channel) {
  21824. n += 1;
  21825. }
  21826. if (t.type === Token.EOF) {
  21827. break;
  21828. }
  21829. }
  21830. return n;
  21831. };
  21832. exports.CommonTokenStream = CommonTokenStream;
  21833. /***/ }),
  21834. /***/ "./node_modules/antlr4/FileStream.js":
  21835. /*!*******************************************!*\
  21836. !*** ./node_modules/antlr4/FileStream.js ***!
  21837. \*******************************************/
  21838. /*! no static exports found */
  21839. /***/ (function(module, exports, __webpack_require__) {
  21840. "use strict";
  21841. //
  21842. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21843. * Use of this file is governed by the BSD 3-clause license that
  21844. * can be found in the LICENSE.txt file in the project root.
  21845. */
  21846. //
  21847. //
  21848. // This is an InputStream that is loaded from a file all at once
  21849. // when you construct the object.
  21850. //
  21851. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  21852. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  21853. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  21854. function FileStream(fileName, decodeToUnicodeCodePoints) {
  21855. var data = fs.readFileSync(fileName, "utf8");
  21856. InputStream.call(this, data, decodeToUnicodeCodePoints);
  21857. this.fileName = fileName;
  21858. return this;
  21859. }
  21860. FileStream.prototype = Object.create(InputStream.prototype);
  21861. FileStream.prototype.constructor = FileStream;
  21862. exports.FileStream = FileStream;
  21863. /***/ }),
  21864. /***/ "./node_modules/antlr4/InputStream.js":
  21865. /*!********************************************!*\
  21866. !*** ./node_modules/antlr4/InputStream.js ***!
  21867. \********************************************/
  21868. /*! no static exports found */
  21869. /***/ (function(module, exports, __webpack_require__) {
  21870. "use strict";
  21871. //
  21872. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21873. * Use of this file is governed by the BSD 3-clause license that
  21874. * can be found in the LICENSE.txt file in the project root.
  21875. */
  21876. //
  21877. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  21878. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  21879. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  21880. // Vacuum all input from a string and then treat it like a buffer.
  21881. function _loadString(stream, decodeToUnicodeCodePoints) {
  21882. stream._index = 0;
  21883. stream.data = [];
  21884. if (stream.decodeToUnicodeCodePoints) {
  21885. for (var i = 0; i < stream.strdata.length;) {
  21886. var codePoint = stream.strdata.codePointAt(i);
  21887. stream.data.push(codePoint);
  21888. i += codePoint <= 0xFFFF ? 1 : 2;
  21889. }
  21890. } else {
  21891. for (var i = 0; i < stream.strdata.length; i++) {
  21892. var codeUnit = stream.strdata.charCodeAt(i);
  21893. stream.data.push(codeUnit);
  21894. }
  21895. }
  21896. stream._size = stream.data.length;
  21897. }
  21898. // If decodeToUnicodeCodePoints is true, the input is treated
  21899. // as a series of Unicode code points.
  21900. //
  21901. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  21902. // units.
  21903. function InputStream(data, decodeToUnicodeCodePoints) {
  21904. this.name = "<empty>";
  21905. this.strdata = data;
  21906. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  21907. _loadString(this);
  21908. return this;
  21909. }
  21910. Object.defineProperty(InputStream.prototype, "index", {
  21911. get: function get() {
  21912. return this._index;
  21913. }
  21914. });
  21915. Object.defineProperty(InputStream.prototype, "size", {
  21916. get: function get() {
  21917. return this._size;
  21918. }
  21919. });
  21920. // Reset the stream so that it's in the same state it was
  21921. // when the object was created *except* the data array is not
  21922. // touched.
  21923. //
  21924. InputStream.prototype.reset = function () {
  21925. this._index = 0;
  21926. };
  21927. InputStream.prototype.consume = function () {
  21928. if (this._index >= this._size) {
  21929. // assert this.LA(1) == Token.EOF
  21930. throw "cannot consume EOF";
  21931. }
  21932. this._index += 1;
  21933. };
  21934. InputStream.prototype.LA = function (offset) {
  21935. if (offset === 0) {
  21936. return 0; // undefined
  21937. }
  21938. if (offset < 0) {
  21939. offset += 1; // e.g., translate LA(-1) to use offset=0
  21940. }
  21941. var pos = this._index + offset - 1;
  21942. if (pos < 0 || pos >= this._size) {
  21943. // invalid
  21944. return Token.EOF;
  21945. }
  21946. return this.data[pos];
  21947. };
  21948. InputStream.prototype.LT = function (offset) {
  21949. return this.LA(offset);
  21950. };
  21951. // mark/release do nothing; we have entire buffer
  21952. InputStream.prototype.mark = function () {
  21953. return -1;
  21954. };
  21955. InputStream.prototype.release = function (marker) {};
  21956. // consume() ahead until p==_index; can't just set p=_index as we must
  21957. // update line and column. If we seek backwards, just set p
  21958. //
  21959. InputStream.prototype.seek = function (_index) {
  21960. if (_index <= this._index) {
  21961. this._index = _index; // just jump; don't update stream state (line,
  21962. // ...)
  21963. return;
  21964. }
  21965. // seek forward
  21966. this._index = Math.min(_index, this._size);
  21967. };
  21968. InputStream.prototype.getText = function (start, stop) {
  21969. if (stop >= this._size) {
  21970. stop = this._size - 1;
  21971. }
  21972. if (start >= this._size) {
  21973. return "";
  21974. } else {
  21975. if (this.decodeToUnicodeCodePoints) {
  21976. var result = "";
  21977. for (var i = start; i <= stop; i++) {
  21978. result += String.fromCodePoint(this.data[i]);
  21979. }
  21980. return result;
  21981. } else {
  21982. return this.strdata.slice(start, stop + 1);
  21983. }
  21984. }
  21985. };
  21986. InputStream.prototype.toString = function () {
  21987. return this.strdata;
  21988. };
  21989. exports.InputStream = InputStream;
  21990. /***/ }),
  21991. /***/ "./node_modules/antlr4/IntervalSet.js":
  21992. /*!********************************************!*\
  21993. !*** ./node_modules/antlr4/IntervalSet.js ***!
  21994. \********************************************/
  21995. /*! no static exports found */
  21996. /***/ (function(module, exports, __webpack_require__) {
  21997. "use strict";
  21998. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  21999. * Use of this file is governed by the BSD 3-clause license that
  22000. * can be found in the LICENSE.txt file in the project root.
  22001. */
  22002. /*jslint smarttabs:true */
  22003. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22004. /* stop is not included! */
  22005. function Interval(start, stop) {
  22006. this.start = start;
  22007. this.stop = stop;
  22008. return this;
  22009. }
  22010. Interval.prototype.contains = function (item) {
  22011. return item >= this.start && item < this.stop;
  22012. };
  22013. Interval.prototype.toString = function () {
  22014. if (this.start === this.stop - 1) {
  22015. return this.start.toString();
  22016. } else {
  22017. return this.start.toString() + ".." + (this.stop - 1).toString();
  22018. }
  22019. };
  22020. Object.defineProperty(Interval.prototype, "length", {
  22021. get: function get() {
  22022. return this.stop - this.start;
  22023. }
  22024. });
  22025. function IntervalSet() {
  22026. this.intervals = null;
  22027. this.readOnly = false;
  22028. }
  22029. IntervalSet.prototype.first = function (v) {
  22030. if (this.intervals === null || this.intervals.length === 0) {
  22031. return Token.INVALID_TYPE;
  22032. } else {
  22033. return this.intervals[0].start;
  22034. }
  22035. };
  22036. IntervalSet.prototype.addOne = function (v) {
  22037. this.addInterval(new Interval(v, v + 1));
  22038. };
  22039. IntervalSet.prototype.addRange = function (l, h) {
  22040. this.addInterval(new Interval(l, h + 1));
  22041. };
  22042. IntervalSet.prototype.addInterval = function (v) {
  22043. if (this.intervals === null) {
  22044. this.intervals = [];
  22045. this.intervals.push(v);
  22046. } else {
  22047. // find insert pos
  22048. for (var k = 0; k < this.intervals.length; k++) {
  22049. var i = this.intervals[k];
  22050. // distinct range -> insert
  22051. if (v.stop < i.start) {
  22052. this.intervals.splice(k, 0, v);
  22053. return;
  22054. }
  22055. // contiguous range -> adjust
  22056. else if (v.stop === i.start) {
  22057. this.intervals[k].start = v.start;
  22058. return;
  22059. }
  22060. // overlapping range -> adjust and reduce
  22061. else if (v.start <= i.stop) {
  22062. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  22063. this.reduce(k);
  22064. return;
  22065. }
  22066. }
  22067. // greater than any existing
  22068. this.intervals.push(v);
  22069. }
  22070. };
  22071. IntervalSet.prototype.addSet = function (other) {
  22072. if (other.intervals !== null) {
  22073. for (var k = 0; k < other.intervals.length; k++) {
  22074. var i = other.intervals[k];
  22075. this.addInterval(new Interval(i.start, i.stop));
  22076. }
  22077. }
  22078. return this;
  22079. };
  22080. IntervalSet.prototype.reduce = function (k) {
  22081. // only need to reduce if k is not the last
  22082. if (k < this.intervalslength - 1) {
  22083. var l = this.intervals[k];
  22084. var r = this.intervals[k + 1];
  22085. // if r contained in l
  22086. if (l.stop >= r.stop) {
  22087. this.intervals.pop(k + 1);
  22088. this.reduce(k);
  22089. } else if (l.stop >= r.start) {
  22090. this.intervals[k] = new Interval(l.start, r.stop);
  22091. this.intervals.pop(k + 1);
  22092. }
  22093. }
  22094. };
  22095. IntervalSet.prototype.complement = function (start, stop) {
  22096. var result = new IntervalSet();
  22097. result.addInterval(new Interval(start, stop + 1));
  22098. for (var i = 0; i < this.intervals.length; i++) {
  22099. result.removeRange(this.intervals[i]);
  22100. }
  22101. return result;
  22102. };
  22103. IntervalSet.prototype.contains = function (item) {
  22104. if (this.intervals === null) {
  22105. return false;
  22106. } else {
  22107. for (var k = 0; k < this.intervals.length; k++) {
  22108. if (this.intervals[k].contains(item)) {
  22109. return true;
  22110. }
  22111. }
  22112. return false;
  22113. }
  22114. };
  22115. Object.defineProperty(IntervalSet.prototype, "length", {
  22116. get: function get() {
  22117. var len = 0;
  22118. this.intervals.map(function (i) {
  22119. len += i.length;
  22120. });
  22121. return len;
  22122. }
  22123. });
  22124. IntervalSet.prototype.removeRange = function (v) {
  22125. if (v.start === v.stop - 1) {
  22126. this.removeOne(v.start);
  22127. } else if (this.intervals !== null) {
  22128. var k = 0;
  22129. for (var n = 0; n < this.intervals.length; n++) {
  22130. var i = this.intervals[k];
  22131. // intervals are ordered
  22132. if (v.stop <= i.start) {
  22133. return;
  22134. }
  22135. // check for including range, split it
  22136. else if (v.start > i.start && v.stop < i.stop) {
  22137. this.intervals[k] = new Interval(i.start, v.start);
  22138. var x = new Interval(v.stop, i.stop);
  22139. this.intervals.splice(k, 0, x);
  22140. return;
  22141. }
  22142. // check for included range, remove it
  22143. else if (v.start <= i.start && v.stop >= i.stop) {
  22144. this.intervals.splice(k, 1);
  22145. k = k - 1; // need another pass
  22146. }
  22147. // check for lower boundary
  22148. else if (v.start < i.stop) {
  22149. this.intervals[k] = new Interval(i.start, v.start);
  22150. }
  22151. // check for upper boundary
  22152. else if (v.stop < i.stop) {
  22153. this.intervals[k] = new Interval(v.stop, i.stop);
  22154. }
  22155. k += 1;
  22156. }
  22157. }
  22158. };
  22159. IntervalSet.prototype.removeOne = function (v) {
  22160. if (this.intervals !== null) {
  22161. for (var k = 0; k < this.intervals.length; k++) {
  22162. var i = this.intervals[k];
  22163. // intervals is ordered
  22164. if (v < i.start) {
  22165. return;
  22166. }
  22167. // check for single value range
  22168. else if (v === i.start && v === i.stop - 1) {
  22169. this.intervals.splice(k, 1);
  22170. return;
  22171. }
  22172. // check for lower boundary
  22173. else if (v === i.start) {
  22174. this.intervals[k] = new Interval(i.start + 1, i.stop);
  22175. return;
  22176. }
  22177. // check for upper boundary
  22178. else if (v === i.stop - 1) {
  22179. this.intervals[k] = new Interval(i.start, i.stop - 1);
  22180. return;
  22181. }
  22182. // split existing range
  22183. else if (v < i.stop - 1) {
  22184. var x = new Interval(i.start, v);
  22185. i.start = v + 1;
  22186. this.intervals.splice(k, 0, x);
  22187. return;
  22188. }
  22189. }
  22190. }
  22191. };
  22192. IntervalSet.prototype.toString = function (literalNames, symbolicNames, elemsAreChar) {
  22193. literalNames = literalNames || null;
  22194. symbolicNames = symbolicNames || null;
  22195. elemsAreChar = elemsAreChar || false;
  22196. if (this.intervals === null) {
  22197. return "{}";
  22198. } else if (literalNames !== null || symbolicNames !== null) {
  22199. return this.toTokenString(literalNames, symbolicNames);
  22200. } else if (elemsAreChar) {
  22201. return this.toCharString();
  22202. } else {
  22203. return this.toIndexString();
  22204. }
  22205. };
  22206. IntervalSet.prototype.toCharString = function () {
  22207. var names = [];
  22208. for (var i = 0; i < this.intervals.length; i++) {
  22209. var v = this.intervals[i];
  22210. if (v.stop === v.start + 1) {
  22211. if (v.start === Token.EOF) {
  22212. names.push("<EOF>");
  22213. } else {
  22214. names.push("'" + String.fromCharCode(v.start) + "'");
  22215. }
  22216. } else {
  22217. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop - 1) + "'");
  22218. }
  22219. }
  22220. if (names.length > 1) {
  22221. return "{" + names.join(", ") + "}";
  22222. } else {
  22223. return names[0];
  22224. }
  22225. };
  22226. IntervalSet.prototype.toIndexString = function () {
  22227. var names = [];
  22228. for (var i = 0; i < this.intervals.length; i++) {
  22229. var v = this.intervals[i];
  22230. if (v.stop === v.start + 1) {
  22231. if (v.start === Token.EOF) {
  22232. names.push("<EOF>");
  22233. } else {
  22234. names.push(v.start.toString());
  22235. }
  22236. } else {
  22237. names.push(v.start.toString() + ".." + (v.stop - 1).toString());
  22238. }
  22239. }
  22240. if (names.length > 1) {
  22241. return "{" + names.join(", ") + "}";
  22242. } else {
  22243. return names[0];
  22244. }
  22245. };
  22246. IntervalSet.prototype.toTokenString = function (literalNames, symbolicNames) {
  22247. var names = [];
  22248. for (var i = 0; i < this.intervals.length; i++) {
  22249. var v = this.intervals[i];
  22250. for (var j = v.start; j < v.stop; j++) {
  22251. names.push(this.elementName(literalNames, symbolicNames, j));
  22252. }
  22253. }
  22254. if (names.length > 1) {
  22255. return "{" + names.join(", ") + "}";
  22256. } else {
  22257. return names[0];
  22258. }
  22259. };
  22260. IntervalSet.prototype.elementName = function (literalNames, symbolicNames, a) {
  22261. if (a === Token.EOF) {
  22262. return "<EOF>";
  22263. } else if (a === Token.EPSILON) {
  22264. return "<EPSILON>";
  22265. } else {
  22266. return literalNames[a] || symbolicNames[a];
  22267. }
  22268. };
  22269. exports.Interval = Interval;
  22270. exports.IntervalSet = IntervalSet;
  22271. /***/ }),
  22272. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  22273. /*!********************************************!*\
  22274. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  22275. \********************************************/
  22276. /*! no static exports found */
  22277. /***/ (function(module, exports, __webpack_require__) {
  22278. "use strict";
  22279. //
  22280. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22281. * Use of this file is governed by the BSD 3-clause license that
  22282. * can be found in the LICENSE.txt file in the project root.
  22283. */
  22284. ///
  22285. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  22286. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  22287. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22288. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  22289. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  22290. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  22291. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  22292. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  22293. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  22294. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  22295. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  22296. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  22297. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  22298. var PredictionContext = pc.PredictionContext;
  22299. var SingletonPredictionContext = pc.SingletonPredictionContext;
  22300. function LL1Analyzer(atn) {
  22301. this.atn = atn;
  22302. }
  22303. //* Special value added to the lookahead sets to indicate that we hit
  22304. // a predicate during analysis if {@code seeThruPreds==false}.
  22305. ///
  22306. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  22307. //*
  22308. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  22309. // of an {@link ATNState}. The returned array has one element for each
  22310. // outgoing transition in {@code s}. If the closure from transition
  22311. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  22312. // element at index <em>i</em> of the result will be {@code null}.
  22313. //
  22314. // @param s the ATN state
  22315. // @return the expected symbols for each outgoing transition of {@code s}.
  22316. ///
  22317. LL1Analyzer.prototype.getDecisionLookahead = function (s) {
  22318. if (s === null) {
  22319. return null;
  22320. }
  22321. var count = s.transitions.length;
  22322. var look = [];
  22323. for (var alt = 0; alt < count; alt++) {
  22324. look[alt] = new IntervalSet();
  22325. var lookBusy = new Set();
  22326. var seeThruPreds = false; // fail to get lookahead upon pred
  22327. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY, look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  22328. // Wipe out lookahead for this alternative if we found nothing
  22329. // or we had a predicate when we !seeThruPreds
  22330. if (look[alt].length === 0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  22331. look[alt] = null;
  22332. }
  22333. }
  22334. return look;
  22335. };
  22336. //*
  22337. // Compute set of tokens that can follow {@code s} in the ATN in the
  22338. // specified {@code ctx}.
  22339. //
  22340. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  22341. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  22342. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  22343. // reached, {@link Token//EOF} is added to the result set.</p>
  22344. //
  22345. // @param s the ATN state
  22346. // @param stopState the ATN state to stop at. This can be a
  22347. // {@link BlockEndState} to detect epsilon paths through a closure.
  22348. // @param ctx the complete parser context, or {@code null} if the context
  22349. // should be ignored
  22350. //
  22351. // @return The set of tokens that can follow {@code s} in the ATN in the
  22352. // specified {@code ctx}.
  22353. ///
  22354. LL1Analyzer.prototype.LOOK = function (s, stopState, ctx) {
  22355. var r = new IntervalSet();
  22356. var seeThruPreds = true; // ignore preds; get all lookahead
  22357. ctx = ctx || null;
  22358. var lookContext = ctx !== null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  22359. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  22360. return r;
  22361. };
  22362. //*
  22363. // Compute set of tokens that can follow {@code s} in the ATN in the
  22364. // specified {@code ctx}.
  22365. //
  22366. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  22367. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  22368. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  22369. // {@code true} and {@code stopState} or the end of the outermost rule is
  22370. // reached, {@link Token//EOF} is added to the result set.</p>
  22371. //
  22372. // @param s the ATN state.
  22373. // @param stopState the ATN state to stop at. This can be a
  22374. // {@link BlockEndState} to detect epsilon paths through a closure.
  22375. // @param ctx The outer context, or {@code null} if the outer context should
  22376. // not be used.
  22377. // @param look The result lookahead set.
  22378. // @param lookBusy A set used for preventing epsilon closures in the ATN
  22379. // from causing a stack overflow. Outside code should pass
  22380. // {@code new Set<ATNConfig>} for this argument.
  22381. // @param calledRuleStack A set used for preventing left recursion in the
  22382. // ATN from causing a stack overflow. Outside code should pass
  22383. // {@code new BitSet()} for this argument.
  22384. // @param seeThruPreds {@code true} to true semantic predicates as
  22385. // implicitly {@code true} and "see through them", otherwise {@code false}
  22386. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  22387. // result if one is encountered.
  22388. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  22389. // outermost context is reached. This parameter has no effect if {@code ctx}
  22390. // is {@code null}.
  22391. ///
  22392. LL1Analyzer.prototype._LOOK = function (s, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  22393. var c = new ATNConfig({ state: s, alt: 0, context: ctx }, null);
  22394. if (lookBusy.contains(c)) {
  22395. return;
  22396. }
  22397. lookBusy.add(c);
  22398. if (s === stopState) {
  22399. if (ctx === null) {
  22400. look.addOne(Token.EPSILON);
  22401. return;
  22402. } else if (ctx.isEmpty() && addEOF) {
  22403. look.addOne(Token.EOF);
  22404. return;
  22405. }
  22406. }
  22407. if (s instanceof RuleStopState) {
  22408. if (ctx === null) {
  22409. look.addOne(Token.EPSILON);
  22410. return;
  22411. } else if (ctx.isEmpty() && addEOF) {
  22412. look.addOne(Token.EOF);
  22413. return;
  22414. }
  22415. if (ctx !== PredictionContext.EMPTY) {
  22416. // run thru all possible stack tops in ctx
  22417. for (var i = 0; i < ctx.length; i++) {
  22418. var returnState = this.atn.states[ctx.getReturnState(i)];
  22419. var removed = calledRuleStack.contains(returnState.ruleIndex);
  22420. try {
  22421. calledRuleStack.remove(returnState.ruleIndex);
  22422. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22423. } finally {
  22424. if (removed) {
  22425. calledRuleStack.add(returnState.ruleIndex);
  22426. }
  22427. }
  22428. }
  22429. return;
  22430. }
  22431. }
  22432. for (var j = 0; j < s.transitions.length; j++) {
  22433. var t = s.transitions[j];
  22434. if (t.constructor === RuleTransition) {
  22435. if (calledRuleStack.contains(t.target.ruleIndex)) {
  22436. continue;
  22437. }
  22438. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  22439. try {
  22440. calledRuleStack.add(t.target.ruleIndex);
  22441. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22442. } finally {
  22443. calledRuleStack.remove(t.target.ruleIndex);
  22444. }
  22445. } else if (t instanceof AbstractPredicateTransition) {
  22446. if (seeThruPreds) {
  22447. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22448. } else {
  22449. look.addOne(LL1Analyzer.HIT_PRED);
  22450. }
  22451. } else if (t.isEpsilon) {
  22452. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  22453. } else if (t.constructor === WildcardTransition) {
  22454. look.addRange(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22455. } else {
  22456. var set = t.label;
  22457. if (set !== null) {
  22458. if (t instanceof NotSetTransition) {
  22459. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  22460. }
  22461. look.addSet(set);
  22462. }
  22463. }
  22464. }
  22465. };
  22466. exports.LL1Analyzer = LL1Analyzer;
  22467. /***/ }),
  22468. /***/ "./node_modules/antlr4/Lexer.js":
  22469. /*!**************************************!*\
  22470. !*** ./node_modules/antlr4/Lexer.js ***!
  22471. \**************************************/
  22472. /*! no static exports found */
  22473. /***/ (function(module, exports, __webpack_require__) {
  22474. "use strict";
  22475. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22476. * Use of this file is governed by the BSD 3-clause license that
  22477. * can be found in the LICENSE.txt file in the project root.
  22478. */
  22479. ///
  22480. // A lexer is recognizer that draws input symbols from a character stream.
  22481. // lexer grammars result in a subclass of this object. A Lexer object
  22482. // uses simplified match() and error recovery mechanisms in the interest of speed.
  22483. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22484. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22485. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  22486. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  22487. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  22488. function TokenSource() {
  22489. return this;
  22490. }
  22491. function Lexer(input) {
  22492. Recognizer.call(this);
  22493. this._input = input;
  22494. this._factory = CommonTokenFactory.DEFAULT;
  22495. this._tokenFactorySourcePair = [this, input];
  22496. this._interp = null; // child classes must populate this
  22497. // The goal of all lexer rules/methods is to create a token object.
  22498. // this is an instance variable as multiple rules may collaborate to
  22499. // create a single token. nextToken will return this object after
  22500. // matching lexer rule(s). If you subclass to allow multiple token
  22501. // emissions, then set this to the last token to be matched or
  22502. // something nonnull so that the auto token emit mechanism will not
  22503. // emit another token.
  22504. this._token = null;
  22505. // What character index in the stream did the current token start at?
  22506. // Needed, for example, to get the text for current token. Set at
  22507. // the start of nextToken.
  22508. this._tokenStartCharIndex = -1;
  22509. // The line on which the first character of the token resides///
  22510. this._tokenStartLine = -1;
  22511. // The character position of first character within the line///
  22512. this._tokenStartColumn = -1;
  22513. // Once we see EOF on char stream, next token will be EOF.
  22514. // If you have DONE : EOF ; then you see DONE EOF.
  22515. this._hitEOF = false;
  22516. // The channel number for the current token///
  22517. this._channel = Token.DEFAULT_CHANNEL;
  22518. // The token type for the current token///
  22519. this._type = Token.INVALID_TYPE;
  22520. this._modeStack = [];
  22521. this._mode = Lexer.DEFAULT_MODE;
  22522. // You can set the text for the current token to override what is in
  22523. // the input char buffer. Use setText() or can set this instance var.
  22524. // /
  22525. this._text = null;
  22526. return this;
  22527. }
  22528. Lexer.prototype = Object.create(Recognizer.prototype);
  22529. Lexer.prototype.constructor = Lexer;
  22530. Lexer.DEFAULT_MODE = 0;
  22531. Lexer.MORE = -2;
  22532. Lexer.SKIP = -3;
  22533. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  22534. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  22535. Lexer.MIN_CHAR_VALUE = 0x0000;
  22536. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  22537. Lexer.prototype.reset = function () {
  22538. // wack Lexer state variables
  22539. if (this._input !== null) {
  22540. this._input.seek(0); // rewind the input
  22541. }
  22542. this._token = null;
  22543. this._type = Token.INVALID_TYPE;
  22544. this._channel = Token.DEFAULT_CHANNEL;
  22545. this._tokenStartCharIndex = -1;
  22546. this._tokenStartColumn = -1;
  22547. this._tokenStartLine = -1;
  22548. this._text = null;
  22549. this._hitEOF = false;
  22550. this._mode = Lexer.DEFAULT_MODE;
  22551. this._modeStack = [];
  22552. this._interp.reset();
  22553. };
  22554. // Return a token from this source; i.e., match a token on the char stream.
  22555. Lexer.prototype.nextToken = function () {
  22556. if (this._input === null) {
  22557. throw "nextToken requires a non-null input stream.";
  22558. }
  22559. // Mark start location in char stream so unbuffered streams are
  22560. // guaranteed at least have text of current token
  22561. var tokenStartMarker = this._input.mark();
  22562. try {
  22563. while (true) {
  22564. if (this._hitEOF) {
  22565. this.emitEOF();
  22566. return this._token;
  22567. }
  22568. this._token = null;
  22569. this._channel = Token.DEFAULT_CHANNEL;
  22570. this._tokenStartCharIndex = this._input.index;
  22571. this._tokenStartColumn = this._interp.column;
  22572. this._tokenStartLine = this._interp.line;
  22573. this._text = null;
  22574. var continueOuter = false;
  22575. while (true) {
  22576. this._type = Token.INVALID_TYPE;
  22577. var ttype = Lexer.SKIP;
  22578. try {
  22579. ttype = this._interp.match(this._input, this._mode);
  22580. } catch (e) {
  22581. if (e instanceof RecognitionException) {
  22582. this.notifyListeners(e); // report error
  22583. this.recover(e);
  22584. } else {
  22585. console.log(e.stack);
  22586. throw e;
  22587. }
  22588. }
  22589. if (this._input.LA(1) === Token.EOF) {
  22590. this._hitEOF = true;
  22591. }
  22592. if (this._type === Token.INVALID_TYPE) {
  22593. this._type = ttype;
  22594. }
  22595. if (this._type === Lexer.SKIP) {
  22596. continueOuter = true;
  22597. break;
  22598. }
  22599. if (this._type !== Lexer.MORE) {
  22600. break;
  22601. }
  22602. }
  22603. if (continueOuter) {
  22604. continue;
  22605. }
  22606. if (this._token === null) {
  22607. this.emit();
  22608. }
  22609. return this._token;
  22610. }
  22611. } finally {
  22612. // make sure we release marker after match or
  22613. // unbuffered char stream will keep buffering
  22614. this._input.release(tokenStartMarker);
  22615. }
  22616. };
  22617. // Instruct the lexer to skip creating a token for current lexer rule
  22618. // and look for another token. nextToken() knows to keep looking when
  22619. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  22620. // if token==null at end of any token rule, it creates one for you
  22621. // and emits it.
  22622. // /
  22623. Lexer.prototype.skip = function () {
  22624. this._type = Lexer.SKIP;
  22625. };
  22626. Lexer.prototype.more = function () {
  22627. this._type = Lexer.MORE;
  22628. };
  22629. Lexer.prototype.mode = function (m) {
  22630. this._mode = m;
  22631. };
  22632. Lexer.prototype.pushMode = function (m) {
  22633. if (this._interp.debug) {
  22634. console.log("pushMode " + m);
  22635. }
  22636. this._modeStack.push(this._mode);
  22637. this.mode(m);
  22638. };
  22639. Lexer.prototype.popMode = function () {
  22640. if (this._modeStack.length === 0) {
  22641. throw "Empty Stack";
  22642. }
  22643. if (this._interp.debug) {
  22644. console.log("popMode back to " + this._modeStack.slice(0, -1));
  22645. }
  22646. this.mode(this._modeStack.pop());
  22647. return this._mode;
  22648. };
  22649. // Set the char stream and reset the lexer
  22650. Object.defineProperty(Lexer.prototype, "inputStream", {
  22651. get: function get() {
  22652. return this._input;
  22653. },
  22654. set: function set(input) {
  22655. this._input = null;
  22656. this._tokenFactorySourcePair = [this, this._input];
  22657. this.reset();
  22658. this._input = input;
  22659. this._tokenFactorySourcePair = [this, this._input];
  22660. }
  22661. });
  22662. Object.defineProperty(Lexer.prototype, "sourceName", {
  22663. get: function sourceName() {
  22664. return this._input.sourceName;
  22665. }
  22666. });
  22667. // By default does not support multiple emits per nextToken invocation
  22668. // for efficiency reasons. Subclass and override this method, nextToken,
  22669. // and getToken (to push tokens into a list and pull from that list
  22670. // rather than a single variable as this implementation does).
  22671. // /
  22672. Lexer.prototype.emitToken = function (token) {
  22673. this._token = token;
  22674. };
  22675. // The standard method called to automatically emit a token at the
  22676. // outermost lexical rule. The token object should point into the
  22677. // char buffer start..stop. If there is a text override in 'text',
  22678. // use that to set the token's text. Override this method to emit
  22679. // custom Token objects or provide a new factory.
  22680. // /
  22681. Lexer.prototype.emit = function () {
  22682. var t = this._factory.create(this._tokenFactorySourcePair, this._type, this._text, this._channel, this._tokenStartCharIndex, this.getCharIndex() - 1, this._tokenStartLine, this._tokenStartColumn);
  22683. this.emitToken(t);
  22684. return t;
  22685. };
  22686. Lexer.prototype.emitEOF = function () {
  22687. var cpos = this.column;
  22688. var lpos = this.line;
  22689. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF, null, Token.DEFAULT_CHANNEL, this._input.index, this._input.index - 1, lpos, cpos);
  22690. this.emitToken(eof);
  22691. return eof;
  22692. };
  22693. Object.defineProperty(Lexer.prototype, "type", {
  22694. get: function get() {
  22695. return this.type;
  22696. },
  22697. set: function set(type) {
  22698. this._type = type;
  22699. }
  22700. });
  22701. Object.defineProperty(Lexer.prototype, "line", {
  22702. get: function get() {
  22703. return this._interp.line;
  22704. },
  22705. set: function set(line) {
  22706. this._interp.line = line;
  22707. }
  22708. });
  22709. Object.defineProperty(Lexer.prototype, "column", {
  22710. get: function get() {
  22711. return this._interp.column;
  22712. },
  22713. set: function set(column) {
  22714. this._interp.column = column;
  22715. }
  22716. });
  22717. // What is the index of the current character of lookahead?///
  22718. Lexer.prototype.getCharIndex = function () {
  22719. return this._input.index;
  22720. };
  22721. // Return the text matched so far for the current token or any text override.
  22722. //Set the complete text of this token; it wipes any previous changes to the text.
  22723. Object.defineProperty(Lexer.prototype, "text", {
  22724. get: function get() {
  22725. if (this._text !== null) {
  22726. return this._text;
  22727. } else {
  22728. return this._interp.getText(this._input);
  22729. }
  22730. },
  22731. set: function set(text) {
  22732. this._text = text;
  22733. }
  22734. });
  22735. // Return a list of all Token objects in input char stream.
  22736. // Forces load of all tokens. Does not include EOF token.
  22737. // /
  22738. Lexer.prototype.getAllTokens = function () {
  22739. var tokens = [];
  22740. var t = this.nextToken();
  22741. while (t.type !== Token.EOF) {
  22742. tokens.push(t);
  22743. t = this.nextToken();
  22744. }
  22745. return tokens;
  22746. };
  22747. Lexer.prototype.notifyListeners = function (e) {
  22748. var start = this._tokenStartCharIndex;
  22749. var stop = this._input.index;
  22750. var text = this._input.getText(start, stop);
  22751. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  22752. var listener = this.getErrorListenerDispatch();
  22753. listener.syntaxError(this, null, this._tokenStartLine, this._tokenStartColumn, msg, e);
  22754. };
  22755. Lexer.prototype.getErrorDisplay = function (s) {
  22756. var d = [];
  22757. for (var i = 0; i < s.length; i++) {
  22758. d.push(s[i]);
  22759. }
  22760. return d.join('');
  22761. };
  22762. Lexer.prototype.getErrorDisplayForChar = function (c) {
  22763. if (c.charCodeAt(0) === Token.EOF) {
  22764. return "<EOF>";
  22765. } else if (c === '\n') {
  22766. return "\\n";
  22767. } else if (c === '\t') {
  22768. return "\\t";
  22769. } else if (c === '\r') {
  22770. return "\\r";
  22771. } else {
  22772. return c;
  22773. }
  22774. };
  22775. Lexer.prototype.getCharErrorDisplay = function (c) {
  22776. return "'" + this.getErrorDisplayForChar(c) + "'";
  22777. };
  22778. // Lexers can normally match any char in it's vocabulary after matching
  22779. // a token, so do the easy thing and just kill a character and hope
  22780. // it all works out. You can instead use the rule invocation stack
  22781. // to do sophisticated error recovery if you are in a fragment rule.
  22782. // /
  22783. Lexer.prototype.recover = function (re) {
  22784. if (this._input.LA(1) !== Token.EOF) {
  22785. if (re instanceof LexerNoViableAltException) {
  22786. // skip a char and try again
  22787. this._interp.consume(this._input);
  22788. } else {
  22789. // TODO: Do we lose character or line position information?
  22790. this._input.consume();
  22791. }
  22792. }
  22793. };
  22794. exports.Lexer = Lexer;
  22795. /***/ }),
  22796. /***/ "./node_modules/antlr4/Parser.js":
  22797. /*!***************************************!*\
  22798. !*** ./node_modules/antlr4/Parser.js ***!
  22799. \***************************************/
  22800. /*! no static exports found */
  22801. /***/ (function(module, exports, __webpack_require__) {
  22802. "use strict";
  22803. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  22804. * Use of this file is governed by the BSD 3-clause license that
  22805. * can be found in the LICENSE.txt file in the project root.
  22806. */
  22807. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  22808. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  22809. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  22810. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  22811. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  22812. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  22813. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  22814. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  22815. function TraceListener(parser) {
  22816. ParseTreeListener.call(this);
  22817. this.parser = parser;
  22818. return this;
  22819. }
  22820. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  22821. TraceListener.prototype.constructor = TraceListener;
  22822. TraceListener.prototype.enterEveryRule = function (ctx) {
  22823. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22824. };
  22825. TraceListener.prototype.visitTerminal = function (node) {
  22826. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  22827. };
  22828. TraceListener.prototype.exitEveryRule = function (ctx) {
  22829. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  22830. };
  22831. // this is all the parsing support code essentially; most of it is error
  22832. // recovery stuff.//
  22833. function Parser(input) {
  22834. Recognizer.call(this);
  22835. // The input stream.
  22836. this._input = null;
  22837. // The error handling strategy for the parser. The default value is a new
  22838. // instance of {@link DefaultErrorStrategy}.
  22839. this._errHandler = new DefaultErrorStrategy();
  22840. this._precedenceStack = [];
  22841. this._precedenceStack.push(0);
  22842. // The {@link ParserRuleContext} object for the currently executing rule.
  22843. // this is always non-null during the parsing process.
  22844. this._ctx = null;
  22845. // Specifies whether or not the parser should construct a parse tree during
  22846. // the parsing process. The default value is {@code true}.
  22847. this.buildParseTrees = true;
  22848. // When {@link //setTrace}{@code (true)} is called, a reference to the
  22849. // {@link TraceListener} is stored here so it can be easily removed in a
  22850. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  22851. // implemented as a parser listener so this field is not directly used by
  22852. // other parser methods.
  22853. this._tracer = null;
  22854. // The list of {@link ParseTreeListener} listeners registered to receive
  22855. // events during the parse.
  22856. this._parseListeners = null;
  22857. // The number of syntax errors reported during parsing. this value is
  22858. // incremented each time {@link //notifyErrorListeners} is called.
  22859. this._syntaxErrors = 0;
  22860. this.setInputStream(input);
  22861. return this;
  22862. }
  22863. Parser.prototype = Object.create(Recognizer.prototype);
  22864. Parser.prototype.contructor = Parser;
  22865. // this field maps from the serialized ATN string to the deserialized {@link
  22866. // ATN} with
  22867. // bypass alternatives.
  22868. //
  22869. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  22870. //
  22871. Parser.bypassAltsAtnCache = {};
  22872. // reset the parser's state//
  22873. Parser.prototype.reset = function () {
  22874. if (this._input !== null) {
  22875. this._input.seek(0);
  22876. }
  22877. this._errHandler.reset(this);
  22878. this._ctx = null;
  22879. this._syntaxErrors = 0;
  22880. this.setTrace(false);
  22881. this._precedenceStack = [];
  22882. this._precedenceStack.push(0);
  22883. if (this._interp !== null) {
  22884. this._interp.reset();
  22885. }
  22886. };
  22887. // Match current input symbol against {@code ttype}. If the symbol type
  22888. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  22889. // called to complete the match process.
  22890. //
  22891. // <p>If the symbol type does not match,
  22892. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  22893. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  22894. // {@code true} and the token index of the symbol returned by
  22895. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  22896. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  22897. //
  22898. // @param ttype the token type to match
  22899. // @return the matched symbol
  22900. // @throws RecognitionException if the current input symbol did not match
  22901. // {@code ttype} and the error strategy could not recover from the
  22902. // mismatched symbol
  22903. Parser.prototype.match = function (ttype) {
  22904. var t = this.getCurrentToken();
  22905. if (t.type === ttype) {
  22906. this._errHandler.reportMatch(this);
  22907. this.consume();
  22908. } else {
  22909. t = this._errHandler.recoverInline(this);
  22910. if (this.buildParseTrees && t.tokenIndex === -1) {
  22911. // we must have conjured up a new token during single token
  22912. // insertion
  22913. // if it's not the current symbol
  22914. this._ctx.addErrorNode(t);
  22915. }
  22916. }
  22917. return t;
  22918. };
  22919. // Match current input symbol as a wildcard. If the symbol type matches
  22920. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  22921. // and {@link //consume} are called to complete the match process.
  22922. //
  22923. // <p>If the symbol type does not match,
  22924. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  22925. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  22926. // {@code true} and the token index of the symbol returned by
  22927. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  22928. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  22929. //
  22930. // @return the matched symbol
  22931. // @throws RecognitionException if the current input symbol did not match
  22932. // a wildcard and the error strategy could not recover from the mismatched
  22933. // symbol
  22934. Parser.prototype.matchWildcard = function () {
  22935. var t = this.getCurrentToken();
  22936. if (t.type > 0) {
  22937. this._errHandler.reportMatch(this);
  22938. this.consume();
  22939. } else {
  22940. t = this._errHandler.recoverInline(this);
  22941. if (this._buildParseTrees && t.tokenIndex === -1) {
  22942. // we must have conjured up a new token during single token
  22943. // insertion
  22944. // if it's not the current symbol
  22945. this._ctx.addErrorNode(t);
  22946. }
  22947. }
  22948. return t;
  22949. };
  22950. Parser.prototype.getParseListeners = function () {
  22951. return this._parseListeners || [];
  22952. };
  22953. // Registers {@code listener} to receive events during the parsing process.
  22954. //
  22955. // <p>To support output-preserving grammar transformations (including but not
  22956. // limited to left-recursion removal, automated left-factoring, and
  22957. // optimized code generation), calls to listener methods during the parse
  22958. // may differ substantially from calls made by
  22959. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  22960. // particular, rule entry and exit events may occur in a different order
  22961. // during the parse than after the parser. In addition, calls to certain
  22962. // rule entry methods may be omitted.</p>
  22963. //
  22964. // <p>With the following specific exceptions, calls to listener events are
  22965. // <em>deterministic</em>, i.e. for identical input the calls to listener
  22966. // methods will be the same.</p>
  22967. //
  22968. // <ul>
  22969. // <li>Alterations to the grammar used to generate code may change the
  22970. // behavior of the listener calls.</li>
  22971. // <li>Alterations to the command line options passed to ANTLR 4 when
  22972. // generating the parser may change the behavior of the listener calls.</li>
  22973. // <li>Changing the version of the ANTLR Tool used to generate the parser
  22974. // may change the behavior of the listener calls.</li>
  22975. // </ul>
  22976. //
  22977. // @param listener the listener to add
  22978. //
  22979. // @throws NullPointerException if {@code} listener is {@code null}
  22980. //
  22981. Parser.prototype.addParseListener = function (listener) {
  22982. if (listener === null) {
  22983. throw "listener";
  22984. }
  22985. if (this._parseListeners === null) {
  22986. this._parseListeners = [];
  22987. }
  22988. this._parseListeners.push(listener);
  22989. };
  22990. //
  22991. // Remove {@code listener} from the list of parse listeners.
  22992. //
  22993. // <p>If {@code listener} is {@code null} or has not been added as a parse
  22994. // listener, this method does nothing.</p>
  22995. // @param listener the listener to remove
  22996. //
  22997. Parser.prototype.removeParseListener = function (listener) {
  22998. if (this._parseListeners !== null) {
  22999. var idx = this._parseListeners.indexOf(listener);
  23000. if (idx >= 0) {
  23001. this._parseListeners.splice(idx, 1);
  23002. }
  23003. if (this._parseListeners.length === 0) {
  23004. this._parseListeners = null;
  23005. }
  23006. }
  23007. };
  23008. // Remove all parse listeners.
  23009. Parser.prototype.removeParseListeners = function () {
  23010. this._parseListeners = null;
  23011. };
  23012. // Notify any parse listeners of an enter rule event.
  23013. Parser.prototype.triggerEnterRuleEvent = function () {
  23014. if (this._parseListeners !== null) {
  23015. var ctx = this._ctx;
  23016. this._parseListeners.map(function (listener) {
  23017. listener.enterEveryRule(ctx);
  23018. ctx.enterRule(listener);
  23019. });
  23020. }
  23021. };
  23022. //
  23023. // Notify any parse listeners of an exit rule event.
  23024. //
  23025. // @see //addParseListener
  23026. //
  23027. Parser.prototype.triggerExitRuleEvent = function () {
  23028. if (this._parseListeners !== null) {
  23029. // reverse order walk of listeners
  23030. var ctx = this._ctx;
  23031. this._parseListeners.slice(0).reverse().map(function (listener) {
  23032. ctx.exitRule(listener);
  23033. listener.exitEveryRule(ctx);
  23034. });
  23035. }
  23036. };
  23037. Parser.prototype.getTokenFactory = function () {
  23038. return this._input.tokenSource._factory;
  23039. };
  23040. // Tell our token source and error strategy about a new way to create tokens.//
  23041. Parser.prototype.setTokenFactory = function (factory) {
  23042. this._input.tokenSource._factory = factory;
  23043. };
  23044. // The ATN with bypass alternatives is expensive to create so we create it
  23045. // lazily.
  23046. //
  23047. // @throws UnsupportedOperationException if the current parser does not
  23048. // implement the {@link //getSerializedATN()} method.
  23049. //
  23050. Parser.prototype.getATNWithBypassAlts = function () {
  23051. var serializedAtn = this.getSerializedATN();
  23052. if (serializedAtn === null) {
  23053. throw "The current parser does not support an ATN with bypass alternatives.";
  23054. }
  23055. var result = this.bypassAltsAtnCache[serializedAtn];
  23056. if (result === null) {
  23057. var deserializationOptions = new ATNDeserializationOptions();
  23058. deserializationOptions.generateRuleBypassTransitions = true;
  23059. result = new ATNDeserializer(deserializationOptions).deserialize(serializedAtn);
  23060. this.bypassAltsAtnCache[serializedAtn] = result;
  23061. }
  23062. return result;
  23063. };
  23064. // The preferred method of getting a tree pattern. For example, here's a
  23065. // sample use:
  23066. //
  23067. // <pre>
  23068. // ParseTree t = parser.expr();
  23069. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  23070. // MyParser.RULE_expr);
  23071. // ParseTreeMatch m = p.match(t);
  23072. // String id = m.get("ID");
  23073. // </pre>
  23074. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  23075. Parser.prototype.compileParseTreePattern = function (pattern, patternRuleIndex, lexer) {
  23076. lexer = lexer || null;
  23077. if (lexer === null) {
  23078. if (this.getTokenStream() !== null) {
  23079. var tokenSource = this.getTokenStream().tokenSource;
  23080. if (tokenSource instanceof Lexer) {
  23081. lexer = tokenSource;
  23082. }
  23083. }
  23084. }
  23085. if (lexer === null) {
  23086. throw "Parser can't discover a lexer to use";
  23087. }
  23088. var m = new ParseTreePatternMatcher(lexer, this);
  23089. return m.compile(pattern, patternRuleIndex);
  23090. };
  23091. Parser.prototype.getInputStream = function () {
  23092. return this.getTokenStream();
  23093. };
  23094. Parser.prototype.setInputStream = function (input) {
  23095. this.setTokenStream(input);
  23096. };
  23097. Parser.prototype.getTokenStream = function () {
  23098. return this._input;
  23099. };
  23100. // Set the token stream and reset the parser.//
  23101. Parser.prototype.setTokenStream = function (input) {
  23102. this._input = null;
  23103. this.reset();
  23104. this._input = input;
  23105. };
  23106. // Match needs to return the current input symbol, which gets put
  23107. // into the label for the associated token ref; e.g., x=ID.
  23108. //
  23109. Parser.prototype.getCurrentToken = function () {
  23110. return this._input.LT(1);
  23111. };
  23112. Parser.prototype.notifyErrorListeners = function (msg, offendingToken, err) {
  23113. offendingToken = offendingToken || null;
  23114. err = err || null;
  23115. if (offendingToken === null) {
  23116. offendingToken = this.getCurrentToken();
  23117. }
  23118. this._syntaxErrors += 1;
  23119. var line = offendingToken.line;
  23120. var column = offendingToken.column;
  23121. var listener = this.getErrorListenerDispatch();
  23122. listener.syntaxError(this, offendingToken, line, column, msg, err);
  23123. };
  23124. //
  23125. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  23126. //
  23127. // <p>E.g., given the following input with {@code A} being the current
  23128. // lookahead symbol, this function moves the cursor to {@code B} and returns
  23129. // {@code A}.</p>
  23130. //
  23131. // <pre>
  23132. // A B
  23133. // ^
  23134. // </pre>
  23135. //
  23136. // If the parser is not in error recovery mode, the consumed symbol is added
  23137. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  23138. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  23139. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  23140. // added to the parse tree using
  23141. // {@link ParserRuleContext//addErrorNode(Token)}, and
  23142. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  23143. // listeners.
  23144. //
  23145. Parser.prototype.consume = function () {
  23146. var o = this.getCurrentToken();
  23147. if (o.type !== Token.EOF) {
  23148. this.getInputStream().consume();
  23149. }
  23150. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  23151. if (this.buildParseTrees || hasListener) {
  23152. var node;
  23153. if (this._errHandler.inErrorRecoveryMode(this)) {
  23154. node = this._ctx.addErrorNode(o);
  23155. } else {
  23156. node = this._ctx.addTokenNode(o);
  23157. }
  23158. node.invokingState = this.state;
  23159. if (hasListener) {
  23160. this._parseListeners.map(function (listener) {
  23161. if (node instanceof ErrorNode || node.isErrorNode !== undefined && node.isErrorNode()) {
  23162. listener.visitErrorNode(node);
  23163. } else if (node instanceof TerminalNode) {
  23164. listener.visitTerminal(node);
  23165. }
  23166. });
  23167. }
  23168. }
  23169. return o;
  23170. };
  23171. Parser.prototype.addContextToParseTree = function () {
  23172. // add current context to parent if we have a parent
  23173. if (this._ctx.parentCtx !== null) {
  23174. this._ctx.parentCtx.addChild(this._ctx);
  23175. }
  23176. };
  23177. // Always called by generated parsers upon entry to a rule. Access field
  23178. // {@link //_ctx} get the current context.
  23179. Parser.prototype.enterRule = function (localctx, state, ruleIndex) {
  23180. this.state = state;
  23181. this._ctx = localctx;
  23182. this._ctx.start = this._input.LT(1);
  23183. if (this.buildParseTrees) {
  23184. this.addContextToParseTree();
  23185. }
  23186. if (this._parseListeners !== null) {
  23187. this.triggerEnterRuleEvent();
  23188. }
  23189. };
  23190. Parser.prototype.exitRule = function () {
  23191. this._ctx.stop = this._input.LT(-1);
  23192. // trigger event on _ctx, before it reverts to parent
  23193. if (this._parseListeners !== null) {
  23194. this.triggerExitRuleEvent();
  23195. }
  23196. this.state = this._ctx.invokingState;
  23197. this._ctx = this._ctx.parentCtx;
  23198. };
  23199. Parser.prototype.enterOuterAlt = function (localctx, altNum) {
  23200. localctx.setAltNumber(altNum);
  23201. // if we have new localctx, make sure we replace existing ctx
  23202. // that is previous child of parse tree
  23203. if (this.buildParseTrees && this._ctx !== localctx) {
  23204. if (this._ctx.parentCtx !== null) {
  23205. this._ctx.parentCtx.removeLastChild();
  23206. this._ctx.parentCtx.addChild(localctx);
  23207. }
  23208. }
  23209. this._ctx = localctx;
  23210. };
  23211. // Get the precedence level for the top-most precedence rule.
  23212. //
  23213. // @return The precedence level for the top-most precedence rule, or -1 if
  23214. // the parser context is not nested within a precedence rule.
  23215. Parser.prototype.getPrecedence = function () {
  23216. if (this._precedenceStack.length === 0) {
  23217. return -1;
  23218. } else {
  23219. return this._precedenceStack[this._precedenceStack.length - 1];
  23220. }
  23221. };
  23222. Parser.prototype.enterRecursionRule = function (localctx, state, ruleIndex, precedence) {
  23223. this.state = state;
  23224. this._precedenceStack.push(precedence);
  23225. this._ctx = localctx;
  23226. this._ctx.start = this._input.LT(1);
  23227. if (this._parseListeners !== null) {
  23228. this.triggerEnterRuleEvent(); // simulates rule entry for
  23229. // left-recursive rules
  23230. }
  23231. };
  23232. //
  23233. // Like {@link //enterRule} but for recursive rules.
  23234. Parser.prototype.pushNewRecursionContext = function (localctx, state, ruleIndex) {
  23235. var previous = this._ctx;
  23236. previous.parentCtx = localctx;
  23237. previous.invokingState = state;
  23238. previous.stop = this._input.LT(-1);
  23239. this._ctx = localctx;
  23240. this._ctx.start = previous.start;
  23241. if (this.buildParseTrees) {
  23242. this._ctx.addChild(previous);
  23243. }
  23244. if (this._parseListeners !== null) {
  23245. this.triggerEnterRuleEvent(); // simulates rule entry for
  23246. // left-recursive rules
  23247. }
  23248. };
  23249. Parser.prototype.unrollRecursionContexts = function (parentCtx) {
  23250. this._precedenceStack.pop();
  23251. this._ctx.stop = this._input.LT(-1);
  23252. var retCtx = this._ctx; // save current ctx (return value)
  23253. // unroll so _ctx is as it was before call to recursive method
  23254. if (this._parseListeners !== null) {
  23255. while (this._ctx !== parentCtx) {
  23256. this.triggerExitRuleEvent();
  23257. this._ctx = this._ctx.parentCtx;
  23258. }
  23259. } else {
  23260. this._ctx = parentCtx;
  23261. }
  23262. // hook into tree
  23263. retCtx.parentCtx = parentCtx;
  23264. if (this.buildParseTrees && parentCtx !== null) {
  23265. // add return ctx into invoking rule's tree
  23266. parentCtx.addChild(retCtx);
  23267. }
  23268. };
  23269. Parser.prototype.getInvokingContext = function (ruleIndex) {
  23270. var ctx = this._ctx;
  23271. while (ctx !== null) {
  23272. if (ctx.ruleIndex === ruleIndex) {
  23273. return ctx;
  23274. }
  23275. ctx = ctx.parentCtx;
  23276. }
  23277. return null;
  23278. };
  23279. Parser.prototype.precpred = function (localctx, precedence) {
  23280. return precedence >= this._precedenceStack[this._precedenceStack.length - 1];
  23281. };
  23282. Parser.prototype.inContext = function (context) {
  23283. // TODO: useful in parser?
  23284. return false;
  23285. };
  23286. //
  23287. // Checks whether or not {@code symbol} can follow the current state in the
  23288. // ATN. The behavior of this method is equivalent to the following, but is
  23289. // implemented such that the complete context-sensitive follow set does not
  23290. // need to be explicitly constructed.
  23291. //
  23292. // <pre>
  23293. // return getExpectedTokens().contains(symbol);
  23294. // </pre>
  23295. //
  23296. // @param symbol the symbol type to check
  23297. // @return {@code true} if {@code symbol} can follow the current state in
  23298. // the ATN, otherwise {@code false}.
  23299. Parser.prototype.isExpectedToken = function (symbol) {
  23300. var atn = this._interp.atn;
  23301. var ctx = this._ctx;
  23302. var s = atn.states[this.state];
  23303. var following = atn.nextTokens(s);
  23304. if (following.contains(symbol)) {
  23305. return true;
  23306. }
  23307. if (!following.contains(Token.EPSILON)) {
  23308. return false;
  23309. }
  23310. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  23311. var invokingState = atn.states[ctx.invokingState];
  23312. var rt = invokingState.transitions[0];
  23313. following = atn.nextTokens(rt.followState);
  23314. if (following.contains(symbol)) {
  23315. return true;
  23316. }
  23317. ctx = ctx.parentCtx;
  23318. }
  23319. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  23320. return true;
  23321. } else {
  23322. return false;
  23323. }
  23324. };
  23325. // Computes the set of input symbols which could follow the current parser
  23326. // state and context, as given by {@link //getState} and {@link //getContext},
  23327. // respectively.
  23328. //
  23329. // @see ATN//getExpectedTokens(int, RuleContext)
  23330. //
  23331. Parser.prototype.getExpectedTokens = function () {
  23332. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  23333. };
  23334. Parser.prototype.getExpectedTokensWithinCurrentRule = function () {
  23335. var atn = this._interp.atn;
  23336. var s = atn.states[this.state];
  23337. return atn.nextTokens(s);
  23338. };
  23339. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  23340. Parser.prototype.getRuleIndex = function (ruleName) {
  23341. var ruleIndex = this.getRuleIndexMap()[ruleName];
  23342. if (ruleIndex !== null) {
  23343. return ruleIndex;
  23344. } else {
  23345. return -1;
  23346. }
  23347. };
  23348. // Return List&lt;String&gt; of the rule names in your parser instance
  23349. // leading up to a call to the current rule. You could override if
  23350. // you want more details such as the file/line info of where
  23351. // in the ATN a rule is invoked.
  23352. //
  23353. // this is very useful for error messages.
  23354. //
  23355. Parser.prototype.getRuleInvocationStack = function (p) {
  23356. p = p || null;
  23357. if (p === null) {
  23358. p = this._ctx;
  23359. }
  23360. var stack = [];
  23361. while (p !== null) {
  23362. // compute what follows who invoked us
  23363. var ruleIndex = p.ruleIndex;
  23364. if (ruleIndex < 0) {
  23365. stack.push("n/a");
  23366. } else {
  23367. stack.push(this.ruleNames[ruleIndex]);
  23368. }
  23369. p = p.parentCtx;
  23370. }
  23371. return stack;
  23372. };
  23373. // For debugging and other purposes.//
  23374. Parser.prototype.getDFAStrings = function () {
  23375. return this._interp.decisionToDFA.toString();
  23376. };
  23377. // For debugging and other purposes.//
  23378. Parser.prototype.dumpDFA = function () {
  23379. var seenOne = false;
  23380. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  23381. var dfa = this._interp.decisionToDFA[i];
  23382. if (dfa.states.length > 0) {
  23383. if (seenOne) {
  23384. console.log();
  23385. }
  23386. this.printer.println("Decision " + dfa.decision + ":");
  23387. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  23388. seenOne = true;
  23389. }
  23390. }
  23391. };
  23392. /*
  23393. " printer = function() {\r\n" +
  23394. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  23395. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  23396. " };\r\n" +
  23397. */
  23398. Parser.prototype.getSourceName = function () {
  23399. return this._input.sourceName;
  23400. };
  23401. // During a parse is sometimes useful to listen in on the rule entry and exit
  23402. // events as well as token matches. this is for quick and dirty debugging.
  23403. //
  23404. Parser.prototype.setTrace = function (trace) {
  23405. if (!trace) {
  23406. this.removeParseListener(this._tracer);
  23407. this._tracer = null;
  23408. } else {
  23409. if (this._tracer !== null) {
  23410. this.removeParseListener(this._tracer);
  23411. }
  23412. this._tracer = new TraceListener(this);
  23413. this.addParseListener(this._tracer);
  23414. }
  23415. };
  23416. exports.Parser = Parser;
  23417. /***/ }),
  23418. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  23419. /*!**************************************************!*\
  23420. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  23421. \**************************************************/
  23422. /*! no static exports found */
  23423. /***/ (function(module, exports, __webpack_require__) {
  23424. "use strict";
  23425. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23426. * Use of this file is governed by the BSD 3-clause license that
  23427. * can be found in the LICENSE.txt file in the project root.
  23428. */
  23429. //* A rule invocation record for parsing.
  23430. //
  23431. // Contains all of the information about the current rule not stored in the
  23432. // RuleContext. It handles parse tree children list, Any ATN state
  23433. // tracing, and the default values available for rule indications:
  23434. // start, stop, rule index, current alt number, current
  23435. // ATN state.
  23436. //
  23437. // Subclasses made for each rule and grammar track the parameters,
  23438. // return values, locals, and labels specific to that rule. These
  23439. // are the objects that are returned from rules.
  23440. //
  23441. // Note text is not an actual field of a rule return value; it is computed
  23442. // from start and stop using the input stream's toString() method. I
  23443. // could add a ctor to this so that we can pass in and store the input
  23444. // stream, but I'm not sure we want to do that. It would seem to be undefined
  23445. // to get the .text property anyway if the rule matches tokens from multiple
  23446. // input streams.
  23447. //
  23448. // I do not use getters for fields of objects that are used simply to
  23449. // group values such as this aggregate. The getters/setters are there to
  23450. // satisfy the superclass interface.
  23451. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23452. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  23453. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  23454. var TerminalNode = Tree.TerminalNode;
  23455. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  23456. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  23457. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  23458. function ParserRuleContext(parent, invokingStateNumber) {
  23459. parent = parent || null;
  23460. invokingStateNumber = invokingStateNumber || null;
  23461. RuleContext.call(this, parent, invokingStateNumber);
  23462. this.ruleIndex = -1;
  23463. // * If we are debugging or building a parse tree for a visitor,
  23464. // we need to track all of the tokens and rule invocations associated
  23465. // with this rule's context. This is empty for parsing w/o tree constr.
  23466. // operation because we don't the need to track the details about
  23467. // how we parse this rule.
  23468. // /
  23469. this.children = null;
  23470. this.start = null;
  23471. this.stop = null;
  23472. // The exception that forced this rule to return. If the rule successfully
  23473. // completed, this is {@code null}.
  23474. this.exception = null;
  23475. }
  23476. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  23477. ParserRuleContext.prototype.constructor = ParserRuleContext;
  23478. // * COPY a ctx (I'm deliberately not using copy constructor)///
  23479. ParserRuleContext.prototype.copyFrom = function (ctx) {
  23480. // from RuleContext
  23481. this.parentCtx = ctx.parentCtx;
  23482. this.invokingState = ctx.invokingState;
  23483. this.children = null;
  23484. this.start = ctx.start;
  23485. this.stop = ctx.stop;
  23486. // copy any error nodes to alt label node
  23487. if (ctx.children) {
  23488. this.children = [];
  23489. // reset parent pointer for any error nodes
  23490. ctx.children.map(function (child) {
  23491. if (child instanceof ErrorNodeImpl) {
  23492. this.children.push(child);
  23493. child.parentCtx = this;
  23494. }
  23495. }, this);
  23496. }
  23497. };
  23498. // Double dispatch methods for listeners
  23499. ParserRuleContext.prototype.enterRule = function (listener) {};
  23500. ParserRuleContext.prototype.exitRule = function (listener) {};
  23501. // * Does not set parent link; other add methods do that///
  23502. ParserRuleContext.prototype.addChild = function (child) {
  23503. if (this.children === null) {
  23504. this.children = [];
  23505. }
  23506. this.children.push(child);
  23507. return child;
  23508. };
  23509. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  23510. // we entered a rule. If we have // label, we will need to remove
  23511. // generic ruleContext object.
  23512. // /
  23513. ParserRuleContext.prototype.removeLastChild = function () {
  23514. if (this.children !== null) {
  23515. this.children.pop();
  23516. }
  23517. };
  23518. ParserRuleContext.prototype.addTokenNode = function (token) {
  23519. var node = new TerminalNodeImpl(token);
  23520. this.addChild(node);
  23521. node.parentCtx = this;
  23522. return node;
  23523. };
  23524. ParserRuleContext.prototype.addErrorNode = function (badToken) {
  23525. var node = new ErrorNodeImpl(badToken);
  23526. this.addChild(node);
  23527. node.parentCtx = this;
  23528. return node;
  23529. };
  23530. ParserRuleContext.prototype.getChild = function (i, type) {
  23531. type = type || null;
  23532. if (this.children === null || i < 0 || i >= this.children.length) {
  23533. return null;
  23534. }
  23535. if (type === null) {
  23536. return this.children[i];
  23537. } else {
  23538. for (var j = 0; j < this.children.length; j++) {
  23539. var child = this.children[j];
  23540. if (child instanceof type) {
  23541. if (i === 0) {
  23542. return child;
  23543. } else {
  23544. i -= 1;
  23545. }
  23546. }
  23547. }
  23548. return null;
  23549. }
  23550. };
  23551. ParserRuleContext.prototype.getToken = function (ttype, i) {
  23552. if (this.children === null || i < 0 || i >= this.children.length) {
  23553. return null;
  23554. }
  23555. for (var j = 0; j < this.children.length; j++) {
  23556. var child = this.children[j];
  23557. if (child instanceof TerminalNode) {
  23558. if (child.symbol.type === ttype) {
  23559. if (i === 0) {
  23560. return child;
  23561. } else {
  23562. i -= 1;
  23563. }
  23564. }
  23565. }
  23566. }
  23567. return null;
  23568. };
  23569. ParserRuleContext.prototype.getTokens = function (ttype) {
  23570. if (this.children === null) {
  23571. return [];
  23572. } else {
  23573. var tokens = [];
  23574. for (var j = 0; j < this.children.length; j++) {
  23575. var child = this.children[j];
  23576. if (child instanceof TerminalNode) {
  23577. if (child.symbol.type === ttype) {
  23578. tokens.push(child);
  23579. }
  23580. }
  23581. }
  23582. return tokens;
  23583. }
  23584. };
  23585. ParserRuleContext.prototype.getTypedRuleContext = function (ctxType, i) {
  23586. return this.getChild(i, ctxType);
  23587. };
  23588. ParserRuleContext.prototype.getTypedRuleContexts = function (ctxType) {
  23589. if (this.children === null) {
  23590. return [];
  23591. } else {
  23592. var contexts = [];
  23593. for (var j = 0; j < this.children.length; j++) {
  23594. var child = this.children[j];
  23595. if (child instanceof ctxType) {
  23596. contexts.push(child);
  23597. }
  23598. }
  23599. return contexts;
  23600. }
  23601. };
  23602. ParserRuleContext.prototype.getChildCount = function () {
  23603. if (this.children === null) {
  23604. return 0;
  23605. } else {
  23606. return this.children.length;
  23607. }
  23608. };
  23609. ParserRuleContext.prototype.getSourceInterval = function () {
  23610. if (this.start === null || this.stop === null) {
  23611. return INVALID_INTERVAL;
  23612. } else {
  23613. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  23614. }
  23615. };
  23616. RuleContext.EMPTY = new ParserRuleContext();
  23617. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  23618. ParserRuleContext.call(parent, invokingStateNumber);
  23619. this.ruleIndex = ruleIndex;
  23620. return this;
  23621. }
  23622. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  23623. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  23624. exports.ParserRuleContext = ParserRuleContext;
  23625. /***/ }),
  23626. /***/ "./node_modules/antlr4/PredictionContext.js":
  23627. /*!**************************************************!*\
  23628. !*** ./node_modules/antlr4/PredictionContext.js ***!
  23629. \**************************************************/
  23630. /*! no static exports found */
  23631. /***/ (function(module, exports, __webpack_require__) {
  23632. "use strict";
  23633. //
  23634. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  23635. * Use of this file is governed by the BSD 3-clause license that
  23636. * can be found in the LICENSE.txt file in the project root.
  23637. */
  23638. ///
  23639. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  23640. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  23641. function PredictionContext(cachedHashCode) {
  23642. this.cachedHashCode = cachedHashCode;
  23643. }
  23644. // Represents {@code $} in local context prediction, which means wildcard.
  23645. // {@code//+x =//}.
  23646. // /
  23647. PredictionContext.EMPTY = null;
  23648. // Represents {@code $} in an array in full context mode, when {@code $}
  23649. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  23650. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  23651. // /
  23652. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  23653. PredictionContext.globalNodeCount = 1;
  23654. PredictionContext.id = PredictionContext.globalNodeCount;
  23655. // Stores the computed hash code of this {@link PredictionContext}. The hash
  23656. // code is computed in parts to match the following reference algorithm.
  23657. //
  23658. // <pre>
  23659. // private int referenceHashCode() {
  23660. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  23661. // //INITIAL_HASH});
  23662. //
  23663. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23664. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  23665. // getParent}(i));
  23666. // }
  23667. //
  23668. // for (int i = 0; i &lt; {@link //size()}; i++) {
  23669. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  23670. // //getReturnState getReturnState}(i));
  23671. // }
  23672. //
  23673. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  23674. // //size()});
  23675. // return hash;
  23676. // }
  23677. // </pre>
  23678. // /
  23679. // This means only the {@link //EMPTY} context is in set.
  23680. PredictionContext.prototype.isEmpty = function () {
  23681. return this === PredictionContext.EMPTY;
  23682. };
  23683. PredictionContext.prototype.hasEmptyPath = function () {
  23684. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  23685. };
  23686. PredictionContext.prototype.hashCode = function () {
  23687. return this.cachedHashCode;
  23688. };
  23689. PredictionContext.prototype.updateHashCode = function (hash) {
  23690. hash.update(this.cachedHashCode);
  23691. };
  23692. /*
  23693. function calculateHashString(parent, returnState) {
  23694. return "" + parent + returnState;
  23695. }
  23696. */
  23697. // Used to cache {@link PredictionContext} objects. Its used for the shared
  23698. // context cash associated with contexts in DFA states. This cache
  23699. // can be used for both lexers and parsers.
  23700. function PredictionContextCache() {
  23701. this.cache = {};
  23702. return this;
  23703. }
  23704. // Add a context to the cache and return it. If the context already exists,
  23705. // return that one instead and do not add a new context to the cache.
  23706. // Protect shared cache from unsafe thread access.
  23707. //
  23708. PredictionContextCache.prototype.add = function (ctx) {
  23709. if (ctx === PredictionContext.EMPTY) {
  23710. return PredictionContext.EMPTY;
  23711. }
  23712. var existing = this.cache[ctx] || null;
  23713. if (existing !== null) {
  23714. return existing;
  23715. }
  23716. this.cache[ctx] = ctx;
  23717. return ctx;
  23718. };
  23719. PredictionContextCache.prototype.get = function (ctx) {
  23720. return this.cache[ctx] || null;
  23721. };
  23722. Object.defineProperty(PredictionContextCache.prototype, "length", {
  23723. get: function get() {
  23724. return this.cache.length;
  23725. }
  23726. });
  23727. function SingletonPredictionContext(parent, returnState) {
  23728. var hashCode = 0;
  23729. if (parent !== null) {
  23730. var hash = new Hash();
  23731. hash.update(parent, returnState);
  23732. hashCode = hash.finish();
  23733. }
  23734. PredictionContext.call(this, hashCode);
  23735. this.parentCtx = parent;
  23736. this.returnState = returnState;
  23737. }
  23738. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23739. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  23740. SingletonPredictionContext.create = function (parent, returnState) {
  23741. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  23742. // someone can pass in the bits of an array ctx that mean $
  23743. return PredictionContext.EMPTY;
  23744. } else {
  23745. return new SingletonPredictionContext(parent, returnState);
  23746. }
  23747. };
  23748. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  23749. get: function get() {
  23750. return 1;
  23751. }
  23752. });
  23753. SingletonPredictionContext.prototype.getParent = function (index) {
  23754. return this.parentCtx;
  23755. };
  23756. SingletonPredictionContext.prototype.getReturnState = function (index) {
  23757. return this.returnState;
  23758. };
  23759. SingletonPredictionContext.prototype.equals = function (other) {
  23760. if (this === other) {
  23761. return true;
  23762. } else if (!(other instanceof SingletonPredictionContext)) {
  23763. return false;
  23764. } else if (this.hashCode() !== other.hashCode()) {
  23765. return false; // can't be same if hash is different
  23766. } else {
  23767. if (this.returnState !== other.returnState) return false;else if (this.parentCtx == null) return other.parentCtx == null;else return this.parentCtx.equals(other.parentCtx);
  23768. }
  23769. };
  23770. SingletonPredictionContext.prototype.toString = function () {
  23771. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  23772. if (up.length === 0) {
  23773. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  23774. return "$";
  23775. } else {
  23776. return "" + this.returnState;
  23777. }
  23778. } else {
  23779. return "" + this.returnState + " " + up;
  23780. }
  23781. };
  23782. function EmptyPredictionContext() {
  23783. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  23784. return this;
  23785. }
  23786. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  23787. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  23788. EmptyPredictionContext.prototype.isEmpty = function () {
  23789. return true;
  23790. };
  23791. EmptyPredictionContext.prototype.getParent = function (index) {
  23792. return null;
  23793. };
  23794. EmptyPredictionContext.prototype.getReturnState = function (index) {
  23795. return this.returnState;
  23796. };
  23797. EmptyPredictionContext.prototype.equals = function (other) {
  23798. return this === other;
  23799. };
  23800. EmptyPredictionContext.prototype.toString = function () {
  23801. return "$";
  23802. };
  23803. PredictionContext.EMPTY = new EmptyPredictionContext();
  23804. function ArrayPredictionContext(parents, returnStates) {
  23805. // Parent can be null only if full ctx mode and we make an array
  23806. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  23807. // null parent and
  23808. // returnState == {@link //EMPTY_RETURN_STATE}.
  23809. var h = new Hash();
  23810. h.update(parents, returnStates);
  23811. var hashCode = h.finish();
  23812. PredictionContext.call(this, hashCode);
  23813. this.parents = parents;
  23814. this.returnStates = returnStates;
  23815. return this;
  23816. }
  23817. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  23818. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  23819. ArrayPredictionContext.prototype.isEmpty = function () {
  23820. // since EMPTY_RETURN_STATE can only appear in the last position, we
  23821. // don't need to verify that size==1
  23822. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  23823. };
  23824. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  23825. get: function get() {
  23826. return this.returnStates.length;
  23827. }
  23828. });
  23829. ArrayPredictionContext.prototype.getParent = function (index) {
  23830. return this.parents[index];
  23831. };
  23832. ArrayPredictionContext.prototype.getReturnState = function (index) {
  23833. return this.returnStates[index];
  23834. };
  23835. ArrayPredictionContext.prototype.equals = function (other) {
  23836. if (this === other) {
  23837. return true;
  23838. } else if (!(other instanceof ArrayPredictionContext)) {
  23839. return false;
  23840. } else if (this.hashCode() !== other.hashCode()) {
  23841. return false; // can't be same if hash is different
  23842. } else {
  23843. return this.returnStates === other.returnStates && this.parents === other.parents;
  23844. }
  23845. };
  23846. ArrayPredictionContext.prototype.toString = function () {
  23847. if (this.isEmpty()) {
  23848. return "[]";
  23849. } else {
  23850. var s = "[";
  23851. for (var i = 0; i < this.returnStates.length; i++) {
  23852. if (i > 0) {
  23853. s = s + ", ";
  23854. }
  23855. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  23856. s = s + "$";
  23857. continue;
  23858. }
  23859. s = s + this.returnStates[i];
  23860. if (this.parents[i] !== null) {
  23861. s = s + " " + this.parents[i];
  23862. } else {
  23863. s = s + "null";
  23864. }
  23865. }
  23866. return s + "]";
  23867. }
  23868. };
  23869. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  23870. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  23871. // /
  23872. function predictionContextFromRuleContext(atn, outerContext) {
  23873. if (outerContext === undefined || outerContext === null) {
  23874. outerContext = RuleContext.EMPTY;
  23875. }
  23876. // if we are in RuleContext of start rule, s, then PredictionContext
  23877. // is EMPTY. Nobody called us. (if we are empty, return empty)
  23878. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  23879. return PredictionContext.EMPTY;
  23880. }
  23881. // If we have a parent, convert it to a PredictionContext graph
  23882. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  23883. var state = atn.states[outerContext.invokingState];
  23884. var transition = state.transitions[0];
  23885. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  23886. }
  23887. /*
  23888. function calculateListsHashString(parents, returnStates) {
  23889. var s = "";
  23890. parents.map(function(p) {
  23891. s = s + p;
  23892. });
  23893. returnStates.map(function(r) {
  23894. s = s + r;
  23895. });
  23896. return s;
  23897. }
  23898. */
  23899. function merge(a, b, rootIsWildcard, mergeCache) {
  23900. // share same graph if both same
  23901. if (a === b) {
  23902. return a;
  23903. }
  23904. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  23905. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  23906. }
  23907. // At least one of a or b is array
  23908. // If one is $ and rootIsWildcard, return $ as// wildcard
  23909. if (rootIsWildcard) {
  23910. if (a instanceof EmptyPredictionContext) {
  23911. return a;
  23912. }
  23913. if (b instanceof EmptyPredictionContext) {
  23914. return b;
  23915. }
  23916. }
  23917. // convert singleton so both are arrays to normalize
  23918. if (a instanceof SingletonPredictionContext) {
  23919. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  23920. }
  23921. if (b instanceof SingletonPredictionContext) {
  23922. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  23923. }
  23924. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  23925. }
  23926. //
  23927. // Merge two {@link SingletonPredictionContext} instances.
  23928. //
  23929. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  23930. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  23931. // type="image/svg+xml"/></p>
  23932. //
  23933. // <p>Same stack top, parents differ; merge parents giving array node, then
  23934. // remainders of those graphs. A new root node is created to point to the
  23935. // merged parents.<br>
  23936. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  23937. // type="image/svg+xml"/></p>
  23938. //
  23939. // <p>Different stack tops pointing to same parent. Make array node for the
  23940. // root where both element in the root point to the same (original)
  23941. // parent.<br>
  23942. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  23943. // type="image/svg+xml"/></p>
  23944. //
  23945. // <p>Different stack tops pointing to different parents. Make array node for
  23946. // the root where each element points to the corresponding original
  23947. // parent.<br>
  23948. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  23949. // type="image/svg+xml"/></p>
  23950. //
  23951. // @param a the first {@link SingletonPredictionContext}
  23952. // @param b the second {@link SingletonPredictionContext}
  23953. // @param rootIsWildcard {@code true} if this is a local-context merge,
  23954. // otherwise false to indicate a full-context merge
  23955. // @param mergeCache
  23956. // /
  23957. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  23958. if (mergeCache !== null) {
  23959. var previous = mergeCache.get(a, b);
  23960. if (previous !== null) {
  23961. return previous;
  23962. }
  23963. previous = mergeCache.get(b, a);
  23964. if (previous !== null) {
  23965. return previous;
  23966. }
  23967. }
  23968. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  23969. if (rootMerge !== null) {
  23970. if (mergeCache !== null) {
  23971. mergeCache.set(a, b, rootMerge);
  23972. }
  23973. return rootMerge;
  23974. }
  23975. if (a.returnState === b.returnState) {
  23976. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  23977. // if parent is same as existing a or b parent or reduced to a parent,
  23978. // return it
  23979. if (parent === a.parentCtx) {
  23980. return a; // ax + bx = ax, if a=b
  23981. }
  23982. if (parent === b.parentCtx) {
  23983. return b; // ax + bx = bx, if a=b
  23984. }
  23985. // else: ax + ay = a'[x,y]
  23986. // merge parents x and y, giving array node with x,y then remainders
  23987. // of those graphs. dup a, a' points at merged array
  23988. // new joined parent so create new singleton pointing to it, a'
  23989. var spc = SingletonPredictionContext.create(parent, a.returnState);
  23990. if (mergeCache !== null) {
  23991. mergeCache.set(a, b, spc);
  23992. }
  23993. return spc;
  23994. } else {
  23995. // a != b payloads differ
  23996. // see if we can collapse parents due to $+x parents if local ctx
  23997. var singleParent = null;
  23998. if (a === b || a.parentCtx !== null && a.parentCtx === b.parentCtx) {
  23999. // ax +
  24000. // bx =
  24001. // [a,b]x
  24002. singleParent = a.parentCtx;
  24003. }
  24004. if (singleParent !== null) {
  24005. // parents are same
  24006. // sort payloads and use same parent
  24007. var payloads = [a.returnState, b.returnState];
  24008. if (a.returnState > b.returnState) {
  24009. payloads[0] = b.returnState;
  24010. payloads[1] = a.returnState;
  24011. }
  24012. var parents = [singleParent, singleParent];
  24013. var apc = new ArrayPredictionContext(parents, payloads);
  24014. if (mergeCache !== null) {
  24015. mergeCache.set(a, b, apc);
  24016. }
  24017. return apc;
  24018. }
  24019. // parents differ and can't merge them. Just pack together
  24020. // into array; can't merge.
  24021. // ax + by = [ax,by]
  24022. var payloads = [a.returnState, b.returnState];
  24023. var parents = [a.parentCtx, b.parentCtx];
  24024. if (a.returnState > b.returnState) {
  24025. // sort by payload
  24026. payloads[0] = b.returnState;
  24027. payloads[1] = a.returnState;
  24028. parents = [b.parentCtx, a.parentCtx];
  24029. }
  24030. var a_ = new ArrayPredictionContext(parents, payloads);
  24031. if (mergeCache !== null) {
  24032. mergeCache.set(a, b, a_);
  24033. }
  24034. return a_;
  24035. }
  24036. }
  24037. //
  24038. // Handle case where at least one of {@code a} or {@code b} is
  24039. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  24040. // to represent {@link //EMPTY}.
  24041. //
  24042. // <h2>Local-Context Merges</h2>
  24043. //
  24044. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  24045. // is true.</p>
  24046. //
  24047. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  24048. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24049. //
  24050. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  24051. // {@code //EMPTY}; return left graph.<br>
  24052. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  24053. //
  24054. // <p>Special case of last merge if local context.<br>
  24055. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  24056. //
  24057. // <h2>Full-Context Merges</h2>
  24058. //
  24059. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  24060. // is false.</p>
  24061. //
  24062. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  24063. //
  24064. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  24065. // null parent).<br>
  24066. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  24067. //
  24068. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  24069. //
  24070. // @param a the first {@link SingletonPredictionContext}
  24071. // @param b the second {@link SingletonPredictionContext}
  24072. // @param rootIsWildcard {@code true} if this is a local-context merge,
  24073. // otherwise false to indicate a full-context merge
  24074. // /
  24075. function mergeRoot(a, b, rootIsWildcard) {
  24076. if (rootIsWildcard) {
  24077. if (a === PredictionContext.EMPTY) {
  24078. return PredictionContext.EMPTY; // // + b =//
  24079. }
  24080. if (b === PredictionContext.EMPTY) {
  24081. return PredictionContext.EMPTY; // a +// =//
  24082. }
  24083. } else {
  24084. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  24085. return PredictionContext.EMPTY; // $ + $ = $
  24086. } else if (a === PredictionContext.EMPTY) {
  24087. // $ + x = [$,x]
  24088. var payloads = [b.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24089. var parents = [b.parentCtx, null];
  24090. return new ArrayPredictionContext(parents, payloads);
  24091. } else if (b === PredictionContext.EMPTY) {
  24092. // x + $ = [$,x] ($ is always first if present)
  24093. var payloads = [a.returnState, PredictionContext.EMPTY_RETURN_STATE];
  24094. var parents = [a.parentCtx, null];
  24095. return new ArrayPredictionContext(parents, payloads);
  24096. }
  24097. }
  24098. return null;
  24099. }
  24100. //
  24101. // Merge two {@link ArrayPredictionContext} instances.
  24102. //
  24103. // <p>Different tops, different parents.<br>
  24104. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  24105. //
  24106. // <p>Shared top, same parents.<br>
  24107. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  24108. //
  24109. // <p>Shared top, different parents.<br>
  24110. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  24111. //
  24112. // <p>Shared top, all shared parents.<br>
  24113. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  24114. // type="image/svg+xml"/></p>
  24115. //
  24116. // <p>Equal tops, merge parents and reduce top to
  24117. // {@link SingletonPredictionContext}.<br>
  24118. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  24119. // /
  24120. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  24121. if (mergeCache !== null) {
  24122. var previous = mergeCache.get(a, b);
  24123. if (previous !== null) {
  24124. return previous;
  24125. }
  24126. previous = mergeCache.get(b, a);
  24127. if (previous !== null) {
  24128. return previous;
  24129. }
  24130. }
  24131. // merge sorted payloads a + b => M
  24132. var i = 0; // walks a
  24133. var j = 0; // walks b
  24134. var k = 0; // walks target M array
  24135. var mergedReturnStates = [];
  24136. var mergedParents = [];
  24137. // walk and merge to yield mergedParents, mergedReturnStates
  24138. while (i < a.returnStates.length && j < b.returnStates.length) {
  24139. var a_parent = a.parents[i];
  24140. var b_parent = b.parents[j];
  24141. if (a.returnStates[i] === b.returnStates[j]) {
  24142. // same payload (stack tops are equal), must yield merged singleton
  24143. var payload = a.returnStates[i];
  24144. // $+$ = $
  24145. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE && a_parent === null && b_parent === null;
  24146. var ax_ax = a_parent !== null && b_parent !== null && a_parent === b_parent; // ax+ax
  24147. // ->
  24148. // ax
  24149. if (bothDollars || ax_ax) {
  24150. mergedParents[k] = a_parent; // choose left
  24151. mergedReturnStates[k] = payload;
  24152. } else {
  24153. // ax+ay -> a'[x,y]
  24154. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  24155. mergedParents[k] = mergedParent;
  24156. mergedReturnStates[k] = payload;
  24157. }
  24158. i += 1; // hop over left one as usual
  24159. j += 1; // but also skip one in right side since we merge
  24160. } else if (a.returnStates[i] < b.returnStates[j]) {
  24161. // copy a[i] to M
  24162. mergedParents[k] = a_parent;
  24163. mergedReturnStates[k] = a.returnStates[i];
  24164. i += 1;
  24165. } else {
  24166. // b > a, copy b[j] to M
  24167. mergedParents[k] = b_parent;
  24168. mergedReturnStates[k] = b.returnStates[j];
  24169. j += 1;
  24170. }
  24171. k += 1;
  24172. }
  24173. // copy over any payloads remaining in either array
  24174. if (i < a.returnStates.length) {
  24175. for (var p = i; p < a.returnStates.length; p++) {
  24176. mergedParents[k] = a.parents[p];
  24177. mergedReturnStates[k] = a.returnStates[p];
  24178. k += 1;
  24179. }
  24180. } else {
  24181. for (var p = j; p < b.returnStates.length; p++) {
  24182. mergedParents[k] = b.parents[p];
  24183. mergedReturnStates[k] = b.returnStates[p];
  24184. k += 1;
  24185. }
  24186. }
  24187. // trim merged if we combined a few that had same stack tops
  24188. if (k < mergedParents.length) {
  24189. // write index < last position; trim
  24190. if (k === 1) {
  24191. // for just one merged element, return singleton top
  24192. var a_ = SingletonPredictionContext.create(mergedParents[0], mergedReturnStates[0]);
  24193. if (mergeCache !== null) {
  24194. mergeCache.set(a, b, a_);
  24195. }
  24196. return a_;
  24197. }
  24198. mergedParents = mergedParents.slice(0, k);
  24199. mergedReturnStates = mergedReturnStates.slice(0, k);
  24200. }
  24201. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  24202. // if we created same array as a or b, return that instead
  24203. // TODO: track whether this is possible above during merge sort for speed
  24204. if (M === a) {
  24205. if (mergeCache !== null) {
  24206. mergeCache.set(a, b, a);
  24207. }
  24208. return a;
  24209. }
  24210. if (M === b) {
  24211. if (mergeCache !== null) {
  24212. mergeCache.set(a, b, b);
  24213. }
  24214. return b;
  24215. }
  24216. combineCommonParents(mergedParents);
  24217. if (mergeCache !== null) {
  24218. mergeCache.set(a, b, M);
  24219. }
  24220. return M;
  24221. }
  24222. //
  24223. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  24224. // ones.
  24225. // /
  24226. function combineCommonParents(parents) {
  24227. var uniqueParents = {};
  24228. for (var p = 0; p < parents.length; p++) {
  24229. var parent = parents[p];
  24230. if (!(parent in uniqueParents)) {
  24231. uniqueParents[parent] = parent;
  24232. }
  24233. }
  24234. for (var q = 0; q < parents.length; q++) {
  24235. parents[q] = uniqueParents[parents[q]];
  24236. }
  24237. }
  24238. function getCachedPredictionContext(context, contextCache, visited) {
  24239. if (context.isEmpty()) {
  24240. return context;
  24241. }
  24242. var existing = visited[context] || null;
  24243. if (existing !== null) {
  24244. return existing;
  24245. }
  24246. existing = contextCache.get(context);
  24247. if (existing !== null) {
  24248. visited[context] = existing;
  24249. return existing;
  24250. }
  24251. var changed = false;
  24252. var parents = [];
  24253. for (var i = 0; i < parents.length; i++) {
  24254. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  24255. if (changed || parent !== context.getParent(i)) {
  24256. if (!changed) {
  24257. parents = [];
  24258. for (var j = 0; j < context.length; j++) {
  24259. parents[j] = context.getParent(j);
  24260. }
  24261. changed = true;
  24262. }
  24263. parents[i] = parent;
  24264. }
  24265. }
  24266. if (!changed) {
  24267. contextCache.add(context);
  24268. visited[context] = context;
  24269. return context;
  24270. }
  24271. var updated = null;
  24272. if (parents.length === 0) {
  24273. updated = PredictionContext.EMPTY;
  24274. } else if (parents.length === 1) {
  24275. updated = SingletonPredictionContext.create(parents[0], context.getReturnState(0));
  24276. } else {
  24277. updated = new ArrayPredictionContext(parents, context.returnStates);
  24278. }
  24279. contextCache.add(updated);
  24280. visited[updated] = updated;
  24281. visited[context] = updated;
  24282. return updated;
  24283. }
  24284. // ter's recursive version of Sam's getAllNodes()
  24285. function getAllContextNodes(context, nodes, visited) {
  24286. if (nodes === null) {
  24287. nodes = [];
  24288. return getAllContextNodes(context, nodes, visited);
  24289. } else if (visited === null) {
  24290. visited = {};
  24291. return getAllContextNodes(context, nodes, visited);
  24292. } else {
  24293. if (context === null || visited[context] !== null) {
  24294. return nodes;
  24295. }
  24296. visited[context] = context;
  24297. nodes.push(context);
  24298. for (var i = 0; i < context.length; i++) {
  24299. getAllContextNodes(context.getParent(i), nodes, visited);
  24300. }
  24301. return nodes;
  24302. }
  24303. }
  24304. exports.merge = merge;
  24305. exports.PredictionContext = PredictionContext;
  24306. exports.PredictionContextCache = PredictionContextCache;
  24307. exports.SingletonPredictionContext = SingletonPredictionContext;
  24308. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  24309. exports.getCachedPredictionContext = getCachedPredictionContext;
  24310. /***/ }),
  24311. /***/ "./node_modules/antlr4/Recognizer.js":
  24312. /*!*******************************************!*\
  24313. !*** ./node_modules/antlr4/Recognizer.js ***!
  24314. \*******************************************/
  24315. /*! no static exports found */
  24316. /***/ (function(module, exports, __webpack_require__) {
  24317. "use strict";
  24318. //
  24319. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24320. * Use of this file is governed by the BSD 3-clause license that
  24321. * can be found in the LICENSE.txt file in the project root.
  24322. */
  24323. //
  24324. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  24325. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  24326. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  24327. function Recognizer() {
  24328. this._listeners = [ConsoleErrorListener.INSTANCE];
  24329. this._interp = null;
  24330. this._stateNumber = -1;
  24331. return this;
  24332. }
  24333. Recognizer.tokenTypeMapCache = {};
  24334. Recognizer.ruleIndexMapCache = {};
  24335. Recognizer.prototype.checkVersion = function (toolVersion) {
  24336. var runtimeVersion = "4.7.1";
  24337. if (runtimeVersion !== toolVersion) {
  24338. console.log("ANTLR runtime and generated code versions disagree: " + runtimeVersion + "!=" + toolVersion);
  24339. }
  24340. };
  24341. Recognizer.prototype.addErrorListener = function (listener) {
  24342. this._listeners.push(listener);
  24343. };
  24344. Recognizer.prototype.removeErrorListeners = function () {
  24345. this._listeners = [];
  24346. };
  24347. Recognizer.prototype.getTokenTypeMap = function () {
  24348. var tokenNames = this.getTokenNames();
  24349. if (tokenNames === null) {
  24350. throw "The current recognizer does not provide a list of token names.";
  24351. }
  24352. var result = this.tokenTypeMapCache[tokenNames];
  24353. if (result === undefined) {
  24354. result = tokenNames.reduce(function (o, k, i) {
  24355. o[k] = i;
  24356. });
  24357. result.EOF = Token.EOF;
  24358. this.tokenTypeMapCache[tokenNames] = result;
  24359. }
  24360. return result;
  24361. };
  24362. // Get a map from rule names to rule indexes.
  24363. //
  24364. // <p>Used for XPath and tree pattern compilation.</p>
  24365. //
  24366. Recognizer.prototype.getRuleIndexMap = function () {
  24367. var ruleNames = this.ruleNames;
  24368. if (ruleNames === null) {
  24369. throw "The current recognizer does not provide a list of rule names.";
  24370. }
  24371. var result = this.ruleIndexMapCache[ruleNames];
  24372. if (result === undefined) {
  24373. result = ruleNames.reduce(function (o, k, i) {
  24374. o[k] = i;
  24375. });
  24376. this.ruleIndexMapCache[ruleNames] = result;
  24377. }
  24378. return result;
  24379. };
  24380. Recognizer.prototype.getTokenType = function (tokenName) {
  24381. var ttype = this.getTokenTypeMap()[tokenName];
  24382. if (ttype !== undefined) {
  24383. return ttype;
  24384. } else {
  24385. return Token.INVALID_TYPE;
  24386. }
  24387. };
  24388. // What is the error header, normally line/character position information?//
  24389. Recognizer.prototype.getErrorHeader = function (e) {
  24390. var line = e.getOffendingToken().line;
  24391. var column = e.getOffendingToken().column;
  24392. return "line " + line + ":" + column;
  24393. };
  24394. // How should a token be displayed in an error message? The default
  24395. // is to display just the text, but during development you might
  24396. // want to have a lot of information spit out. Override in that case
  24397. // to use t.toString() (which, for CommonToken, dumps everything about
  24398. // the token). This is better than forcing you to override a method in
  24399. // your token objects because you don't have to go modify your lexer
  24400. // so that it creates a new Java type.
  24401. //
  24402. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  24403. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  24404. // feature when necessary. For example, see
  24405. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  24406. //
  24407. Recognizer.prototype.getTokenErrorDisplay = function (t) {
  24408. if (t === null) {
  24409. return "<no token>";
  24410. }
  24411. var s = t.text;
  24412. if (s === null) {
  24413. if (t.type === Token.EOF) {
  24414. s = "<EOF>";
  24415. } else {
  24416. s = "<" + t.type + ">";
  24417. }
  24418. }
  24419. s = s.replace("\n", "\\n").replace("\r", "\\r").replace("\t", "\\t");
  24420. return "'" + s + "'";
  24421. };
  24422. Recognizer.prototype.getErrorListenerDispatch = function () {
  24423. return new ProxyErrorListener(this._listeners);
  24424. };
  24425. // subclass needs to override these if there are sempreds or actions
  24426. // that the ATN interp needs to execute
  24427. Recognizer.prototype.sempred = function (localctx, ruleIndex, actionIndex) {
  24428. return true;
  24429. };
  24430. Recognizer.prototype.precpred = function (localctx, precedence) {
  24431. return true;
  24432. };
  24433. //Indicate that the recognizer has changed internal state that is
  24434. //consistent with the ATN state passed in. This way we always know
  24435. //where we are in the ATN as the parser goes along. The rule
  24436. //context objects form a stack that lets us see the stack of
  24437. //invoking rules. Combine this and we have complete ATN
  24438. //configuration information.
  24439. Object.defineProperty(Recognizer.prototype, "state", {
  24440. get: function get() {
  24441. return this._stateNumber;
  24442. },
  24443. set: function set(state) {
  24444. this._stateNumber = state;
  24445. }
  24446. });
  24447. exports.Recognizer = Recognizer;
  24448. /***/ }),
  24449. /***/ "./node_modules/antlr4/RuleContext.js":
  24450. /*!********************************************!*\
  24451. !*** ./node_modules/antlr4/RuleContext.js ***!
  24452. \********************************************/
  24453. /*! no static exports found */
  24454. /***/ (function(module, exports, __webpack_require__) {
  24455. "use strict";
  24456. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24457. * Use of this file is governed by the BSD 3-clause license that
  24458. * can be found in the LICENSE.txt file in the project root.
  24459. */
  24460. ///
  24461. // A rule context is a record of a single rule invocation. It knows
  24462. // which context invoked it, if any. If there is no parent context, then
  24463. // naturally the invoking state is not valid. The parent link
  24464. // provides a chain upwards from the current rule invocation to the root
  24465. // of the invocation tree, forming a stack. We actually carry no
  24466. // information about the rule associated with this context (except
  24467. // when parsing). We keep only the state number of the invoking state from
  24468. // the ATN submachine that invoked this. Contrast this with the s
  24469. // pointer inside ParserRuleContext that tracks the current state
  24470. // being "executed" for the current rule.
  24471. //
  24472. // The parent contexts are useful for computing lookahead sets and
  24473. // getting error information.
  24474. //
  24475. // These objects are used during parsing and prediction.
  24476. // For the special case of parsers, we use the subclass
  24477. // ParserRuleContext.
  24478. //
  24479. // @see ParserRuleContext
  24480. ///
  24481. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  24482. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  24483. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  24484. function RuleContext(parent, invokingState) {
  24485. RuleNode.call(this);
  24486. // What context invoked this rule?
  24487. this.parentCtx = parent || null;
  24488. // What state invoked the rule associated with this context?
  24489. // The "return address" is the followState of invokingState
  24490. // If parent is null, this should be -1.
  24491. this.invokingState = invokingState || -1;
  24492. return this;
  24493. }
  24494. RuleContext.prototype = Object.create(RuleNode.prototype);
  24495. RuleContext.prototype.constructor = RuleContext;
  24496. RuleContext.prototype.depth = function () {
  24497. var n = 0;
  24498. var p = this;
  24499. while (p !== null) {
  24500. p = p.parentCtx;
  24501. n += 1;
  24502. }
  24503. return n;
  24504. };
  24505. // A context is empty if there is no invoking state; meaning nobody call
  24506. // current context.
  24507. RuleContext.prototype.isEmpty = function () {
  24508. return this.invokingState === -1;
  24509. };
  24510. // satisfy the ParseTree / SyntaxTree interface
  24511. RuleContext.prototype.getSourceInterval = function () {
  24512. return INVALID_INTERVAL;
  24513. };
  24514. RuleContext.prototype.getRuleContext = function () {
  24515. return this;
  24516. };
  24517. RuleContext.prototype.getPayload = function () {
  24518. return this;
  24519. };
  24520. // Return the combined text of all child nodes. This method only considers
  24521. // tokens which have been added to the parse tree.
  24522. // <p>
  24523. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  24524. // added to the parse trees, they will not appear in the output of this
  24525. // method.
  24526. // /
  24527. RuleContext.prototype.getText = function () {
  24528. if (this.getChildCount() === 0) {
  24529. return "";
  24530. } else {
  24531. return this.children.map(function (child) {
  24532. return child.getText();
  24533. }).join("");
  24534. }
  24535. };
  24536. // For rule associated with this parse tree internal node, return
  24537. // the outer alternative number used to match the input. Default
  24538. // implementation does not compute nor store this alt num. Create
  24539. // a subclass of ParserRuleContext with backing field and set
  24540. // option contextSuperClass.
  24541. // to set it.
  24542. RuleContext.prototype.getAltNumber = function () {
  24543. return INVALID_ALT_NUMBER;
  24544. };
  24545. // Set the outer alternative number for this context node. Default
  24546. // implementation does nothing to avoid backing field overhead for
  24547. // trees that don't need it. Create
  24548. // a subclass of ParserRuleContext with backing field and set
  24549. // option contextSuperClass.
  24550. RuleContext.prototype.setAltNumber = function (altNumber) {};
  24551. RuleContext.prototype.getChild = function (i) {
  24552. return null;
  24553. };
  24554. RuleContext.prototype.getChildCount = function () {
  24555. return 0;
  24556. };
  24557. RuleContext.prototype.accept = function (visitor) {
  24558. return visitor.visitChildren(this);
  24559. };
  24560. //need to manage circular dependencies, so export now
  24561. exports.RuleContext = RuleContext;
  24562. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  24563. // Print out a whole tree, not just a node, in LISP format
  24564. // (root child1 .. childN). Print just a node if this is a leaf.
  24565. //
  24566. RuleContext.prototype.toStringTree = function (ruleNames, recog) {
  24567. return Trees.toStringTree(this, ruleNames, recog);
  24568. };
  24569. RuleContext.prototype.toString = function (ruleNames, stop) {
  24570. ruleNames = ruleNames || null;
  24571. stop = stop || null;
  24572. var p = this;
  24573. var s = "[";
  24574. while (p !== null && p !== stop) {
  24575. if (ruleNames === null) {
  24576. if (!p.isEmpty()) {
  24577. s += p.invokingState;
  24578. }
  24579. } else {
  24580. var ri = p.ruleIndex;
  24581. var ruleName = ri >= 0 && ri < ruleNames.length ? ruleNames[ri] : "" + ri;
  24582. s += ruleName;
  24583. }
  24584. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  24585. s += " ";
  24586. }
  24587. p = p.parentCtx;
  24588. }
  24589. s += "]";
  24590. return s;
  24591. };
  24592. /***/ }),
  24593. /***/ "./node_modules/antlr4/Token.js":
  24594. /*!**************************************!*\
  24595. !*** ./node_modules/antlr4/Token.js ***!
  24596. \**************************************/
  24597. /*! no static exports found */
  24598. /***/ (function(module, exports, __webpack_require__) {
  24599. "use strict";
  24600. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24601. * Use of this file is governed by the BSD 3-clause license that
  24602. * can be found in the LICENSE.txt file in the project root.
  24603. */
  24604. //
  24605. // A token has properties: text, type, line, character position in the line
  24606. // (so we can ignore tabs), token channel, index, and source from which
  24607. // we obtained this token.
  24608. function Token() {
  24609. this.source = null;
  24610. this.type = null; // token type of the token
  24611. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  24612. this.start = null; // optional; return -1 if not implemented.
  24613. this.stop = null; // optional; return -1 if not implemented.
  24614. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  24615. this.line = null; // line=1..n of the 1st character
  24616. this.column = null; // beginning of the line at which it occurs, 0..n-1
  24617. this._text = null; // text of the token.
  24618. return this;
  24619. }
  24620. Token.INVALID_TYPE = 0;
  24621. // During lookahead operations, this "token" signifies we hit rule end ATN state
  24622. // and did not follow it despite needing to.
  24623. Token.EPSILON = -2;
  24624. Token.MIN_USER_TOKEN_TYPE = 1;
  24625. Token.EOF = -1;
  24626. // All tokens go to the parser (unless skip() is called in that rule)
  24627. // on a particular "channel". The parser tunes to a particular channel
  24628. // so that whitespace etc... can go to the parser on a "hidden" channel.
  24629. Token.DEFAULT_CHANNEL = 0;
  24630. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  24631. // by parser.
  24632. Token.HIDDEN_CHANNEL = 1;
  24633. // Explicitly set the text for this token. If {code text} is not
  24634. // {@code null}, then {@link //getText} will return this value rather than
  24635. // extracting the text from the input.
  24636. //
  24637. // @param text The explicit text of the token, or {@code null} if the text
  24638. // should be obtained from the input along with the start and stop indexes
  24639. // of the token.
  24640. Object.defineProperty(Token.prototype, "text", {
  24641. get: function get() {
  24642. return this._text;
  24643. },
  24644. set: function set(text) {
  24645. this._text = text;
  24646. }
  24647. });
  24648. Token.prototype.getTokenSource = function () {
  24649. return this.source[0];
  24650. };
  24651. Token.prototype.getInputStream = function () {
  24652. return this.source[1];
  24653. };
  24654. function CommonToken(source, type, channel, start, stop) {
  24655. Token.call(this);
  24656. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  24657. this.type = type !== undefined ? type : null;
  24658. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  24659. this.start = start !== undefined ? start : -1;
  24660. this.stop = stop !== undefined ? stop : -1;
  24661. this.tokenIndex = -1;
  24662. if (this.source[0] !== null) {
  24663. this.line = source[0].line;
  24664. this.column = source[0].column;
  24665. } else {
  24666. this.column = -1;
  24667. }
  24668. return this;
  24669. }
  24670. CommonToken.prototype = Object.create(Token.prototype);
  24671. CommonToken.prototype.constructor = CommonToken;
  24672. // An empty {@link Pair} which is used as the default value of
  24673. // {@link //source} for tokens that do not have a source.
  24674. CommonToken.EMPTY_SOURCE = [null, null];
  24675. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  24676. //
  24677. // <p>
  24678. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  24679. // constructed token will share a reference to the {@link //text} field and
  24680. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  24681. // be assigned the result of calling {@link //getText}, and {@link //source}
  24682. // will be constructed from the result of {@link Token//getTokenSource} and
  24683. // {@link Token//getInputStream}.</p>
  24684. //
  24685. // @param oldToken The token to copy.
  24686. //
  24687. CommonToken.prototype.clone = function () {
  24688. var t = new CommonToken(this.source, this.type, this.channel, this.start, this.stop);
  24689. t.tokenIndex = this.tokenIndex;
  24690. t.line = this.line;
  24691. t.column = this.column;
  24692. t.text = this.text;
  24693. return t;
  24694. };
  24695. Object.defineProperty(CommonToken.prototype, "text", {
  24696. get: function get() {
  24697. if (this._text !== null) {
  24698. return this._text;
  24699. }
  24700. var input = this.getInputStream();
  24701. if (input === null) {
  24702. return null;
  24703. }
  24704. var n = input.size;
  24705. if (this.start < n && this.stop < n) {
  24706. return input.getText(this.start, this.stop);
  24707. } else {
  24708. return "<EOF>";
  24709. }
  24710. },
  24711. set: function set(text) {
  24712. this._text = text;
  24713. }
  24714. });
  24715. CommonToken.prototype.toString = function () {
  24716. var txt = this.text;
  24717. if (txt !== null) {
  24718. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  24719. } else {
  24720. txt = "<no text>";
  24721. }
  24722. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" + txt + "',<" + this.type + ">" + (this.channel > 0 ? ",channel=" + this.channel : "") + "," + this.line + ":" + this.column + "]";
  24723. };
  24724. exports.Token = Token;
  24725. exports.CommonToken = CommonToken;
  24726. /***/ }),
  24727. /***/ "./node_modules/antlr4/Utils.js":
  24728. /*!**************************************!*\
  24729. !*** ./node_modules/antlr4/Utils.js ***!
  24730. \**************************************/
  24731. /*! no static exports found */
  24732. /***/ (function(module, exports, __webpack_require__) {
  24733. "use strict";
  24734. 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; };
  24735. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  24736. * Use of this file is governed by the BSD 3-clause license that
  24737. * can be found in the LICENSE.txt file in the project root.
  24738. */
  24739. function arrayToString(a) {
  24740. return "[" + a.join(", ") + "]";
  24741. }
  24742. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  24743. String.prototype.hashCode = function () {
  24744. var remainder,
  24745. bytes,
  24746. h1,
  24747. h1b,
  24748. c1,
  24749. c1b,
  24750. c2,
  24751. c2b,
  24752. k1,
  24753. i,
  24754. key = this.toString();
  24755. remainder = key.length & 3; // key.length % 4
  24756. bytes = key.length - remainder;
  24757. h1 = String.prototype.seed;
  24758. c1 = 0xcc9e2d51;
  24759. c2 = 0x1b873593;
  24760. i = 0;
  24761. while (i < bytes) {
  24762. k1 = key.charCodeAt(i) & 0xff | (key.charCodeAt(++i) & 0xff) << 8 | (key.charCodeAt(++i) & 0xff) << 16 | (key.charCodeAt(++i) & 0xff) << 24;
  24763. ++i;
  24764. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24765. k1 = k1 << 15 | k1 >>> 17;
  24766. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24767. h1 ^= k1;
  24768. h1 = h1 << 13 | h1 >>> 19;
  24769. h1b = (h1 & 0xffff) * 5 + (((h1 >>> 16) * 5 & 0xffff) << 16) & 0xffffffff;
  24770. h1 = (h1b & 0xffff) + 0x6b64 + (((h1b >>> 16) + 0xe654 & 0xffff) << 16);
  24771. }
  24772. k1 = 0;
  24773. switch (remainder) {
  24774. case 3:
  24775. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  24776. case 2:
  24777. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  24778. case 1:
  24779. k1 ^= key.charCodeAt(i) & 0xff;
  24780. k1 = (k1 & 0xffff) * c1 + (((k1 >>> 16) * c1 & 0xffff) << 16) & 0xffffffff;
  24781. k1 = k1 << 15 | k1 >>> 17;
  24782. k1 = (k1 & 0xffff) * c2 + (((k1 >>> 16) * c2 & 0xffff) << 16) & 0xffffffff;
  24783. h1 ^= k1;
  24784. }
  24785. h1 ^= key.length;
  24786. h1 ^= h1 >>> 16;
  24787. h1 = (h1 & 0xffff) * 0x85ebca6b + (((h1 >>> 16) * 0x85ebca6b & 0xffff) << 16) & 0xffffffff;
  24788. h1 ^= h1 >>> 13;
  24789. h1 = (h1 & 0xffff) * 0xc2b2ae35 + (((h1 >>> 16) * 0xc2b2ae35 & 0xffff) << 16) & 0xffffffff;
  24790. h1 ^= h1 >>> 16;
  24791. return h1 >>> 0;
  24792. };
  24793. function standardEqualsFunction(a, b) {
  24794. return a.equals(b);
  24795. }
  24796. function standardHashCodeFunction(a) {
  24797. return a.hashCode();
  24798. }
  24799. function Set(hashFunction, equalsFunction) {
  24800. this.data = {};
  24801. this.hashFunction = hashFunction || standardHashCodeFunction;
  24802. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24803. return this;
  24804. }
  24805. Object.defineProperty(Set.prototype, "length", {
  24806. get: function get() {
  24807. var l = 0;
  24808. for (var key in this.data) {
  24809. if (key.indexOf("hash_") === 0) {
  24810. l = l + this.data[key].length;
  24811. }
  24812. }
  24813. return l;
  24814. }
  24815. });
  24816. Set.prototype.add = function (value) {
  24817. var hash = this.hashFunction(value);
  24818. var key = "hash_" + hash;
  24819. if (key in this.data) {
  24820. var values = this.data[key];
  24821. for (var i = 0; i < values.length; i++) {
  24822. if (this.equalsFunction(value, values[i])) {
  24823. return values[i];
  24824. }
  24825. }
  24826. values.push(value);
  24827. return value;
  24828. } else {
  24829. this.data[key] = [value];
  24830. return value;
  24831. }
  24832. };
  24833. Set.prototype.contains = function (value) {
  24834. return this.get(value) != null;
  24835. };
  24836. Set.prototype.get = function (value) {
  24837. var hash = this.hashFunction(value);
  24838. var key = "hash_" + hash;
  24839. if (key in this.data) {
  24840. var values = this.data[key];
  24841. for (var i = 0; i < values.length; i++) {
  24842. if (this.equalsFunction(value, values[i])) {
  24843. return values[i];
  24844. }
  24845. }
  24846. }
  24847. return null;
  24848. };
  24849. Set.prototype.values = function () {
  24850. var l = [];
  24851. for (var key in this.data) {
  24852. if (key.indexOf("hash_") === 0) {
  24853. l = l.concat(this.data[key]);
  24854. }
  24855. }
  24856. return l;
  24857. };
  24858. Set.prototype.toString = function () {
  24859. return arrayToString(this.values());
  24860. };
  24861. function BitSet() {
  24862. this.data = [];
  24863. return this;
  24864. }
  24865. BitSet.prototype.add = function (value) {
  24866. this.data[value] = true;
  24867. };
  24868. BitSet.prototype.or = function (set) {
  24869. var bits = this;
  24870. Object.keys(set.data).map(function (alt) {
  24871. bits.add(alt);
  24872. });
  24873. };
  24874. BitSet.prototype.remove = function (value) {
  24875. delete this.data[value];
  24876. };
  24877. BitSet.prototype.contains = function (value) {
  24878. return this.data[value] === true;
  24879. };
  24880. BitSet.prototype.values = function () {
  24881. return Object.keys(this.data);
  24882. };
  24883. BitSet.prototype.minValue = function () {
  24884. return Math.min.apply(null, this.values());
  24885. };
  24886. BitSet.prototype.hashCode = function () {
  24887. var hash = new Hash();
  24888. hash.update(this.values());
  24889. return hash.finish();
  24890. };
  24891. BitSet.prototype.equals = function (other) {
  24892. if (!(other instanceof BitSet)) {
  24893. return false;
  24894. }
  24895. return this.hashCode() === other.hashCode();
  24896. };
  24897. Object.defineProperty(BitSet.prototype, "length", {
  24898. get: function get() {
  24899. return this.values().length;
  24900. }
  24901. });
  24902. BitSet.prototype.toString = function () {
  24903. return "{" + this.values().join(", ") + "}";
  24904. };
  24905. function Map(hashFunction, equalsFunction) {
  24906. this.data = {};
  24907. this.hashFunction = hashFunction || standardHashCodeFunction;
  24908. this.equalsFunction = equalsFunction || standardEqualsFunction;
  24909. return this;
  24910. }
  24911. Object.defineProperty(Map.prototype, "length", {
  24912. get: function get() {
  24913. var l = 0;
  24914. for (var hashKey in this.data) {
  24915. if (hashKey.indexOf("hash_") === 0) {
  24916. l = l + this.data[hashKey].length;
  24917. }
  24918. }
  24919. return l;
  24920. }
  24921. });
  24922. Map.prototype.put = function (key, value) {
  24923. var hashKey = "hash_" + this.hashFunction(key);
  24924. if (hashKey in this.data) {
  24925. var entries = this.data[hashKey];
  24926. for (var i = 0; i < entries.length; i++) {
  24927. var entry = entries[i];
  24928. if (this.equalsFunction(key, entry.key)) {
  24929. var oldValue = entry.value;
  24930. entry.value = value;
  24931. return oldValue;
  24932. }
  24933. }
  24934. entries.push({ key: key, value: value });
  24935. return value;
  24936. } else {
  24937. this.data[hashKey] = [{ key: key, value: value }];
  24938. return value;
  24939. }
  24940. };
  24941. Map.prototype.containsKey = function (key) {
  24942. var hashKey = "hash_" + this.hashFunction(key);
  24943. if (hashKey in this.data) {
  24944. var entries = this.data[hashKey];
  24945. for (var i = 0; i < entries.length; i++) {
  24946. var entry = entries[i];
  24947. if (this.equalsFunction(key, entry.key)) return true;
  24948. }
  24949. }
  24950. return false;
  24951. };
  24952. Map.prototype.get = function (key) {
  24953. var hashKey = "hash_" + this.hashFunction(key);
  24954. if (hashKey in this.data) {
  24955. var entries = this.data[hashKey];
  24956. for (var i = 0; i < entries.length; i++) {
  24957. var entry = entries[i];
  24958. if (this.equalsFunction(key, entry.key)) return entry.value;
  24959. }
  24960. }
  24961. return null;
  24962. };
  24963. Map.prototype.entries = function () {
  24964. var l = [];
  24965. for (var key in this.data) {
  24966. if (key.indexOf("hash_") === 0) {
  24967. l = l.concat(this.data[key]);
  24968. }
  24969. }
  24970. return l;
  24971. };
  24972. Map.prototype.getKeys = function () {
  24973. return this.entries().map(function (e) {
  24974. return e.key;
  24975. });
  24976. };
  24977. Map.prototype.getValues = function () {
  24978. return this.entries().map(function (e) {
  24979. return e.value;
  24980. });
  24981. };
  24982. Map.prototype.toString = function () {
  24983. var ss = this.entries().map(function (entry) {
  24984. return '{' + entry.key + ':' + entry.value + '}';
  24985. });
  24986. return '[' + ss.join(", ") + ']';
  24987. };
  24988. function AltDict() {
  24989. this.data = {};
  24990. return this;
  24991. }
  24992. AltDict.prototype.get = function (key) {
  24993. key = "k-" + key;
  24994. if (key in this.data) {
  24995. return this.data[key];
  24996. } else {
  24997. return null;
  24998. }
  24999. };
  25000. AltDict.prototype.put = function (key, value) {
  25001. key = "k-" + key;
  25002. this.data[key] = value;
  25003. };
  25004. AltDict.prototype.values = function () {
  25005. var data = this.data;
  25006. var keys = Object.keys(this.data);
  25007. return keys.map(function (key) {
  25008. return data[key];
  25009. });
  25010. };
  25011. function DoubleDict() {
  25012. return this;
  25013. }
  25014. function Hash() {
  25015. this.count = 0;
  25016. this.hash = 0;
  25017. return this;
  25018. }
  25019. Hash.prototype.update = function () {
  25020. for (var i = 0; i < arguments.length; i++) {
  25021. var value = arguments[i];
  25022. if (value == null) continue;
  25023. if (Array.isArray(value)) this.update.apply(value);else {
  25024. var k = 0;
  25025. switch (typeof value === "undefined" ? "undefined" : _typeof(value)) {
  25026. case 'undefined':
  25027. case 'function':
  25028. continue;
  25029. case 'number':
  25030. case 'boolean':
  25031. k = value;
  25032. break;
  25033. case 'string':
  25034. k = value.hashCode();
  25035. break;
  25036. default:
  25037. value.updateHashCode(this);
  25038. continue;
  25039. }
  25040. k = k * 0xCC9E2D51;
  25041. k = k << 15 | k >>> 32 - 15;
  25042. k = k * 0x1B873593;
  25043. this.count = this.count + 1;
  25044. var hash = this.hash ^ k;
  25045. hash = hash << 13 | hash >>> 32 - 13;
  25046. hash = hash * 5 + 0xE6546B64;
  25047. this.hash = hash;
  25048. }
  25049. }
  25050. };
  25051. Hash.prototype.finish = function () {
  25052. var hash = this.hash ^ this.count * 4;
  25053. hash = hash ^ hash >>> 16;
  25054. hash = hash * 0x85EBCA6B;
  25055. hash = hash ^ hash >>> 13;
  25056. hash = hash * 0xC2B2AE35;
  25057. hash = hash ^ hash >>> 16;
  25058. return hash;
  25059. };
  25060. function hashStuff() {
  25061. var hash = new Hash();
  25062. hash.update.apply(arguments);
  25063. return hash.finish();
  25064. }
  25065. DoubleDict.prototype.get = function (a, b) {
  25066. var d = this[a] || null;
  25067. return d === null ? null : d[b] || null;
  25068. };
  25069. DoubleDict.prototype.set = function (a, b, o) {
  25070. var d = this[a] || null;
  25071. if (d === null) {
  25072. d = {};
  25073. this[a] = d;
  25074. }
  25075. d[b] = o;
  25076. };
  25077. function escapeWhitespace(s, escapeSpaces) {
  25078. s = s.replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r");
  25079. if (escapeSpaces) {
  25080. s = s.replace(/ /g, "\xB7");
  25081. }
  25082. return s;
  25083. }
  25084. function titleCase(str) {
  25085. return str.replace(/\w\S*/g, function (txt) {
  25086. return txt.charAt(0).toUpperCase() + txt.substr(1);
  25087. });
  25088. };
  25089. function equalArrays(a, b) {
  25090. if (!Array.isArray(a) || !Array.isArray(b)) return false;
  25091. if (a == b) return true;
  25092. if (a.length != b.length) return false;
  25093. for (var i = 0; i < a.length; i++) {
  25094. if (a[i] == b[i]) continue;
  25095. if (!a[i].equals(b[i])) return false;
  25096. }
  25097. return true;
  25098. };
  25099. exports.Hash = Hash;
  25100. exports.Set = Set;
  25101. exports.Map = Map;
  25102. exports.BitSet = BitSet;
  25103. exports.AltDict = AltDict;
  25104. exports.DoubleDict = DoubleDict;
  25105. exports.hashStuff = hashStuff;
  25106. exports.escapeWhitespace = escapeWhitespace;
  25107. exports.arrayToString = arrayToString;
  25108. exports.titleCase = titleCase;
  25109. exports.equalArrays = equalArrays;
  25110. /***/ }),
  25111. /***/ "./node_modules/antlr4/atn/ATN.js":
  25112. /*!****************************************!*\
  25113. !*** ./node_modules/antlr4/atn/ATN.js ***!
  25114. \****************************************/
  25115. /*! no static exports found */
  25116. /***/ (function(module, exports, __webpack_require__) {
  25117. "use strict";
  25118. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25119. * Use of this file is governed by the BSD 3-clause license that
  25120. * can be found in the LICENSE.txt file in the project root.
  25121. */
  25122. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  25123. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25124. function ATN(grammarType, maxTokenType) {
  25125. // Used for runtime deserialization of ATNs from strings///
  25126. // The type of the ATN.
  25127. this.grammarType = grammarType;
  25128. // The maximum value for any symbol recognized by a transition in the ATN.
  25129. this.maxTokenType = maxTokenType;
  25130. this.states = [];
  25131. // Each subrule/rule is a decision point and we must track them so we
  25132. // can go back later and build DFA predictors for them. This includes
  25133. // all the rules, subrules, optional blocks, ()+, ()* etc...
  25134. this.decisionToState = [];
  25135. // Maps from rule index to starting state number.
  25136. this.ruleToStartState = [];
  25137. // Maps from rule index to stop state number.
  25138. this.ruleToStopState = null;
  25139. this.modeNameToStartState = {};
  25140. // For lexer ATNs, this maps the rule index to the resulting token type.
  25141. // For parser ATNs, this maps the rule index to the generated bypass token
  25142. // type if the
  25143. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  25144. // deserialization option was specified; otherwise, this is {@code null}.
  25145. this.ruleToTokenType = null;
  25146. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  25147. // be referenced by action transitions in the ATN.
  25148. this.lexerActions = null;
  25149. this.modeToStartState = [];
  25150. return this;
  25151. }
  25152. // Compute the set of valid tokens that can occur starting in state {@code s}.
  25153. // If {@code ctx} is null, the set of tokens will not include what can follow
  25154. // the rule surrounding {@code s}. In other words, the set will be
  25155. // restricted to tokens reachable staying within {@code s}'s rule.
  25156. ATN.prototype.nextTokensInContext = function (s, ctx) {
  25157. var anal = new LL1Analyzer(this);
  25158. return anal.LOOK(s, null, ctx);
  25159. };
  25160. // Compute the set of valid tokens that can occur starting in {@code s} and
  25161. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  25162. // rule.
  25163. ATN.prototype.nextTokensNoContext = function (s) {
  25164. if (s.nextTokenWithinRule !== null) {
  25165. return s.nextTokenWithinRule;
  25166. }
  25167. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  25168. s.nextTokenWithinRule.readOnly = true;
  25169. return s.nextTokenWithinRule;
  25170. };
  25171. ATN.prototype.nextTokens = function (s, ctx) {
  25172. if (ctx === undefined) {
  25173. return this.nextTokensNoContext(s);
  25174. } else {
  25175. return this.nextTokensInContext(s, ctx);
  25176. }
  25177. };
  25178. ATN.prototype.addState = function (state) {
  25179. if (state !== null) {
  25180. state.atn = this;
  25181. state.stateNumber = this.states.length;
  25182. }
  25183. this.states.push(state);
  25184. };
  25185. ATN.prototype.removeState = function (state) {
  25186. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  25187. };
  25188. ATN.prototype.defineDecisionState = function (s) {
  25189. this.decisionToState.push(s);
  25190. s.decision = this.decisionToState.length - 1;
  25191. return s.decision;
  25192. };
  25193. ATN.prototype.getDecisionState = function (decision) {
  25194. if (this.decisionToState.length === 0) {
  25195. return null;
  25196. } else {
  25197. return this.decisionToState[decision];
  25198. }
  25199. };
  25200. // Computes the set of input symbols which could follow ATN state number
  25201. // {@code stateNumber} in the specified full {@code context}. This method
  25202. // considers the complete parser context, but does not evaluate semantic
  25203. // predicates (i.e. all predicates encountered during the calculation are
  25204. // assumed true). If a path in the ATN exists from the starting state to the
  25205. // {@link RuleStopState} of the outermost context without matching any
  25206. // symbols, {@link Token//EOF} is added to the returned set.
  25207. //
  25208. // <p>If {@code context} is {@code null}, it is treated as
  25209. // {@link ParserRuleContext//EMPTY}.</p>
  25210. //
  25211. // @param stateNumber the ATN state number
  25212. // @param context the full parse context
  25213. // @return The set of potentially valid input symbols which could follow the
  25214. // specified state in the specified context.
  25215. // @throws IllegalArgumentException if the ATN does not contain a state with
  25216. // number {@code stateNumber}
  25217. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25218. ATN.prototype.getExpectedTokens = function (stateNumber, ctx) {
  25219. if (stateNumber < 0 || stateNumber >= this.states.length) {
  25220. throw "Invalid state number.";
  25221. }
  25222. var s = this.states[stateNumber];
  25223. var following = this.nextTokens(s);
  25224. if (!following.contains(Token.EPSILON)) {
  25225. return following;
  25226. }
  25227. var expected = new IntervalSet();
  25228. expected.addSet(following);
  25229. expected.removeOne(Token.EPSILON);
  25230. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  25231. var invokingState = this.states[ctx.invokingState];
  25232. var rt = invokingState.transitions[0];
  25233. following = this.nextTokens(rt.followState);
  25234. expected.addSet(following);
  25235. expected.removeOne(Token.EPSILON);
  25236. ctx = ctx.parentCtx;
  25237. }
  25238. if (following.contains(Token.EPSILON)) {
  25239. expected.addOne(Token.EOF);
  25240. }
  25241. return expected;
  25242. };
  25243. ATN.INVALID_ALT_NUMBER = 0;
  25244. exports.ATN = ATN;
  25245. /***/ }),
  25246. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  25247. /*!**********************************************!*\
  25248. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  25249. \**********************************************/
  25250. /*! no static exports found */
  25251. /***/ (function(module, exports, __webpack_require__) {
  25252. "use strict";
  25253. //
  25254. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25255. * Use of this file is governed by the BSD 3-clause license that
  25256. * can be found in the LICENSE.txt file in the project root.
  25257. */
  25258. ///
  25259. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  25260. // The syntactic context is a graph-structured stack node whose
  25261. // path(s) to the root is the rule invocation(s)
  25262. // chain used to arrive at the state. The semantic context is
  25263. // the tree of semantic predicates encountered before reaching
  25264. // an ATN state.
  25265. ///
  25266. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  25267. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25268. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  25269. function checkParams(params, isCfg) {
  25270. if (params === null) {
  25271. var result = { state: null, alt: null, context: null, semanticContext: null };
  25272. if (isCfg) {
  25273. result.reachesIntoOuterContext = 0;
  25274. }
  25275. return result;
  25276. } else {
  25277. var props = {};
  25278. props.state = params.state || null;
  25279. props.alt = params.alt === undefined ? null : params.alt;
  25280. props.context = params.context || null;
  25281. props.semanticContext = params.semanticContext || null;
  25282. if (isCfg) {
  25283. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  25284. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  25285. }
  25286. return props;
  25287. }
  25288. }
  25289. function ATNConfig(params, config) {
  25290. this.checkContext(params, config);
  25291. params = checkParams(params);
  25292. config = checkParams(config, true);
  25293. // The ATN state associated with this configuration///
  25294. this.state = params.state !== null ? params.state : config.state;
  25295. // What alt (or lexer rule) is predicted by this configuration///
  25296. this.alt = params.alt !== null ? params.alt : config.alt;
  25297. // The stack of invoking states leading to the rule/states associated
  25298. // with this config. We track only those contexts pushed during
  25299. // execution of the ATN simulator.
  25300. this.context = params.context !== null ? params.context : config.context;
  25301. this.semanticContext = params.semanticContext !== null ? params.semanticContext : config.semanticContext !== null ? config.semanticContext : SemanticContext.NONE;
  25302. // We cannot execute predicates dependent upon local context unless
  25303. // we know for sure we are in the correct context. Because there is
  25304. // no way to do this efficiently, we simply cannot evaluate
  25305. // dependent predicates unless we are in the rule that initially
  25306. // invokes the ATN simulator.
  25307. //
  25308. // closure() tracks the depth of how far we dip into the
  25309. // outer context: depth &gt; 0. Note that it may not be totally
  25310. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  25311. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  25312. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  25313. return this;
  25314. }
  25315. ATNConfig.prototype.checkContext = function (params, config) {
  25316. if ((params.context === null || params.context === undefined) && (config === null || config.context === null || config.context === undefined)) {
  25317. this.context = null;
  25318. }
  25319. };
  25320. ATNConfig.prototype.hashCode = function () {
  25321. var hash = new Hash();
  25322. this.updateHashCode(hash);
  25323. return hash.finish();
  25324. };
  25325. ATNConfig.prototype.updateHashCode = function (hash) {
  25326. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  25327. };
  25328. // An ATN configuration is equal to another if both have
  25329. // the same state, they predict the same alternative, and
  25330. // syntactic/semantic contexts are the same.
  25331. ATNConfig.prototype.equals = function (other) {
  25332. if (this === other) {
  25333. return true;
  25334. } else if (!(other instanceof ATNConfig)) {
  25335. return false;
  25336. } else {
  25337. 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;
  25338. }
  25339. };
  25340. ATNConfig.prototype.hashCodeForConfigSet = function () {
  25341. var hash = new Hash();
  25342. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  25343. return hash.finish();
  25344. };
  25345. ATNConfig.prototype.equalsForConfigSet = function (other) {
  25346. if (this === other) {
  25347. return true;
  25348. } else if (!(other instanceof ATNConfig)) {
  25349. return false;
  25350. } else {
  25351. return this.state.stateNumber === other.state.stateNumber && this.alt === other.alt && this.semanticContext.equals(other.semanticContext);
  25352. }
  25353. };
  25354. ATNConfig.prototype.toString = function () {
  25355. return "(" + this.state + "," + this.alt + (this.context !== null ? ",[" + this.context.toString() + "]" : "") + (this.semanticContext !== SemanticContext.NONE ? "," + this.semanticContext.toString() : "") + (this.reachesIntoOuterContext > 0 ? ",up=" + this.reachesIntoOuterContext : "") + ")";
  25356. };
  25357. function LexerATNConfig(params, config) {
  25358. ATNConfig.call(this, params, config);
  25359. // This is the backing field for {@link //getLexerActionExecutor}.
  25360. var lexerActionExecutor = params.lexerActionExecutor || null;
  25361. this.lexerActionExecutor = lexerActionExecutor || (config !== null ? config.lexerActionExecutor : null);
  25362. this.passedThroughNonGreedyDecision = config !== null ? this.checkNonGreedyDecision(config, this.state) : false;
  25363. return this;
  25364. }
  25365. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  25366. LexerATNConfig.prototype.constructor = LexerATNConfig;
  25367. LexerATNConfig.prototype.updateHashCode = function (hash) {
  25368. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  25369. };
  25370. LexerATNConfig.prototype.equals = function (other) {
  25371. 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);
  25372. };
  25373. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  25374. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  25375. LexerATNConfig.prototype.checkNonGreedyDecision = function (source, target) {
  25376. return source.passedThroughNonGreedyDecision || target instanceof DecisionState && target.nonGreedy;
  25377. };
  25378. exports.ATNConfig = ATNConfig;
  25379. exports.LexerATNConfig = LexerATNConfig;
  25380. /***/ }),
  25381. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  25382. /*!*************************************************!*\
  25383. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  25384. \*************************************************/
  25385. /*! no static exports found */
  25386. /***/ (function(module, exports, __webpack_require__) {
  25387. "use strict";
  25388. //
  25389. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25390. * Use of this file is governed by the BSD 3-clause license that
  25391. * can be found in the LICENSE.txt file in the project root.
  25392. */
  25393. //
  25394. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  25395. // info about the set, with support for combining similar configurations using a
  25396. // graph-structured stack.
  25397. ///
  25398. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25399. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  25400. var Hash = Utils.Hash;
  25401. var Set = Utils.Set;
  25402. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  25403. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  25404. function hashATNConfig(c) {
  25405. return c.hashCodeForConfigSet();
  25406. }
  25407. function equalATNConfigs(a, b) {
  25408. if (a === b) {
  25409. return true;
  25410. } else if (a === null || b === null) {
  25411. return false;
  25412. } else return a.equalsForConfigSet(b);
  25413. }
  25414. function ATNConfigSet(fullCtx) {
  25415. //
  25416. // The reason that we need this is because we don't want the hash map to use
  25417. // the standard hash code and equals. We need all configurations with the
  25418. // same
  25419. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  25420. // doubles
  25421. // the number of objects associated with ATNConfigs. The other solution is
  25422. // to
  25423. // use a hash table that lets us specify the equals/hashcode operation.
  25424. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  25425. // when we go readonly as this set becomes a DFA state.
  25426. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  25427. // Indicates that this configuration set is part of a full context
  25428. // LL prediction. It will be used to determine how to merge $. With SLL
  25429. // it's a wildcard whereas it is not for LL context merge.
  25430. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  25431. // Indicates that the set of configurations is read-only. Do not
  25432. // allow any code to manipulate the set; DFA states will point at
  25433. // the sets and they must not change. This does not protect the other
  25434. // fields; in particular, conflictingAlts is set after
  25435. // we've made this readonly.
  25436. this.readOnly = false;
  25437. // Track the elements as they are added to the set; supports get(i)///
  25438. this.configs = [];
  25439. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  25440. // together, saves recomputation
  25441. // TODO: can we track conflicts as they are added to save scanning configs
  25442. // later?
  25443. this.uniqueAlt = 0;
  25444. this.conflictingAlts = null;
  25445. // Used in parser and lexer. In lexer, it indicates we hit a pred
  25446. // while computing a closure operation. Don't make a DFA state from this.
  25447. this.hasSemanticContext = false;
  25448. this.dipsIntoOuterContext = false;
  25449. this.cachedHashCode = -1;
  25450. return this;
  25451. }
  25452. // Adding a new config means merging contexts with existing configs for
  25453. // {@code (s, i, pi, _)}, where {@code s} is the
  25454. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  25455. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  25456. // {@code (s,i,pi)} as key.
  25457. //
  25458. // <p>This method updates {@link //dipsIntoOuterContext} and
  25459. // {@link //hasSemanticContext} when necessary.</p>
  25460. // /
  25461. ATNConfigSet.prototype.add = function (config, mergeCache) {
  25462. if (mergeCache === undefined) {
  25463. mergeCache = null;
  25464. }
  25465. if (this.readOnly) {
  25466. throw "This set is readonly";
  25467. }
  25468. if (config.semanticContext !== SemanticContext.NONE) {
  25469. this.hasSemanticContext = true;
  25470. }
  25471. if (config.reachesIntoOuterContext > 0) {
  25472. this.dipsIntoOuterContext = true;
  25473. }
  25474. var existing = this.configLookup.add(config);
  25475. if (existing === config) {
  25476. this.cachedHashCode = -1;
  25477. this.configs.push(config); // track order here
  25478. return true;
  25479. }
  25480. // a previous (s,i,pi,_), merge with it and save result
  25481. var rootIsWildcard = !this.fullCtx;
  25482. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  25483. // no need to check for existing.context, config.context in cache
  25484. // since only way to create new graphs is "call rule" and here. We
  25485. // cache at both places.
  25486. existing.reachesIntoOuterContext = Math.max(existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  25487. // make sure to preserve the precedence filter suppression during the merge
  25488. if (config.precedenceFilterSuppressed) {
  25489. existing.precedenceFilterSuppressed = true;
  25490. }
  25491. existing.context = merged; // replace context; no need to alt mapping
  25492. return true;
  25493. };
  25494. ATNConfigSet.prototype.getStates = function () {
  25495. var states = new Set();
  25496. for (var i = 0; i < this.configs.length; i++) {
  25497. states.add(this.configs[i].state);
  25498. }
  25499. return states;
  25500. };
  25501. ATNConfigSet.prototype.getPredicates = function () {
  25502. var preds = [];
  25503. for (var i = 0; i < this.configs.length; i++) {
  25504. var c = this.configs[i].semanticContext;
  25505. if (c !== SemanticContext.NONE) {
  25506. preds.push(c.semanticContext);
  25507. }
  25508. }
  25509. return preds;
  25510. };
  25511. Object.defineProperty(ATNConfigSet.prototype, "items", {
  25512. get: function get() {
  25513. return this.configs;
  25514. }
  25515. });
  25516. ATNConfigSet.prototype.optimizeConfigs = function (interpreter) {
  25517. if (this.readOnly) {
  25518. throw "This set is readonly";
  25519. }
  25520. if (this.configLookup.length === 0) {
  25521. return;
  25522. }
  25523. for (var i = 0; i < this.configs.length; i++) {
  25524. var config = this.configs[i];
  25525. config.context = interpreter.getCachedContext(config.context);
  25526. }
  25527. };
  25528. ATNConfigSet.prototype.addAll = function (coll) {
  25529. for (var i = 0; i < coll.length; i++) {
  25530. this.add(coll[i]);
  25531. }
  25532. return false;
  25533. };
  25534. ATNConfigSet.prototype.equals = function (other) {
  25535. 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;
  25536. };
  25537. ATNConfigSet.prototype.hashCode = function () {
  25538. var hash = new Hash();
  25539. this.updateHashCode(hash);
  25540. return hash.finish();
  25541. };
  25542. ATNConfigSet.prototype.updateHashCode = function (hash) {
  25543. if (this.readOnly) {
  25544. if (this.cachedHashCode === -1) {
  25545. var hash = new Hash();
  25546. hash.update(this.configs);
  25547. this.cachedHashCode = hash.finish();
  25548. }
  25549. hash.update(this.cachedHashCode);
  25550. } else {
  25551. hash.update(this.configs);
  25552. }
  25553. };
  25554. Object.defineProperty(ATNConfigSet.prototype, "length", {
  25555. get: function get() {
  25556. return this.configs.length;
  25557. }
  25558. });
  25559. ATNConfigSet.prototype.isEmpty = function () {
  25560. return this.configs.length === 0;
  25561. };
  25562. ATNConfigSet.prototype.contains = function (item) {
  25563. if (this.configLookup === null) {
  25564. throw "This method is not implemented for readonly sets.";
  25565. }
  25566. return this.configLookup.contains(item);
  25567. };
  25568. ATNConfigSet.prototype.containsFast = function (item) {
  25569. if (this.configLookup === null) {
  25570. throw "This method is not implemented for readonly sets.";
  25571. }
  25572. return this.configLookup.containsFast(item);
  25573. };
  25574. ATNConfigSet.prototype.clear = function () {
  25575. if (this.readOnly) {
  25576. throw "This set is readonly";
  25577. }
  25578. this.configs = [];
  25579. this.cachedHashCode = -1;
  25580. this.configLookup = new Set();
  25581. };
  25582. ATNConfigSet.prototype.setReadonly = function (readOnly) {
  25583. this.readOnly = readOnly;
  25584. if (readOnly) {
  25585. this.configLookup = null; // can't mod, no need for lookup cache
  25586. }
  25587. };
  25588. ATNConfigSet.prototype.toString = function () {
  25589. 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" : "");
  25590. };
  25591. function OrderedATNConfigSet() {
  25592. ATNConfigSet.call(this);
  25593. this.configLookup = new Set();
  25594. return this;
  25595. }
  25596. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  25597. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  25598. exports.ATNConfigSet = ATNConfigSet;
  25599. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  25600. /***/ }),
  25601. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  25602. /*!**************************************************************!*\
  25603. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  25604. \**************************************************************/
  25605. /*! no static exports found */
  25606. /***/ (function(module, exports, __webpack_require__) {
  25607. "use strict";
  25608. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25609. * Use of this file is governed by the BSD 3-clause license that
  25610. * can be found in the LICENSE.txt file in the project root.
  25611. */
  25612. function ATNDeserializationOptions(copyFrom) {
  25613. if (copyFrom === undefined) {
  25614. copyFrom = null;
  25615. }
  25616. this.readOnly = false;
  25617. this.verifyATN = copyFrom === null ? true : copyFrom.verifyATN;
  25618. this.generateRuleBypassTransitions = copyFrom === null ? false : copyFrom.generateRuleBypassTransitions;
  25619. return this;
  25620. }
  25621. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  25622. ATNDeserializationOptions.defaultOptions.readOnly = true;
  25623. // def __setattr__(self, key, value):
  25624. // if key!="readOnly" and self.readOnly:
  25625. // raise Exception("The object is read only.")
  25626. // super(type(self), self).__setattr__(key,value)
  25627. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  25628. /***/ }),
  25629. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  25630. /*!****************************************************!*\
  25631. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  25632. \****************************************************/
  25633. /*! no static exports found */
  25634. /***/ (function(module, exports, __webpack_require__) {
  25635. "use strict";
  25636. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  25637. * Use of this file is governed by the BSD 3-clause license that
  25638. * can be found in the LICENSE.txt file in the project root.
  25639. */
  25640. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  25641. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  25642. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  25643. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  25644. var ATNState = ATNStates.ATNState;
  25645. var BasicState = ATNStates.BasicState;
  25646. var DecisionState = ATNStates.DecisionState;
  25647. var BlockStartState = ATNStates.BlockStartState;
  25648. var BlockEndState = ATNStates.BlockEndState;
  25649. var LoopEndState = ATNStates.LoopEndState;
  25650. var RuleStartState = ATNStates.RuleStartState;
  25651. var RuleStopState = ATNStates.RuleStopState;
  25652. var TokensStartState = ATNStates.TokensStartState;
  25653. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  25654. var StarLoopbackState = ATNStates.StarLoopbackState;
  25655. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  25656. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  25657. var StarBlockStartState = ATNStates.StarBlockStartState;
  25658. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  25659. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  25660. var Transition = Transitions.Transition;
  25661. var AtomTransition = Transitions.AtomTransition;
  25662. var SetTransition = Transitions.SetTransition;
  25663. var NotSetTransition = Transitions.NotSetTransition;
  25664. var RuleTransition = Transitions.RuleTransition;
  25665. var RangeTransition = Transitions.RangeTransition;
  25666. var ActionTransition = Transitions.ActionTransition;
  25667. var EpsilonTransition = Transitions.EpsilonTransition;
  25668. var WildcardTransition = Transitions.WildcardTransition;
  25669. var PredicateTransition = Transitions.PredicateTransition;
  25670. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  25671. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  25672. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  25673. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  25674. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  25675. var LexerActionType = LexerActions.LexerActionType;
  25676. var LexerSkipAction = LexerActions.LexerSkipAction;
  25677. var LexerChannelAction = LexerActions.LexerChannelAction;
  25678. var LexerCustomAction = LexerActions.LexerCustomAction;
  25679. var LexerMoreAction = LexerActions.LexerMoreAction;
  25680. var LexerTypeAction = LexerActions.LexerTypeAction;
  25681. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  25682. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  25683. var LexerModeAction = LexerActions.LexerModeAction;
  25684. // This is the earliest supported serialized UUID.
  25685. // stick to serialized version for now, we don't need a UUID instance
  25686. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  25687. //
  25688. // This UUID indicates the serialized ATN contains two sets of
  25689. // IntervalSets, where the second set's values are encoded as
  25690. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  25691. //
  25692. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  25693. // This list contains all of the currently supported UUIDs, ordered by when
  25694. // the feature first appeared in this branch.
  25695. var SUPPORTED_UUIDS = [BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP];
  25696. var SERIALIZED_VERSION = 3;
  25697. // This is the current serialized UUID.
  25698. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  25699. function initArray(length, value) {
  25700. var tmp = [];
  25701. tmp[length - 1] = value;
  25702. return tmp.map(function (i) {
  25703. return value;
  25704. });
  25705. }
  25706. function ATNDeserializer(options) {
  25707. if (options === undefined || options === null) {
  25708. options = ATNDeserializationOptions.defaultOptions;
  25709. }
  25710. this.deserializationOptions = options;
  25711. this.stateFactories = null;
  25712. this.actionFactories = null;
  25713. return this;
  25714. }
  25715. // Determines if a particular serialized representation of an ATN supports
  25716. // a particular feature, identified by the {@link UUID} used for serializing
  25717. // the ATN at the time the feature was first introduced.
  25718. //
  25719. // @param feature The {@link UUID} marking the first time the feature was
  25720. // supported in the serialized ATN.
  25721. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  25722. // currently being deserialized.
  25723. // @return {@code true} if the {@code actualUuid} value represents a
  25724. // serialized ATN at or after the feature identified by {@code feature} was
  25725. // introduced; otherwise, {@code false}.
  25726. ATNDeserializer.prototype.isFeatureSupported = function (feature, actualUuid) {
  25727. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  25728. if (idx1 < 0) {
  25729. return false;
  25730. }
  25731. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  25732. return idx2 >= idx1;
  25733. };
  25734. ATNDeserializer.prototype.deserialize = function (data) {
  25735. this.reset(data);
  25736. this.checkVersion();
  25737. this.checkUUID();
  25738. var atn = this.readATN();
  25739. this.readStates(atn);
  25740. this.readRules(atn);
  25741. this.readModes(atn);
  25742. var sets = [];
  25743. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  25744. this.readSets(atn, sets, this.readInt.bind(this));
  25745. // Next, if the ATN was serialized with the Unicode SMP feature,
  25746. // deserialize sets with 32-bit arguments <= U+10FFFF.
  25747. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  25748. this.readSets(atn, sets, this.readInt32.bind(this));
  25749. }
  25750. this.readEdges(atn, sets);
  25751. this.readDecisions(atn);
  25752. this.readLexerActions(atn);
  25753. this.markPrecedenceDecisions(atn);
  25754. this.verifyATN(atn);
  25755. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER) {
  25756. this.generateRuleBypassTransitions(atn);
  25757. // re-verify after modification
  25758. this.verifyATN(atn);
  25759. }
  25760. return atn;
  25761. };
  25762. ATNDeserializer.prototype.reset = function (data) {
  25763. var adjust = function adjust(c) {
  25764. var v = c.charCodeAt(0);
  25765. return v > 1 ? v - 2 : v + 65533;
  25766. };
  25767. var temp = data.split("").map(adjust);
  25768. // don't adjust the first value since that's the version number
  25769. temp[0] = data.charCodeAt(0);
  25770. this.data = temp;
  25771. this.pos = 0;
  25772. };
  25773. ATNDeserializer.prototype.checkVersion = function () {
  25774. var version = this.readInt();
  25775. if (version !== SERIALIZED_VERSION) {
  25776. throw "Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").";
  25777. }
  25778. };
  25779. ATNDeserializer.prototype.checkUUID = function () {
  25780. var uuid = this.readUUID();
  25781. if (SUPPORTED_UUIDS.indexOf(uuid) < 0) {
  25782. throw "Could not deserialize ATN with UUID: " + uuid + " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID;
  25783. }
  25784. this.uuid = uuid;
  25785. };
  25786. ATNDeserializer.prototype.readATN = function () {
  25787. var grammarType = this.readInt();
  25788. var maxTokenType = this.readInt();
  25789. return new ATN(grammarType, maxTokenType);
  25790. };
  25791. ATNDeserializer.prototype.readStates = function (atn) {
  25792. var j, pair, stateNumber;
  25793. var loopBackStateNumbers = [];
  25794. var endStateNumbers = [];
  25795. var nstates = this.readInt();
  25796. for (var i = 0; i < nstates; i++) {
  25797. var stype = this.readInt();
  25798. // ignore bad type of states
  25799. if (stype === ATNState.INVALID_TYPE) {
  25800. atn.addState(null);
  25801. continue;
  25802. }
  25803. var ruleIndex = this.readInt();
  25804. if (ruleIndex === 0xFFFF) {
  25805. ruleIndex = -1;
  25806. }
  25807. var s = this.stateFactory(stype, ruleIndex);
  25808. if (stype === ATNState.LOOP_END) {
  25809. // special case
  25810. var loopBackStateNumber = this.readInt();
  25811. loopBackStateNumbers.push([s, loopBackStateNumber]);
  25812. } else if (s instanceof BlockStartState) {
  25813. var endStateNumber = this.readInt();
  25814. endStateNumbers.push([s, endStateNumber]);
  25815. }
  25816. atn.addState(s);
  25817. }
  25818. // delay the assignment of loop back and end states until we know all the
  25819. // state instances have been initialized
  25820. for (j = 0; j < loopBackStateNumbers.length; j++) {
  25821. pair = loopBackStateNumbers[j];
  25822. pair[0].loopBackState = atn.states[pair[1]];
  25823. }
  25824. for (j = 0; j < endStateNumbers.length; j++) {
  25825. pair = endStateNumbers[j];
  25826. pair[0].endState = atn.states[pair[1]];
  25827. }
  25828. var numNonGreedyStates = this.readInt();
  25829. for (j = 0; j < numNonGreedyStates; j++) {
  25830. stateNumber = this.readInt();
  25831. atn.states[stateNumber].nonGreedy = true;
  25832. }
  25833. var numPrecedenceStates = this.readInt();
  25834. for (j = 0; j < numPrecedenceStates; j++) {
  25835. stateNumber = this.readInt();
  25836. atn.states[stateNumber].isPrecedenceRule = true;
  25837. }
  25838. };
  25839. ATNDeserializer.prototype.readRules = function (atn) {
  25840. var i;
  25841. var nrules = this.readInt();
  25842. if (atn.grammarType === ATNType.LEXER) {
  25843. atn.ruleToTokenType = initArray(nrules, 0);
  25844. }
  25845. atn.ruleToStartState = initArray(nrules, 0);
  25846. for (i = 0; i < nrules; i++) {
  25847. var s = this.readInt();
  25848. var startState = atn.states[s];
  25849. atn.ruleToStartState[i] = startState;
  25850. if (atn.grammarType === ATNType.LEXER) {
  25851. var tokenType = this.readInt();
  25852. if (tokenType === 0xFFFF) {
  25853. tokenType = Token.EOF;
  25854. }
  25855. atn.ruleToTokenType[i] = tokenType;
  25856. }
  25857. }
  25858. atn.ruleToStopState = initArray(nrules, 0);
  25859. for (i = 0; i < atn.states.length; i++) {
  25860. var state = atn.states[i];
  25861. if (!(state instanceof RuleStopState)) {
  25862. continue;
  25863. }
  25864. atn.ruleToStopState[state.ruleIndex] = state;
  25865. atn.ruleToStartState[state.ruleIndex].stopState = state;
  25866. }
  25867. };
  25868. ATNDeserializer.prototype.readModes = function (atn) {
  25869. var nmodes = this.readInt();
  25870. for (var i = 0; i < nmodes; i++) {
  25871. var s = this.readInt();
  25872. atn.modeToStartState.push(atn.states[s]);
  25873. }
  25874. };
  25875. ATNDeserializer.prototype.readSets = function (atn, sets, readUnicode) {
  25876. var m = this.readInt();
  25877. for (var i = 0; i < m; i++) {
  25878. var iset = new IntervalSet();
  25879. sets.push(iset);
  25880. var n = this.readInt();
  25881. var containsEof = this.readInt();
  25882. if (containsEof !== 0) {
  25883. iset.addOne(-1);
  25884. }
  25885. for (var j = 0; j < n; j++) {
  25886. var i1 = readUnicode();
  25887. var i2 = readUnicode();
  25888. iset.addRange(i1, i2);
  25889. }
  25890. }
  25891. };
  25892. ATNDeserializer.prototype.readEdges = function (atn, sets) {
  25893. var i, j, state, trans, target;
  25894. var nedges = this.readInt();
  25895. for (i = 0; i < nedges; i++) {
  25896. var src = this.readInt();
  25897. var trg = this.readInt();
  25898. var ttype = this.readInt();
  25899. var arg1 = this.readInt();
  25900. var arg2 = this.readInt();
  25901. var arg3 = this.readInt();
  25902. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  25903. var srcState = atn.states[src];
  25904. srcState.addTransition(trans);
  25905. }
  25906. // edges for rule stop states can be derived, so they aren't serialized
  25907. for (i = 0; i < atn.states.length; i++) {
  25908. state = atn.states[i];
  25909. for (j = 0; j < state.transitions.length; j++) {
  25910. var t = state.transitions[j];
  25911. if (!(t instanceof RuleTransition)) {
  25912. continue;
  25913. }
  25914. var outermostPrecedenceReturn = -1;
  25915. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  25916. if (t.precedence === 0) {
  25917. outermostPrecedenceReturn = t.target.ruleIndex;
  25918. }
  25919. }
  25920. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  25921. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  25922. }
  25923. }
  25924. for (i = 0; i < atn.states.length; i++) {
  25925. state = atn.states[i];
  25926. if (state instanceof BlockStartState) {
  25927. // we need to know the end state to set its start state
  25928. if (state.endState === null) {
  25929. throw "IllegalState";
  25930. }
  25931. // block end states can only be associated to a single block start
  25932. // state
  25933. if (state.endState.startState !== null) {
  25934. throw "IllegalState";
  25935. }
  25936. state.endState.startState = state;
  25937. }
  25938. if (state instanceof PlusLoopbackState) {
  25939. for (j = 0; j < state.transitions.length; j++) {
  25940. target = state.transitions[j].target;
  25941. if (target instanceof PlusBlockStartState) {
  25942. target.loopBackState = state;
  25943. }
  25944. }
  25945. } else if (state instanceof StarLoopbackState) {
  25946. for (j = 0; j < state.transitions.length; j++) {
  25947. target = state.transitions[j].target;
  25948. if (target instanceof StarLoopEntryState) {
  25949. target.loopBackState = state;
  25950. }
  25951. }
  25952. }
  25953. }
  25954. };
  25955. ATNDeserializer.prototype.readDecisions = function (atn) {
  25956. var ndecisions = this.readInt();
  25957. for (var i = 0; i < ndecisions; i++) {
  25958. var s = this.readInt();
  25959. var decState = atn.states[s];
  25960. atn.decisionToState.push(decState);
  25961. decState.decision = i;
  25962. }
  25963. };
  25964. ATNDeserializer.prototype.readLexerActions = function (atn) {
  25965. if (atn.grammarType === ATNType.LEXER) {
  25966. var count = this.readInt();
  25967. atn.lexerActions = initArray(count, null);
  25968. for (var i = 0; i < count; i++) {
  25969. var actionType = this.readInt();
  25970. var data1 = this.readInt();
  25971. if (data1 === 0xFFFF) {
  25972. data1 = -1;
  25973. }
  25974. var data2 = this.readInt();
  25975. if (data2 === 0xFFFF) {
  25976. data2 = -1;
  25977. }
  25978. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  25979. atn.lexerActions[i] = lexerAction;
  25980. }
  25981. }
  25982. };
  25983. ATNDeserializer.prototype.generateRuleBypassTransitions = function (atn) {
  25984. var i;
  25985. var count = atn.ruleToStartState.length;
  25986. for (i = 0; i < count; i++) {
  25987. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  25988. }
  25989. for (i = 0; i < count; i++) {
  25990. this.generateRuleBypassTransition(atn, i);
  25991. }
  25992. };
  25993. ATNDeserializer.prototype.generateRuleBypassTransition = function (atn, idx) {
  25994. var i, state;
  25995. var bypassStart = new BasicBlockStartState();
  25996. bypassStart.ruleIndex = idx;
  25997. atn.addState(bypassStart);
  25998. var bypassStop = new BlockEndState();
  25999. bypassStop.ruleIndex = idx;
  26000. atn.addState(bypassStop);
  26001. bypassStart.endState = bypassStop;
  26002. atn.defineDecisionState(bypassStart);
  26003. bypassStop.startState = bypassStart;
  26004. var excludeTransition = null;
  26005. var endState = null;
  26006. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  26007. // wrap from the beginning of the rule to the StarLoopEntryState
  26008. endState = null;
  26009. for (i = 0; i < atn.states.length; i++) {
  26010. state = atn.states[i];
  26011. if (this.stateIsEndStateFor(state, idx)) {
  26012. endState = state;
  26013. excludeTransition = state.loopBackState.transitions[0];
  26014. break;
  26015. }
  26016. }
  26017. if (excludeTransition === null) {
  26018. throw "Couldn't identify final state of the precedence rule prefix section.";
  26019. }
  26020. } else {
  26021. endState = atn.ruleToStopState[idx];
  26022. }
  26023. // all non-excluded transitions that currently target end state need to
  26024. // target blockEnd instead
  26025. for (i = 0; i < atn.states.length; i++) {
  26026. state = atn.states[i];
  26027. for (var j = 0; j < state.transitions.length; j++) {
  26028. var transition = state.transitions[j];
  26029. if (transition === excludeTransition) {
  26030. continue;
  26031. }
  26032. if (transition.target === endState) {
  26033. transition.target = bypassStop;
  26034. }
  26035. }
  26036. }
  26037. // all transitions leaving the rule start state need to leave blockStart
  26038. // instead
  26039. var ruleToStartState = atn.ruleToStartState[idx];
  26040. var count = ruleToStartState.transitions.length;
  26041. while (count > 0) {
  26042. bypassStart.addTransition(ruleToStartState.transitions[count - 1]);
  26043. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  26044. }
  26045. // link the new states
  26046. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  26047. bypassStop.addTransition(new EpsilonTransition(endState));
  26048. var matchState = new BasicState();
  26049. atn.addState(matchState);
  26050. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  26051. bypassStart.addTransition(new EpsilonTransition(matchState));
  26052. };
  26053. ATNDeserializer.prototype.stateIsEndStateFor = function (state, idx) {
  26054. if (state.ruleIndex !== idx) {
  26055. return null;
  26056. }
  26057. if (!(state instanceof StarLoopEntryState)) {
  26058. return null;
  26059. }
  26060. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26061. if (!(maybeLoopEndState instanceof LoopEndState)) {
  26062. return null;
  26063. }
  26064. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26065. return state;
  26066. } else {
  26067. return null;
  26068. }
  26069. };
  26070. //
  26071. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  26072. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  26073. // correct value.
  26074. //
  26075. // @param atn The ATN.
  26076. //
  26077. ATNDeserializer.prototype.markPrecedenceDecisions = function (atn) {
  26078. for (var i = 0; i < atn.states.length; i++) {
  26079. var state = atn.states[i];
  26080. if (!(state instanceof StarLoopEntryState)) {
  26081. continue;
  26082. }
  26083. // We analyze the ATN to determine if this ATN decision state is the
  26084. // decision for the closure block that determines whether a
  26085. // precedence rule should continue or complete.
  26086. //
  26087. if (atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  26088. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  26089. if (maybeLoopEndState instanceof LoopEndState) {
  26090. if (maybeLoopEndState.epsilonOnlyTransitions && maybeLoopEndState.transitions[0].target instanceof RuleStopState) {
  26091. state.isPrecedenceDecision = true;
  26092. }
  26093. }
  26094. }
  26095. }
  26096. };
  26097. ATNDeserializer.prototype.verifyATN = function (atn) {
  26098. if (!this.deserializationOptions.verifyATN) {
  26099. return;
  26100. }
  26101. // verify assumptions
  26102. for (var i = 0; i < atn.states.length; i++) {
  26103. var state = atn.states[i];
  26104. if (state === null) {
  26105. continue;
  26106. }
  26107. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  26108. if (state instanceof PlusBlockStartState) {
  26109. this.checkCondition(state.loopBackState !== null);
  26110. } else if (state instanceof StarLoopEntryState) {
  26111. this.checkCondition(state.loopBackState !== null);
  26112. this.checkCondition(state.transitions.length === 2);
  26113. if (state.transitions[0].target instanceof StarBlockStartState) {
  26114. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  26115. this.checkCondition(!state.nonGreedy);
  26116. } else if (state.transitions[0].target instanceof LoopEndState) {
  26117. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  26118. this.checkCondition(state.nonGreedy);
  26119. } else {
  26120. throw "IllegalState";
  26121. }
  26122. } else if (state instanceof StarLoopbackState) {
  26123. this.checkCondition(state.transitions.length === 1);
  26124. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  26125. } else if (state instanceof LoopEndState) {
  26126. this.checkCondition(state.loopBackState !== null);
  26127. } else if (state instanceof RuleStartState) {
  26128. this.checkCondition(state.stopState !== null);
  26129. } else if (state instanceof BlockStartState) {
  26130. this.checkCondition(state.endState !== null);
  26131. } else if (state instanceof BlockEndState) {
  26132. this.checkCondition(state.startState !== null);
  26133. } else if (state instanceof DecisionState) {
  26134. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  26135. } else {
  26136. this.checkCondition(state.transitions.length <= 1 || state instanceof RuleStopState);
  26137. }
  26138. }
  26139. };
  26140. ATNDeserializer.prototype.checkCondition = function (condition, message) {
  26141. if (!condition) {
  26142. if (message === undefined || message === null) {
  26143. message = "IllegalState";
  26144. }
  26145. throw message;
  26146. }
  26147. };
  26148. ATNDeserializer.prototype.readInt = function () {
  26149. return this.data[this.pos++];
  26150. };
  26151. ATNDeserializer.prototype.readInt32 = function () {
  26152. var low = this.readInt();
  26153. var high = this.readInt();
  26154. return low | high << 16;
  26155. };
  26156. ATNDeserializer.prototype.readLong = function () {
  26157. var low = this.readInt32();
  26158. var high = this.readInt32();
  26159. return low & 0x00000000FFFFFFFF | high << 32;
  26160. };
  26161. function createByteToHex() {
  26162. var bth = [];
  26163. for (var i = 0; i < 256; i++) {
  26164. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  26165. }
  26166. return bth;
  26167. }
  26168. var byteToHex = createByteToHex();
  26169. ATNDeserializer.prototype.readUUID = function () {
  26170. var bb = [];
  26171. for (var i = 7; i >= 0; i--) {
  26172. var int = this.readInt();
  26173. /* jshint bitwise: false */
  26174. bb[2 * i + 1] = int & 0xFF;
  26175. bb[2 * i] = int >> 8 & 0xFF;
  26176. }
  26177. 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]];
  26178. };
  26179. ATNDeserializer.prototype.edgeFactory = function (atn, type, src, trg, arg1, arg2, arg3, sets) {
  26180. var target = atn.states[trg];
  26181. switch (type) {
  26182. case Transition.EPSILON:
  26183. return new EpsilonTransition(target);
  26184. case Transition.RANGE:
  26185. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  26186. case Transition.RULE:
  26187. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  26188. case Transition.PREDICATE:
  26189. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  26190. case Transition.PRECEDENCE:
  26191. return new PrecedencePredicateTransition(target, arg1);
  26192. case Transition.ATOM:
  26193. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  26194. case Transition.ACTION:
  26195. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  26196. case Transition.SET:
  26197. return new SetTransition(target, sets[arg1]);
  26198. case Transition.NOT_SET:
  26199. return new NotSetTransition(target, sets[arg1]);
  26200. case Transition.WILDCARD:
  26201. return new WildcardTransition(target);
  26202. default:
  26203. throw "The specified transition type: " + type + " is not valid.";
  26204. }
  26205. };
  26206. ATNDeserializer.prototype.stateFactory = function (type, ruleIndex) {
  26207. if (this.stateFactories === null) {
  26208. var sf = [];
  26209. sf[ATNState.INVALID_TYPE] = null;
  26210. sf[ATNState.BASIC] = function () {
  26211. return new BasicState();
  26212. };
  26213. sf[ATNState.RULE_START] = function () {
  26214. return new RuleStartState();
  26215. };
  26216. sf[ATNState.BLOCK_START] = function () {
  26217. return new BasicBlockStartState();
  26218. };
  26219. sf[ATNState.PLUS_BLOCK_START] = function () {
  26220. return new PlusBlockStartState();
  26221. };
  26222. sf[ATNState.STAR_BLOCK_START] = function () {
  26223. return new StarBlockStartState();
  26224. };
  26225. sf[ATNState.TOKEN_START] = function () {
  26226. return new TokensStartState();
  26227. };
  26228. sf[ATNState.RULE_STOP] = function () {
  26229. return new RuleStopState();
  26230. };
  26231. sf[ATNState.BLOCK_END] = function () {
  26232. return new BlockEndState();
  26233. };
  26234. sf[ATNState.STAR_LOOP_BACK] = function () {
  26235. return new StarLoopbackState();
  26236. };
  26237. sf[ATNState.STAR_LOOP_ENTRY] = function () {
  26238. return new StarLoopEntryState();
  26239. };
  26240. sf[ATNState.PLUS_LOOP_BACK] = function () {
  26241. return new PlusLoopbackState();
  26242. };
  26243. sf[ATNState.LOOP_END] = function () {
  26244. return new LoopEndState();
  26245. };
  26246. this.stateFactories = sf;
  26247. }
  26248. if (type > this.stateFactories.length || this.stateFactories[type] === null) {
  26249. throw "The specified state type " + type + " is not valid.";
  26250. } else {
  26251. var s = this.stateFactories[type]();
  26252. if (s !== null) {
  26253. s.ruleIndex = ruleIndex;
  26254. return s;
  26255. }
  26256. }
  26257. };
  26258. ATNDeserializer.prototype.lexerActionFactory = function (type, data1, data2) {
  26259. if (this.actionFactories === null) {
  26260. var af = [];
  26261. af[LexerActionType.CHANNEL] = function (data1, data2) {
  26262. return new LexerChannelAction(data1);
  26263. };
  26264. af[LexerActionType.CUSTOM] = function (data1, data2) {
  26265. return new LexerCustomAction(data1, data2);
  26266. };
  26267. af[LexerActionType.MODE] = function (data1, data2) {
  26268. return new LexerModeAction(data1);
  26269. };
  26270. af[LexerActionType.MORE] = function (data1, data2) {
  26271. return LexerMoreAction.INSTANCE;
  26272. };
  26273. af[LexerActionType.POP_MODE] = function (data1, data2) {
  26274. return LexerPopModeAction.INSTANCE;
  26275. };
  26276. af[LexerActionType.PUSH_MODE] = function (data1, data2) {
  26277. return new LexerPushModeAction(data1);
  26278. };
  26279. af[LexerActionType.SKIP] = function (data1, data2) {
  26280. return LexerSkipAction.INSTANCE;
  26281. };
  26282. af[LexerActionType.TYPE] = function (data1, data2) {
  26283. return new LexerTypeAction(data1);
  26284. };
  26285. this.actionFactories = af;
  26286. }
  26287. if (type > this.actionFactories.length || this.actionFactories[type] === null) {
  26288. throw "The specified lexer action type " + type + " is not valid.";
  26289. } else {
  26290. return this.actionFactories[type](data1, data2);
  26291. }
  26292. };
  26293. exports.ATNDeserializer = ATNDeserializer;
  26294. /***/ }),
  26295. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  26296. /*!*************************************************!*\
  26297. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  26298. \*************************************************/
  26299. /*! no static exports found */
  26300. /***/ (function(module, exports, __webpack_require__) {
  26301. "use strict";
  26302. //
  26303. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26304. * Use of this file is governed by the BSD 3-clause license that
  26305. * can be found in the LICENSE.txt file in the project root.
  26306. */
  26307. ///
  26308. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26309. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26310. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  26311. function ATNSimulator(atn, sharedContextCache) {
  26312. // The context cache maps all PredictionContext objects that are ==
  26313. // to a single cached copy. This cache is shared across all contexts
  26314. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  26315. // to use only cached nodes/graphs in addDFAState(). We don't want to
  26316. // fill this during closure() since there are lots of contexts that
  26317. // pop up but are not used ever again. It also greatly slows down closure().
  26318. //
  26319. // <p>This cache makes a huge difference in memory and a little bit in speed.
  26320. // For the Java grammar on java.*, it dropped the memory requirements
  26321. // at the end from 25M to 16M. We don't store any of the full context
  26322. // graphs in the DFA because they are limited to local context only,
  26323. // but apparently there's a lot of repetition there as well. We optimize
  26324. // the config contexts before storing the config set in the DFA states
  26325. // by literally rebuilding them with cached subgraphs only.</p>
  26326. //
  26327. // <p>I tried a cache for use during closure operations, that was
  26328. // whacked after each adaptivePredict(). It cost a little bit
  26329. // more time I think and doesn't save on the overall footprint
  26330. // so it's not worth the complexity.</p>
  26331. ///
  26332. this.atn = atn;
  26333. this.sharedContextCache = sharedContextCache;
  26334. return this;
  26335. }
  26336. // Must distinguish between missing edge and edge we know leads nowhere///
  26337. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  26338. ATNSimulator.prototype.getCachedContext = function (context) {
  26339. if (this.sharedContextCache === null) {
  26340. return context;
  26341. }
  26342. var visited = {};
  26343. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  26344. };
  26345. exports.ATNSimulator = ATNSimulator;
  26346. /***/ }),
  26347. /***/ "./node_modules/antlr4/atn/ATNState.js":
  26348. /*!*********************************************!*\
  26349. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  26350. \*********************************************/
  26351. /*! no static exports found */
  26352. /***/ (function(module, exports, __webpack_require__) {
  26353. "use strict";
  26354. //
  26355. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26356. * Use of this file is governed by the BSD 3-clause license that
  26357. * can be found in the LICENSE.txt file in the project root.
  26358. */
  26359. //
  26360. // The following images show the relation of states and
  26361. // {@link ATNState//transitions} for various grammar constructs.
  26362. //
  26363. // <ul>
  26364. //
  26365. // <li>Solid edges marked with an &//0949; indicate a required
  26366. // {@link EpsilonTransition}.</li>
  26367. //
  26368. // <li>Dashed edges indicate locations where any transition derived from
  26369. // {@link Transition} might appear.</li>
  26370. //
  26371. // <li>Dashed nodes are place holders for either a sequence of linked
  26372. // {@link BasicState} states or the inclusion of a block representing a nested
  26373. // construct in one of the forms below.</li>
  26374. //
  26375. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  26376. // any number of alternatives (one or more). Nodes without the {@code ...} only
  26377. // support the exact number of alternatives shown in the diagram.</li>
  26378. //
  26379. // </ul>
  26380. //
  26381. // <h2>Basic Blocks</h2>
  26382. //
  26383. // <h3>Rule</h3>
  26384. //
  26385. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  26386. //
  26387. // <h3>Block of 1 or more alternatives</h3>
  26388. //
  26389. // <embed src="images/Block.svg" type="image/svg+xml"/>
  26390. //
  26391. // <h2>Greedy Loops</h2>
  26392. //
  26393. // <h3>Greedy Closure: {@code (...)*}</h3>
  26394. //
  26395. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  26396. //
  26397. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  26398. //
  26399. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  26400. //
  26401. // <h3>Greedy Optional: {@code (...)?}</h3>
  26402. //
  26403. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  26404. //
  26405. // <h2>Non-Greedy Loops</h2>
  26406. //
  26407. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  26408. //
  26409. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  26410. //
  26411. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  26412. //
  26413. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  26414. //
  26415. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  26416. //
  26417. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  26418. //
  26419. var INITIAL_NUM_TRANSITIONS = 4;
  26420. function ATNState() {
  26421. // Which ATN are we in?
  26422. this.atn = null;
  26423. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  26424. this.stateType = null;
  26425. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  26426. this.epsilonOnlyTransitions = false;
  26427. // Track the transitions emanating from this ATN state.
  26428. this.transitions = [];
  26429. // Used to cache lookahead during parsing, not used during construction
  26430. this.nextTokenWithinRule = null;
  26431. return this;
  26432. }
  26433. // constants for serialization
  26434. ATNState.INVALID_TYPE = 0;
  26435. ATNState.BASIC = 1;
  26436. ATNState.RULE_START = 2;
  26437. ATNState.BLOCK_START = 3;
  26438. ATNState.PLUS_BLOCK_START = 4;
  26439. ATNState.STAR_BLOCK_START = 5;
  26440. ATNState.TOKEN_START = 6;
  26441. ATNState.RULE_STOP = 7;
  26442. ATNState.BLOCK_END = 8;
  26443. ATNState.STAR_LOOP_BACK = 9;
  26444. ATNState.STAR_LOOP_ENTRY = 10;
  26445. ATNState.PLUS_LOOP_BACK = 11;
  26446. ATNState.LOOP_END = 12;
  26447. 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"];
  26448. ATNState.INVALID_STATE_NUMBER = -1;
  26449. ATNState.prototype.toString = function () {
  26450. return this.stateNumber;
  26451. };
  26452. ATNState.prototype.equals = function (other) {
  26453. if (other instanceof ATNState) {
  26454. return this.stateNumber === other.stateNumber;
  26455. } else {
  26456. return false;
  26457. }
  26458. };
  26459. ATNState.prototype.isNonGreedyExitState = function () {
  26460. return false;
  26461. };
  26462. ATNState.prototype.addTransition = function (trans, index) {
  26463. if (index === undefined) {
  26464. index = -1;
  26465. }
  26466. if (this.transitions.length === 0) {
  26467. this.epsilonOnlyTransitions = trans.isEpsilon;
  26468. } else if (this.epsilonOnlyTransitions !== trans.isEpsilon) {
  26469. this.epsilonOnlyTransitions = false;
  26470. }
  26471. if (index === -1) {
  26472. this.transitions.push(trans);
  26473. } else {
  26474. this.transitions.splice(index, 1, trans);
  26475. }
  26476. };
  26477. function BasicState() {
  26478. ATNState.call(this);
  26479. this.stateType = ATNState.BASIC;
  26480. return this;
  26481. }
  26482. BasicState.prototype = Object.create(ATNState.prototype);
  26483. BasicState.prototype.constructor = BasicState;
  26484. function DecisionState() {
  26485. ATNState.call(this);
  26486. this.decision = -1;
  26487. this.nonGreedy = false;
  26488. return this;
  26489. }
  26490. DecisionState.prototype = Object.create(ATNState.prototype);
  26491. DecisionState.prototype.constructor = DecisionState;
  26492. // The start of a regular {@code (...)} block.
  26493. function BlockStartState() {
  26494. DecisionState.call(this);
  26495. this.endState = null;
  26496. return this;
  26497. }
  26498. BlockStartState.prototype = Object.create(DecisionState.prototype);
  26499. BlockStartState.prototype.constructor = BlockStartState;
  26500. function BasicBlockStartState() {
  26501. BlockStartState.call(this);
  26502. this.stateType = ATNState.BLOCK_START;
  26503. return this;
  26504. }
  26505. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26506. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  26507. // Terminal node of a simple {@code (a|b|c)} block.
  26508. function BlockEndState() {
  26509. ATNState.call(this);
  26510. this.stateType = ATNState.BLOCK_END;
  26511. this.startState = null;
  26512. return this;
  26513. }
  26514. BlockEndState.prototype = Object.create(ATNState.prototype);
  26515. BlockEndState.prototype.constructor = BlockEndState;
  26516. // The last node in the ATN for a rule, unless that rule is the start symbol.
  26517. // In that case, there is one transition to EOF. Later, we might encode
  26518. // references to all calls to this rule to compute FOLLOW sets for
  26519. // error handling.
  26520. //
  26521. function RuleStopState() {
  26522. ATNState.call(this);
  26523. this.stateType = ATNState.RULE_STOP;
  26524. return this;
  26525. }
  26526. RuleStopState.prototype = Object.create(ATNState.prototype);
  26527. RuleStopState.prototype.constructor = RuleStopState;
  26528. function RuleStartState() {
  26529. ATNState.call(this);
  26530. this.stateType = ATNState.RULE_START;
  26531. this.stopState = null;
  26532. this.isPrecedenceRule = false;
  26533. return this;
  26534. }
  26535. RuleStartState.prototype = Object.create(ATNState.prototype);
  26536. RuleStartState.prototype.constructor = RuleStartState;
  26537. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  26538. // one to the loop back to start of the block and one to exit.
  26539. //
  26540. function PlusLoopbackState() {
  26541. DecisionState.call(this);
  26542. this.stateType = ATNState.PLUS_LOOP_BACK;
  26543. return this;
  26544. }
  26545. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  26546. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  26547. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  26548. // we don't use for code generation; somebody might need it, so I'm defining
  26549. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  26550. // real decision-making note for {@code A+}.
  26551. //
  26552. function PlusBlockStartState() {
  26553. BlockStartState.call(this);
  26554. this.stateType = ATNState.PLUS_BLOCK_START;
  26555. this.loopBackState = null;
  26556. return this;
  26557. }
  26558. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26559. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  26560. // The block that begins a closure loop.
  26561. function StarBlockStartState() {
  26562. BlockStartState.call(this);
  26563. this.stateType = ATNState.STAR_BLOCK_START;
  26564. return this;
  26565. }
  26566. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  26567. StarBlockStartState.prototype.constructor = StarBlockStartState;
  26568. function StarLoopbackState() {
  26569. ATNState.call(this);
  26570. this.stateType = ATNState.STAR_LOOP_BACK;
  26571. return this;
  26572. }
  26573. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  26574. StarLoopbackState.prototype.constructor = StarLoopbackState;
  26575. function StarLoopEntryState() {
  26576. DecisionState.call(this);
  26577. this.stateType = ATNState.STAR_LOOP_ENTRY;
  26578. this.loopBackState = null;
  26579. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  26580. this.isPrecedenceDecision = null;
  26581. return this;
  26582. }
  26583. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  26584. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  26585. // Mark the end of a * or + loop.
  26586. function LoopEndState() {
  26587. ATNState.call(this);
  26588. this.stateType = ATNState.LOOP_END;
  26589. this.loopBackState = null;
  26590. return this;
  26591. }
  26592. LoopEndState.prototype = Object.create(ATNState.prototype);
  26593. LoopEndState.prototype.constructor = LoopEndState;
  26594. // The Tokens rule start state linking to each lexer rule start state */
  26595. function TokensStartState() {
  26596. DecisionState.call(this);
  26597. this.stateType = ATNState.TOKEN_START;
  26598. return this;
  26599. }
  26600. TokensStartState.prototype = Object.create(DecisionState.prototype);
  26601. TokensStartState.prototype.constructor = TokensStartState;
  26602. exports.ATNState = ATNState;
  26603. exports.BasicState = BasicState;
  26604. exports.DecisionState = DecisionState;
  26605. exports.BlockStartState = BlockStartState;
  26606. exports.BlockEndState = BlockEndState;
  26607. exports.LoopEndState = LoopEndState;
  26608. exports.RuleStartState = RuleStartState;
  26609. exports.RuleStopState = RuleStopState;
  26610. exports.TokensStartState = TokensStartState;
  26611. exports.PlusLoopbackState = PlusLoopbackState;
  26612. exports.StarLoopbackState = StarLoopbackState;
  26613. exports.StarLoopEntryState = StarLoopEntryState;
  26614. exports.PlusBlockStartState = PlusBlockStartState;
  26615. exports.StarBlockStartState = StarBlockStartState;
  26616. exports.BasicBlockStartState = BasicBlockStartState;
  26617. /***/ }),
  26618. /***/ "./node_modules/antlr4/atn/ATNType.js":
  26619. /*!********************************************!*\
  26620. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  26621. \********************************************/
  26622. /*! no static exports found */
  26623. /***/ (function(module, exports, __webpack_require__) {
  26624. "use strict";
  26625. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26626. * Use of this file is governed by the BSD 3-clause license that
  26627. * can be found in the LICENSE.txt file in the project root.
  26628. */
  26629. ///
  26630. // Represents the type of recognizer an ATN applies to.
  26631. function ATNType() {}
  26632. ATNType.LEXER = 0;
  26633. ATNType.PARSER = 1;
  26634. exports.ATNType = ATNType;
  26635. /***/ }),
  26636. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  26637. /*!******************************************************!*\
  26638. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  26639. \******************************************************/
  26640. /*! no static exports found */
  26641. /***/ (function(module, exports, __webpack_require__) {
  26642. "use strict";
  26643. //
  26644. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  26645. * Use of this file is governed by the BSD 3-clause license that
  26646. * can be found in the LICENSE.txt file in the project root.
  26647. */
  26648. ///
  26649. // When we hit an accept state in either the DFA or the ATN, we
  26650. // have to notify the character stream to start buffering characters
  26651. // via {@link IntStream//mark} and record the current state. The current sim state
  26652. // includes the current index into the input, the current line,
  26653. // and current character position in that line. Note that the Lexer is
  26654. // tracking the starting line and characterization of the token. These
  26655. // variables track the "state" of the simulator when it hits an accept state.
  26656. //
  26657. // <p>We track these variables separately for the DFA and ATN simulation
  26658. // because the DFA simulation often has to fail over to the ATN
  26659. // simulation. If the ATN simulation fails, we need the DFA to fall
  26660. // back to its previously accepted state, if any. If the ATN succeeds,
  26661. // then the ATN does the accept and the DFA simulator that invoked it
  26662. // can simply return the predicted token type.</p>
  26663. ///
  26664. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  26665. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  26666. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  26667. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  26668. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  26669. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  26670. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  26671. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  26672. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  26673. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  26674. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  26675. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  26676. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  26677. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  26678. function resetSimState(sim) {
  26679. sim.index = -1;
  26680. sim.line = 0;
  26681. sim.column = -1;
  26682. sim.dfaState = null;
  26683. }
  26684. function SimState() {
  26685. resetSimState(this);
  26686. return this;
  26687. }
  26688. SimState.prototype.reset = function () {
  26689. resetSimState(this);
  26690. };
  26691. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  26692. ATNSimulator.call(this, atn, sharedContextCache);
  26693. this.decisionToDFA = decisionToDFA;
  26694. this.recog = recog;
  26695. // The current token's starting index into the character stream.
  26696. // Shared across DFA to ATN simulation in case the ATN fails and the
  26697. // DFA did not have a previous accept state. In this case, we use the
  26698. // ATN-generated exception object.
  26699. this.startIndex = -1;
  26700. // line number 1..n within the input///
  26701. this.line = 1;
  26702. // The index of the character relative to the beginning of the line
  26703. // 0..n-1///
  26704. this.column = 0;
  26705. this.mode = Lexer.DEFAULT_MODE;
  26706. // Used during DFA/ATN exec to record the most recent accept configuration
  26707. // info
  26708. this.prevAccept = new SimState();
  26709. // done
  26710. return this;
  26711. }
  26712. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  26713. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  26714. LexerATNSimulator.debug = false;
  26715. LexerATNSimulator.dfa_debug = false;
  26716. LexerATNSimulator.MIN_DFA_EDGE = 0;
  26717. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  26718. LexerATNSimulator.match_calls = 0;
  26719. LexerATNSimulator.prototype.copyState = function (simulator) {
  26720. this.column = simulator.column;
  26721. this.line = simulator.line;
  26722. this.mode = simulator.mode;
  26723. this.startIndex = simulator.startIndex;
  26724. };
  26725. LexerATNSimulator.prototype.match = function (input, mode) {
  26726. this.match_calls += 1;
  26727. this.mode = mode;
  26728. var mark = input.mark();
  26729. try {
  26730. this.startIndex = input.index;
  26731. this.prevAccept.reset();
  26732. var dfa = this.decisionToDFA[mode];
  26733. if (dfa.s0 === null) {
  26734. return this.matchATN(input);
  26735. } else {
  26736. return this.execATN(input, dfa.s0);
  26737. }
  26738. } finally {
  26739. input.release(mark);
  26740. }
  26741. };
  26742. LexerATNSimulator.prototype.reset = function () {
  26743. this.prevAccept.reset();
  26744. this.startIndex = -1;
  26745. this.line = 1;
  26746. this.column = 0;
  26747. this.mode = Lexer.DEFAULT_MODE;
  26748. };
  26749. LexerATNSimulator.prototype.matchATN = function (input) {
  26750. var startState = this.atn.modeToStartState[this.mode];
  26751. if (LexerATNSimulator.debug) {
  26752. console.log("matchATN mode " + this.mode + " start: " + startState);
  26753. }
  26754. var old_mode = this.mode;
  26755. var s0_closure = this.computeStartState(input, startState);
  26756. var suppressEdge = s0_closure.hasSemanticContext;
  26757. s0_closure.hasSemanticContext = false;
  26758. var next = this.addDFAState(s0_closure);
  26759. if (!suppressEdge) {
  26760. this.decisionToDFA[this.mode].s0 = next;
  26761. }
  26762. var predict = this.execATN(input, next);
  26763. if (LexerATNSimulator.debug) {
  26764. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  26765. }
  26766. return predict;
  26767. };
  26768. LexerATNSimulator.prototype.execATN = function (input, ds0) {
  26769. if (LexerATNSimulator.debug) {
  26770. console.log("start state closure=" + ds0.configs);
  26771. }
  26772. if (ds0.isAcceptState) {
  26773. // allow zero-length tokens
  26774. this.captureSimState(this.prevAccept, input, ds0);
  26775. }
  26776. var t = input.LA(1);
  26777. var s = ds0; // s is current/from DFA state
  26778. while (true) {
  26779. // while more work
  26780. if (LexerATNSimulator.debug) {
  26781. console.log("execATN loop starting closure: " + s.configs);
  26782. }
  26783. // As we move src->trg, src->trg, we keep track of the previous trg to
  26784. // avoid looking up the DFA state again, which is expensive.
  26785. // If the previous target was already part of the DFA, we might
  26786. // be able to avoid doing a reach operation upon t. If s!=null,
  26787. // it means that semantic predicates didn't prevent us from
  26788. // creating a DFA state. Once we know s!=null, we check to see if
  26789. // the DFA state has an edge already for t. If so, we can just reuse
  26790. // it's configuration set; there's no point in re-computing it.
  26791. // This is kind of like doing DFA simulation within the ATN
  26792. // simulation because DFA simulation is really just a way to avoid
  26793. // computing reach/closure sets. Technically, once we know that
  26794. // we have a previously added DFA state, we could jump over to
  26795. // the DFA simulator. But, that would mean popping back and forth
  26796. // a lot and making things more complicated algorithmically.
  26797. // This optimization makes a lot of sense for loops within DFA.
  26798. // A character will take us back to an existing DFA state
  26799. // that already has lots of edges out of it. e.g., .* in comments.
  26800. // print("Target for:" + str(s) + " and:" + str(t))
  26801. var target = this.getExistingTargetState(s, t);
  26802. // print("Existing:" + str(target))
  26803. if (target === null) {
  26804. target = this.computeTargetState(input, s, t);
  26805. // print("Computed:" + str(target))
  26806. }
  26807. if (target === ATNSimulator.ERROR) {
  26808. break;
  26809. }
  26810. // If this is a consumable input element, make sure to consume before
  26811. // capturing the accept state so the input index, line, and char
  26812. // position accurately reflect the state of the interpreter at the
  26813. // end of the token.
  26814. if (t !== Token.EOF) {
  26815. this.consume(input);
  26816. }
  26817. if (target.isAcceptState) {
  26818. this.captureSimState(this.prevAccept, input, target);
  26819. if (t === Token.EOF) {
  26820. break;
  26821. }
  26822. }
  26823. t = input.LA(1);
  26824. s = target; // flip; current DFA target becomes new src/from state
  26825. }
  26826. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  26827. };
  26828. // Get an existing target state for an edge in the DFA. If the target state
  26829. // for the edge has not yet been computed or is otherwise not available,
  26830. // this method returns {@code null}.
  26831. //
  26832. // @param s The current DFA state
  26833. // @param t The next input symbol
  26834. // @return The existing target DFA state for the given input symbol
  26835. // {@code t}, or {@code null} if the target state for this edge is not
  26836. // already cached
  26837. LexerATNSimulator.prototype.getExistingTargetState = function (s, t) {
  26838. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  26839. return null;
  26840. }
  26841. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  26842. if (target === undefined) {
  26843. target = null;
  26844. }
  26845. if (LexerATNSimulator.debug && target !== null) {
  26846. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  26847. }
  26848. return target;
  26849. };
  26850. // Compute a target state for an edge in the DFA, and attempt to add the
  26851. // computed state and corresponding edge to the DFA.
  26852. //
  26853. // @param input The input stream
  26854. // @param s The current DFA state
  26855. // @param t The next input symbol
  26856. //
  26857. // @return The computed target DFA state for the given input symbol
  26858. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  26859. // returns {@link //ERROR}.
  26860. LexerATNSimulator.prototype.computeTargetState = function (input, s, t) {
  26861. var reach = new OrderedATNConfigSet();
  26862. // if we don't find an existing DFA state
  26863. // Fill reach starting from closure, following t transitions
  26864. this.getReachableConfigSet(input, s.configs, reach, t);
  26865. if (reach.items.length === 0) {
  26866. // we got nowhere on t from s
  26867. if (!reach.hasSemanticContext) {
  26868. // we got nowhere on t, don't throw out this knowledge; it'd
  26869. // cause a failover from DFA later.
  26870. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  26871. }
  26872. // stop when we can't match any more char
  26873. return ATNSimulator.ERROR;
  26874. }
  26875. // Add an edge from s to target DFA found/created for reach
  26876. return this.addDFAEdge(s, t, null, reach);
  26877. };
  26878. LexerATNSimulator.prototype.failOrAccept = function (prevAccept, input, reach, t) {
  26879. if (this.prevAccept.dfaState !== null) {
  26880. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  26881. this.accept(input, lexerActionExecutor, this.startIndex, prevAccept.index, prevAccept.line, prevAccept.column);
  26882. return prevAccept.dfaState.prediction;
  26883. } else {
  26884. // if no accept and EOF is first char, return EOF
  26885. if (t === Token.EOF && input.index === this.startIndex) {
  26886. return Token.EOF;
  26887. }
  26888. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  26889. }
  26890. };
  26891. // Given a starting configuration set, figure out all ATN configurations
  26892. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  26893. // parameter.
  26894. LexerATNSimulator.prototype.getReachableConfigSet = function (input, closure, reach, t) {
  26895. // this is used to skip processing for configs which have a lower priority
  26896. // than a config that already reached an accept state for the same rule
  26897. var skipAlt = ATN.INVALID_ALT_NUMBER;
  26898. for (var i = 0; i < closure.items.length; i++) {
  26899. var cfg = closure.items[i];
  26900. var currentAltReachedAcceptState = cfg.alt === skipAlt;
  26901. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  26902. continue;
  26903. }
  26904. if (LexerATNSimulator.debug) {
  26905. console.log("testing %s at %s\n", this.getTokenName(t), cfg.toString(this.recog, true));
  26906. }
  26907. for (var j = 0; j < cfg.state.transitions.length; j++) {
  26908. var trans = cfg.state.transitions[j]; // for each transition
  26909. var target = this.getReachableTarget(trans, t);
  26910. if (target !== null) {
  26911. var lexerActionExecutor = cfg.lexerActionExecutor;
  26912. if (lexerActionExecutor !== null) {
  26913. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  26914. }
  26915. var treatEofAsEpsilon = t === Token.EOF;
  26916. var config = new LexerATNConfig({ state: target, lexerActionExecutor: lexerActionExecutor }, cfg);
  26917. if (this.closure(input, config, reach, currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  26918. // any remaining configs for this alt have a lower priority
  26919. // than the one that just reached an accept state.
  26920. skipAlt = cfg.alt;
  26921. }
  26922. }
  26923. }
  26924. }
  26925. };
  26926. LexerATNSimulator.prototype.accept = function (input, lexerActionExecutor, startIndex, index, line, charPos) {
  26927. if (LexerATNSimulator.debug) {
  26928. console.log("ACTION %s\n", lexerActionExecutor);
  26929. }
  26930. // seek to after last char in token
  26931. input.seek(index);
  26932. this.line = line;
  26933. this.column = charPos;
  26934. if (lexerActionExecutor !== null && this.recog !== null) {
  26935. lexerActionExecutor.execute(this.recog, input, startIndex);
  26936. }
  26937. };
  26938. LexerATNSimulator.prototype.getReachableTarget = function (trans, t) {
  26939. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  26940. return trans.target;
  26941. } else {
  26942. return null;
  26943. }
  26944. };
  26945. LexerATNSimulator.prototype.computeStartState = function (input, p) {
  26946. var initialContext = PredictionContext.EMPTY;
  26947. var configs = new OrderedATNConfigSet();
  26948. for (var i = 0; i < p.transitions.length; i++) {
  26949. var target = p.transitions[i].target;
  26950. var cfg = new LexerATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  26951. this.closure(input, cfg, configs, false, false, false);
  26952. }
  26953. return configs;
  26954. };
  26955. // Since the alternatives within any lexer decision are ordered by
  26956. // preference, this method stops pursuing the closure as soon as an accept
  26957. // state is reached. After the first accept state is reached by depth-first
  26958. // search from {@code config}, all other (potentially reachable) states for
  26959. // this rule would have a lower priority.
  26960. //
  26961. // @return {@code true} if an accept state is reached, otherwise
  26962. // {@code false}.
  26963. LexerATNSimulator.prototype.closure = function (input, config, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  26964. var cfg = null;
  26965. if (LexerATNSimulator.debug) {
  26966. console.log("closure(" + config.toString(this.recog, true) + ")");
  26967. }
  26968. if (config.state instanceof RuleStopState) {
  26969. if (LexerATNSimulator.debug) {
  26970. if (this.recog !== null) {
  26971. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  26972. } else {
  26973. console.log("closure at rule stop %s\n", config);
  26974. }
  26975. }
  26976. if (config.context === null || config.context.hasEmptyPath()) {
  26977. if (config.context === null || config.context.isEmpty()) {
  26978. configs.add(config);
  26979. return true;
  26980. } else {
  26981. configs.add(new LexerATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config));
  26982. currentAltReachedAcceptState = true;
  26983. }
  26984. }
  26985. if (config.context !== null && !config.context.isEmpty()) {
  26986. for (var i = 0; i < config.context.length; i++) {
  26987. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  26988. var newContext = config.context.getParent(i); // "pop" return state
  26989. var returnState = this.atn.states[config.context.getReturnState(i)];
  26990. cfg = new LexerATNConfig({ state: returnState, context: newContext }, config);
  26991. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  26992. }
  26993. }
  26994. }
  26995. return currentAltReachedAcceptState;
  26996. }
  26997. // optimization
  26998. if (!config.state.epsilonOnlyTransitions) {
  26999. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  27000. configs.add(config);
  27001. }
  27002. }
  27003. for (var j = 0; j < config.state.transitions.length; j++) {
  27004. var trans = config.state.transitions[j];
  27005. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  27006. if (cfg !== null) {
  27007. currentAltReachedAcceptState = this.closure(input, cfg, configs, currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  27008. }
  27009. }
  27010. return currentAltReachedAcceptState;
  27011. };
  27012. // side-effect: can alter configs.hasSemanticContext
  27013. LexerATNSimulator.prototype.getEpsilonTarget = function (input, config, trans, configs, speculative, treatEofAsEpsilon) {
  27014. var cfg = null;
  27015. if (trans.serializationType === Transition.RULE) {
  27016. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  27017. cfg = new LexerATNConfig({ state: trans.target, context: newContext }, config);
  27018. } else if (trans.serializationType === Transition.PRECEDENCE) {
  27019. throw "Precedence predicates are not supported in lexers.";
  27020. } else if (trans.serializationType === Transition.PREDICATE) {
  27021. // Track traversing semantic predicates. If we traverse,
  27022. // we cannot add a DFA state for this "reach" computation
  27023. // because the DFA would not test the predicate again in the
  27024. // future. Rather than creating collections of semantic predicates
  27025. // like v3 and testing them on prediction, v4 will test them on the
  27026. // fly all the time using the ATN not the DFA. This is slower but
  27027. // semantically it's not used that often. One of the key elements to
  27028. // this predicate mechanism is not adding DFA states that see
  27029. // predicates immediately afterwards in the ATN. For example,
  27030. // a : ID {p1}? | ID {p2}? ;
  27031. // should create the start state for rule 'a' (to save start state
  27032. // competition), but should not create target of ID state. The
  27033. // collection of ATN states the following ID references includes
  27034. // states reached by traversing predicates. Since this is when we
  27035. // test them, we cannot cash the DFA state target of ID.
  27036. if (LexerATNSimulator.debug) {
  27037. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  27038. }
  27039. configs.hasSemanticContext = true;
  27040. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  27041. cfg = new LexerATNConfig({ state: trans.target }, config);
  27042. }
  27043. } else if (trans.serializationType === Transition.ACTION) {
  27044. if (config.context === null || config.context.hasEmptyPath()) {
  27045. // execute actions anywhere in the start rule for a token.
  27046. //
  27047. // TODO: if the entry rule is invoked recursively, some
  27048. // actions may be executed during the recursive call. The
  27049. // problem can appear when hasEmptyPath() is true but
  27050. // isEmpty() is false. In this case, the config needs to be
  27051. // split into two contexts - one with just the empty path
  27052. // and another with everything but the empty path.
  27053. // Unfortunately, the current algorithm does not allow
  27054. // getEpsilonTarget to return two configurations, so
  27055. // additional modifications are needed before we can support
  27056. // the split operation.
  27057. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor, this.atn.lexerActions[trans.actionIndex]);
  27058. cfg = new LexerATNConfig({ state: trans.target, lexerActionExecutor: lexerActionExecutor }, config);
  27059. } else {
  27060. // ignore actions in referenced rules
  27061. cfg = new LexerATNConfig({ state: trans.target }, config);
  27062. }
  27063. } else if (trans.serializationType === Transition.EPSILON) {
  27064. cfg = new LexerATNConfig({ state: trans.target }, config);
  27065. } else if (trans.serializationType === Transition.ATOM || trans.serializationType === Transition.RANGE || trans.serializationType === Transition.SET) {
  27066. if (treatEofAsEpsilon) {
  27067. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  27068. cfg = new LexerATNConfig({ state: trans.target }, config);
  27069. }
  27070. }
  27071. }
  27072. return cfg;
  27073. };
  27074. // Evaluate a predicate specified in the lexer.
  27075. //
  27076. // <p>If {@code speculative} is {@code true}, this method was called before
  27077. // {@link //consume} for the matched character. This method should call
  27078. // {@link //consume} before evaluating the predicate to ensure position
  27079. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  27080. // and {@link Lexer//getcolumn}, properly reflect the current
  27081. // lexer state. This method should restore {@code input} and the simulator
  27082. // to the original state before returning (i.e. undo the actions made by the
  27083. // call to {@link //consume}.</p>
  27084. //
  27085. // @param input The input stream.
  27086. // @param ruleIndex The rule containing the predicate.
  27087. // @param predIndex The index of the predicate within the rule.
  27088. // @param speculative {@code true} if the current index in {@code input} is
  27089. // one character before the predicate's location.
  27090. //
  27091. // @return {@code true} if the specified predicate evaluates to
  27092. // {@code true}.
  27093. // /
  27094. LexerATNSimulator.prototype.evaluatePredicate = function (input, ruleIndex, predIndex, speculative) {
  27095. // assume true if no recognizer was provided
  27096. if (this.recog === null) {
  27097. return true;
  27098. }
  27099. if (!speculative) {
  27100. return this.recog.sempred(null, ruleIndex, predIndex);
  27101. }
  27102. var savedcolumn = this.column;
  27103. var savedLine = this.line;
  27104. var index = input.index;
  27105. var marker = input.mark();
  27106. try {
  27107. this.consume(input);
  27108. return this.recog.sempred(null, ruleIndex, predIndex);
  27109. } finally {
  27110. this.column = savedcolumn;
  27111. this.line = savedLine;
  27112. input.seek(index);
  27113. input.release(marker);
  27114. }
  27115. };
  27116. LexerATNSimulator.prototype.captureSimState = function (settings, input, dfaState) {
  27117. settings.index = input.index;
  27118. settings.line = this.line;
  27119. settings.column = this.column;
  27120. settings.dfaState = dfaState;
  27121. };
  27122. LexerATNSimulator.prototype.addDFAEdge = function (from_, tk, to, cfgs) {
  27123. if (to === undefined) {
  27124. to = null;
  27125. }
  27126. if (cfgs === undefined) {
  27127. cfgs = null;
  27128. }
  27129. if (to === null && cfgs !== null) {
  27130. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  27131. // marker indicating dynamic predicate evaluation makes this edge
  27132. // dependent on the specific input sequence, so the static edge in the
  27133. // DFA should be omitted. The target DFAState is still created since
  27134. // execATN has the ability to resynchronize with the DFA state cache
  27135. // following the predicate evaluation step.
  27136. //
  27137. // TJP notes: next time through the DFA, we see a pred again and eval.
  27138. // If that gets us to a previously created (but dangling) DFA
  27139. // state, we can continue in pure DFA mode from there.
  27140. // /
  27141. var suppressEdge = cfgs.hasSemanticContext;
  27142. cfgs.hasSemanticContext = false;
  27143. to = this.addDFAState(cfgs);
  27144. if (suppressEdge) {
  27145. return to;
  27146. }
  27147. }
  27148. // add the edge
  27149. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  27150. // Only track edges within the DFA bounds
  27151. return to;
  27152. }
  27153. if (LexerATNSimulator.debug) {
  27154. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  27155. }
  27156. if (from_.edges === null) {
  27157. // make room for tokens 1..n and -1 masquerading as index 0
  27158. from_.edges = [];
  27159. }
  27160. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  27161. return to;
  27162. };
  27163. // Add a new DFA state if there isn't one with this set of
  27164. // configurations already. This method also detects the first
  27165. // configuration containing an ATN rule stop state. Later, when
  27166. // traversing the DFA, we will know which rule to accept.
  27167. LexerATNSimulator.prototype.addDFAState = function (configs) {
  27168. var proposed = new DFAState(null, configs);
  27169. var firstConfigWithRuleStopState = null;
  27170. for (var i = 0; i < configs.items.length; i++) {
  27171. var cfg = configs.items[i];
  27172. if (cfg.state instanceof RuleStopState) {
  27173. firstConfigWithRuleStopState = cfg;
  27174. break;
  27175. }
  27176. }
  27177. if (firstConfigWithRuleStopState !== null) {
  27178. proposed.isAcceptState = true;
  27179. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  27180. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  27181. }
  27182. var dfa = this.decisionToDFA[this.mode];
  27183. var existing = dfa.states.get(proposed);
  27184. if (existing !== null) {
  27185. return existing;
  27186. }
  27187. var newState = proposed;
  27188. newState.stateNumber = dfa.states.length;
  27189. configs.setReadonly(true);
  27190. newState.configs = configs;
  27191. dfa.states.add(newState);
  27192. return newState;
  27193. };
  27194. LexerATNSimulator.prototype.getDFA = function (mode) {
  27195. return this.decisionToDFA[mode];
  27196. };
  27197. // Get the text matched so far for the current token.
  27198. LexerATNSimulator.prototype.getText = function (input) {
  27199. // index is first lookahead char, don't include.
  27200. return input.getText(this.startIndex, input.index - 1);
  27201. };
  27202. LexerATNSimulator.prototype.consume = function (input) {
  27203. var curChar = input.LA(1);
  27204. if (curChar === "\n".charCodeAt(0)) {
  27205. this.line += 1;
  27206. this.column = 0;
  27207. } else {
  27208. this.column += 1;
  27209. }
  27210. input.consume();
  27211. };
  27212. LexerATNSimulator.prototype.getTokenName = function (tt) {
  27213. if (tt === -1) {
  27214. return "EOF";
  27215. } else {
  27216. return "'" + String.fromCharCode(tt) + "'";
  27217. }
  27218. };
  27219. exports.LexerATNSimulator = LexerATNSimulator;
  27220. /***/ }),
  27221. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  27222. /*!************************************************!*\
  27223. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  27224. \************************************************/
  27225. /*! no static exports found */
  27226. /***/ (function(module, exports, __webpack_require__) {
  27227. "use strict";
  27228. //
  27229. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27230. * Use of this file is governed by the BSD 3-clause license that
  27231. * can be found in the LICENSE.txt file in the project root.
  27232. */
  27233. //
  27234. function LexerActionType() {}
  27235. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  27236. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  27237. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  27238. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  27239. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  27240. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  27241. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  27242. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  27243. function LexerAction(action) {
  27244. this.actionType = action;
  27245. this.isPositionDependent = false;
  27246. return this;
  27247. }
  27248. LexerAction.prototype.hashCode = function () {
  27249. var hash = new Hash();
  27250. this.updateHashCode(hash);
  27251. return hash.finish();
  27252. };
  27253. LexerAction.prototype.updateHashCode = function (hash) {
  27254. hash.update(this.actionType);
  27255. };
  27256. LexerAction.prototype.equals = function (other) {
  27257. return this === other;
  27258. };
  27259. //
  27260. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  27261. //
  27262. // <p>The {@code skip} command does not have any parameters, so this action is
  27263. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27264. function LexerSkipAction() {
  27265. LexerAction.call(this, LexerActionType.SKIP);
  27266. return this;
  27267. }
  27268. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  27269. LexerSkipAction.prototype.constructor = LexerSkipAction;
  27270. // Provides a singleton instance of this parameterless lexer action.
  27271. LexerSkipAction.INSTANCE = new LexerSkipAction();
  27272. LexerSkipAction.prototype.execute = function (lexer) {
  27273. lexer.skip();
  27274. };
  27275. LexerSkipAction.prototype.toString = function () {
  27276. return "skip";
  27277. };
  27278. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  27279. // with the assigned type.
  27280. function LexerTypeAction(type) {
  27281. LexerAction.call(this, LexerActionType.TYPE);
  27282. this.type = type;
  27283. return this;
  27284. }
  27285. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  27286. LexerTypeAction.prototype.constructor = LexerTypeAction;
  27287. LexerTypeAction.prototype.execute = function (lexer) {
  27288. lexer.type = this.type;
  27289. };
  27290. LexerTypeAction.prototype.updateHashCode = function (hash) {
  27291. hash.update(this.actionType, this.type);
  27292. };
  27293. LexerTypeAction.prototype.equals = function (other) {
  27294. if (this === other) {
  27295. return true;
  27296. } else if (!(other instanceof LexerTypeAction)) {
  27297. return false;
  27298. } else {
  27299. return this.type === other.type;
  27300. }
  27301. };
  27302. LexerTypeAction.prototype.toString = function () {
  27303. return "type(" + this.type + ")";
  27304. };
  27305. // Implements the {@code pushMode} lexer action by calling
  27306. // {@link Lexer//pushMode} with the assigned mode.
  27307. function LexerPushModeAction(mode) {
  27308. LexerAction.call(this, LexerActionType.PUSH_MODE);
  27309. this.mode = mode;
  27310. return this;
  27311. }
  27312. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  27313. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  27314. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  27315. // value provided by {@link //getMode}.</p>
  27316. LexerPushModeAction.prototype.execute = function (lexer) {
  27317. lexer.pushMode(this.mode);
  27318. };
  27319. LexerPushModeAction.prototype.updateHashCode = function (hash) {
  27320. hash.update(this.actionType, this.mode);
  27321. };
  27322. LexerPushModeAction.prototype.equals = function (other) {
  27323. if (this === other) {
  27324. return true;
  27325. } else if (!(other instanceof LexerPushModeAction)) {
  27326. return false;
  27327. } else {
  27328. return this.mode === other.mode;
  27329. }
  27330. };
  27331. LexerPushModeAction.prototype.toString = function () {
  27332. return "pushMode(" + this.mode + ")";
  27333. };
  27334. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  27335. //
  27336. // <p>The {@code popMode} command does not have any parameters, so this action is
  27337. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27338. function LexerPopModeAction() {
  27339. LexerAction.call(this, LexerActionType.POP_MODE);
  27340. return this;
  27341. }
  27342. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  27343. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  27344. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  27345. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27346. LexerPopModeAction.prototype.execute = function (lexer) {
  27347. lexer.popMode();
  27348. };
  27349. LexerPopModeAction.prototype.toString = function () {
  27350. return "popMode";
  27351. };
  27352. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  27353. //
  27354. // <p>The {@code more} command does not have any parameters, so this action is
  27355. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  27356. function LexerMoreAction() {
  27357. LexerAction.call(this, LexerActionType.MORE);
  27358. return this;
  27359. }
  27360. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  27361. LexerMoreAction.prototype.constructor = LexerMoreAction;
  27362. LexerMoreAction.INSTANCE = new LexerMoreAction();
  27363. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  27364. LexerMoreAction.prototype.execute = function (lexer) {
  27365. lexer.more();
  27366. };
  27367. LexerMoreAction.prototype.toString = function () {
  27368. return "more";
  27369. };
  27370. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  27371. // the assigned mode.
  27372. function LexerModeAction(mode) {
  27373. LexerAction.call(this, LexerActionType.MODE);
  27374. this.mode = mode;
  27375. return this;
  27376. }
  27377. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  27378. LexerModeAction.prototype.constructor = LexerModeAction;
  27379. // <p>This action is implemented by calling {@link Lexer//mode} with the
  27380. // value provided by {@link //getMode}.</p>
  27381. LexerModeAction.prototype.execute = function (lexer) {
  27382. lexer.mode(this.mode);
  27383. };
  27384. LexerModeAction.prototype.updateHashCode = function (hash) {
  27385. hash.update(this.actionType, this.mode);
  27386. };
  27387. LexerModeAction.prototype.equals = function (other) {
  27388. if (this === other) {
  27389. return true;
  27390. } else if (!(other instanceof LexerModeAction)) {
  27391. return false;
  27392. } else {
  27393. return this.mode === other.mode;
  27394. }
  27395. };
  27396. LexerModeAction.prototype.toString = function () {
  27397. return "mode(" + this.mode + ")";
  27398. };
  27399. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  27400. // rule and action indexes assigned to the custom action. The implementation of
  27401. // a custom action is added to the generated code for the lexer in an override
  27402. // of {@link Recognizer//action} when the grammar is compiled.
  27403. //
  27404. // <p>This class may represent embedded actions created with the <code>{...}</code>
  27405. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  27406. // command argument could not be evaluated when the grammar was compiled.</p>
  27407. // Constructs a custom lexer action with the specified rule and action
  27408. // indexes.
  27409. //
  27410. // @param ruleIndex The rule index to use for calls to
  27411. // {@link Recognizer//action}.
  27412. // @param actionIndex The action index to use for calls to
  27413. // {@link Recognizer//action}.
  27414. function LexerCustomAction(ruleIndex, actionIndex) {
  27415. LexerAction.call(this, LexerActionType.CUSTOM);
  27416. this.ruleIndex = ruleIndex;
  27417. this.actionIndex = actionIndex;
  27418. this.isPositionDependent = true;
  27419. return this;
  27420. }
  27421. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  27422. LexerCustomAction.prototype.constructor = LexerCustomAction;
  27423. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  27424. // appropriate rule and action indexes.</p>
  27425. LexerCustomAction.prototype.execute = function (lexer) {
  27426. lexer.action(null, this.ruleIndex, this.actionIndex);
  27427. };
  27428. LexerCustomAction.prototype.updateHashCode = function (hash) {
  27429. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  27430. };
  27431. LexerCustomAction.prototype.equals = function (other) {
  27432. if (this === other) {
  27433. return true;
  27434. } else if (!(other instanceof LexerCustomAction)) {
  27435. return false;
  27436. } else {
  27437. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  27438. }
  27439. };
  27440. // Implements the {@code channel} lexer action by calling
  27441. // {@link Lexer//setChannel} with the assigned channel.
  27442. // Constructs a new {@code channel} action with the specified channel value.
  27443. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  27444. function LexerChannelAction(channel) {
  27445. LexerAction.call(this, LexerActionType.CHANNEL);
  27446. this.channel = channel;
  27447. return this;
  27448. }
  27449. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  27450. LexerChannelAction.prototype.constructor = LexerChannelAction;
  27451. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  27452. // value provided by {@link //getChannel}.</p>
  27453. LexerChannelAction.prototype.execute = function (lexer) {
  27454. lexer._channel = this.channel;
  27455. };
  27456. LexerChannelAction.prototype.updateHashCode = function (hash) {
  27457. hash.update(this.actionType, this.channel);
  27458. };
  27459. LexerChannelAction.prototype.equals = function (other) {
  27460. if (this === other) {
  27461. return true;
  27462. } else if (!(other instanceof LexerChannelAction)) {
  27463. return false;
  27464. } else {
  27465. return this.channel === other.channel;
  27466. }
  27467. };
  27468. LexerChannelAction.prototype.toString = function () {
  27469. return "channel(" + this.channel + ")";
  27470. };
  27471. // This implementation of {@link LexerAction} is used for tracking input offsets
  27472. // for position-dependent actions within a {@link LexerActionExecutor}.
  27473. //
  27474. // <p>This action is not serialized as part of the ATN, and is only required for
  27475. // position-dependent lexer actions which appear at a location other than the
  27476. // end of a rule. For more information about DFA optimizations employed for
  27477. // lexer actions, see {@link LexerActionExecutor//append} and
  27478. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  27479. // Constructs a new indexed custom action by associating a character offset
  27480. // with a {@link LexerAction}.
  27481. //
  27482. // <p>Note: This class is only required for lexer actions for which
  27483. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  27484. //
  27485. // @param offset The offset into the input {@link CharStream}, relative to
  27486. // the token start index, at which the specified lexer action should be
  27487. // executed.
  27488. // @param action The lexer action to execute at a particular offset in the
  27489. // input {@link CharStream}.
  27490. function LexerIndexedCustomAction(offset, action) {
  27491. LexerAction.call(this, action.actionType);
  27492. this.offset = offset;
  27493. this.action = action;
  27494. this.isPositionDependent = true;
  27495. return this;
  27496. }
  27497. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  27498. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  27499. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  27500. // using the provided {@code lexer}.</p>
  27501. LexerIndexedCustomAction.prototype.execute = function (lexer) {
  27502. // assume the input stream position was properly set by the calling code
  27503. this.action.execute(lexer);
  27504. };
  27505. LexerIndexedCustomAction.prototype.updateHashCode = function (hash) {
  27506. hash.update(this.actionType, this.offset, this.action);
  27507. };
  27508. LexerIndexedCustomAction.prototype.equals = function (other) {
  27509. if (this === other) {
  27510. return true;
  27511. } else if (!(other instanceof LexerIndexedCustomAction)) {
  27512. return false;
  27513. } else {
  27514. return this.offset === other.offset && this.action === other.action;
  27515. }
  27516. };
  27517. exports.LexerActionType = LexerActionType;
  27518. exports.LexerSkipAction = LexerSkipAction;
  27519. exports.LexerChannelAction = LexerChannelAction;
  27520. exports.LexerCustomAction = LexerCustomAction;
  27521. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  27522. exports.LexerMoreAction = LexerMoreAction;
  27523. exports.LexerTypeAction = LexerTypeAction;
  27524. exports.LexerPushModeAction = LexerPushModeAction;
  27525. exports.LexerPopModeAction = LexerPopModeAction;
  27526. exports.LexerModeAction = LexerModeAction;
  27527. /***/ }),
  27528. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  27529. /*!********************************************************!*\
  27530. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  27531. \********************************************************/
  27532. /*! no static exports found */
  27533. /***/ (function(module, exports, __webpack_require__) {
  27534. "use strict";
  27535. //
  27536. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27537. * Use of this file is governed by the BSD 3-clause license that
  27538. * can be found in the LICENSE.txt file in the project root.
  27539. */
  27540. ///
  27541. // Represents an executor for a sequence of lexer actions which traversed during
  27542. // the matching operation of a lexer rule (token).
  27543. //
  27544. // <p>The executor tracks position information for position-dependent lexer actions
  27545. // efficiently, ensuring that actions appearing only at the end of the rule do
  27546. // not cause bloating of the {@link DFA} created for the lexer.</p>
  27547. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  27548. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  27549. function LexerActionExecutor(lexerActions) {
  27550. this.lexerActions = lexerActions === null ? [] : lexerActions;
  27551. // Caches the result of {@link //hashCode} since the hash code is an element
  27552. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  27553. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  27554. // lexerActions]))
  27555. return this;
  27556. }
  27557. // Creates a {@link LexerActionExecutor} which executes the actions for
  27558. // the input {@code lexerActionExecutor} followed by a specified
  27559. // {@code lexerAction}.
  27560. //
  27561. // @param lexerActionExecutor The executor for actions already traversed by
  27562. // the lexer while matching a token within a particular
  27563. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  27564. // though it were an empty executor.
  27565. // @param lexerAction The lexer action to execute after the actions
  27566. // specified in {@code lexerActionExecutor}.
  27567. //
  27568. // @return A {@link LexerActionExecutor} for executing the combine actions
  27569. // of {@code lexerActionExecutor} and {@code lexerAction}.
  27570. LexerActionExecutor.append = function (lexerActionExecutor, lexerAction) {
  27571. if (lexerActionExecutor === null) {
  27572. return new LexerActionExecutor([lexerAction]);
  27573. }
  27574. var lexerActions = lexerActionExecutor.lexerActions.concat([lexerAction]);
  27575. return new LexerActionExecutor(lexerActions);
  27576. };
  27577. // Creates a {@link LexerActionExecutor} which encodes the current offset
  27578. // for position-dependent lexer actions.
  27579. //
  27580. // <p>Normally, when the executor encounters lexer actions where
  27581. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  27582. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  27583. // position to the <em>end</em> of the current token. This behavior provides
  27584. // for efficient DFA representation of lexer actions which appear at the end
  27585. // of a lexer rule, even when the lexer rule matches a variable number of
  27586. // characters.</p>
  27587. //
  27588. // <p>Prior to traversing a match transition in the ATN, the current offset
  27589. // from the token start index is assigned to all position-dependent lexer
  27590. // actions which have not already been assigned a fixed offset. By storing
  27591. // the offsets relative to the token start index, the DFA representation of
  27592. // lexer actions which appear in the middle of tokens remains efficient due
  27593. // to sharing among tokens of the same length, regardless of their absolute
  27594. // position in the input stream.</p>
  27595. //
  27596. // <p>If the current executor already has offsets assigned to all
  27597. // position-dependent lexer actions, the method returns {@code this}.</p>
  27598. //
  27599. // @param offset The current offset to assign to all position-dependent
  27600. // lexer actions which do not already have offsets assigned.
  27601. //
  27602. // @return A {@link LexerActionExecutor} which stores input stream offsets
  27603. // for all position-dependent lexer actions.
  27604. // /
  27605. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function (offset) {
  27606. var updatedLexerActions = null;
  27607. for (var i = 0; i < this.lexerActions.length; i++) {
  27608. if (this.lexerActions[i].isPositionDependent && !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  27609. if (updatedLexerActions === null) {
  27610. updatedLexerActions = this.lexerActions.concat([]);
  27611. }
  27612. updatedLexerActions[i] = new LexerIndexedCustomAction(offset, this.lexerActions[i]);
  27613. }
  27614. }
  27615. if (updatedLexerActions === null) {
  27616. return this;
  27617. } else {
  27618. return new LexerActionExecutor(updatedLexerActions);
  27619. }
  27620. };
  27621. // Execute the actions encapsulated by this executor within the context of a
  27622. // particular {@link Lexer}.
  27623. //
  27624. // <p>This method calls {@link IntStream//seek} to set the position of the
  27625. // {@code input} {@link CharStream} prior to calling
  27626. // {@link LexerAction//execute} on a position-dependent action. Before the
  27627. // method returns, the input position will be restored to the same position
  27628. // it was in when the method was invoked.</p>
  27629. //
  27630. // @param lexer The lexer instance.
  27631. // @param input The input stream which is the source for the current token.
  27632. // When this method is called, the current {@link IntStream//index} for
  27633. // {@code input} should be the start of the following token, i.e. 1
  27634. // character past the end of the current token.
  27635. // @param startIndex The token start index. This value may be passed to
  27636. // {@link IntStream//seek} to set the {@code input} position to the beginning
  27637. // of the token.
  27638. // /
  27639. LexerActionExecutor.prototype.execute = function (lexer, input, startIndex) {
  27640. var requiresSeek = false;
  27641. var stopIndex = input.index;
  27642. try {
  27643. for (var i = 0; i < this.lexerActions.length; i++) {
  27644. var lexerAction = this.lexerActions[i];
  27645. if (lexerAction instanceof LexerIndexedCustomAction) {
  27646. var offset = lexerAction.offset;
  27647. input.seek(startIndex + offset);
  27648. lexerAction = lexerAction.action;
  27649. requiresSeek = startIndex + offset !== stopIndex;
  27650. } else if (lexerAction.isPositionDependent) {
  27651. input.seek(stopIndex);
  27652. requiresSeek = false;
  27653. }
  27654. lexerAction.execute(lexer);
  27655. }
  27656. } finally {
  27657. if (requiresSeek) {
  27658. input.seek(stopIndex);
  27659. }
  27660. }
  27661. };
  27662. LexerActionExecutor.prototype.hashCode = function () {
  27663. return this.cachedHashCode;
  27664. };
  27665. LexerActionExecutor.prototype.updateHashCode = function (hash) {
  27666. hash.update(this.cachedHashCode);
  27667. };
  27668. LexerActionExecutor.prototype.equals = function (other) {
  27669. if (this === other) {
  27670. return true;
  27671. } else if (!(other instanceof LexerActionExecutor)) {
  27672. return false;
  27673. } else if (this.cachedHashCode != other.cachedHashCode) {
  27674. return false;
  27675. } else if (this.lexerActions.length != other.lexerActions.length) {
  27676. return false;
  27677. } else {
  27678. var numActions = this.lexerActions.length;
  27679. for (var idx = 0; idx < numActions; ++idx) {
  27680. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  27681. return false;
  27682. }
  27683. }
  27684. return true;
  27685. }
  27686. };
  27687. exports.LexerActionExecutor = LexerActionExecutor;
  27688. /***/ }),
  27689. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  27690. /*!*******************************************************!*\
  27691. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  27692. \*******************************************************/
  27693. /*! no static exports found */
  27694. /***/ (function(module, exports, __webpack_require__) {
  27695. "use strict";
  27696. //
  27697. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27698. * Use of this file is governed by the BSD 3-clause license that
  27699. * can be found in the LICENSE.txt file in the project root.
  27700. */
  27701. //
  27702. //
  27703. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  27704. //
  27705. // <p>
  27706. // The basic complexity of the adaptive strategy makes it harder to understand.
  27707. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  27708. // requests go through the DFA first. If they reach a state without an edge for
  27709. // the current symbol, the algorithm fails over to the ATN simulation to
  27710. // complete the DFA path for the current input (until it finds a conflict state
  27711. // or uniquely predicting state).</p>
  27712. //
  27713. // <p>
  27714. // All of that is done without using the outer context because we want to create
  27715. // a DFA that is not dependent upon the rule invocation stack when we do a
  27716. // prediction. One DFA works in all contexts. We avoid using context not
  27717. // necessarily because it's slower, although it can be, but because of the DFA
  27718. // caching problem. The closure routine only considers the rule invocation stack
  27719. // created during prediction beginning in the decision rule. For example, if
  27720. // prediction occurs without invoking another rule's ATN, there are no context
  27721. // stacks in the configurations. When lack of context leads to a conflict, we
  27722. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  27723. // strategy (versus full LL(*)).</p>
  27724. //
  27725. // <p>
  27726. // When SLL yields a configuration set with conflict, we rewind the input and
  27727. // retry the ATN simulation, this time using full outer context without adding
  27728. // to the DFA. Configuration context stacks will be the full invocation stacks
  27729. // from the start rule. If we get a conflict using full context, then we can
  27730. // definitively say we have a true ambiguity for that input sequence. If we
  27731. // don't get a conflict, it implies that the decision is sensitive to the outer
  27732. // context. (It is not context-sensitive in the sense of context-sensitive
  27733. // grammars.)</p>
  27734. //
  27735. // <p>
  27736. // The next time we reach this DFA state with an SLL conflict, through DFA
  27737. // simulation, we will again retry the ATN simulation using full context mode.
  27738. // This is slow because we can't save the results and have to "interpret" the
  27739. // ATN each time we get that input.</p>
  27740. //
  27741. // <p>
  27742. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  27743. //
  27744. // <p>
  27745. // We could cache results from full context to predicted alternative easily and
  27746. // that saves a lot of time but doesn't work in presence of predicates. The set
  27747. // of visible predicates from the ATN start state changes depending on the
  27748. // context, because closure can fall off the end of a rule. I tried to cache
  27749. // tuples (stack context, semantic context, predicted alt) but it was slower
  27750. // than interpreting and much more complicated. Also required a huge amount of
  27751. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  27752. // to keep this algorithm simple. By launching multiple threads, we can improve
  27753. // the speed of parsing across a large number of files.</p>
  27754. //
  27755. // <p>
  27756. // There is no strict ordering between the amount of input used by SLL vs LL,
  27757. // which makes it really hard to build a cache for full context. Let's say that
  27758. // we have input A B C that leads to an SLL conflict with full context X. That
  27759. // implies that using X we might only use A B but we could also use A B C D to
  27760. // resolve conflict. Input A B C D could predict alternative 1 in one position
  27761. // in the input and A B C E could predict alternative 2 in another position in
  27762. // input. The conflicting SLL configurations could still be non-unique in the
  27763. // full context prediction, which would lead us to requiring more input than the
  27764. // original A B C. To make a prediction cache work, we have to track the exact
  27765. // input used during the previous prediction. That amounts to a cache that maps
  27766. // X to a specific DFA for that context.</p>
  27767. //
  27768. // <p>
  27769. // Something should be done for left-recursive expression predictions. They are
  27770. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  27771. // with full LL thing Sam does.</p>
  27772. //
  27773. // <p>
  27774. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  27775. //
  27776. // <p>
  27777. // We avoid doing full context retry when the outer context is empty, we did not
  27778. // dip into the outer context by falling off the end of the decision state rule,
  27779. // or when we force SLL mode.</p>
  27780. //
  27781. // <p>
  27782. // As an example of the not dip into outer context case, consider as super
  27783. // constructor calls versus function calls. One grammar might look like
  27784. // this:</p>
  27785. //
  27786. // <pre>
  27787. // ctorBody
  27788. // : '{' superCall? stat* '}'
  27789. // ;
  27790. // </pre>
  27791. //
  27792. // <p>
  27793. // Or, you might see something like</p>
  27794. //
  27795. // <pre>
  27796. // stat
  27797. // : superCall ';'
  27798. // | expression ';'
  27799. // | ...
  27800. // ;
  27801. // </pre>
  27802. //
  27803. // <p>
  27804. // In both cases I believe that no closure operations will dip into the outer
  27805. // context. In the first case ctorBody in the worst case will stop at the '}'.
  27806. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  27807. // entry rule and not dip into the outer context.</p>
  27808. //
  27809. // <p>
  27810. // <strong>PREDICATES</strong></p>
  27811. //
  27812. // <p>
  27813. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  27814. // LL simulation deals with predicates differently. SLL collects predicates as
  27815. // it performs closure operations like ANTLR v3 did. It delays predicate
  27816. // evaluation until it reaches and accept state. This allows us to cache the SLL
  27817. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  27818. // closure, the DFA state configuration sets would be different and we couldn't
  27819. // build up a suitable DFA.</p>
  27820. //
  27821. // <p>
  27822. // When building a DFA accept state during ATN simulation, we evaluate any
  27823. // predicates and return the sole semantically valid alternative. If there is
  27824. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  27825. // we throw an exception. Alternatives without predicates act like they have
  27826. // true predicates. The simple way to think about it is to strip away all
  27827. // alternatives with false predicates and choose the minimum alternative that
  27828. // remains.</p>
  27829. //
  27830. // <p>
  27831. // When we start in the DFA and reach an accept state that's predicated, we test
  27832. // those and return the minimum semantically viable alternative. If no
  27833. // alternatives are viable, we throw an exception.</p>
  27834. //
  27835. // <p>
  27836. // During full LL ATN simulation, closure always evaluates predicates and
  27837. // on-the-fly. This is crucial to reducing the configuration set size during
  27838. // closure. It hits a landmine when parsing with the Java grammar, for example,
  27839. // without this on-the-fly evaluation.</p>
  27840. //
  27841. // <p>
  27842. // <strong>SHARING DFA</strong></p>
  27843. //
  27844. // <p>
  27845. // All instances of the same parser share the same decision DFAs through a
  27846. // static field. Each instance gets its own ATN simulator but they share the
  27847. // same {@link //decisionToDFA} field. They also share a
  27848. // {@link PredictionContextCache} object that makes sure that all
  27849. // {@link PredictionContext} objects are shared among the DFA states. This makes
  27850. // a big size difference.</p>
  27851. //
  27852. // <p>
  27853. // <strong>THREAD SAFETY</strong></p>
  27854. //
  27855. // <p>
  27856. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  27857. // it adds a new DFA object to that array. {@link //addDFAEdge}
  27858. // locks on the DFA for the current decision when setting the
  27859. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  27860. // the DFA for the current decision when looking up a DFA state to see if it
  27861. // already exists. We must make sure that all requests to add DFA states that
  27862. // are equivalent result in the same shared DFA object. This is because lots of
  27863. // threads will be trying to update the DFA at once. The
  27864. // {@link //addDFAState} method also locks inside the DFA lock
  27865. // but this time on the shared context cache when it rebuilds the
  27866. // configurations' {@link PredictionContext} objects using cached
  27867. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  27868. // safe as long as we can guarantee that all threads referencing
  27869. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  27870. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  27871. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  27872. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  27873. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  27874. // {@code dfa.edges[t]} to be non-null. The
  27875. // {@link //addDFAEdge} method could be racing to set the field
  27876. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  27877. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  27878. // way it will work because it's not doing a test and set operation.</p>
  27879. //
  27880. // <p>
  27881. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  27882. // Parsing)</strong></p>
  27883. //
  27884. // <p>
  27885. // Sam pointed out that if SLL does not give a syntax error, then there is no
  27886. // point in doing full LL, which is slower. We only have to try LL if we get a
  27887. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  27888. // mode with the {@link BailErrorStrategy}:</p>
  27889. //
  27890. // <pre>
  27891. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  27892. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  27893. // </pre>
  27894. //
  27895. // <p>
  27896. // If it does not get a syntax error, then we're done. If it does get a syntax
  27897. // error, we need to retry with the combined SLL/LL strategy.</p>
  27898. //
  27899. // <p>
  27900. // The reason this works is as follows. If there are no SLL conflicts, then the
  27901. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  27902. // the full LL analysis must yield a set of viable alternatives which is a
  27903. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  27904. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  27905. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  27906. // is truly ambiguous on the current input. If the LL set is smaller, then the
  27907. // SLL conflict resolution might choose an alternative that the full LL would
  27908. // rule out as a possibility based upon better context information. If that's
  27909. // the case, then the SLL parse will definitely get an error because the full LL
  27910. // analysis says it's not viable. If SLL conflict resolution chooses an
  27911. // alternative within the LL set, them both SLL and LL would choose the same
  27912. // alternative because they both choose the minimum of multiple conflicting
  27913. // alternatives.</p>
  27914. //
  27915. // <p>
  27916. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  27917. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  27918. // parsing will get an error because SLL will pursue alternative 1. If
  27919. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  27920. // choose the same alternative because alternative one is the minimum of either
  27921. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  27922. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  27923. //
  27924. // <p>
  27925. // Of course, if the input is invalid, then we will get an error for sure in
  27926. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  27927. // the input.</p>
  27928. //
  27929. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  27930. var Set = Utils.Set;
  27931. var BitSet = Utils.BitSet;
  27932. var DoubleDict = Utils.DoubleDict;
  27933. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  27934. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  27935. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  27936. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  27937. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  27938. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  27939. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  27940. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  27941. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  27942. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  27943. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  27944. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  27945. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  27946. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  27947. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  27948. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27949. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  27950. var Transition = Transitions.Transition;
  27951. var SetTransition = Transitions.SetTransition;
  27952. var NotSetTransition = Transitions.NotSetTransition;
  27953. var RuleTransition = Transitions.RuleTransition;
  27954. var ActionTransition = Transitions.ActionTransition;
  27955. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  27956. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  27957. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  27958. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  27959. ATNSimulator.call(this, atn, sharedContextCache);
  27960. this.parser = parser;
  27961. this.decisionToDFA = decisionToDFA;
  27962. // SLL, LL, or LL + exact ambig detection?//
  27963. this.predictionMode = PredictionMode.LL;
  27964. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  27965. this._input = null;
  27966. this._startIndex = 0;
  27967. this._outerContext = null;
  27968. this._dfa = null;
  27969. // Each prediction operation uses a cache for merge of prediction contexts.
  27970. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  27971. // isn't synchronized but we're ok since two threads shouldn't reuse same
  27972. // parser/atnsim object because it can only handle one input at a time.
  27973. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  27974. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  27975. // also be examined during cache lookup.
  27976. //
  27977. this.mergeCache = null;
  27978. return this;
  27979. }
  27980. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  27981. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  27982. ParserATNSimulator.prototype.debug = false;
  27983. ParserATNSimulator.prototype.debug_closure = false;
  27984. ParserATNSimulator.prototype.debug_add = false;
  27985. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  27986. ParserATNSimulator.prototype.dfa_debug = false;
  27987. ParserATNSimulator.prototype.retry_debug = false;
  27988. ParserATNSimulator.prototype.reset = function () {};
  27989. ParserATNSimulator.prototype.adaptivePredict = function (input, decision, outerContext) {
  27990. if (this.debug || this.debug_list_atn_decisions) {
  27991. console.log("adaptivePredict decision " + decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  27992. }
  27993. this._input = input;
  27994. this._startIndex = input.index;
  27995. this._outerContext = outerContext;
  27996. var dfa = this.decisionToDFA[decision];
  27997. this._dfa = dfa;
  27998. var m = input.mark();
  27999. var index = input.index;
  28000. // Now we are certain to have a specific decision's DFA
  28001. // But, do we still need an initial state?
  28002. try {
  28003. var s0;
  28004. if (dfa.precedenceDfa) {
  28005. // the start state for a precedence DFA depends on the current
  28006. // parser precedence, and is provided by a DFA method.
  28007. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  28008. } else {
  28009. // the start state for a "regular" DFA is just s0
  28010. s0 = dfa.s0;
  28011. }
  28012. if (s0 === null) {
  28013. if (outerContext === null) {
  28014. outerContext = RuleContext.EMPTY;
  28015. }
  28016. if (this.debug || this.debug_list_atn_decisions) {
  28017. console.log("predictATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  28018. }
  28019. var fullCtx = false;
  28020. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  28021. if (dfa.precedenceDfa) {
  28022. // If this is a precedence DFA, we use applyPrecedenceFilter
  28023. // to convert the computed start state to a precedence start
  28024. // state. We then use DFA.setPrecedenceStartState to set the
  28025. // appropriate start state for the precedence level rather
  28026. // than simply setting DFA.s0.
  28027. //
  28028. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  28029. s0_closure = this.applyPrecedenceFilter(s0_closure);
  28030. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28031. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  28032. } else {
  28033. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  28034. dfa.s0 = s0;
  28035. }
  28036. }
  28037. var alt = this.execATN(dfa, s0, input, index, outerContext);
  28038. if (this.debug) {
  28039. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  28040. }
  28041. return alt;
  28042. } finally {
  28043. this._dfa = null;
  28044. this.mergeCache = null; // wack cache after each prediction
  28045. input.seek(index);
  28046. input.release(m);
  28047. }
  28048. };
  28049. // Performs ATN simulation to compute a predicted alternative based
  28050. // upon the remaining input, but also updates the DFA cache to avoid
  28051. // having to traverse the ATN again for the same input sequence.
  28052. // There are some key conditions we're looking for after computing a new
  28053. // set of ATN configs (proposed DFA state):
  28054. // if the set is empty, there is no viable alternative for current symbol
  28055. // does the state uniquely predict an alternative?
  28056. // does the state have a conflict that would prevent us from
  28057. // putting it on the work list?
  28058. // We also have some key operations to do:
  28059. // add an edge from previous DFA state to potentially new DFA state, D,
  28060. // upon current symbol but only if adding to work list, which means in all
  28061. // cases except no viable alternative (and possibly non-greedy decisions?)
  28062. // collecting predicates and adding semantic context to DFA accept states
  28063. // adding rule context to context-sensitive DFA accept states
  28064. // consuming an input symbol
  28065. // reporting a conflict
  28066. // reporting an ambiguity
  28067. // reporting a context sensitivity
  28068. // reporting insufficient predicates
  28069. // cover these cases:
  28070. // dead end
  28071. // single alt
  28072. // single alt + preds
  28073. // conflict
  28074. // conflict + preds
  28075. //
  28076. ParserATNSimulator.prototype.execATN = function (dfa, s0, input, startIndex, outerContext) {
  28077. if (this.debug || this.debug_list_atn_decisions) {
  28078. console.log("execATN decision " + dfa.decision + " exec LA(1)==" + this.getLookaheadName(input) + " line " + input.LT(1).line + ":" + input.LT(1).column);
  28079. }
  28080. var alt;
  28081. var previousD = s0;
  28082. if (this.debug) {
  28083. console.log("s0 = " + s0);
  28084. }
  28085. var t = input.LA(1);
  28086. while (true) {
  28087. // while more work
  28088. var D = this.getExistingTargetState(previousD, t);
  28089. if (D === null) {
  28090. D = this.computeTargetState(dfa, previousD, t);
  28091. }
  28092. if (D === ATNSimulator.ERROR) {
  28093. // if any configs in previous dipped into outer context, that
  28094. // means that input up to t actually finished entry rule
  28095. // at least for SLL decision. Full LL doesn't dip into outer
  28096. // so don't need special case.
  28097. // We will get an error no matter what so delay until after
  28098. // decision; better error message. Also, no reachable target
  28099. // ATN states in SLL implies LL will also get nowhere.
  28100. // If conflict in states that dip out, choose min since we
  28101. // will get error no matter what.
  28102. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  28103. input.seek(startIndex);
  28104. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  28105. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28106. return alt;
  28107. } else {
  28108. throw e;
  28109. }
  28110. }
  28111. if (D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  28112. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  28113. var conflictingAlts = null;
  28114. if (D.predicates !== null) {
  28115. if (this.debug) {
  28116. console.log("DFA state has preds in DFA sim LL failover");
  28117. }
  28118. var conflictIndex = input.index;
  28119. if (conflictIndex !== startIndex) {
  28120. input.seek(startIndex);
  28121. }
  28122. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  28123. if (conflictingAlts.length === 1) {
  28124. if (this.debug) {
  28125. console.log("Full LL avoided");
  28126. }
  28127. return conflictingAlts.minValue();
  28128. }
  28129. if (conflictIndex !== startIndex) {
  28130. // restore the index so reporting the fallback to full
  28131. // context occurs with the index at the correct spot
  28132. input.seek(conflictIndex);
  28133. }
  28134. }
  28135. if (this.dfa_debug) {
  28136. console.log("ctx sensitive state " + outerContext + " in " + D);
  28137. }
  28138. var fullCtx = true;
  28139. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  28140. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  28141. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  28142. return alt;
  28143. }
  28144. if (D.isAcceptState) {
  28145. if (D.predicates === null) {
  28146. return D.prediction;
  28147. }
  28148. var stopIndex = input.index;
  28149. input.seek(startIndex);
  28150. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  28151. if (alts.length === 0) {
  28152. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  28153. } else if (alts.length === 1) {
  28154. return alts.minValue();
  28155. } else {
  28156. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  28157. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  28158. return alts.minValue();
  28159. }
  28160. }
  28161. previousD = D;
  28162. if (t !== Token.EOF) {
  28163. input.consume();
  28164. t = input.LA(1);
  28165. }
  28166. }
  28167. };
  28168. //
  28169. // Get an existing target state for an edge in the DFA. If the target state
  28170. // for the edge has not yet been computed or is otherwise not available,
  28171. // this method returns {@code null}.
  28172. //
  28173. // @param previousD The current DFA state
  28174. // @param t The next input symbol
  28175. // @return The existing target DFA state for the given input symbol
  28176. // {@code t}, or {@code null} if the target state for this edge is not
  28177. // already cached
  28178. //
  28179. ParserATNSimulator.prototype.getExistingTargetState = function (previousD, t) {
  28180. var edges = previousD.edges;
  28181. if (edges === null) {
  28182. return null;
  28183. } else {
  28184. return edges[t + 1] || null;
  28185. }
  28186. };
  28187. //
  28188. // Compute a target state for an edge in the DFA, and attempt to add the
  28189. // computed state and corresponding edge to the DFA.
  28190. //
  28191. // @param dfa The DFA
  28192. // @param previousD The current DFA state
  28193. // @param t The next input symbol
  28194. //
  28195. // @return The computed target DFA state for the given input symbol
  28196. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  28197. // returns {@link //ERROR}.
  28198. //
  28199. ParserATNSimulator.prototype.computeTargetState = function (dfa, previousD, t) {
  28200. var reach = this.computeReachSet(previousD.configs, t, false);
  28201. if (reach === null) {
  28202. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  28203. return ATNSimulator.ERROR;
  28204. }
  28205. // create new target state; we'll add to DFA after it's complete
  28206. var D = new DFAState(null, reach);
  28207. var predictedAlt = this.getUniqueAlt(reach);
  28208. if (this.debug) {
  28209. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28210. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) + ", previous=" + previousD.configs + ", configs=" + reach + ", predict=" + predictedAlt + ", allSubsetsConflict=" + PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" + this.getConflictingAlts(reach));
  28211. }
  28212. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28213. // NO CONFLICT, UNIQUELY PREDICTED ALT
  28214. D.isAcceptState = true;
  28215. D.configs.uniqueAlt = predictedAlt;
  28216. D.prediction = predictedAlt;
  28217. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  28218. // MORE THAN ONE VIABLE ALTERNATIVE
  28219. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  28220. D.requiresFullContext = true;
  28221. // in SLL-only mode, we will stop at this state and return the minimum alt
  28222. D.isAcceptState = true;
  28223. D.prediction = D.configs.conflictingAlts.minValue();
  28224. }
  28225. if (D.isAcceptState && D.configs.hasSemanticContext) {
  28226. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  28227. if (D.predicates !== null) {
  28228. D.prediction = ATN.INVALID_ALT_NUMBER;
  28229. }
  28230. }
  28231. // all adds to dfa are done after we've created full D state
  28232. D = this.addDFAEdge(dfa, previousD, t, D);
  28233. return D;
  28234. };
  28235. ParserATNSimulator.prototype.predicateDFAState = function (dfaState, decisionState) {
  28236. // We need to test all predicates, even in DFA states that
  28237. // uniquely predict alternative.
  28238. var nalts = decisionState.transitions.length;
  28239. // Update DFA so reach becomes accept state with (predicate,alt)
  28240. // pairs if preds found for conflicting alts
  28241. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  28242. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  28243. if (altToPred !== null) {
  28244. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  28245. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  28246. } else {
  28247. // There are preds in configs but they might go away
  28248. // when OR'd together like {p}? || NONE == NONE. If neither
  28249. // alt has preds, resolve to min alt
  28250. dfaState.prediction = altsToCollectPredsFrom.minValue();
  28251. }
  28252. };
  28253. // comes back with reach.uniqueAlt set to a valid alt
  28254. ParserATNSimulator.prototype.execATNWithFullContext = function (dfa, D, // how far we got before failing over
  28255. s0, input, startIndex, outerContext) {
  28256. if (this.debug || this.debug_list_atn_decisions) {
  28257. console.log("execATNWithFullContext " + s0);
  28258. }
  28259. var fullCtx = true;
  28260. var foundExactAmbig = false;
  28261. var reach = null;
  28262. var previous = s0;
  28263. input.seek(startIndex);
  28264. var t = input.LA(1);
  28265. var predictedAlt = -1;
  28266. while (true) {
  28267. // while more work
  28268. reach = this.computeReachSet(previous, t, fullCtx);
  28269. if (reach === null) {
  28270. // if any configs in previous dipped into outer context, that
  28271. // means that input up to t actually finished entry rule
  28272. // at least for LL decision. Full LL doesn't dip into outer
  28273. // so don't need special case.
  28274. // We will get an error no matter what so delay until after
  28275. // decision; better error message. Also, no reachable target
  28276. // ATN states in SLL implies LL will also get nowhere.
  28277. // If conflict in states that dip out, choose min since we
  28278. // will get error no matter what.
  28279. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  28280. input.seek(startIndex);
  28281. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  28282. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28283. return alt;
  28284. } else {
  28285. throw e;
  28286. }
  28287. }
  28288. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  28289. if (this.debug) {
  28290. console.log("LL altSubSets=" + altSubSets + ", predict=" + PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" + PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  28291. }
  28292. reach.uniqueAlt = this.getUniqueAlt(reach);
  28293. // unique prediction?
  28294. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28295. predictedAlt = reach.uniqueAlt;
  28296. break;
  28297. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  28298. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  28299. if (predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  28300. break;
  28301. }
  28302. } else {
  28303. // In exact ambiguity mode, we never try to terminate early.
  28304. // Just keeps scarfing until we know what the conflict is
  28305. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  28306. foundExactAmbig = true;
  28307. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  28308. break;
  28309. }
  28310. // else there are multiple non-conflicting subsets or
  28311. // we're not sure what the ambiguity is yet.
  28312. // So, keep going.
  28313. }
  28314. previous = reach;
  28315. if (t !== Token.EOF) {
  28316. input.consume();
  28317. t = input.LA(1);
  28318. }
  28319. }
  28320. // If the configuration set uniquely predicts an alternative,
  28321. // without conflict, then we know that it's a full LL decision
  28322. // not SLL.
  28323. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  28324. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  28325. return predictedAlt;
  28326. }
  28327. // We do not check predicates here because we have checked them
  28328. // on-the-fly when doing full context prediction.
  28329. //
  28330. // In non-exact ambiguity detection mode, we might actually be able to
  28331. // detect an exact ambiguity, but I'm not going to spend the cycles
  28332. // needed to check. We only emit ambiguity warnings in exact ambiguity
  28333. // mode.
  28334. //
  28335. // For example, we might know that we have conflicting configurations.
  28336. // But, that does not mean that there is no way forward without a
  28337. // conflict. It's possible to have nonconflicting alt subsets as in:
  28338. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  28339. // from
  28340. //
  28341. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  28342. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  28343. //
  28344. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  28345. // would resolve this without conflict to alternative 1. Any other viable
  28346. // next sequence, however, is associated with a conflict. We stop
  28347. // looking for input because no amount of further lookahead will alter
  28348. // the fact that we should predict alternative 1. We just can't say for
  28349. // sure that there is an ambiguity without looking further.
  28350. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  28351. return predictedAlt;
  28352. };
  28353. ParserATNSimulator.prototype.computeReachSet = function (closure, t, fullCtx) {
  28354. if (this.debug) {
  28355. console.log("in computeReachSet, starting closure: " + closure);
  28356. }
  28357. if (this.mergeCache === null) {
  28358. this.mergeCache = new DoubleDict();
  28359. }
  28360. var intermediate = new ATNConfigSet(fullCtx);
  28361. // Configurations already in a rule stop state indicate reaching the end
  28362. // of the decision rule (local context) or end of the start rule (full
  28363. // context). Once reached, these configurations are never updated by a
  28364. // closure operation, so they are handled separately for the performance
  28365. // advantage of having a smaller intermediate set when calling closure.
  28366. //
  28367. // For full-context reach operations, separate handling is required to
  28368. // ensure that the alternative matching the longest overall sequence is
  28369. // chosen when multiple such configurations can match the input.
  28370. var skippedStopStates = null;
  28371. // First figure out where we can reach on input t
  28372. for (var i = 0; i < closure.items.length; i++) {
  28373. var c = closure.items[i];
  28374. if (this.debug_add) {
  28375. console.log("testing " + this.getTokenName(t) + " at " + c);
  28376. }
  28377. if (c.state instanceof RuleStopState) {
  28378. if (fullCtx || t === Token.EOF) {
  28379. if (skippedStopStates === null) {
  28380. skippedStopStates = [];
  28381. }
  28382. skippedStopStates.push(c);
  28383. if (this.debug_add) {
  28384. console.log("added " + c + " to skippedStopStates");
  28385. }
  28386. }
  28387. continue;
  28388. }
  28389. for (var j = 0; j < c.state.transitions.length; j++) {
  28390. var trans = c.state.transitions[j];
  28391. var target = this.getReachableTarget(trans, t);
  28392. if (target !== null) {
  28393. var cfg = new ATNConfig({ state: target }, c);
  28394. intermediate.add(cfg, this.mergeCache);
  28395. if (this.debug_add) {
  28396. console.log("added " + cfg + " to intermediate");
  28397. }
  28398. }
  28399. }
  28400. }
  28401. // Now figure out where the reach operation can take us...
  28402. var reach = null;
  28403. // This block optimizes the reach operation for intermediate sets which
  28404. // trivially indicate a termination state for the overall
  28405. // adaptivePredict operation.
  28406. //
  28407. // The conditions assume that intermediate
  28408. // contains all configurations relevant to the reach set, but this
  28409. // condition is not true when one or more configurations have been
  28410. // withheld in skippedStopStates, or when the current symbol is EOF.
  28411. //
  28412. if (skippedStopStates === null && t !== Token.EOF) {
  28413. if (intermediate.items.length === 1) {
  28414. // Don't pursue the closure if there is just one state.
  28415. // It can only have one alternative; just add to result
  28416. // Also don't pursue the closure if there is unique alternative
  28417. // among the configurations.
  28418. reach = intermediate;
  28419. } else if (this.getUniqueAlt(intermediate) !== ATN.INVALID_ALT_NUMBER) {
  28420. // Also don't pursue the closure if there is unique alternative
  28421. // among the configurations.
  28422. reach = intermediate;
  28423. }
  28424. }
  28425. // If the reach set could not be trivially determined, perform a closure
  28426. // operation on the intermediate set to compute its initial value.
  28427. //
  28428. if (reach === null) {
  28429. reach = new ATNConfigSet(fullCtx);
  28430. var closureBusy = new Set();
  28431. var treatEofAsEpsilon = t === Token.EOF;
  28432. for (var k = 0; k < intermediate.items.length; k++) {
  28433. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  28434. }
  28435. }
  28436. if (t === Token.EOF) {
  28437. // After consuming EOF no additional input is possible, so we are
  28438. // only interested in configurations which reached the end of the
  28439. // decision rule (local context) or end of the start rule (full
  28440. // context). Update reach to contain only these configurations. This
  28441. // handles both explicit EOF transitions in the grammar and implicit
  28442. // EOF transitions following the end of the decision or start rule.
  28443. //
  28444. // When reach==intermediate, no closure operation was performed. In
  28445. // this case, removeAllConfigsNotInRuleStopState needs to check for
  28446. // reachable rule stop states as well as configurations already in
  28447. // a rule stop state.
  28448. //
  28449. // This is handled before the configurations in skippedStopStates,
  28450. // because any configurations potentially added from that list are
  28451. // already guaranteed to meet this condition whether or not it's
  28452. // required.
  28453. //
  28454. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  28455. }
  28456. // If skippedStopStates!==null, then it contains at least one
  28457. // configuration. For full-context reach operations, these
  28458. // configurations reached the end of the start rule, in which case we
  28459. // only add them back to reach if no configuration during the current
  28460. // closure operation reached such a state. This ensures adaptivePredict
  28461. // chooses an alternative matching the longest overall sequence when
  28462. // multiple alternatives are viable.
  28463. //
  28464. if (skippedStopStates !== null && (!fullCtx || !PredictionMode.hasConfigInRuleStopState(reach))) {
  28465. for (var l = 0; l < skippedStopStates.length; l++) {
  28466. reach.add(skippedStopStates[l], this.mergeCache);
  28467. }
  28468. }
  28469. if (reach.items.length === 0) {
  28470. return null;
  28471. } else {
  28472. return reach;
  28473. }
  28474. };
  28475. //
  28476. // Return a configuration set containing only the configurations from
  28477. // {@code configs} which are in a {@link RuleStopState}. If all
  28478. // configurations in {@code configs} are already in a rule stop state, this
  28479. // method simply returns {@code configs}.
  28480. //
  28481. // <p>When {@code lookToEndOfRule} is true, this method uses
  28482. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  28483. // not already in a rule stop state to see if a rule stop state is reachable
  28484. // from the configuration via epsilon-only transitions.</p>
  28485. //
  28486. // @param configs the configuration set to update
  28487. // @param lookToEndOfRule when true, this method checks for rule stop states
  28488. // reachable by epsilon-only transitions from each configuration in
  28489. // {@code configs}.
  28490. //
  28491. // @return {@code configs} if all configurations in {@code configs} are in a
  28492. // rule stop state, otherwise return a new configuration set containing only
  28493. // the configurations from {@code configs} which are in a rule stop state
  28494. //
  28495. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function (configs, lookToEndOfRule) {
  28496. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  28497. return configs;
  28498. }
  28499. var result = new ATNConfigSet(configs.fullCtx);
  28500. for (var i = 0; i < configs.items.length; i++) {
  28501. var config = configs.items[i];
  28502. if (config.state instanceof RuleStopState) {
  28503. result.add(config, this.mergeCache);
  28504. continue;
  28505. }
  28506. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  28507. var nextTokens = this.atn.nextTokens(config.state);
  28508. if (nextTokens.contains(Token.EPSILON)) {
  28509. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  28510. result.add(new ATNConfig({ state: endOfRuleState }, config), this.mergeCache);
  28511. }
  28512. }
  28513. }
  28514. return result;
  28515. };
  28516. ParserATNSimulator.prototype.computeStartState = function (p, ctx, fullCtx) {
  28517. // always at least the implicit call to start rule
  28518. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  28519. var configs = new ATNConfigSet(fullCtx);
  28520. for (var i = 0; i < p.transitions.length; i++) {
  28521. var target = p.transitions[i].target;
  28522. var c = new ATNConfig({ state: target, alt: i + 1, context: initialContext }, null);
  28523. var closureBusy = new Set();
  28524. this.closure(c, configs, closureBusy, true, fullCtx, false);
  28525. }
  28526. return configs;
  28527. };
  28528. //
  28529. // This method transforms the start state computed by
  28530. // {@link //computeStartState} to the special start state used by a
  28531. // precedence DFA for a particular precedence value. The transformation
  28532. // process applies the following changes to the start state's configuration
  28533. // set.
  28534. //
  28535. // <ol>
  28536. // <li>Evaluate the precedence predicates for each configuration using
  28537. // {@link SemanticContext//evalPrecedence}.</li>
  28538. // <li>Remove all configurations which predict an alternative greater than
  28539. // 1, for which another configuration that predicts alternative 1 is in the
  28540. // same ATN state with the same prediction context. This transformation is
  28541. // valid for the following reasons:
  28542. // <ul>
  28543. // <li>The closure block cannot contain any epsilon transitions which bypass
  28544. // the body of the closure, so all states reachable via alternative 1 are
  28545. // part of the precedence alternatives of the transformed left-recursive
  28546. // rule.</li>
  28547. // <li>The "primary" portion of a left recursive rule cannot contain an
  28548. // epsilon transition, so the only way an alternative other than 1 can exist
  28549. // in a state that is also reachable via alternative 1 is by nesting calls
  28550. // to the left-recursive rule, with the outer calls not being at the
  28551. // preferred precedence level.</li>
  28552. // </ul>
  28553. // </li>
  28554. // </ol>
  28555. //
  28556. // <p>
  28557. // The prediction context must be considered by this filter to address
  28558. // situations like the following.
  28559. // </p>
  28560. // <code>
  28561. // <pre>
  28562. // grammar TA;
  28563. // prog: statement* EOF;
  28564. // statement: letterA | statement letterA 'b' ;
  28565. // letterA: 'a';
  28566. // </pre>
  28567. // </code>
  28568. // <p>
  28569. // If the above grammar, the ATN state immediately before the token
  28570. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  28571. // of both the primary and closure blocks of the left-recursive rule
  28572. // {@code statement}. The prediction context associated with each of these
  28573. // configurations distinguishes between them, and prevents the alternative
  28574. // which stepped out to {@code prog} (and then back in to {@code statement}
  28575. // from being eliminated by the filter.
  28576. // </p>
  28577. //
  28578. // @param configs The configuration set computed by
  28579. // {@link //computeStartState} as the start state for the DFA.
  28580. // @return The transformed configuration set representing the start state
  28581. // for a precedence DFA at a particular precedence level (determined by
  28582. // calling {@link Parser//getPrecedence}).
  28583. //
  28584. ParserATNSimulator.prototype.applyPrecedenceFilter = function (configs) {
  28585. var config;
  28586. var statesFromAlt1 = [];
  28587. var configSet = new ATNConfigSet(configs.fullCtx);
  28588. for (var i = 0; i < configs.items.length; i++) {
  28589. config = configs.items[i];
  28590. // handle alt 1 first
  28591. if (config.alt !== 1) {
  28592. continue;
  28593. }
  28594. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  28595. if (updatedContext === null) {
  28596. // the configuration was eliminated
  28597. continue;
  28598. }
  28599. statesFromAlt1[config.state.stateNumber] = config.context;
  28600. if (updatedContext !== config.semanticContext) {
  28601. configSet.add(new ATNConfig({ semanticContext: updatedContext }, config), this.mergeCache);
  28602. } else {
  28603. configSet.add(config, this.mergeCache);
  28604. }
  28605. }
  28606. for (i = 0; i < configs.items.length; i++) {
  28607. config = configs.items[i];
  28608. if (config.alt === 1) {
  28609. // already handled
  28610. continue;
  28611. }
  28612. // In the future, this elimination step could be updated to also
  28613. // filter the prediction context for alternatives predicting alt>1
  28614. // (basically a graph subtraction algorithm).
  28615. if (!config.precedenceFilterSuppressed) {
  28616. var context = statesFromAlt1[config.state.stateNumber] || null;
  28617. if (context !== null && context.equals(config.context)) {
  28618. // eliminated
  28619. continue;
  28620. }
  28621. }
  28622. configSet.add(config, this.mergeCache);
  28623. }
  28624. return configSet;
  28625. };
  28626. ParserATNSimulator.prototype.getReachableTarget = function (trans, ttype) {
  28627. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  28628. return trans.target;
  28629. } else {
  28630. return null;
  28631. }
  28632. };
  28633. ParserATNSimulator.prototype.getPredsForAmbigAlts = function (ambigAlts, configs, nalts) {
  28634. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  28635. // altToPred starts as an array of all null contexts. The entry at index i
  28636. // corresponds to alternative i. altToPred[i] may have one of three values:
  28637. // 1. null: no ATNConfig c is found such that c.alt==i
  28638. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  28639. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  28640. // alt i has at least one unpredicated config.
  28641. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  28642. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  28643. //
  28644. // From this, it is clear that NONE||anything==NONE.
  28645. //
  28646. var altToPred = [];
  28647. for (var i = 0; i < configs.items.length; i++) {
  28648. var c = configs.items[i];
  28649. if (ambigAlts.contains(c.alt)) {
  28650. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  28651. }
  28652. }
  28653. var nPredAlts = 0;
  28654. for (i = 1; i < nalts + 1; i++) {
  28655. var pred = altToPred[i] || null;
  28656. if (pred === null) {
  28657. altToPred[i] = SemanticContext.NONE;
  28658. } else if (pred !== SemanticContext.NONE) {
  28659. nPredAlts += 1;
  28660. }
  28661. }
  28662. // nonambig alts are null in altToPred
  28663. if (nPredAlts === 0) {
  28664. altToPred = null;
  28665. }
  28666. if (this.debug) {
  28667. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  28668. }
  28669. return altToPred;
  28670. };
  28671. ParserATNSimulator.prototype.getPredicatePredictions = function (ambigAlts, altToPred) {
  28672. var pairs = [];
  28673. var containsPredicate = false;
  28674. for (var i = 1; i < altToPred.length; i++) {
  28675. var pred = altToPred[i];
  28676. // unpredicated is indicated by SemanticContext.NONE
  28677. if (ambigAlts !== null && ambigAlts.contains(i)) {
  28678. pairs.push(new PredPrediction(pred, i));
  28679. }
  28680. if (pred !== SemanticContext.NONE) {
  28681. containsPredicate = true;
  28682. }
  28683. }
  28684. if (!containsPredicate) {
  28685. return null;
  28686. }
  28687. return pairs;
  28688. };
  28689. //
  28690. // This method is used to improve the localization of error messages by
  28691. // choosing an alternative rather than throwing a
  28692. // {@link NoViableAltException} in particular prediction scenarios where the
  28693. // {@link //ERROR} state was reached during ATN simulation.
  28694. //
  28695. // <p>
  28696. // The default implementation of this method uses the following
  28697. // algorithm to identify an ATN configuration which successfully parsed the
  28698. // decision entry rule. Choosing such an alternative ensures that the
  28699. // {@link ParserRuleContext} returned by the calling rule will be complete
  28700. // and valid, and the syntax error will be reported later at a more
  28701. // localized location.</p>
  28702. //
  28703. // <ul>
  28704. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  28705. // they are semantically valid if predicated, return the min associated alt.</li>
  28706. // <li>Else, if a semantically invalid but syntactically valid path exist
  28707. // or paths exist, return the minimum associated alt.
  28708. // </li>
  28709. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  28710. // </ul>
  28711. //
  28712. // <p>
  28713. // In some scenarios, the algorithm described above could predict an
  28714. // alternative which will result in a {@link FailedPredicateException} in
  28715. // the parser. Specifically, this could occur if the <em>only</em> configuration
  28716. // capable of successfully parsing to the end of the decision rule is
  28717. // blocked by a semantic predicate. By choosing this alternative within
  28718. // {@link //adaptivePredict} instead of throwing a
  28719. // {@link NoViableAltException}, the resulting
  28720. // {@link FailedPredicateException} in the parser will identify the specific
  28721. // predicate which is preventing the parser from successfully parsing the
  28722. // decision rule, which helps developers identify and correct logic errors
  28723. // in semantic predicates.
  28724. // </p>
  28725. //
  28726. // @param configs The ATN configurations which were valid immediately before
  28727. // the {@link //ERROR} state was reached
  28728. // @param outerContext The is the \gamma_0 initial parser context from the paper
  28729. // or the parser stack at the instant before prediction commences.
  28730. //
  28731. // @return The value to return from {@link //adaptivePredict}, or
  28732. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  28733. // identified and {@link //adaptivePredict} should report an error instead.
  28734. //
  28735. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function (configs, outerContext) {
  28736. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  28737. var semValidConfigs = cfgs[0];
  28738. var semInvalidConfigs = cfgs[1];
  28739. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  28740. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28741. // semantically/syntactically viable path exists
  28742. return alt;
  28743. }
  28744. // Is there a syntactically valid path with a failed pred?
  28745. if (semInvalidConfigs.items.length > 0) {
  28746. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  28747. if (alt !== ATN.INVALID_ALT_NUMBER) {
  28748. // syntactically viable path exists
  28749. return alt;
  28750. }
  28751. }
  28752. return ATN.INVALID_ALT_NUMBER;
  28753. };
  28754. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function (configs) {
  28755. var alts = [];
  28756. for (var i = 0; i < configs.items.length; i++) {
  28757. var c = configs.items[i];
  28758. if (c.reachesIntoOuterContext > 0 || c.state instanceof RuleStopState && c.context.hasEmptyPath()) {
  28759. if (alts.indexOf(c.alt) < 0) {
  28760. alts.push(c.alt);
  28761. }
  28762. }
  28763. }
  28764. if (alts.length === 0) {
  28765. return ATN.INVALID_ALT_NUMBER;
  28766. } else {
  28767. return Math.min.apply(null, alts);
  28768. }
  28769. };
  28770. // Walk the list of configurations and split them according to
  28771. // those that have preds evaluating to true/false. If no pred, assume
  28772. // true pred and include in succeeded set. Returns Pair of sets.
  28773. //
  28774. // Create a new set so as not to alter the incoming parameter.
  28775. //
  28776. // Assumption: the input stream has been restored to the starting point
  28777. // prediction, which is where predicates need to evaluate.
  28778. //
  28779. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function (configs, outerContext) {
  28780. var succeeded = new ATNConfigSet(configs.fullCtx);
  28781. var failed = new ATNConfigSet(configs.fullCtx);
  28782. for (var i = 0; i < configs.items.length; i++) {
  28783. var c = configs.items[i];
  28784. if (c.semanticContext !== SemanticContext.NONE) {
  28785. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  28786. if (predicateEvaluationResult) {
  28787. succeeded.add(c);
  28788. } else {
  28789. failed.add(c);
  28790. }
  28791. } else {
  28792. succeeded.add(c);
  28793. }
  28794. }
  28795. return [succeeded, failed];
  28796. };
  28797. // Look through a list of predicate/alt pairs, returning alts for the
  28798. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  28799. // unpredicated config which behaves as "always true." If !complete
  28800. // then we stop at the first predicate that evaluates to true. This
  28801. // includes pairs with null predicates.
  28802. //
  28803. ParserATNSimulator.prototype.evalSemanticContext = function (predPredictions, outerContext, complete) {
  28804. var predictions = new BitSet();
  28805. for (var i = 0; i < predPredictions.length; i++) {
  28806. var pair = predPredictions[i];
  28807. if (pair.pred === SemanticContext.NONE) {
  28808. predictions.add(pair.alt);
  28809. if (!complete) {
  28810. break;
  28811. }
  28812. continue;
  28813. }
  28814. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  28815. if (this.debug || this.dfa_debug) {
  28816. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  28817. }
  28818. if (predicateEvaluationResult) {
  28819. if (this.debug || this.dfa_debug) {
  28820. console.log("PREDICT " + pair.alt);
  28821. }
  28822. predictions.add(pair.alt);
  28823. if (!complete) {
  28824. break;
  28825. }
  28826. }
  28827. }
  28828. return predictions;
  28829. };
  28830. // TODO: If we are doing predicates, there is no point in pursuing
  28831. // closure operations if we reach a DFA state that uniquely predicts
  28832. // alternative. We will not be caching that DFA state and it is a
  28833. // waste to pursue the closure. Might have to advance when we do
  28834. // ambig detection thought :(
  28835. //
  28836. ParserATNSimulator.prototype.closure = function (config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  28837. var initialDepth = 0;
  28838. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates, fullCtx, initialDepth, treatEofAsEpsilon);
  28839. };
  28840. ParserATNSimulator.prototype.closureCheckingStopState = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28841. if (this.debug || this.debug_closure) {
  28842. console.log("closure(" + config.toString(this.parser, true) + ")");
  28843. // console.log("configs(" + configs.toString() + ")");
  28844. if (config.reachesIntoOuterContext > 50) {
  28845. throw "problem";
  28846. }
  28847. }
  28848. if (config.state instanceof RuleStopState) {
  28849. // We hit rule end. If we have context info, use it
  28850. // run thru all possible stack tops in ctx
  28851. if (!config.context.isEmpty()) {
  28852. for (var i = 0; i < config.context.length; i++) {
  28853. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  28854. if (fullCtx) {
  28855. configs.add(new ATNConfig({ state: config.state, context: PredictionContext.EMPTY }, config), this.mergeCache);
  28856. continue;
  28857. } else {
  28858. // we have no context info, just chase follow links (if greedy)
  28859. if (this.debug) {
  28860. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28861. }
  28862. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28863. }
  28864. continue;
  28865. }
  28866. var returnState = this.atn.states[config.context.getReturnState(i)];
  28867. var newContext = config.context.getParent(i); // "pop" return state
  28868. var parms = { state: returnState, alt: config.alt, context: newContext, semanticContext: config.semanticContext };
  28869. var c = new ATNConfig(parms, null);
  28870. // While we have context to pop back from, we may have
  28871. // gotten that context AFTER having falling off a rule.
  28872. // Make sure we track that we are now out of context.
  28873. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  28874. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  28875. }
  28876. return;
  28877. } else if (fullCtx) {
  28878. // reached end of start rule
  28879. configs.add(config, this.mergeCache);
  28880. return;
  28881. } else {
  28882. // else if we have no context info, just chase follow links (if greedy)
  28883. if (this.debug) {
  28884. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  28885. }
  28886. }
  28887. }
  28888. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  28889. };
  28890. // Do the actual work of walking epsilon edges//
  28891. ParserATNSimulator.prototype.closure_ = function (config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  28892. var p = config.state;
  28893. // optimization
  28894. if (!p.epsilonOnlyTransitions) {
  28895. configs.add(config, this.mergeCache);
  28896. // make sure to not return here, because EOF transitions can act as
  28897. // both epsilon transitions and non-epsilon transitions.
  28898. }
  28899. for (var i = 0; i < p.transitions.length; i++) {
  28900. if (i == 0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config)) continue;
  28901. var t = p.transitions[i];
  28902. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  28903. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  28904. if (c !== null) {
  28905. if (!t.isEpsilon && closureBusy.add(c) !== c) {
  28906. // avoid infinite recursion for EOF* and EOF+
  28907. continue;
  28908. }
  28909. var newDepth = depth;
  28910. if (config.state instanceof RuleStopState) {
  28911. // target fell off end of rule; mark resulting c as having dipped into outer context
  28912. // We can't get here if incoming config was rule stop and we had context
  28913. // track how far we dip into outer context. Might
  28914. // come in handy and we avoid evaluating context dependent
  28915. // preds if this is > 0.
  28916. if (closureBusy.add(c) !== c) {
  28917. // avoid infinite recursion for right-recursive rules
  28918. continue;
  28919. }
  28920. if (this._dfa !== null && this._dfa.precedenceDfa) {
  28921. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  28922. c.precedenceFilterSuppressed = true;
  28923. }
  28924. }
  28925. c.reachesIntoOuterContext += 1;
  28926. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  28927. newDepth -= 1;
  28928. if (this.debug) {
  28929. console.log("dips into outer ctx: " + c);
  28930. }
  28931. } else if (t instanceof RuleTransition) {
  28932. // latch when newDepth goes negative - once we step out of the entry context we can't return
  28933. if (newDepth >= 0) {
  28934. newDepth += 1;
  28935. }
  28936. }
  28937. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  28938. }
  28939. }
  28940. };
  28941. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function (config) {
  28942. // return False
  28943. var p = config.state;
  28944. // First check to see if we are in StarLoopEntryState generated during
  28945. // left-recursion elimination. For efficiency, also check if
  28946. // the context has an empty stack case. If so, it would mean
  28947. // global FOLLOW so we can't perform optimization
  28948. // Are we the special loop entry/exit state? or SLL wildcard
  28949. if (p.stateType != ATNState.STAR_LOOP_ENTRY) return false;
  28950. if (p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision || config.context.isEmpty() || config.context.hasEmptyPath()) return false;
  28951. // Require all return states to return back to the same rule that p is in.
  28952. var numCtxs = config.context.length;
  28953. for (var i = 0; i < numCtxs; i++) {
  28954. // for each stack context
  28955. var returnState = this.atn.states[config.context.getReturnState(i)];
  28956. if (returnState.ruleIndex != p.ruleIndex) return false;
  28957. }
  28958. var decisionStartState = p.transitions[0].target;
  28959. var blockEndStateNum = decisionStartState.endState.stateNumber;
  28960. var blockEndState = this.atn.states[blockEndStateNum];
  28961. // Verify that the top of each stack context leads to loop entry/exit
  28962. // state through epsilon edges and w/o leaving rule.
  28963. for (var i = 0; i < numCtxs; i++) {
  28964. // for each stack context
  28965. var returnStateNumber = config.context.getReturnState(i);
  28966. var returnState = this.atn.states[returnStateNumber];
  28967. // all states must have single outgoing epsilon edge
  28968. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon) return false;
  28969. // Look for prefix op case like 'not expr', (' type ')' expr
  28970. var returnStateTarget = returnState.transitions[0].target;
  28971. if (returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p) continue;
  28972. // Look for 'expr op expr' or case where expr's return state is block end
  28973. // of (...)* internal block; the block end points to loop back
  28974. // which points to p but we don't need to check that
  28975. if (returnState == blockEndState) continue;
  28976. // Look for ternary expr ? expr : expr. The return state points at block end,
  28977. // which points at loop entry state
  28978. if (returnStateTarget == blockEndState) continue;
  28979. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  28980. // return state points at block end state of (...)* internal block
  28981. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1 && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p) continue;
  28982. // anything else ain't conforming
  28983. return false;
  28984. }
  28985. return true;
  28986. };
  28987. ParserATNSimulator.prototype.getRuleName = function (index) {
  28988. if (this.parser !== null && index >= 0) {
  28989. return this.parser.ruleNames[index];
  28990. } else {
  28991. return "<rule " + index + ">";
  28992. }
  28993. };
  28994. ParserATNSimulator.prototype.getEpsilonTarget = function (config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  28995. switch (t.serializationType) {
  28996. case Transition.RULE:
  28997. return this.ruleTransition(config, t);
  28998. case Transition.PRECEDENCE:
  28999. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  29000. case Transition.PREDICATE:
  29001. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  29002. case Transition.ACTION:
  29003. return this.actionTransition(config, t);
  29004. case Transition.EPSILON:
  29005. return new ATNConfig({ state: t.target }, config);
  29006. case Transition.ATOM:
  29007. case Transition.RANGE:
  29008. case Transition.SET:
  29009. // EOF transitions act like epsilon transitions after the first EOF
  29010. // transition is traversed
  29011. if (treatEofAsEpsilon) {
  29012. if (t.matches(Token.EOF, 0, 1)) {
  29013. return new ATNConfig({ state: t.target }, config);
  29014. }
  29015. }
  29016. return null;
  29017. default:
  29018. return null;
  29019. }
  29020. };
  29021. ParserATNSimulator.prototype.actionTransition = function (config, t) {
  29022. if (this.debug) {
  29023. var index = t.actionIndex == -1 ? 65535 : t.actionIndex;
  29024. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  29025. }
  29026. return new ATNConfig({ state: t.target }, config);
  29027. };
  29028. ParserATNSimulator.prototype.precedenceTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29029. if (this.debug) {
  29030. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.precedence + ">=_p, ctx dependent=true");
  29031. if (this.parser !== null) {
  29032. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29033. }
  29034. }
  29035. var c = null;
  29036. if (collectPredicates && inContext) {
  29037. if (fullCtx) {
  29038. // In full context mode, we can evaluate predicates on-the-fly
  29039. // during closure, which dramatically reduces the size of
  29040. // the config sets. It also obviates the need to test predicates
  29041. // later during conflict resolution.
  29042. var currentPosition = this._input.index;
  29043. this._input.seek(this._startIndex);
  29044. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29045. this._input.seek(currentPosition);
  29046. if (predSucceeds) {
  29047. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29048. }
  29049. } else {
  29050. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29051. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29052. }
  29053. } else {
  29054. c = new ATNConfig({ state: pt.target }, config);
  29055. }
  29056. if (this.debug) {
  29057. console.log("config from pred transition=" + c);
  29058. }
  29059. return c;
  29060. };
  29061. ParserATNSimulator.prototype.predTransition = function (config, pt, collectPredicates, inContext, fullCtx) {
  29062. if (this.debug) {
  29063. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex + ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  29064. if (this.parser !== null) {
  29065. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  29066. }
  29067. }
  29068. var c = null;
  29069. if (collectPredicates && (pt.isCtxDependent && inContext || !pt.isCtxDependent)) {
  29070. if (fullCtx) {
  29071. // In full context mode, we can evaluate predicates on-the-fly
  29072. // during closure, which dramatically reduces the size of
  29073. // the config sets. It also obviates the need to test predicates
  29074. // later during conflict resolution.
  29075. var currentPosition = this._input.index;
  29076. this._input.seek(this._startIndex);
  29077. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  29078. this._input.seek(currentPosition);
  29079. if (predSucceeds) {
  29080. c = new ATNConfig({ state: pt.target }, config); // no pred context
  29081. }
  29082. } else {
  29083. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  29084. c = new ATNConfig({ state: pt.target, semanticContext: newSemCtx }, config);
  29085. }
  29086. } else {
  29087. c = new ATNConfig({ state: pt.target }, config);
  29088. }
  29089. if (this.debug) {
  29090. console.log("config from pred transition=" + c);
  29091. }
  29092. return c;
  29093. };
  29094. ParserATNSimulator.prototype.ruleTransition = function (config, t) {
  29095. if (this.debug) {
  29096. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  29097. }
  29098. var returnState = t.followState;
  29099. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  29100. return new ATNConfig({ state: t.target, context: newContext }, config);
  29101. };
  29102. ParserATNSimulator.prototype.getConflictingAlts = function (configs) {
  29103. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29104. return PredictionMode.getAlts(altsets);
  29105. };
  29106. // Sam pointed out a problem with the previous definition, v3, of
  29107. // ambiguous states. If we have another state associated with conflicting
  29108. // alternatives, we should keep going. For example, the following grammar
  29109. //
  29110. // s : (ID | ID ID?) ';' ;
  29111. //
  29112. // When the ATN simulation reaches the state before ';', it has a DFA
  29113. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  29114. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  29115. // because alternative to has another way to continue, via [6|2|[]].
  29116. // The key is that we have a single state that has config's only associated
  29117. // with a single alternative, 2, and crucially the state transitions
  29118. // among the configurations are all non-epsilon transitions. That means
  29119. // we don't consider any conflicts that include alternative 2. So, we
  29120. // ignore the conflict between alts 1 and 2. We ignore a set of
  29121. // conflicting alts when there is an intersection with an alternative
  29122. // associated with a single alt state in the state&rarr;config-list map.
  29123. //
  29124. // It's also the case that we might have two conflicting configurations but
  29125. // also a 3rd nonconflicting configuration for a different alternative:
  29126. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  29127. //
  29128. // a : A | A | A B ;
  29129. //
  29130. // After matching input A, we reach the stop state for rule A, state 1.
  29131. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29132. // conflict and no amount of further lookahead will separate the two.
  29133. // However, alternative 3 will be able to continue and so we do not
  29134. // stop working on this state. In the previous example, we're concerned
  29135. // with states associated with the conflicting alternatives. Here alt
  29136. // 3 is not associated with the conflicting configs, but since we can continue
  29137. // looking for input reasonably, I don't declare the state done. We
  29138. // ignore a set of conflicting alts when we have an alternative
  29139. // that we still need to pursue.
  29140. //
  29141. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function (configs) {
  29142. var conflictingAlts = null;
  29143. if (configs.uniqueAlt !== ATN.INVALID_ALT_NUMBER) {
  29144. conflictingAlts = new BitSet();
  29145. conflictingAlts.add(configs.uniqueAlt);
  29146. } else {
  29147. conflictingAlts = configs.conflictingAlts;
  29148. }
  29149. return conflictingAlts;
  29150. };
  29151. ParserATNSimulator.prototype.getTokenName = function (t) {
  29152. if (t === Token.EOF) {
  29153. return "EOF";
  29154. }
  29155. if (this.parser !== null && this.parser.literalNames !== null) {
  29156. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  29157. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  29158. console.log("" + this.parser.getInputStream().getTokens());
  29159. } else {
  29160. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  29161. return name + "<" + t + ">";
  29162. }
  29163. }
  29164. return "" + t;
  29165. };
  29166. ParserATNSimulator.prototype.getLookaheadName = function (input) {
  29167. return this.getTokenName(input.LA(1));
  29168. };
  29169. // Used for debugging in adaptivePredict around execATN but I cut
  29170. // it out for clarity now that alg. works well. We can leave this
  29171. // "dead" code for a bit.
  29172. //
  29173. ParserATNSimulator.prototype.dumpDeadEndConfigs = function (nvae) {
  29174. console.log("dead end configs: ");
  29175. var decs = nvae.getDeadEndConfigs();
  29176. for (var i = 0; i < decs.length; i++) {
  29177. var c = decs[i];
  29178. var trans = "no edges";
  29179. if (c.state.transitions.length > 0) {
  29180. var t = c.state.transitions[0];
  29181. if (t instanceof AtomTransition) {
  29182. trans = "Atom " + this.getTokenName(t.label);
  29183. } else if (t instanceof SetTransition) {
  29184. var neg = t instanceof NotSetTransition;
  29185. trans = (neg ? "~" : "") + "Set " + t.set;
  29186. }
  29187. }
  29188. console.error(c.toString(this.parser, true) + ":" + trans);
  29189. }
  29190. };
  29191. ParserATNSimulator.prototype.noViableAlt = function (input, outerContext, configs, startIndex) {
  29192. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  29193. };
  29194. ParserATNSimulator.prototype.getUniqueAlt = function (configs) {
  29195. var alt = ATN.INVALID_ALT_NUMBER;
  29196. for (var i = 0; i < configs.items.length; i++) {
  29197. var c = configs.items[i];
  29198. if (alt === ATN.INVALID_ALT_NUMBER) {
  29199. alt = c.alt; // found first alt
  29200. } else if (c.alt !== alt) {
  29201. return ATN.INVALID_ALT_NUMBER;
  29202. }
  29203. }
  29204. return alt;
  29205. };
  29206. //
  29207. // Add an edge to the DFA, if possible. This method calls
  29208. // {@link //addDFAState} to ensure the {@code to} state is present in the
  29209. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  29210. // range of edges that can be represented in the DFA tables, this method
  29211. // returns without adding the edge to the DFA.
  29212. //
  29213. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  29214. // Otherwise, this method returns the {@link DFAState} returned by calling
  29215. // {@link //addDFAState} for the {@code to} state.</p>
  29216. //
  29217. // @param dfa The DFA
  29218. // @param from The source state for the edge
  29219. // @param t The input symbol
  29220. // @param to The target state for the edge
  29221. //
  29222. // @return If {@code to} is {@code null}, this method returns {@code null};
  29223. // otherwise this method returns the result of calling {@link //addDFAState}
  29224. // on {@code to}
  29225. //
  29226. ParserATNSimulator.prototype.addDFAEdge = function (dfa, from_, t, to) {
  29227. if (this.debug) {
  29228. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  29229. }
  29230. if (to === null) {
  29231. return null;
  29232. }
  29233. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  29234. if (from_ === null || t < -1 || t > this.atn.maxTokenType) {
  29235. return to;
  29236. }
  29237. if (from_.edges === null) {
  29238. from_.edges = [];
  29239. }
  29240. from_.edges[t + 1] = to; // connect
  29241. if (this.debug) {
  29242. var literalNames = this.parser === null ? null : this.parser.literalNames;
  29243. var symbolicNames = this.parser === null ? null : this.parser.symbolicNames;
  29244. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  29245. }
  29246. return to;
  29247. };
  29248. //
  29249. // Add state {@code D} to the DFA if it is not already present, and return
  29250. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  29251. // is already in the DFA, the existing state is returned. Otherwise this
  29252. // method returns {@code D} after adding it to the DFA.
  29253. //
  29254. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  29255. // does not change the DFA.</p>
  29256. //
  29257. // @param dfa The dfa
  29258. // @param D The DFA state to add
  29259. // @return The state stored in the DFA. This will be either the existing
  29260. // state if {@code D} is already in the DFA, or {@code D} itself if the
  29261. // state was not already present.
  29262. //
  29263. ParserATNSimulator.prototype.addDFAState = function (dfa, D) {
  29264. if (D == ATNSimulator.ERROR) {
  29265. return D;
  29266. }
  29267. var existing = dfa.states.get(D);
  29268. if (existing !== null) {
  29269. return existing;
  29270. }
  29271. D.stateNumber = dfa.states.length;
  29272. if (!D.configs.readOnly) {
  29273. D.configs.optimizeConfigs(this);
  29274. D.configs.setReadonly(true);
  29275. }
  29276. dfa.states.add(D);
  29277. if (this.debug) {
  29278. console.log("adding new DFA state: " + D);
  29279. }
  29280. return D;
  29281. };
  29282. ParserATNSimulator.prototype.reportAttemptingFullContext = function (dfa, conflictingAlts, configs, startIndex, stopIndex) {
  29283. if (this.debug || this.retry_debug) {
  29284. var interval = new Interval(startIndex, stopIndex + 1);
  29285. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29286. }
  29287. if (this.parser !== null) {
  29288. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  29289. }
  29290. };
  29291. ParserATNSimulator.prototype.reportContextSensitivity = function (dfa, prediction, configs, startIndex, stopIndex) {
  29292. if (this.debug || this.retry_debug) {
  29293. var interval = new Interval(startIndex, stopIndex + 1);
  29294. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29295. }
  29296. if (this.parser !== null) {
  29297. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  29298. }
  29299. };
  29300. // If context sensitive parsing, we know it's ambiguity not conflict//
  29301. ParserATNSimulator.prototype.reportAmbiguity = function (dfa, D, startIndex, stopIndex, exact, ambigAlts, configs) {
  29302. if (this.debug || this.retry_debug) {
  29303. var interval = new Interval(startIndex, stopIndex + 1);
  29304. console.log("reportAmbiguity " + ambigAlts + ":" + configs + ", input=" + this.parser.getTokenStream().getText(interval));
  29305. }
  29306. if (this.parser !== null) {
  29307. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  29308. }
  29309. };
  29310. exports.ParserATNSimulator = ParserATNSimulator;
  29311. /***/ }),
  29312. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  29313. /*!***************************************************!*\
  29314. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  29315. \***************************************************/
  29316. /*! no static exports found */
  29317. /***/ (function(module, exports, __webpack_require__) {
  29318. "use strict";
  29319. //
  29320. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29321. * Use of this file is governed by the BSD 3-clause license that
  29322. * can be found in the LICENSE.txt file in the project root.
  29323. */
  29324. //
  29325. //
  29326. // This enumeration defines the prediction modes available in ANTLR 4 along with
  29327. // utility methods for analyzing configuration sets for conflicts and/or
  29328. // ambiguities.
  29329. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29330. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  29331. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  29332. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  29333. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  29334. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  29335. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  29336. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  29337. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  29338. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29339. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  29340. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  29341. function PredictionMode() {
  29342. return this;
  29343. }
  29344. //
  29345. // The SLL(*) prediction mode. This prediction mode ignores the current
  29346. // parser context when making predictions. This is the fastest prediction
  29347. // mode, and provides correct results for many grammars. This prediction
  29348. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  29349. // may result in syntax errors for grammar and input combinations which are
  29350. // not SLL.
  29351. //
  29352. // <p>
  29353. // When using this prediction mode, the parser will either return a correct
  29354. // parse tree (i.e. the same parse tree that would be returned with the
  29355. // {@link //LL} prediction mode), or it will report a syntax error. If a
  29356. // syntax error is encountered when using the {@link //SLL} prediction mode,
  29357. // it may be due to either an actual syntax error in the input or indicate
  29358. // that the particular combination of grammar and input requires the more
  29359. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  29360. //
  29361. // <p>
  29362. // This prediction mode does not provide any guarantees for prediction
  29363. // behavior for syntactically-incorrect inputs.</p>
  29364. //
  29365. PredictionMode.SLL = 0;
  29366. //
  29367. // The LL(*) prediction mode. This prediction mode allows the current parser
  29368. // context to be used for resolving SLL conflicts that occur during
  29369. // prediction. This is the fastest prediction mode that guarantees correct
  29370. // parse results for all combinations of grammars with syntactically correct
  29371. // inputs.
  29372. //
  29373. // <p>
  29374. // When using this prediction mode, the parser will make correct decisions
  29375. // for all syntactically-correct grammar and input combinations. However, in
  29376. // cases where the grammar is truly ambiguous this prediction mode might not
  29377. // report a precise answer for <em>exactly which</em> alternatives are
  29378. // ambiguous.</p>
  29379. //
  29380. // <p>
  29381. // This prediction mode does not provide any guarantees for prediction
  29382. // behavior for syntactically-incorrect inputs.</p>
  29383. //
  29384. PredictionMode.LL = 1;
  29385. //
  29386. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  29387. // the correctness guarantees provided by the {@link //LL} prediction mode,
  29388. // this prediction mode instructs the prediction algorithm to determine the
  29389. // complete and exact set of ambiguous alternatives for every ambiguous
  29390. // decision encountered while parsing.
  29391. //
  29392. // <p>
  29393. // This prediction mode may be used for diagnosing ambiguities during
  29394. // grammar development. Due to the performance overhead of calculating sets
  29395. // of ambiguous alternatives, this prediction mode should be avoided when
  29396. // the exact results are not necessary.</p>
  29397. //
  29398. // <p>
  29399. // This prediction mode does not provide any guarantees for prediction
  29400. // behavior for syntactically-incorrect inputs.</p>
  29401. //
  29402. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  29403. //
  29404. // Computes the SLL prediction termination condition.
  29405. //
  29406. // <p>
  29407. // This method computes the SLL prediction termination condition for both of
  29408. // the following cases.</p>
  29409. //
  29410. // <ul>
  29411. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  29412. // <li>Pure SLL without LL fallback</li>
  29413. // </ul>
  29414. //
  29415. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  29416. //
  29417. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  29418. // ensured regardless of how the termination condition is computed by this
  29419. // method. Due to the substantially higher cost of LL prediction, the
  29420. // prediction should only fall back to LL when the additional lookahead
  29421. // cannot lead to a unique SLL prediction.</p>
  29422. //
  29423. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  29424. // conflicting subsets should fall back to full LL, even if the
  29425. // configuration sets don't resolve to the same alternative (e.g.
  29426. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  29427. // configuration, SLL could continue with the hopes that more lookahead will
  29428. // resolve via one of those non-conflicting configurations.</p>
  29429. //
  29430. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  29431. // stops when it sees only conflicting configuration subsets. In contrast,
  29432. // full LL keeps going when there is uncertainty.</p>
  29433. //
  29434. // <p><strong>HEURISTIC</strong></p>
  29435. //
  29436. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  29437. // unless we see a state that only has one alternative associated with it.
  29438. // The single-alt-state thing lets prediction continue upon rules like
  29439. // (otherwise, it would admit defeat too soon):</p>
  29440. //
  29441. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  29442. //
  29443. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  29444. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  29445. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  29446. // processing this node because alternative to has another way to continue,
  29447. // via {@code [6|2|[]]}.</p>
  29448. //
  29449. // <p>It also let's us continue for this rule:</p>
  29450. //
  29451. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  29452. //
  29453. // <p>After matching input A, we reach the stop state for rule A, state 1.
  29454. // State 8 is the state right before B. Clearly alternatives 1 and 2
  29455. // conflict and no amount of further lookahead will separate the two.
  29456. // However, alternative 3 will be able to continue and so we do not stop
  29457. // working on this state. In the previous example, we're concerned with
  29458. // states associated with the conflicting alternatives. Here alt 3 is not
  29459. // associated with the conflicting configs, but since we can continue
  29460. // looking for input reasonably, don't declare the state done.</p>
  29461. //
  29462. // <p><strong>PURE SLL PARSING</strong></p>
  29463. //
  29464. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  29465. // combine stack contexts for configurations that differ only by semantic
  29466. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  29467. //
  29468. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  29469. //
  29470. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  29471. // states because they need to create the DFA cache that works in all
  29472. // semantic situations. In contrast, full LL evaluates predicates collected
  29473. // during start state computation so it can ignore predicates thereafter.
  29474. // This means that SLL termination detection can totally ignore semantic
  29475. // predicates.</p>
  29476. //
  29477. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  29478. // semantic predicate contexts so we might see two configurations like the
  29479. // following.</p>
  29480. //
  29481. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  29482. //
  29483. // <p>Before testing these configurations against others, we have to merge
  29484. // {@code x} and {@code x'} (without modifying the existing configurations).
  29485. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  29486. // the following configurations.</p>
  29487. //
  29488. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  29489. //
  29490. // <p>If the configuration set has predicates (as indicated by
  29491. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  29492. // the configurations to strip out all of the predicates so that a standard
  29493. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  29494. //
  29495. PredictionMode.hasSLLConflictTerminatingPrediction = function (mode, configs) {
  29496. // Configs in rule stop states indicate reaching the end of the decision
  29497. // rule (local context) or end of start rule (full context). If all
  29498. // configs meet this condition, then none of the configurations is able
  29499. // to match additional input so we terminate prediction.
  29500. //
  29501. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  29502. return true;
  29503. }
  29504. // pure SLL mode parsing
  29505. if (mode === PredictionMode.SLL) {
  29506. // Don't bother with combining configs from different semantic
  29507. // contexts if we can fail over to full LL; costs more time
  29508. // since we'll often fail over anyway.
  29509. if (configs.hasSemanticContext) {
  29510. // dup configs, tossing out semantic predicates
  29511. var dup = new ATNConfigSet();
  29512. for (var i = 0; i < configs.items.length; i++) {
  29513. var c = configs.items[i];
  29514. c = new ATNConfig({ semanticContext: SemanticContext.NONE }, c);
  29515. dup.add(c);
  29516. }
  29517. configs = dup;
  29518. }
  29519. // now we have combined contexts for configs with dissimilar preds
  29520. }
  29521. // pure SLL or combined SLL+LL mode parsing
  29522. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  29523. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  29524. };
  29525. // Checks if any configuration in {@code configs} is in a
  29526. // {@link RuleStopState}. Configurations meeting this condition have reached
  29527. // the end of the decision rule (local context) or end of start rule (full
  29528. // context).
  29529. //
  29530. // @param configs the configuration set to test
  29531. // @return {@code true} if any configuration in {@code configs} is in a
  29532. // {@link RuleStopState}, otherwise {@code false}
  29533. PredictionMode.hasConfigInRuleStopState = function (configs) {
  29534. for (var i = 0; i < configs.items.length; i++) {
  29535. var c = configs.items[i];
  29536. if (c.state instanceof RuleStopState) {
  29537. return true;
  29538. }
  29539. }
  29540. return false;
  29541. };
  29542. // Checks if all configurations in {@code configs} are in a
  29543. // {@link RuleStopState}. Configurations meeting this condition have reached
  29544. // the end of the decision rule (local context) or end of start rule (full
  29545. // context).
  29546. //
  29547. // @param configs the configuration set to test
  29548. // @return {@code true} if all configurations in {@code configs} are in a
  29549. // {@link RuleStopState}, otherwise {@code false}
  29550. PredictionMode.allConfigsInRuleStopStates = function (configs) {
  29551. for (var i = 0; i < configs.items.length; i++) {
  29552. var c = configs.items[i];
  29553. if (!(c.state instanceof RuleStopState)) {
  29554. return false;
  29555. }
  29556. }
  29557. return true;
  29558. };
  29559. //
  29560. // Full LL prediction termination.
  29561. //
  29562. // <p>Can we stop looking ahead during ATN simulation or is there some
  29563. // uncertainty as to which alternative we will ultimately pick, after
  29564. // consuming more input? Even if there are partial conflicts, we might know
  29565. // that everything is going to resolve to the same minimum alternative. That
  29566. // means we can stop since no more lookahead will change that fact. On the
  29567. // other hand, there might be multiple conflicts that resolve to different
  29568. // minimums. That means we need more look ahead to decide which of those
  29569. // alternatives we should predict.</p>
  29570. //
  29571. // <p>The basic idea is to split the set of configurations {@code C}, into
  29572. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  29573. // non-conflicting configurations. Two configurations conflict if they have
  29574. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  29575. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  29576. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  29577. //
  29578. // <p>Reduce these configuration subsets to the set of possible alternatives.
  29579. // You can compute the alternative subsets in one pass as follows:</p>
  29580. //
  29581. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  29582. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  29583. //
  29584. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  29585. //
  29586. // <pre>
  29587. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29588. // alt and not pred
  29589. // </pre>
  29590. //
  29591. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  29592. //
  29593. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  29594. // {@code s} and {@code ctx}.</p>
  29595. //
  29596. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  29597. // the union of these alternative subsets is a singleton, then no amount of
  29598. // more lookahead will help us. We will always pick that alternative. If,
  29599. // however, there is more than one alternative, then we are uncertain which
  29600. // alternative to predict and must continue looking for resolution. We may
  29601. // or may not discover an ambiguity in the future, even if there are no
  29602. // conflicting subsets this round.</p>
  29603. //
  29604. // <p>The biggest sin is to terminate early because it means we've made a
  29605. // decision but were uncertain as to the eventual outcome. We haven't used
  29606. // enough lookahead. On the other hand, announcing a conflict too late is no
  29607. // big deal; you will still have the conflict. It's just inefficient. It
  29608. // might even look until the end of file.</p>
  29609. //
  29610. // <p>No special consideration for semantic predicates is required because
  29611. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  29612. // no configuration contains a semantic context during the termination
  29613. // check.</p>
  29614. //
  29615. // <p><strong>CONFLICTING CONFIGS</strong></p>
  29616. //
  29617. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  29618. // when {@code i!=j} but {@code x=x'}. Because we merge all
  29619. // {@code (s, i, _)} configurations together, that means that there are at
  29620. // most {@code n} configurations associated with state {@code s} for
  29621. // {@code n} possible alternatives in the decision. The merged stacks
  29622. // complicate the comparison of configuration contexts {@code x} and
  29623. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  29624. // merge and checking to see if the merged result is either {@code x} or
  29625. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  29626. // is the superset, then {@code i} is the only possible prediction since the
  29627. // others resolve to {@code min(i)} as well. However, if {@code x} is
  29628. // associated with {@code j>i} then at least one stack configuration for
  29629. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  29630. // should keep going, looking for more lookahead due to the uncertainty.</p>
  29631. //
  29632. // <p>For simplicity, I'm doing a equality check between {@code x} and
  29633. // {@code x'} that lets the algorithm continue to consume lookahead longer
  29634. // than necessary. The reason I like the equality is of course the
  29635. // simplicity but also because that is the test you need to detect the
  29636. // alternatives that are actually in conflict.</p>
  29637. //
  29638. // <p><strong>CONTINUE/STOP RULE</strong></p>
  29639. //
  29640. // <p>Continue if union of resolved alternative sets from non-conflicting and
  29641. // conflicting alternative subsets has more than one alternative. We are
  29642. // uncertain about which alternative to predict.</p>
  29643. //
  29644. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  29645. // alternatives are still in the running for the amount of input we've
  29646. // consumed at this point. The conflicting sets let us to strip away
  29647. // configurations that won't lead to more states because we resolve
  29648. // conflicts to the configuration with a minimum alternate for the
  29649. // conflicting set.</p>
  29650. //
  29651. // <p><strong>CASES</strong></p>
  29652. //
  29653. // <ul>
  29654. //
  29655. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  29656. //
  29657. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  29658. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  29659. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29660. // {@code {1,3}} =&gt; continue
  29661. // </li>
  29662. //
  29663. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29664. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  29665. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  29666. // {@code {1}} =&gt; stop and predict 1</li>
  29667. //
  29668. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  29669. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  29670. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  29671. // ambiguity {@code {1,2}}</li>
  29672. //
  29673. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  29674. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  29675. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  29676. //
  29677. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  29678. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  29679. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  29680. //
  29681. // </ul>
  29682. //
  29683. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  29684. //
  29685. // <p>If all states report the same conflicting set of alternatives, then we
  29686. // know we have the exact ambiguity set.</p>
  29687. //
  29688. // <p><code>|A_<em>i</em>|&gt;1</code> and
  29689. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  29690. //
  29691. // <p>In other words, we continue examining lookahead until all {@code A_i}
  29692. // have more than one alternative and all {@code A_i} are the same. If
  29693. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  29694. // because the resolved set is {@code {1}}. To determine what the real
  29695. // ambiguity is, we have to know whether the ambiguity is between one and
  29696. // two or one and three so we keep going. We can only stop prediction when
  29697. // we need exact ambiguity detection when the sets look like
  29698. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  29699. //
  29700. PredictionMode.resolvesToJustOneViableAlt = function (altsets) {
  29701. return PredictionMode.getSingleViableAlt(altsets);
  29702. };
  29703. //
  29704. // Determines if every alternative subset in {@code altsets} contains more
  29705. // than one alternative.
  29706. //
  29707. // @param altsets a collection of alternative subsets
  29708. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  29709. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29710. //
  29711. PredictionMode.allSubsetsConflict = function (altsets) {
  29712. return !PredictionMode.hasNonConflictingAltSet(altsets);
  29713. };
  29714. //
  29715. // Determines if any single alternative subset in {@code altsets} contains
  29716. // exactly one alternative.
  29717. //
  29718. // @param altsets a collection of alternative subsets
  29719. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29720. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  29721. //
  29722. PredictionMode.hasNonConflictingAltSet = function (altsets) {
  29723. for (var i = 0; i < altsets.length; i++) {
  29724. var alts = altsets[i];
  29725. if (alts.length === 1) {
  29726. return true;
  29727. }
  29728. }
  29729. return false;
  29730. };
  29731. //
  29732. // Determines if any single alternative subset in {@code altsets} contains
  29733. // more than one alternative.
  29734. //
  29735. // @param altsets a collection of alternative subsets
  29736. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  29737. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  29738. //
  29739. PredictionMode.hasConflictingAltSet = function (altsets) {
  29740. for (var i = 0; i < altsets.length; i++) {
  29741. var alts = altsets[i];
  29742. if (alts.length > 1) {
  29743. return true;
  29744. }
  29745. }
  29746. return false;
  29747. };
  29748. //
  29749. // Determines if every alternative subset in {@code altsets} is equivalent.
  29750. //
  29751. // @param altsets a collection of alternative subsets
  29752. // @return {@code true} if every member of {@code altsets} is equal to the
  29753. // others, otherwise {@code false}
  29754. //
  29755. PredictionMode.allSubsetsEqual = function (altsets) {
  29756. var first = null;
  29757. for (var i = 0; i < altsets.length; i++) {
  29758. var alts = altsets[i];
  29759. if (first === null) {
  29760. first = alts;
  29761. } else if (alts !== first) {
  29762. return false;
  29763. }
  29764. }
  29765. return true;
  29766. };
  29767. //
  29768. // Returns the unique alternative predicted by all alternative subsets in
  29769. // {@code altsets}. If no such alternative exists, this method returns
  29770. // {@link ATN//INVALID_ALT_NUMBER}.
  29771. //
  29772. // @param altsets a collection of alternative subsets
  29773. //
  29774. PredictionMode.getUniqueAlt = function (altsets) {
  29775. var all = PredictionMode.getAlts(altsets);
  29776. if (all.length === 1) {
  29777. return all.minValue();
  29778. } else {
  29779. return ATN.INVALID_ALT_NUMBER;
  29780. }
  29781. };
  29782. // Gets the complete set of represented alternatives for a collection of
  29783. // alternative subsets. This method returns the union of each {@link BitSet}
  29784. // in {@code altsets}.
  29785. //
  29786. // @param altsets a collection of alternative subsets
  29787. // @return the set of represented alternatives in {@code altsets}
  29788. //
  29789. PredictionMode.getAlts = function (altsets) {
  29790. var all = new BitSet();
  29791. altsets.map(function (alts) {
  29792. all.or(alts);
  29793. });
  29794. return all;
  29795. };
  29796. //
  29797. // This function gets the conflicting alt subsets from a configuration set.
  29798. // For each configuration {@code c} in {@code configs}:
  29799. //
  29800. // <pre>
  29801. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  29802. // alt and not pred
  29803. // </pre>
  29804. PredictionMode.getConflictingAltSubsets = function (configs) {
  29805. var configToAlts = new Map();
  29806. configToAlts.hashFunction = function (cfg) {
  29807. hashStuff(cfg.state.stateNumber, cfg.context);
  29808. };
  29809. configToAlts.equalsFunction = function (c1, c2) {
  29810. return c1.state.stateNumber == c2.state.stateNumber && c1.context.equals(c2.context);
  29811. };
  29812. configs.items.map(function (cfg) {
  29813. var alts = configToAlts.get(cfg);
  29814. if (alts === null) {
  29815. alts = new BitSet();
  29816. configToAlts.put(cfg, alts);
  29817. }
  29818. alts.add(cfg.alt);
  29819. });
  29820. return configToAlts.getValues();
  29821. };
  29822. //
  29823. // Get a map from state to alt subset from a configuration set. For each
  29824. // configuration {@code c} in {@code configs}:
  29825. //
  29826. // <pre>
  29827. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  29828. // </pre>
  29829. //
  29830. PredictionMode.getStateToAltMap = function (configs) {
  29831. var m = new AltDict();
  29832. configs.items.map(function (c) {
  29833. var alts = m.get(c.state);
  29834. if (alts === null) {
  29835. alts = new BitSet();
  29836. m.put(c.state, alts);
  29837. }
  29838. alts.add(c.alt);
  29839. });
  29840. return m;
  29841. };
  29842. PredictionMode.hasStateAssociatedWithOneAlt = function (configs) {
  29843. var values = PredictionMode.getStateToAltMap(configs).values();
  29844. for (var i = 0; i < values.length; i++) {
  29845. if (values[i].length === 1) {
  29846. return true;
  29847. }
  29848. }
  29849. return false;
  29850. };
  29851. PredictionMode.getSingleViableAlt = function (altsets) {
  29852. var result = null;
  29853. for (var i = 0; i < altsets.length; i++) {
  29854. var alts = altsets[i];
  29855. var minAlt = alts.minValue();
  29856. if (result === null) {
  29857. result = minAlt;
  29858. } else if (result !== minAlt) {
  29859. // more than 1 viable alt
  29860. return ATN.INVALID_ALT_NUMBER;
  29861. }
  29862. }
  29863. return result;
  29864. };
  29865. exports.PredictionMode = PredictionMode;
  29866. /***/ }),
  29867. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  29868. /*!****************************************************!*\
  29869. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  29870. \****************************************************/
  29871. /*! no static exports found */
  29872. /***/ (function(module, exports, __webpack_require__) {
  29873. "use strict";
  29874. //
  29875. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29876. * Use of this file is governed by the BSD 3-clause license that
  29877. * can be found in the LICENSE.txt file in the project root.
  29878. */
  29879. //
  29880. // A tree structure used to record the semantic context in which
  29881. // an ATN configuration is valid. It's either a single predicate,
  29882. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  29883. //
  29884. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  29885. // {@link SemanticContext} within the scope of this outer class.</p>
  29886. //
  29887. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  29888. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29889. function SemanticContext() {
  29890. return this;
  29891. }
  29892. SemanticContext.prototype.hashCode = function () {
  29893. var hash = new Hash();
  29894. this.updateHashCode(hash);
  29895. return hash.finish();
  29896. };
  29897. // For context independent predicates, we evaluate them without a local
  29898. // context (i.e., null context). That way, we can evaluate them without
  29899. // having to create proper rule-specific context during prediction (as
  29900. // opposed to the parser, which creates them naturally). In a practical
  29901. // sense, this avoids a cast exception from RuleContext to myruleContext.
  29902. //
  29903. // <p>For context dependent predicates, we must pass in a local context so that
  29904. // references such as $arg evaluate properly as _localctx.arg. We only
  29905. // capture context dependent predicates in the context in which we begin
  29906. // prediction, so we passed in the outer context here in case of context
  29907. // dependent predicate evaluation.</p>
  29908. //
  29909. SemanticContext.prototype.evaluate = function (parser, outerContext) {};
  29910. //
  29911. // Evaluate the precedence predicates for the context and reduce the result.
  29912. //
  29913. // @param parser The parser instance.
  29914. // @param outerContext The current parser context object.
  29915. // @return The simplified semantic context after precedence predicates are
  29916. // evaluated, which will be one of the following values.
  29917. // <ul>
  29918. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  29919. // precedence predicates are evaluated.</li>
  29920. // <li>{@code null}: if the predicate simplifies to {@code false} after
  29921. // precedence predicates are evaluated.</li>
  29922. // <li>{@code this}: if the semantic context is not changed as a result of
  29923. // precedence predicate evaluation.</li>
  29924. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  29925. // semantic context after precedence predicates are evaluated.</li>
  29926. // </ul>
  29927. //
  29928. SemanticContext.prototype.evalPrecedence = function (parser, outerContext) {
  29929. return this;
  29930. };
  29931. SemanticContext.andContext = function (a, b) {
  29932. if (a === null || a === SemanticContext.NONE) {
  29933. return b;
  29934. }
  29935. if (b === null || b === SemanticContext.NONE) {
  29936. return a;
  29937. }
  29938. var result = new AND(a, b);
  29939. if (result.opnds.length === 1) {
  29940. return result.opnds[0];
  29941. } else {
  29942. return result;
  29943. }
  29944. };
  29945. SemanticContext.orContext = function (a, b) {
  29946. if (a === null) {
  29947. return b;
  29948. }
  29949. if (b === null) {
  29950. return a;
  29951. }
  29952. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  29953. return SemanticContext.NONE;
  29954. }
  29955. var result = new OR(a, b);
  29956. if (result.opnds.length === 1) {
  29957. return result.opnds[0];
  29958. } else {
  29959. return result;
  29960. }
  29961. };
  29962. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  29963. SemanticContext.call(this);
  29964. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  29965. this.predIndex = predIndex === undefined ? -1 : predIndex;
  29966. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  29967. return this;
  29968. }
  29969. Predicate.prototype = Object.create(SemanticContext.prototype);
  29970. Predicate.prototype.constructor = Predicate;
  29971. //The default {@link SemanticContext}, which is semantically equivalent to
  29972. //a predicate of the form {@code {true}?}.
  29973. //
  29974. SemanticContext.NONE = new Predicate();
  29975. Predicate.prototype.evaluate = function (parser, outerContext) {
  29976. var localctx = this.isCtxDependent ? outerContext : null;
  29977. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  29978. };
  29979. Predicate.prototype.updateHashCode = function (hash) {
  29980. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  29981. };
  29982. Predicate.prototype.equals = function (other) {
  29983. if (this === other) {
  29984. return true;
  29985. } else if (!(other instanceof Predicate)) {
  29986. return false;
  29987. } else {
  29988. return this.ruleIndex === other.ruleIndex && this.predIndex === other.predIndex && this.isCtxDependent === other.isCtxDependent;
  29989. }
  29990. };
  29991. Predicate.prototype.toString = function () {
  29992. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  29993. };
  29994. function PrecedencePredicate(precedence) {
  29995. SemanticContext.call(this);
  29996. this.precedence = precedence === undefined ? 0 : precedence;
  29997. }
  29998. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  29999. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  30000. PrecedencePredicate.prototype.evaluate = function (parser, outerContext) {
  30001. return parser.precpred(outerContext, this.precedence);
  30002. };
  30003. PrecedencePredicate.prototype.evalPrecedence = function (parser, outerContext) {
  30004. if (parser.precpred(outerContext, this.precedence)) {
  30005. return SemanticContext.NONE;
  30006. } else {
  30007. return null;
  30008. }
  30009. };
  30010. PrecedencePredicate.prototype.compareTo = function (other) {
  30011. return this.precedence - other.precedence;
  30012. };
  30013. PrecedencePredicate.prototype.updateHashCode = function (hash) {
  30014. hash.update(31);
  30015. };
  30016. PrecedencePredicate.prototype.equals = function (other) {
  30017. if (this === other) {
  30018. return true;
  30019. } else if (!(other instanceof PrecedencePredicate)) {
  30020. return false;
  30021. } else {
  30022. return this.precedence === other.precedence;
  30023. }
  30024. };
  30025. PrecedencePredicate.prototype.toString = function () {
  30026. return "{" + this.precedence + ">=prec}?";
  30027. };
  30028. PrecedencePredicate.filterPrecedencePredicates = function (set) {
  30029. var result = [];
  30030. set.values().map(function (context) {
  30031. if (context instanceof PrecedencePredicate) {
  30032. result.push(context);
  30033. }
  30034. });
  30035. return result;
  30036. };
  30037. // A semantic context which is true whenever none of the contained contexts
  30038. // is false.
  30039. //
  30040. function AND(a, b) {
  30041. SemanticContext.call(this);
  30042. var operands = new Set();
  30043. if (a instanceof AND) {
  30044. a.opnds.map(function (o) {
  30045. operands.add(o);
  30046. });
  30047. } else {
  30048. operands.add(a);
  30049. }
  30050. if (b instanceof AND) {
  30051. b.opnds.map(function (o) {
  30052. operands.add(o);
  30053. });
  30054. } else {
  30055. operands.add(b);
  30056. }
  30057. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30058. if (precedencePredicates.length > 0) {
  30059. // interested in the transition with the lowest precedence
  30060. var reduced = null;
  30061. precedencePredicates.map(function (p) {
  30062. if (reduced === null || p.precedence < reduced.precedence) {
  30063. reduced = p;
  30064. }
  30065. });
  30066. operands.add(reduced);
  30067. }
  30068. this.opnds = operands.values();
  30069. return this;
  30070. }
  30071. AND.prototype = Object.create(SemanticContext.prototype);
  30072. AND.prototype.constructor = AND;
  30073. AND.prototype.equals = function (other) {
  30074. if (this === other) {
  30075. return true;
  30076. } else if (!(other instanceof AND)) {
  30077. return false;
  30078. } else {
  30079. return this.opnds === other.opnds;
  30080. }
  30081. };
  30082. AND.prototype.updateHashCode = function (hash) {
  30083. hash.update(this.opnds, "AND");
  30084. };
  30085. //
  30086. // {@inheritDoc}
  30087. //
  30088. // <p>
  30089. // The evaluation of predicates by this context is short-circuiting, but
  30090. // unordered.</p>
  30091. //
  30092. AND.prototype.evaluate = function (parser, outerContext) {
  30093. for (var i = 0; i < this.opnds.length; i++) {
  30094. if (!this.opnds[i].evaluate(parser, outerContext)) {
  30095. return false;
  30096. }
  30097. }
  30098. return true;
  30099. };
  30100. AND.prototype.evalPrecedence = function (parser, outerContext) {
  30101. var differs = false;
  30102. var operands = [];
  30103. for (var i = 0; i < this.opnds.length; i++) {
  30104. var context = this.opnds[i];
  30105. var evaluated = context.evalPrecedence(parser, outerContext);
  30106. differs |= evaluated !== context;
  30107. if (evaluated === null) {
  30108. // The AND context is false if any element is false
  30109. return null;
  30110. } else if (evaluated !== SemanticContext.NONE) {
  30111. // Reduce the result by skipping true elements
  30112. operands.push(evaluated);
  30113. }
  30114. }
  30115. if (!differs) {
  30116. return this;
  30117. }
  30118. if (operands.length === 0) {
  30119. // all elements were true, so the AND context is true
  30120. return SemanticContext.NONE;
  30121. }
  30122. var result = null;
  30123. operands.map(function (o) {
  30124. result = result === null ? o : SemanticContext.andContext(result, o);
  30125. });
  30126. return result;
  30127. };
  30128. AND.prototype.toString = function () {
  30129. var s = "";
  30130. this.opnds.map(function (o) {
  30131. s += "&& " + o.toString();
  30132. });
  30133. return s.length > 3 ? s.slice(3) : s;
  30134. };
  30135. //
  30136. // A semantic context which is true whenever at least one of the contained
  30137. // contexts is true.
  30138. //
  30139. function OR(a, b) {
  30140. SemanticContext.call(this);
  30141. var operands = new Set();
  30142. if (a instanceof OR) {
  30143. a.opnds.map(function (o) {
  30144. operands.add(o);
  30145. });
  30146. } else {
  30147. operands.add(a);
  30148. }
  30149. if (b instanceof OR) {
  30150. b.opnds.map(function (o) {
  30151. operands.add(o);
  30152. });
  30153. } else {
  30154. operands.add(b);
  30155. }
  30156. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  30157. if (precedencePredicates.length > 0) {
  30158. // interested in the transition with the highest precedence
  30159. var s = precedencePredicates.sort(function (a, b) {
  30160. return a.compareTo(b);
  30161. });
  30162. var reduced = s[s.length - 1];
  30163. operands.add(reduced);
  30164. }
  30165. this.opnds = operands.values();
  30166. return this;
  30167. }
  30168. OR.prototype = Object.create(SemanticContext.prototype);
  30169. OR.prototype.constructor = OR;
  30170. OR.prototype.constructor = function (other) {
  30171. if (this === other) {
  30172. return true;
  30173. } else if (!(other instanceof OR)) {
  30174. return false;
  30175. } else {
  30176. return this.opnds === other.opnds;
  30177. }
  30178. };
  30179. OR.prototype.updateHashCode = function (hash) {
  30180. hash.update(this.opnds, "OR");
  30181. };
  30182. // <p>
  30183. // The evaluation of predicates by this context is short-circuiting, but
  30184. // unordered.</p>
  30185. //
  30186. OR.prototype.evaluate = function (parser, outerContext) {
  30187. for (var i = 0; i < this.opnds.length; i++) {
  30188. if (this.opnds[i].evaluate(parser, outerContext)) {
  30189. return true;
  30190. }
  30191. }
  30192. return false;
  30193. };
  30194. OR.prototype.evalPrecedence = function (parser, outerContext) {
  30195. var differs = false;
  30196. var operands = [];
  30197. for (var i = 0; i < this.opnds.length; i++) {
  30198. var context = this.opnds[i];
  30199. var evaluated = context.evalPrecedence(parser, outerContext);
  30200. differs |= evaluated !== context;
  30201. if (evaluated === SemanticContext.NONE) {
  30202. // The OR context is true if any element is true
  30203. return SemanticContext.NONE;
  30204. } else if (evaluated !== null) {
  30205. // Reduce the result by skipping false elements
  30206. operands.push(evaluated);
  30207. }
  30208. }
  30209. if (!differs) {
  30210. return this;
  30211. }
  30212. if (operands.length === 0) {
  30213. // all elements were false, so the OR context is false
  30214. return null;
  30215. }
  30216. var result = null;
  30217. operands.map(function (o) {
  30218. return result === null ? o : SemanticContext.orContext(result, o);
  30219. });
  30220. return result;
  30221. };
  30222. OR.prototype.toString = function () {
  30223. var s = "";
  30224. this.opnds.map(function (o) {
  30225. s += "|| " + o.toString();
  30226. });
  30227. return s.length > 3 ? s.slice(3) : s;
  30228. };
  30229. exports.SemanticContext = SemanticContext;
  30230. exports.PrecedencePredicate = PrecedencePredicate;
  30231. exports.Predicate = Predicate;
  30232. /***/ }),
  30233. /***/ "./node_modules/antlr4/atn/Transition.js":
  30234. /*!***********************************************!*\
  30235. !*** ./node_modules/antlr4/atn/Transition.js ***!
  30236. \***********************************************/
  30237. /*! no static exports found */
  30238. /***/ (function(module, exports, __webpack_require__) {
  30239. "use strict";
  30240. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30241. * Use of this file is governed by the BSD 3-clause license that
  30242. * can be found in the LICENSE.txt file in the project root.
  30243. */
  30244. //
  30245. // An ATN transition between any two ATN states. Subclasses define
  30246. // atom, set, epsilon, action, predicate, rule transitions.
  30247. //
  30248. // <p>This is a one way link. It emanates from a state (usually via a list of
  30249. // transitions) and has a target state.</p>
  30250. //
  30251. // <p>Since we never have to change the ATN transitions once we construct it,
  30252. // we can fix these transitions as specific classes. The DFA transitions
  30253. // on the other hand need to update the labels as it adds transitions to
  30254. // the states. We'll use the term Edge for the DFA to distinguish them from
  30255. // ATN transitions.</p>
  30256. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  30257. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30258. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  30259. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  30260. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  30261. function Transition(target) {
  30262. // The target of this transition.
  30263. if (target === undefined || target === null) {
  30264. throw "target cannot be null.";
  30265. }
  30266. this.target = target;
  30267. // Are we epsilon, action, sempred?
  30268. this.isEpsilon = false;
  30269. this.label = null;
  30270. return this;
  30271. }
  30272. // constants for serialization
  30273. Transition.EPSILON = 1;
  30274. Transition.RANGE = 2;
  30275. Transition.RULE = 3;
  30276. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  30277. Transition.ATOM = 5;
  30278. Transition.ACTION = 6;
  30279. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  30280. Transition.NOT_SET = 8;
  30281. Transition.WILDCARD = 9;
  30282. Transition.PRECEDENCE = 10;
  30283. Transition.serializationNames = ["INVALID", "EPSILON", "RANGE", "RULE", "PREDICATE", "ATOM", "ACTION", "SET", "NOT_SET", "WILDCARD", "PRECEDENCE"];
  30284. Transition.serializationTypes = {
  30285. EpsilonTransition: Transition.EPSILON,
  30286. RangeTransition: Transition.RANGE,
  30287. RuleTransition: Transition.RULE,
  30288. PredicateTransition: Transition.PREDICATE,
  30289. AtomTransition: Transition.ATOM,
  30290. ActionTransition: Transition.ACTION,
  30291. SetTransition: Transition.SET,
  30292. NotSetTransition: Transition.NOT_SET,
  30293. WildcardTransition: Transition.WILDCARD,
  30294. PrecedencePredicateTransition: Transition.PRECEDENCE
  30295. };
  30296. // TODO: make all transitions sets? no, should remove set edges
  30297. function AtomTransition(target, label) {
  30298. Transition.call(this, target);
  30299. this.label_ = label; // The token type or character value; or, signifies special label.
  30300. this.label = this.makeLabel();
  30301. this.serializationType = Transition.ATOM;
  30302. return this;
  30303. }
  30304. AtomTransition.prototype = Object.create(Transition.prototype);
  30305. AtomTransition.prototype.constructor = AtomTransition;
  30306. AtomTransition.prototype.makeLabel = function () {
  30307. var s = new IntervalSet();
  30308. s.addOne(this.label_);
  30309. return s;
  30310. };
  30311. AtomTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30312. return this.label_ === symbol;
  30313. };
  30314. AtomTransition.prototype.toString = function () {
  30315. return this.label_;
  30316. };
  30317. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  30318. Transition.call(this, ruleStart);
  30319. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  30320. this.precedence = precedence;
  30321. this.followState = followState; // what node to begin computations following ref to rule
  30322. this.serializationType = Transition.RULE;
  30323. this.isEpsilon = true;
  30324. return this;
  30325. }
  30326. RuleTransition.prototype = Object.create(Transition.prototype);
  30327. RuleTransition.prototype.constructor = RuleTransition;
  30328. RuleTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30329. return false;
  30330. };
  30331. function EpsilonTransition(target, outermostPrecedenceReturn) {
  30332. Transition.call(this, target);
  30333. this.serializationType = Transition.EPSILON;
  30334. this.isEpsilon = true;
  30335. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  30336. return this;
  30337. }
  30338. EpsilonTransition.prototype = Object.create(Transition.prototype);
  30339. EpsilonTransition.prototype.constructor = EpsilonTransition;
  30340. EpsilonTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30341. return false;
  30342. };
  30343. EpsilonTransition.prototype.toString = function () {
  30344. return "epsilon";
  30345. };
  30346. function RangeTransition(target, start, stop) {
  30347. Transition.call(this, target);
  30348. this.serializationType = Transition.RANGE;
  30349. this.start = start;
  30350. this.stop = stop;
  30351. this.label = this.makeLabel();
  30352. return this;
  30353. }
  30354. RangeTransition.prototype = Object.create(Transition.prototype);
  30355. RangeTransition.prototype.constructor = RangeTransition;
  30356. RangeTransition.prototype.makeLabel = function () {
  30357. var s = new IntervalSet();
  30358. s.addRange(this.start, this.stop);
  30359. return s;
  30360. };
  30361. RangeTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30362. return symbol >= this.start && symbol <= this.stop;
  30363. };
  30364. RangeTransition.prototype.toString = function () {
  30365. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  30366. };
  30367. function AbstractPredicateTransition(target) {
  30368. Transition.call(this, target);
  30369. return this;
  30370. }
  30371. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  30372. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  30373. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  30374. AbstractPredicateTransition.call(this, target);
  30375. this.serializationType = Transition.PREDICATE;
  30376. this.ruleIndex = ruleIndex;
  30377. this.predIndex = predIndex;
  30378. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  30379. this.isEpsilon = true;
  30380. return this;
  30381. }
  30382. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30383. PredicateTransition.prototype.constructor = PredicateTransition;
  30384. PredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30385. return false;
  30386. };
  30387. PredicateTransition.prototype.getPredicate = function () {
  30388. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  30389. };
  30390. PredicateTransition.prototype.toString = function () {
  30391. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  30392. };
  30393. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  30394. Transition.call(this, target);
  30395. this.serializationType = Transition.ACTION;
  30396. this.ruleIndex = ruleIndex;
  30397. this.actionIndex = actionIndex === undefined ? -1 : actionIndex;
  30398. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  30399. this.isEpsilon = true;
  30400. return this;
  30401. }
  30402. ActionTransition.prototype = Object.create(Transition.prototype);
  30403. ActionTransition.prototype.constructor = ActionTransition;
  30404. ActionTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30405. return false;
  30406. };
  30407. ActionTransition.prototype.toString = function () {
  30408. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  30409. };
  30410. // A transition containing a set of values.
  30411. function SetTransition(target, set) {
  30412. Transition.call(this, target);
  30413. this.serializationType = Transition.SET;
  30414. if (set !== undefined && set !== null) {
  30415. this.label = set;
  30416. } else {
  30417. this.label = new IntervalSet();
  30418. this.label.addOne(Token.INVALID_TYPE);
  30419. }
  30420. return this;
  30421. }
  30422. SetTransition.prototype = Object.create(Transition.prototype);
  30423. SetTransition.prototype.constructor = SetTransition;
  30424. SetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30425. return this.label.contains(symbol);
  30426. };
  30427. SetTransition.prototype.toString = function () {
  30428. return this.label.toString();
  30429. };
  30430. function NotSetTransition(target, set) {
  30431. SetTransition.call(this, target, set);
  30432. this.serializationType = Transition.NOT_SET;
  30433. return this;
  30434. }
  30435. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  30436. NotSetTransition.prototype.constructor = NotSetTransition;
  30437. NotSetTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30438. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol && !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  30439. };
  30440. NotSetTransition.prototype.toString = function () {
  30441. return '~' + SetTransition.prototype.toString.call(this);
  30442. };
  30443. function WildcardTransition(target) {
  30444. Transition.call(this, target);
  30445. this.serializationType = Transition.WILDCARD;
  30446. return this;
  30447. }
  30448. WildcardTransition.prototype = Object.create(Transition.prototype);
  30449. WildcardTransition.prototype.constructor = WildcardTransition;
  30450. WildcardTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30451. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  30452. };
  30453. WildcardTransition.prototype.toString = function () {
  30454. return ".";
  30455. };
  30456. function PrecedencePredicateTransition(target, precedence) {
  30457. AbstractPredicateTransition.call(this, target);
  30458. this.serializationType = Transition.PRECEDENCE;
  30459. this.precedence = precedence;
  30460. this.isEpsilon = true;
  30461. return this;
  30462. }
  30463. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  30464. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  30465. PrecedencePredicateTransition.prototype.matches = function (symbol, minVocabSymbol, maxVocabSymbol) {
  30466. return false;
  30467. };
  30468. PrecedencePredicateTransition.prototype.getPredicate = function () {
  30469. return new PrecedencePredicate(this.precedence);
  30470. };
  30471. PrecedencePredicateTransition.prototype.toString = function () {
  30472. return this.precedence + " >= _p";
  30473. };
  30474. exports.Transition = Transition;
  30475. exports.AtomTransition = AtomTransition;
  30476. exports.SetTransition = SetTransition;
  30477. exports.NotSetTransition = NotSetTransition;
  30478. exports.RuleTransition = RuleTransition;
  30479. exports.ActionTransition = ActionTransition;
  30480. exports.EpsilonTransition = EpsilonTransition;
  30481. exports.RangeTransition = RangeTransition;
  30482. exports.WildcardTransition = WildcardTransition;
  30483. exports.PredicateTransition = PredicateTransition;
  30484. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  30485. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  30486. /***/ }),
  30487. /***/ "./node_modules/antlr4/atn/index.js":
  30488. /*!******************************************!*\
  30489. !*** ./node_modules/antlr4/atn/index.js ***!
  30490. \******************************************/
  30491. /*! no static exports found */
  30492. /***/ (function(module, exports, __webpack_require__) {
  30493. "use strict";
  30494. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30495. * Use of this file is governed by the BSD 3-clause license that
  30496. * can be found in the LICENSE.txt file in the project root.
  30497. */
  30498. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  30499. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  30500. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  30501. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  30502. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  30503. /***/ }),
  30504. /***/ "./node_modules/antlr4/dfa/DFA.js":
  30505. /*!****************************************!*\
  30506. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  30507. \****************************************/
  30508. /*! no static exports found */
  30509. /***/ (function(module, exports, __webpack_require__) {
  30510. "use strict";
  30511. //
  30512. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30513. * Use of this file is governed by the BSD 3-clause license that
  30514. * can be found in the LICENSE.txt file in the project root.
  30515. */
  30516. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  30517. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  30518. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  30519. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30520. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30521. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30522. function DFA(atnStartState, decision) {
  30523. if (decision === undefined) {
  30524. decision = 0;
  30525. }
  30526. // From which ATN state did we create this DFA?
  30527. this.atnStartState = atnStartState;
  30528. this.decision = decision;
  30529. // A set of all DFA states. Use {@link Map} so we can get old state back
  30530. // ({@link Set} only allows you to see if it's there).
  30531. this._states = new Set();
  30532. this.s0 = null;
  30533. // {@code true} if this DFA is for a precedence decision; otherwise,
  30534. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  30535. // {@link //setPrecedenceDfa}.
  30536. this.precedenceDfa = false;
  30537. if (atnStartState instanceof StarLoopEntryState) {
  30538. if (atnStartState.isPrecedenceDecision) {
  30539. this.precedenceDfa = true;
  30540. var precedenceState = new DFAState(null, new ATNConfigSet());
  30541. precedenceState.edges = [];
  30542. precedenceState.isAcceptState = false;
  30543. precedenceState.requiresFullContext = false;
  30544. this.s0 = precedenceState;
  30545. }
  30546. }
  30547. return this;
  30548. }
  30549. // Get the start state for a specific precedence value.
  30550. //
  30551. // @param precedence The current precedence.
  30552. // @return The start state corresponding to the specified precedence, or
  30553. // {@code null} if no start state exists for the specified precedence.
  30554. //
  30555. // @throws IllegalStateException if this is not a precedence DFA.
  30556. // @see //isPrecedenceDfa()
  30557. DFA.prototype.getPrecedenceStartState = function (precedence) {
  30558. if (!this.precedenceDfa) {
  30559. throw "Only precedence DFAs may contain a precedence start state.";
  30560. }
  30561. // s0.edges is never null for a precedence DFA
  30562. if (precedence < 0 || precedence >= this.s0.edges.length) {
  30563. return null;
  30564. }
  30565. return this.s0.edges[precedence] || null;
  30566. };
  30567. // Set the start state for a specific precedence value.
  30568. //
  30569. // @param precedence The current precedence.
  30570. // @param startState The start state corresponding to the specified
  30571. // precedence.
  30572. //
  30573. // @throws IllegalStateException if this is not a precedence DFA.
  30574. // @see //isPrecedenceDfa()
  30575. //
  30576. DFA.prototype.setPrecedenceStartState = function (precedence, startState) {
  30577. if (!this.precedenceDfa) {
  30578. throw "Only precedence DFAs may contain a precedence start state.";
  30579. }
  30580. if (precedence < 0) {
  30581. return;
  30582. }
  30583. // synchronization on s0 here is ok. when the DFA is turned into a
  30584. // precedence DFA, s0 will be initialized once and not updated again
  30585. // s0.edges is never null for a precedence DFA
  30586. this.s0.edges[precedence] = startState;
  30587. };
  30588. //
  30589. // Sets whether this is a precedence DFA. If the specified value differs
  30590. // from the current DFA configuration, the following actions are taken;
  30591. // otherwise no changes are made to the current DFA.
  30592. //
  30593. // <ul>
  30594. // <li>The {@link //states} map is cleared</li>
  30595. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  30596. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  30597. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  30598. // store the start states for individual precedence values.</li>
  30599. // <li>The {@link //precedenceDfa} field is updated</li>
  30600. // </ul>
  30601. //
  30602. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  30603. // {@code false}
  30604. DFA.prototype.setPrecedenceDfa = function (precedenceDfa) {
  30605. if (this.precedenceDfa !== precedenceDfa) {
  30606. this._states = new DFAStatesSet();
  30607. if (precedenceDfa) {
  30608. var precedenceState = new DFAState(null, new ATNConfigSet());
  30609. precedenceState.edges = [];
  30610. precedenceState.isAcceptState = false;
  30611. precedenceState.requiresFullContext = false;
  30612. this.s0 = precedenceState;
  30613. } else {
  30614. this.s0 = null;
  30615. }
  30616. this.precedenceDfa = precedenceDfa;
  30617. }
  30618. };
  30619. Object.defineProperty(DFA.prototype, "states", {
  30620. get: function get() {
  30621. return this._states;
  30622. }
  30623. });
  30624. // Return a list of all states in this DFA, ordered by state number.
  30625. DFA.prototype.sortedStates = function () {
  30626. var list = this._states.values();
  30627. return list.sort(function (a, b) {
  30628. return a.stateNumber - b.stateNumber;
  30629. });
  30630. };
  30631. DFA.prototype.toString = function (literalNames, symbolicNames) {
  30632. literalNames = literalNames || null;
  30633. symbolicNames = symbolicNames || null;
  30634. if (this.s0 === null) {
  30635. return "";
  30636. }
  30637. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  30638. return serializer.toString();
  30639. };
  30640. DFA.prototype.toLexerString = function () {
  30641. if (this.s0 === null) {
  30642. return "";
  30643. }
  30644. var serializer = new LexerDFASerializer(this);
  30645. return serializer.toString();
  30646. };
  30647. exports.DFA = DFA;
  30648. /***/ }),
  30649. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  30650. /*!**************************************************!*\
  30651. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  30652. \**************************************************/
  30653. /*! no static exports found */
  30654. /***/ (function(module, exports, __webpack_require__) {
  30655. "use strict";
  30656. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30657. * Use of this file is governed by the BSD 3-clause license that
  30658. * can be found in the LICENSE.txt file in the project root.
  30659. */
  30660. // A DFA walker that knows how to dump them to serialized strings.#/
  30661. function DFASerializer(dfa, literalNames, symbolicNames) {
  30662. this.dfa = dfa;
  30663. this.literalNames = literalNames || [];
  30664. this.symbolicNames = symbolicNames || [];
  30665. return this;
  30666. }
  30667. DFASerializer.prototype.toString = function () {
  30668. if (this.dfa.s0 === null) {
  30669. return null;
  30670. }
  30671. var buf = "";
  30672. var states = this.dfa.sortedStates();
  30673. for (var i = 0; i < states.length; i++) {
  30674. var s = states[i];
  30675. if (s.edges !== null) {
  30676. var n = s.edges.length;
  30677. for (var j = 0; j < n; j++) {
  30678. var t = s.edges[j] || null;
  30679. if (t !== null && t.stateNumber !== 0x7FFFFFFF) {
  30680. buf = buf.concat(this.getStateString(s));
  30681. buf = buf.concat("-");
  30682. buf = buf.concat(this.getEdgeLabel(j));
  30683. buf = buf.concat("->");
  30684. buf = buf.concat(this.getStateString(t));
  30685. buf = buf.concat('\n');
  30686. }
  30687. }
  30688. }
  30689. }
  30690. return buf.length === 0 ? null : buf;
  30691. };
  30692. DFASerializer.prototype.getEdgeLabel = function (i) {
  30693. if (i === 0) {
  30694. return "EOF";
  30695. } else if (this.literalNames !== null || this.symbolicNames !== null) {
  30696. return this.literalNames[i - 1] || this.symbolicNames[i - 1];
  30697. } else {
  30698. return String.fromCharCode(i - 1);
  30699. }
  30700. };
  30701. DFASerializer.prototype.getStateString = function (s) {
  30702. var baseStateStr = (s.isAcceptState ? ":" : "") + "s" + s.stateNumber + (s.requiresFullContext ? "^" : "");
  30703. if (s.isAcceptState) {
  30704. if (s.predicates !== null) {
  30705. return baseStateStr + "=>" + s.predicates.toString();
  30706. } else {
  30707. return baseStateStr + "=>" + s.prediction.toString();
  30708. }
  30709. } else {
  30710. return baseStateStr;
  30711. }
  30712. };
  30713. function LexerDFASerializer(dfa) {
  30714. DFASerializer.call(this, dfa, null);
  30715. return this;
  30716. }
  30717. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  30718. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  30719. LexerDFASerializer.prototype.getEdgeLabel = function (i) {
  30720. return "'" + String.fromCharCode(i) + "'";
  30721. };
  30722. exports.DFASerializer = DFASerializer;
  30723. exports.LexerDFASerializer = LexerDFASerializer;
  30724. /***/ }),
  30725. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  30726. /*!*********************************************!*\
  30727. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  30728. \*********************************************/
  30729. /*! no static exports found */
  30730. /***/ (function(module, exports, __webpack_require__) {
  30731. "use strict";
  30732. //
  30733. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30734. * Use of this file is governed by the BSD 3-clause license that
  30735. * can be found in the LICENSE.txt file in the project root.
  30736. */
  30737. ///
  30738. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  30739. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  30740. var Hash = Utils.Hash;
  30741. var Set = Utils.Set;
  30742. // Map a predicate to a predicted alternative.///
  30743. function PredPrediction(pred, alt) {
  30744. this.alt = alt;
  30745. this.pred = pred;
  30746. return this;
  30747. }
  30748. PredPrediction.prototype.toString = function () {
  30749. return "(" + this.pred + ", " + this.alt + ")";
  30750. };
  30751. // A DFA state represents a set of possible ATN configurations.
  30752. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  30753. // to keep track of all possible states the ATN can be in after
  30754. // reading each input symbol. That is to say, after reading
  30755. // input a1a2..an, the DFA is in a state that represents the
  30756. // subset T of the states of the ATN that are reachable from the
  30757. // ATN's start state along some path labeled a1a2..an."
  30758. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  30759. // would be a bitset representing the set of states the
  30760. // ATN could be in. We need to track the alt predicted by each
  30761. // state as well, however. More importantly, we need to maintain
  30762. // a stack of states, tracking the closure operations as they
  30763. // jump from rule to rule, emulating rule invocations (method calls).
  30764. // I have to add a stack to simulate the proper lookahead sequences for
  30765. // the underlying LL grammar from which the ATN was derived.
  30766. //
  30767. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  30768. // is both a state (ala normal conversion) and a RuleContext describing
  30769. // the chain of rules (if any) followed to arrive at that state.</p>
  30770. //
  30771. // <p>A DFA state may have multiple references to a particular state,
  30772. // but with different ATN contexts (with same or different alts)
  30773. // meaning that state was reached via a different set of rule invocations.</p>
  30774. // /
  30775. function DFAState(stateNumber, configs) {
  30776. if (stateNumber === null) {
  30777. stateNumber = -1;
  30778. }
  30779. if (configs === null) {
  30780. configs = new ATNConfigSet();
  30781. }
  30782. this.stateNumber = stateNumber;
  30783. this.configs = configs;
  30784. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  30785. // {@link Token//EOF} maps to {@code edges[0]}.
  30786. this.edges = null;
  30787. this.isAcceptState = false;
  30788. // if accept state, what ttype do we match or alt do we predict?
  30789. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  30790. // //predicates}{@code !=null} or
  30791. // {@link //requiresFullContext}.
  30792. this.prediction = 0;
  30793. this.lexerActionExecutor = null;
  30794. // Indicates that this state was created during SLL prediction that
  30795. // discovered a conflict between the configurations in the state. Future
  30796. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  30797. // full context prediction if this field is true.
  30798. this.requiresFullContext = false;
  30799. // During SLL parsing, this is a list of predicates associated with the
  30800. // ATN configurations of the DFA state. When we have predicates,
  30801. // {@link //requiresFullContext} is {@code false} since full context
  30802. // prediction evaluates predicates
  30803. // on-the-fly. If this is not null, then {@link //prediction} is
  30804. // {@link ATN//INVALID_ALT_NUMBER}.
  30805. //
  30806. // <p>We only use these for non-{@link //requiresFullContext} but
  30807. // conflicting states. That
  30808. // means we know from the context (it's $ or we don't dip into outer
  30809. // context) that it's an ambiguity not a conflict.</p>
  30810. //
  30811. // <p>This list is computed by {@link
  30812. // ParserATNSimulator//predicateDFAState}.</p>
  30813. this.predicates = null;
  30814. return this;
  30815. }
  30816. // Get the set of all alts mentioned by all ATN configurations in this
  30817. // DFA state.
  30818. DFAState.prototype.getAltSet = function () {
  30819. var alts = new Set();
  30820. if (this.configs !== null) {
  30821. for (var i = 0; i < this.configs.length; i++) {
  30822. var c = this.configs[i];
  30823. alts.add(c.alt);
  30824. }
  30825. }
  30826. if (alts.length === 0) {
  30827. return null;
  30828. } else {
  30829. return alts;
  30830. }
  30831. };
  30832. // Two {@link DFAState} instances are equal if their ATN configuration sets
  30833. // are the same. This method is used to see if a state already exists.
  30834. //
  30835. // <p>Because the number of alternatives and number of ATN configurations are
  30836. // finite, there is a finite number of DFA states that can be processed.
  30837. // This is necessary to show that the algorithm terminates.</p>
  30838. //
  30839. // <p>Cannot test the DFA state numbers here because in
  30840. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  30841. // exists that has this exact set of ATN configurations. The
  30842. // {@link //stateNumber} is irrelevant.</p>
  30843. DFAState.prototype.equals = function (other) {
  30844. // compare set of ATN configurations in this set with other
  30845. return this === other || other instanceof DFAState && this.configs.equals(other.configs);
  30846. };
  30847. DFAState.prototype.toString = function () {
  30848. var s = "" + this.stateNumber + ":" + this.configs;
  30849. if (this.isAcceptState) {
  30850. s = s + "=>";
  30851. if (this.predicates !== null) s = s + this.predicates;else s = s + this.prediction;
  30852. }
  30853. return s;
  30854. };
  30855. DFAState.prototype.hashCode = function () {
  30856. var hash = new Hash();
  30857. hash.update(this.configs);
  30858. if (this.isAcceptState) {
  30859. if (this.predicates !== null) hash.update(this.predicates);else hash.update(this.prediction);
  30860. }
  30861. return hash.finish();
  30862. };
  30863. exports.DFAState = DFAState;
  30864. exports.PredPrediction = PredPrediction;
  30865. /***/ }),
  30866. /***/ "./node_modules/antlr4/dfa/index.js":
  30867. /*!******************************************!*\
  30868. !*** ./node_modules/antlr4/dfa/index.js ***!
  30869. \******************************************/
  30870. /*! no static exports found */
  30871. /***/ (function(module, exports, __webpack_require__) {
  30872. "use strict";
  30873. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30874. * Use of this file is governed by the BSD 3-clause license that
  30875. * can be found in the LICENSE.txt file in the project root.
  30876. */
  30877. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  30878. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  30879. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  30880. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  30881. /***/ }),
  30882. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  30883. /*!**************************************************************!*\
  30884. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  30885. \**************************************************************/
  30886. /*! no static exports found */
  30887. /***/ (function(module, exports, __webpack_require__) {
  30888. "use strict";
  30889. //
  30890. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30891. * Use of this file is governed by the BSD 3-clause license that
  30892. * can be found in the LICENSE.txt file in the project root.
  30893. */
  30894. //
  30895. //
  30896. // This implementation of {@link ANTLRErrorListener} can be used to identify
  30897. // certain potential correctness and performance problems in grammars. "Reports"
  30898. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  30899. // message.
  30900. //
  30901. // <ul>
  30902. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  30903. // grammar can match the input.</li>
  30904. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  30905. // prediction resolved an SLL conflict to a unique alternative which equaled the
  30906. // minimum alternative of the SLL conflict.</li>
  30907. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  30908. // full-context prediction resolved an SLL conflict to a unique alternative,
  30909. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  30910. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  30911. // this situation occurs.</li>
  30912. // </ul>
  30913. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  30914. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  30915. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  30916. function DiagnosticErrorListener(exactOnly) {
  30917. ErrorListener.call(this);
  30918. exactOnly = exactOnly || true;
  30919. // whether all ambiguities or only exact ambiguities are reported.
  30920. this.exactOnly = exactOnly;
  30921. return this;
  30922. }
  30923. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  30924. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  30925. DiagnosticErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  30926. if (this.exactOnly && !exact) {
  30927. return;
  30928. }
  30929. var msg = "reportAmbiguity d=" + this.getDecisionDescription(recognizer, dfa) + ": ambigAlts=" + this.getConflictingAlts(ambigAlts, configs) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30930. recognizer.notifyErrorListeners(msg);
  30931. };
  30932. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  30933. var msg = "reportAttemptingFullContext d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30934. recognizer.notifyErrorListeners(msg);
  30935. };
  30936. DiagnosticErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  30937. var msg = "reportContextSensitivity d=" + this.getDecisionDescription(recognizer, dfa) + ", input='" + recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  30938. recognizer.notifyErrorListeners(msg);
  30939. };
  30940. DiagnosticErrorListener.prototype.getDecisionDescription = function (recognizer, dfa) {
  30941. var decision = dfa.decision;
  30942. var ruleIndex = dfa.atnStartState.ruleIndex;
  30943. var ruleNames = recognizer.ruleNames;
  30944. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  30945. return "" + decision;
  30946. }
  30947. var ruleName = ruleNames[ruleIndex] || null;
  30948. if (ruleName === null || ruleName.length === 0) {
  30949. return "" + decision;
  30950. }
  30951. return "" + decision + " (" + ruleName + ")";
  30952. };
  30953. //
  30954. // Computes the set of conflicting or ambiguous alternatives from a
  30955. // configuration set, if that information was not already provided by the
  30956. // parser.
  30957. //
  30958. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  30959. // reported by the parser.
  30960. // @param configs The conflicting or ambiguous configuration set.
  30961. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  30962. // returns the set of alternatives represented in {@code configs}.
  30963. //
  30964. DiagnosticErrorListener.prototype.getConflictingAlts = function (reportedAlts, configs) {
  30965. if (reportedAlts !== null) {
  30966. return reportedAlts;
  30967. }
  30968. var result = new BitSet();
  30969. for (var i = 0; i < configs.items.length; i++) {
  30970. result.add(configs.items[i].alt);
  30971. }
  30972. return "{" + result.values().join(", ") + "}";
  30973. };
  30974. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  30975. /***/ }),
  30976. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  30977. /*!****************************************************!*\
  30978. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  30979. \****************************************************/
  30980. /*! no static exports found */
  30981. /***/ (function(module, exports, __webpack_require__) {
  30982. "use strict";
  30983. //
  30984. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30985. * Use of this file is governed by the BSD 3-clause license that
  30986. * can be found in the LICENSE.txt file in the project root.
  30987. */
  30988. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  30989. // default implementation of each method does nothing, but can be overridden as
  30990. // necessary.
  30991. function ErrorListener() {
  30992. return this;
  30993. }
  30994. ErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {};
  30995. ErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {};
  30996. ErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {};
  30997. ErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {};
  30998. function ConsoleErrorListener() {
  30999. ErrorListener.call(this);
  31000. return this;
  31001. }
  31002. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  31003. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  31004. //
  31005. // Provides a default instance of {@link ConsoleErrorListener}.
  31006. //
  31007. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  31008. //
  31009. // {@inheritDoc}
  31010. //
  31011. // <p>
  31012. // This implementation prints messages to {@link System//err} containing the
  31013. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  31014. // the following format.</p>
  31015. //
  31016. // <pre>
  31017. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  31018. // </pre>
  31019. //
  31020. ConsoleErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31021. console.error("line " + line + ":" + column + " " + msg);
  31022. };
  31023. function ProxyErrorListener(delegates) {
  31024. ErrorListener.call(this);
  31025. if (delegates === null) {
  31026. throw "delegates";
  31027. }
  31028. this.delegates = delegates;
  31029. return this;
  31030. }
  31031. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  31032. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  31033. ProxyErrorListener.prototype.syntaxError = function (recognizer, offendingSymbol, line, column, msg, e) {
  31034. this.delegates.map(function (d) {
  31035. d.syntaxError(recognizer, offendingSymbol, line, column, msg, e);
  31036. });
  31037. };
  31038. ProxyErrorListener.prototype.reportAmbiguity = function (recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  31039. this.delegates.map(function (d) {
  31040. d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  31041. });
  31042. };
  31043. ProxyErrorListener.prototype.reportAttemptingFullContext = function (recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  31044. this.delegates.map(function (d) {
  31045. d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs);
  31046. });
  31047. };
  31048. ProxyErrorListener.prototype.reportContextSensitivity = function (recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  31049. this.delegates.map(function (d) {
  31050. d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs);
  31051. });
  31052. };
  31053. exports.ErrorListener = ErrorListener;
  31054. exports.ConsoleErrorListener = ConsoleErrorListener;
  31055. exports.ProxyErrorListener = ProxyErrorListener;
  31056. /***/ }),
  31057. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  31058. /*!****************************************************!*\
  31059. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  31060. \****************************************************/
  31061. /*! no static exports found */
  31062. /***/ (function(module, exports, __webpack_require__) {
  31063. "use strict";
  31064. //
  31065. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31066. * Use of this file is governed by the BSD 3-clause license that
  31067. * can be found in the LICENSE.txt file in the project root.
  31068. */
  31069. //
  31070. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31071. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  31072. var NoViableAltException = Errors.NoViableAltException;
  31073. var InputMismatchException = Errors.InputMismatchException;
  31074. var FailedPredicateException = Errors.FailedPredicateException;
  31075. var ParseCancellationException = Errors.ParseCancellationException;
  31076. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  31077. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31078. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31079. function ErrorStrategy() {}
  31080. ErrorStrategy.prototype.reset = function (recognizer) {};
  31081. ErrorStrategy.prototype.recoverInline = function (recognizer) {};
  31082. ErrorStrategy.prototype.recover = function (recognizer, e) {};
  31083. ErrorStrategy.prototype.sync = function (recognizer) {};
  31084. ErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {};
  31085. ErrorStrategy.prototype.reportError = function (recognizer) {};
  31086. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  31087. // error reporting and recovery in ANTLR parsers.
  31088. //
  31089. function DefaultErrorStrategy() {
  31090. ErrorStrategy.call(this);
  31091. // Indicates whether the error strategy is currently "recovering from an
  31092. // error". This is used to suppress reporting multiple error messages while
  31093. // attempting to recover from a detected syntax error.
  31094. //
  31095. // @see //inErrorRecoveryMode
  31096. //
  31097. this.errorRecoveryMode = false;
  31098. // The index into the input stream where the last error occurred.
  31099. // This is used to prevent infinite loops where an error is found
  31100. // but no token is consumed during recovery...another error is found,
  31101. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  31102. // one token/tree node is consumed for two errors.
  31103. //
  31104. this.lastErrorIndex = -1;
  31105. this.lastErrorStates = null;
  31106. return this;
  31107. }
  31108. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  31109. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  31110. // <p>The default implementation simply calls {@link //endErrorCondition} to
  31111. // ensure that the handler is not in error recovery mode.</p>
  31112. DefaultErrorStrategy.prototype.reset = function (recognizer) {
  31113. this.endErrorCondition(recognizer);
  31114. };
  31115. //
  31116. // This method is called to enter error recovery mode when a recognition
  31117. // exception is reported.
  31118. //
  31119. // @param recognizer the parser instance
  31120. //
  31121. DefaultErrorStrategy.prototype.beginErrorCondition = function (recognizer) {
  31122. this.errorRecoveryMode = true;
  31123. };
  31124. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function (recognizer) {
  31125. return this.errorRecoveryMode;
  31126. };
  31127. //
  31128. // This method is called to leave error recovery mode after recovering from
  31129. // a recognition exception.
  31130. //
  31131. // @param recognizer
  31132. //
  31133. DefaultErrorStrategy.prototype.endErrorCondition = function (recognizer) {
  31134. this.errorRecoveryMode = false;
  31135. this.lastErrorStates = null;
  31136. this.lastErrorIndex = -1;
  31137. };
  31138. //
  31139. // {@inheritDoc}
  31140. //
  31141. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  31142. //
  31143. DefaultErrorStrategy.prototype.reportMatch = function (recognizer) {
  31144. this.endErrorCondition(recognizer);
  31145. };
  31146. //
  31147. // {@inheritDoc}
  31148. //
  31149. // <p>The default implementation returns immediately if the handler is already
  31150. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  31151. // and dispatches the reporting task based on the runtime type of {@code e}
  31152. // according to the following table.</p>
  31153. //
  31154. // <ul>
  31155. // <li>{@link NoViableAltException}: Dispatches the call to
  31156. // {@link //reportNoViableAlternative}</li>
  31157. // <li>{@link InputMismatchException}: Dispatches the call to
  31158. // {@link //reportInputMismatch}</li>
  31159. // <li>{@link FailedPredicateException}: Dispatches the call to
  31160. // {@link //reportFailedPredicate}</li>
  31161. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  31162. // the exception</li>
  31163. // </ul>
  31164. //
  31165. DefaultErrorStrategy.prototype.reportError = function (recognizer, e) {
  31166. // if we've already reported an error and have not matched a token
  31167. // yet successfully, don't report any errors.
  31168. if (this.inErrorRecoveryMode(recognizer)) {
  31169. return; // don't report spurious errors
  31170. }
  31171. this.beginErrorCondition(recognizer);
  31172. if (e instanceof NoViableAltException) {
  31173. this.reportNoViableAlternative(recognizer, e);
  31174. } else if (e instanceof InputMismatchException) {
  31175. this.reportInputMismatch(recognizer, e);
  31176. } else if (e instanceof FailedPredicateException) {
  31177. this.reportFailedPredicate(recognizer, e);
  31178. } else {
  31179. console.log("unknown recognition error type: " + e.constructor.name);
  31180. console.log(e.stack);
  31181. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  31182. }
  31183. };
  31184. //
  31185. // {@inheritDoc}
  31186. //
  31187. // <p>The default implementation resynchronizes the parser by consuming tokens
  31188. // until we find one in the resynchronization set--loosely the set of tokens
  31189. // that can follow the current rule.</p>
  31190. //
  31191. DefaultErrorStrategy.prototype.recover = function (recognizer, e) {
  31192. if (this.lastErrorIndex === recognizer.getInputStream().index && this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state) >= 0) {
  31193. // uh oh, another error at same token index and previously-visited
  31194. // state in ATN; must be a case where LT(1) is in the recovery
  31195. // token set so nothing got consumed. Consume a single token
  31196. // at least to prevent an infinite loop; this is a failsafe.
  31197. recognizer.consume();
  31198. }
  31199. this.lastErrorIndex = recognizer._input.index;
  31200. if (this.lastErrorStates === null) {
  31201. this.lastErrorStates = [];
  31202. }
  31203. this.lastErrorStates.push(recognizer.state);
  31204. var followSet = this.getErrorRecoverySet(recognizer);
  31205. this.consumeUntil(recognizer, followSet);
  31206. };
  31207. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  31208. // that the current lookahead symbol is consistent with what were expecting
  31209. // at this point in the ATN. You can call this anytime but ANTLR only
  31210. // generates code to check before subrules/loops and each iteration.
  31211. //
  31212. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  31213. // subrules. E.g.,</p>
  31214. //
  31215. // <pre>
  31216. // a : sync ( stuff sync )* ;
  31217. // sync : {consume to what can follow sync} ;
  31218. // </pre>
  31219. //
  31220. // At the start of a sub rule upon error, {@link //sync} performs single
  31221. // token deletion, if possible. If it can't do that, it bails on the current
  31222. // rule and uses the default error recovery, which consumes until the
  31223. // resynchronization set of the current rule.
  31224. //
  31225. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  31226. // with an empty alternative), then the expected set includes what follows
  31227. // the subrule.</p>
  31228. //
  31229. // <p>During loop iteration, it consumes until it sees a token that can start a
  31230. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  31231. // stay in the loop as long as possible.</p>
  31232. //
  31233. // <p><strong>ORIGINS</strong></p>
  31234. //
  31235. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  31236. // A single mismatch token or missing token would force the parser to bail
  31237. // out of the entire rules surrounding the loop. So, for rule</p>
  31238. //
  31239. // <pre>
  31240. // classDef : 'class' ID '{' member* '}'
  31241. // </pre>
  31242. //
  31243. // input with an extra token between members would force the parser to
  31244. // consume until it found the next class definition rather than the next
  31245. // member definition of the current class.
  31246. //
  31247. // <p>This functionality cost a little bit of effort because the parser has to
  31248. // compare token set at the start of the loop and at each iteration. If for
  31249. // some reason speed is suffering for you, you can turn off this
  31250. // functionality by simply overriding this method as a blank { }.</p>
  31251. //
  31252. DefaultErrorStrategy.prototype.sync = function (recognizer) {
  31253. // If already recovering, don't try to sync
  31254. if (this.inErrorRecoveryMode(recognizer)) {
  31255. return;
  31256. }
  31257. var s = recognizer._interp.atn.states[recognizer.state];
  31258. var la = recognizer.getTokenStream().LA(1);
  31259. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  31260. var nextTokens = recognizer.atn.nextTokens(s);
  31261. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  31262. return;
  31263. }
  31264. switch (s.stateType) {
  31265. case ATNState.BLOCK_START:
  31266. case ATNState.STAR_BLOCK_START:
  31267. case ATNState.PLUS_BLOCK_START:
  31268. case ATNState.STAR_LOOP_ENTRY:
  31269. // report error and recover if possible
  31270. if (this.singleTokenDeletion(recognizer) !== null) {
  31271. return;
  31272. } else {
  31273. throw new InputMismatchException(recognizer);
  31274. }
  31275. break;
  31276. case ATNState.PLUS_LOOP_BACK:
  31277. case ATNState.STAR_LOOP_BACK:
  31278. this.reportUnwantedToken(recognizer);
  31279. var expecting = new IntervalSet();
  31280. expecting.addSet(recognizer.getExpectedTokens());
  31281. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  31282. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  31283. break;
  31284. default:
  31285. // do nothing if we can't identify the exact kind of ATN state
  31286. }
  31287. };
  31288. // This is called by {@link //reportError} when the exception is a
  31289. // {@link NoViableAltException}.
  31290. //
  31291. // @see //reportError
  31292. //
  31293. // @param recognizer the parser instance
  31294. // @param e the recognition exception
  31295. //
  31296. DefaultErrorStrategy.prototype.reportNoViableAlternative = function (recognizer, e) {
  31297. var tokens = recognizer.getTokenStream();
  31298. var input;
  31299. if (tokens !== null) {
  31300. if (e.startToken.type === Token.EOF) {
  31301. input = "<EOF>";
  31302. } else {
  31303. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  31304. }
  31305. } else {
  31306. input = "<unknown input>";
  31307. }
  31308. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  31309. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31310. };
  31311. //
  31312. // This is called by {@link //reportError} when the exception is an
  31313. // {@link InputMismatchException}.
  31314. //
  31315. // @see //reportError
  31316. //
  31317. // @param recognizer the parser instance
  31318. // @param e the recognition exception
  31319. //
  31320. DefaultErrorStrategy.prototype.reportInputMismatch = function (recognizer, e) {
  31321. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) + " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  31322. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31323. };
  31324. //
  31325. // This is called by {@link //reportError} when the exception is a
  31326. // {@link FailedPredicateException}.
  31327. //
  31328. // @see //reportError
  31329. //
  31330. // @param recognizer the parser instance
  31331. // @param e the recognition exception
  31332. //
  31333. DefaultErrorStrategy.prototype.reportFailedPredicate = function (recognizer, e) {
  31334. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  31335. var msg = "rule " + ruleName + " " + e.message;
  31336. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  31337. };
  31338. // This method is called to report a syntax error which requires the removal
  31339. // of a token from the input stream. At the time this method is called, the
  31340. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  31341. // removed from the input stream. When this method returns,
  31342. // {@code recognizer} is in error recovery mode.
  31343. //
  31344. // <p>This method is called when {@link //singleTokenDeletion} identifies
  31345. // single-token deletion as a viable recovery strategy for a mismatched
  31346. // input error.</p>
  31347. //
  31348. // <p>The default implementation simply returns if the handler is already in
  31349. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31350. // enter error recovery mode, followed by calling
  31351. // {@link Parser//notifyErrorListeners}.</p>
  31352. //
  31353. // @param recognizer the parser instance
  31354. //
  31355. DefaultErrorStrategy.prototype.reportUnwantedToken = function (recognizer) {
  31356. if (this.inErrorRecoveryMode(recognizer)) {
  31357. return;
  31358. }
  31359. this.beginErrorCondition(recognizer);
  31360. var t = recognizer.getCurrentToken();
  31361. var tokenName = this.getTokenErrorDisplay(t);
  31362. var expecting = this.getExpectedTokens(recognizer);
  31363. var msg = "extraneous input " + tokenName + " expecting " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  31364. recognizer.notifyErrorListeners(msg, t, null);
  31365. };
  31366. // This method is called to report a syntax error which requires the
  31367. // insertion of a missing token into the input stream. At the time this
  31368. // method is called, the missing token has not yet been inserted. When this
  31369. // method returns, {@code recognizer} is in error recovery mode.
  31370. //
  31371. // <p>This method is called when {@link //singleTokenInsertion} identifies
  31372. // single-token insertion as a viable recovery strategy for a mismatched
  31373. // input error.</p>
  31374. //
  31375. // <p>The default implementation simply returns if the handler is already in
  31376. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  31377. // enter error recovery mode, followed by calling
  31378. // {@link Parser//notifyErrorListeners}.</p>
  31379. //
  31380. // @param recognizer the parser instance
  31381. //
  31382. DefaultErrorStrategy.prototype.reportMissingToken = function (recognizer) {
  31383. if (this.inErrorRecoveryMode(recognizer)) {
  31384. return;
  31385. }
  31386. this.beginErrorCondition(recognizer);
  31387. var t = recognizer.getCurrentToken();
  31388. var expecting = this.getExpectedTokens(recognizer);
  31389. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) + " at " + this.getTokenErrorDisplay(t);
  31390. recognizer.notifyErrorListeners(msg, t, null);
  31391. };
  31392. // <p>The default implementation attempts to recover from the mismatched input
  31393. // by using single token insertion and deletion as described below. If the
  31394. // recovery attempt fails, this method throws an
  31395. // {@link InputMismatchException}.</p>
  31396. //
  31397. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  31398. //
  31399. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  31400. // right token, however, then assume {@code LA(1)} is some extra spurious
  31401. // token and delete it. Then consume and return the next token (which was
  31402. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  31403. //
  31404. // <p>This recovery strategy is implemented by {@link
  31405. // //singleTokenDeletion}.</p>
  31406. //
  31407. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  31408. //
  31409. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  31410. // after the expected {@code LA(1)} token, then assume the token is missing
  31411. // and use the parser's {@link TokenFactory} to create it on the fly. The
  31412. // "insertion" is performed by returning the created token as the successful
  31413. // result of the match operation.</p>
  31414. //
  31415. // <p>This recovery strategy is implemented by {@link
  31416. // //singleTokenInsertion}.</p>
  31417. //
  31418. // <p><strong>EXAMPLE</strong></p>
  31419. //
  31420. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  31421. // the parser returns from the nested call to {@code expr}, it will have
  31422. // call chain:</p>
  31423. //
  31424. // <pre>
  31425. // stat &rarr; expr &rarr; atom
  31426. // </pre>
  31427. //
  31428. // and it will be trying to match the {@code ')'} at this point in the
  31429. // derivation:
  31430. //
  31431. // <pre>
  31432. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  31433. // ^
  31434. // </pre>
  31435. //
  31436. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  31437. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  31438. // is in the set of tokens that can follow the {@code ')'} token reference
  31439. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  31440. //
  31441. DefaultErrorStrategy.prototype.recoverInline = function (recognizer) {
  31442. // SINGLE TOKEN DELETION
  31443. var matchedSymbol = this.singleTokenDeletion(recognizer);
  31444. if (matchedSymbol !== null) {
  31445. // we have deleted the extra token.
  31446. // now, move past ttype token as if all were ok
  31447. recognizer.consume();
  31448. return matchedSymbol;
  31449. }
  31450. // SINGLE TOKEN INSERTION
  31451. if (this.singleTokenInsertion(recognizer)) {
  31452. return this.getMissingSymbol(recognizer);
  31453. }
  31454. // even that didn't work; must throw the exception
  31455. throw new InputMismatchException(recognizer);
  31456. };
  31457. //
  31458. // This method implements the single-token insertion inline error recovery
  31459. // strategy. It is called by {@link //recoverInline} if the single-token
  31460. // deletion strategy fails to recover from the mismatched input. If this
  31461. // method returns {@code true}, {@code recognizer} will be in error recovery
  31462. // mode.
  31463. //
  31464. // <p>This method determines whether or not single-token insertion is viable by
  31465. // checking if the {@code LA(1)} input symbol could be successfully matched
  31466. // if it were instead the {@code LA(2)} symbol. If this method returns
  31467. // {@code true}, the caller is responsible for creating and inserting a
  31468. // token with the correct type to produce this behavior.</p>
  31469. //
  31470. // @param recognizer the parser instance
  31471. // @return {@code true} if single-token insertion is a viable recovery
  31472. // strategy for the current mismatched input, otherwise {@code false}
  31473. //
  31474. DefaultErrorStrategy.prototype.singleTokenInsertion = function (recognizer) {
  31475. var currentSymbolType = recognizer.getTokenStream().LA(1);
  31476. // if current token is consistent with what could come after current
  31477. // ATN state, then we know we're missing a token; error recovery
  31478. // is free to conjure up and insert the missing token
  31479. var atn = recognizer._interp.atn;
  31480. var currentState = atn.states[recognizer.state];
  31481. var next = currentState.transitions[0].target;
  31482. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  31483. if (expectingAtLL2.contains(currentSymbolType)) {
  31484. this.reportMissingToken(recognizer);
  31485. return true;
  31486. } else {
  31487. return false;
  31488. }
  31489. };
  31490. // This method implements the single-token deletion inline error recovery
  31491. // strategy. It is called by {@link //recoverInline} to attempt to recover
  31492. // from mismatched input. If this method returns null, the parser and error
  31493. // handler state will not have changed. If this method returns non-null,
  31494. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  31495. // returned token was a successful match.
  31496. //
  31497. // <p>If the single-token deletion is successful, this method calls
  31498. // {@link //reportUnwantedToken} to report the error, followed by
  31499. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  31500. // before returning {@link //reportMatch} is called to signal a successful
  31501. // match.</p>
  31502. //
  31503. // @param recognizer the parser instance
  31504. // @return the successfully matched {@link Token} instance if single-token
  31505. // deletion successfully recovers from the mismatched input, otherwise
  31506. // {@code null}
  31507. //
  31508. DefaultErrorStrategy.prototype.singleTokenDeletion = function (recognizer) {
  31509. var nextTokenType = recognizer.getTokenStream().LA(2);
  31510. var expecting = this.getExpectedTokens(recognizer);
  31511. if (expecting.contains(nextTokenType)) {
  31512. this.reportUnwantedToken(recognizer);
  31513. // print("recoverFromMismatchedToken deleting " \
  31514. // + str(recognizer.getTokenStream().LT(1)) \
  31515. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  31516. // + " is what we want", file=sys.stderr)
  31517. recognizer.consume(); // simply delete extra token
  31518. // we want to return the token we're actually matching
  31519. var matchedSymbol = recognizer.getCurrentToken();
  31520. this.reportMatch(recognizer); // we know current token is correct
  31521. return matchedSymbol;
  31522. } else {
  31523. return null;
  31524. }
  31525. };
  31526. // Conjure up a missing token during error recovery.
  31527. //
  31528. // The recognizer attempts to recover from single missing
  31529. // symbols. But, actions might refer to that missing symbol.
  31530. // For example, x=ID {f($x);}. The action clearly assumes
  31531. // that there has been an identifier matched previously and that
  31532. // $x points at that token. If that token is missing, but
  31533. // the next token in the stream is what we want we assume that
  31534. // this token is missing and we keep going. Because we
  31535. // have to return some token to replace the missing token,
  31536. // we have to conjure one up. This method gives the user control
  31537. // over the tokens returned for missing tokens. Mostly,
  31538. // you will want to create something special for identifier
  31539. // tokens. For literals such as '{' and ',', the default
  31540. // action in the parser or tree parser works. It simply creates
  31541. // a CommonToken of the appropriate type. The text will be the token.
  31542. // If you change what tokens must be created by the lexer,
  31543. // override this method to create the appropriate tokens.
  31544. //
  31545. DefaultErrorStrategy.prototype.getMissingSymbol = function (recognizer) {
  31546. var currentSymbol = recognizer.getCurrentToken();
  31547. var expecting = this.getExpectedTokens(recognizer);
  31548. var expectedTokenType = expecting.first(); // get any element
  31549. var tokenText;
  31550. if (expectedTokenType === Token.EOF) {
  31551. tokenText = "<missing EOF>";
  31552. } else {
  31553. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  31554. }
  31555. var current = currentSymbol;
  31556. var lookback = recognizer.getTokenStream().LT(-1);
  31557. if (current.type === Token.EOF && lookback !== null) {
  31558. current = lookback;
  31559. }
  31560. return recognizer.getTokenFactory().create(current.source, expectedTokenType, tokenText, Token.DEFAULT_CHANNEL, -1, -1, current.line, current.column);
  31561. };
  31562. DefaultErrorStrategy.prototype.getExpectedTokens = function (recognizer) {
  31563. return recognizer.getExpectedTokens();
  31564. };
  31565. // How should a token be displayed in an error message? The default
  31566. // is to display just the text, but during development you might
  31567. // want to have a lot of information spit out. Override in that case
  31568. // to use t.toString() (which, for CommonToken, dumps everything about
  31569. // the token). This is better than forcing you to override a method in
  31570. // your token objects because you don't have to go modify your lexer
  31571. // so that it creates a new Java type.
  31572. //
  31573. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function (t) {
  31574. if (t === null) {
  31575. return "<no token>";
  31576. }
  31577. var s = t.text;
  31578. if (s === null) {
  31579. if (t.type === Token.EOF) {
  31580. s = "<EOF>";
  31581. } else {
  31582. s = "<" + t.type + ">";
  31583. }
  31584. }
  31585. return this.escapeWSAndQuote(s);
  31586. };
  31587. DefaultErrorStrategy.prototype.escapeWSAndQuote = function (s) {
  31588. s = s.replace(/\n/g, "\\n");
  31589. s = s.replace(/\r/g, "\\r");
  31590. s = s.replace(/\t/g, "\\t");
  31591. return "'" + s + "'";
  31592. };
  31593. // Compute the error recovery set for the current rule. During
  31594. // rule invocation, the parser pushes the set of tokens that can
  31595. // follow that rule reference on the stack; this amounts to
  31596. // computing FIRST of what follows the rule reference in the
  31597. // enclosing rule. See LinearApproximator.FIRST().
  31598. // This local follow set only includes tokens
  31599. // from within the rule; i.e., the FIRST computation done by
  31600. // ANTLR stops at the end of a rule.
  31601. //
  31602. // EXAMPLE
  31603. //
  31604. // When you find a "no viable alt exception", the input is not
  31605. // consistent with any of the alternatives for rule r. The best
  31606. // thing to do is to consume tokens until you see something that
  31607. // can legally follow a call to r//or* any rule that called r.
  31608. // You don't want the exact set of viable next tokens because the
  31609. // input might just be missing a token--you might consume the
  31610. // rest of the input looking for one of the missing tokens.
  31611. //
  31612. // Consider grammar:
  31613. //
  31614. // a : '[' b ']'
  31615. // | '(' b ')'
  31616. // ;
  31617. // b : c '^' INT ;
  31618. // c : ID
  31619. // | INT
  31620. // ;
  31621. //
  31622. // At each rule invocation, the set of tokens that could follow
  31623. // that rule is pushed on a stack. Here are the various
  31624. // context-sensitive follow sets:
  31625. //
  31626. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  31627. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  31628. // FOLLOW(c_in_b) = FIRST('^') = '^'
  31629. //
  31630. // Upon erroneous input "[]", the call chain is
  31631. //
  31632. // a -> b -> c
  31633. //
  31634. // and, hence, the follow context stack is:
  31635. //
  31636. // depth follow set start of rule execution
  31637. // 0 <EOF> a (from main())
  31638. // 1 ']' b
  31639. // 2 '^' c
  31640. //
  31641. // Notice that ')' is not included, because b would have to have
  31642. // been called from a different context in rule a for ')' to be
  31643. // included.
  31644. //
  31645. // For error recovery, we cannot consider FOLLOW(c)
  31646. // (context-sensitive or otherwise). We need the combined set of
  31647. // all context-sensitive FOLLOW sets--the set of all tokens that
  31648. // could follow any reference in the call chain. We need to
  31649. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  31650. // we resync'd to that token, we'd consume until EOF. We need to
  31651. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  31652. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  31653. // not consume anything. After printing an error, rule c would
  31654. // return normally. Rule b would not find the required '^' though.
  31655. // At this point, it gets a mismatched token error and throws an
  31656. // exception (since LA(1) is not in the viable following token
  31657. // set). The rule exception handler tries to recover, but finds
  31658. // the same recovery set and doesn't consume anything. Rule b
  31659. // exits normally returning to rule a. Now it finds the ']' (and
  31660. // with the successful match exits errorRecovery mode).
  31661. //
  31662. // So, you can see that the parser walks up the call chain looking
  31663. // for the token that was a member of the recovery set.
  31664. //
  31665. // Errors are not generated in errorRecovery mode.
  31666. //
  31667. // ANTLR's error recovery mechanism is based upon original ideas:
  31668. //
  31669. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  31670. //
  31671. // and
  31672. //
  31673. // "A note on error recovery in recursive descent parsers":
  31674. // http://portal.acm.org/citation.cfm?id=947902.947905
  31675. //
  31676. // Later, Josef Grosch had some good ideas:
  31677. //
  31678. // "Efficient and Comfortable Error Recovery in Recursive Descent
  31679. // Parsers":
  31680. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  31681. //
  31682. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  31683. // at run-time upon error to avoid overhead during parsing.
  31684. //
  31685. DefaultErrorStrategy.prototype.getErrorRecoverySet = function (recognizer) {
  31686. var atn = recognizer._interp.atn;
  31687. var ctx = recognizer._ctx;
  31688. var recoverSet = new IntervalSet();
  31689. while (ctx !== null && ctx.invokingState >= 0) {
  31690. // compute what follows who invoked us
  31691. var invokingState = atn.states[ctx.invokingState];
  31692. var rt = invokingState.transitions[0];
  31693. var follow = atn.nextTokens(rt.followState);
  31694. recoverSet.addSet(follow);
  31695. ctx = ctx.parentCtx;
  31696. }
  31697. recoverSet.removeOne(Token.EPSILON);
  31698. return recoverSet;
  31699. };
  31700. // Consume tokens until one matches the given token set.//
  31701. DefaultErrorStrategy.prototype.consumeUntil = function (recognizer, set) {
  31702. var ttype = recognizer.getTokenStream().LA(1);
  31703. while (ttype !== Token.EOF && !set.contains(ttype)) {
  31704. recognizer.consume();
  31705. ttype = recognizer.getTokenStream().LA(1);
  31706. }
  31707. };
  31708. //
  31709. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  31710. // by immediately canceling the parse operation with a
  31711. // {@link ParseCancellationException}. The implementation ensures that the
  31712. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  31713. // that were not completed prior to encountering the error.
  31714. //
  31715. // <p>
  31716. // This error strategy is useful in the following scenarios.</p>
  31717. //
  31718. // <ul>
  31719. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  31720. // stage of two-stage parsing to immediately terminate if an error is
  31721. // encountered, and immediately fall back to the second stage. In addition to
  31722. // avoiding wasted work by attempting to recover from errors here, the empty
  31723. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  31724. // the first stage.</li>
  31725. // <li><strong>Silent validation:</strong> When syntax errors are not being
  31726. // reported or logged, and the parse result is simply ignored if errors occur,
  31727. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  31728. // when the result will be ignored either way.</li>
  31729. // </ul>
  31730. //
  31731. // <p>
  31732. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  31733. //
  31734. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  31735. //
  31736. function BailErrorStrategy() {
  31737. DefaultErrorStrategy.call(this);
  31738. return this;
  31739. }
  31740. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  31741. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  31742. // Instead of recovering from exception {@code e}, re-throw it wrapped
  31743. // in a {@link ParseCancellationException} so it is not caught by the
  31744. // rule function catches. Use {@link Exception//getCause()} to get the
  31745. // original {@link RecognitionException}.
  31746. //
  31747. BailErrorStrategy.prototype.recover = function (recognizer, e) {
  31748. var context = recognizer._ctx;
  31749. while (context !== null) {
  31750. context.exception = e;
  31751. context = context.parentCtx;
  31752. }
  31753. throw new ParseCancellationException(e);
  31754. };
  31755. // Make sure we don't attempt to recover inline; if the parser
  31756. // successfully recovers, it won't throw an exception.
  31757. //
  31758. BailErrorStrategy.prototype.recoverInline = function (recognizer) {
  31759. this.recover(recognizer, new InputMismatchException(recognizer));
  31760. };
  31761. // Make sure we don't attempt to recover from problems in subrules.//
  31762. BailErrorStrategy.prototype.sync = function (recognizer) {
  31763. // pass
  31764. };
  31765. exports.BailErrorStrategy = BailErrorStrategy;
  31766. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  31767. /***/ }),
  31768. /***/ "./node_modules/antlr4/error/Errors.js":
  31769. /*!*********************************************!*\
  31770. !*** ./node_modules/antlr4/error/Errors.js ***!
  31771. \*********************************************/
  31772. /*! no static exports found */
  31773. /***/ (function(module, exports, __webpack_require__) {
  31774. "use strict";
  31775. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31776. * Use of this file is governed by the BSD 3-clause license that
  31777. * can be found in the LICENSE.txt file in the project root.
  31778. */
  31779. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  31780. // 3 kinds of errors: prediction errors, failed predicate errors, and
  31781. // mismatched input errors. In each case, the parser knows where it is
  31782. // in the input, where it is in the ATN, the rule invocation stack,
  31783. // and what kind of problem occurred.
  31784. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  31785. function RecognitionException(params) {
  31786. Error.call(this);
  31787. if (!!Error.captureStackTrace) {
  31788. Error.captureStackTrace(this, RecognitionException);
  31789. } else {
  31790. var stack = new Error().stack;
  31791. }
  31792. this.message = params.message;
  31793. this.recognizer = params.recognizer;
  31794. this.input = params.input;
  31795. this.ctx = params.ctx;
  31796. // The current {@link Token} when an error occurred. Since not all streams
  31797. // support accessing symbols by index, we have to track the {@link Token}
  31798. // instance itself.
  31799. this.offendingToken = null;
  31800. // Get the ATN state number the parser was in at the time the error
  31801. // occurred. For {@link NoViableAltException} and
  31802. // {@link LexerNoViableAltException} exceptions, this is the
  31803. // {@link DecisionState} number. For others, it is the state whose outgoing
  31804. // edge we couldn't match.
  31805. this.offendingState = -1;
  31806. if (this.recognizer !== null) {
  31807. this.offendingState = this.recognizer.state;
  31808. }
  31809. return this;
  31810. }
  31811. RecognitionException.prototype = Object.create(Error.prototype);
  31812. RecognitionException.prototype.constructor = RecognitionException;
  31813. // <p>If the state number is not known, this method returns -1.</p>
  31814. //
  31815. // Gets the set of input symbols which could potentially follow the
  31816. // previously matched symbol at the time this exception was thrown.
  31817. //
  31818. // <p>If the set of expected tokens is not known and could not be computed,
  31819. // this method returns {@code null}.</p>
  31820. //
  31821. // @return The set of token types that could potentially follow the current
  31822. // state in the ATN, or {@code null} if the information is not available.
  31823. // /
  31824. RecognitionException.prototype.getExpectedTokens = function () {
  31825. if (this.recognizer !== null) {
  31826. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  31827. } else {
  31828. return null;
  31829. }
  31830. };
  31831. RecognitionException.prototype.toString = function () {
  31832. return this.message;
  31833. };
  31834. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  31835. RecognitionException.call(this, { message: "", recognizer: lexer, input: input, ctx: null });
  31836. this.startIndex = startIndex;
  31837. this.deadEndConfigs = deadEndConfigs;
  31838. return this;
  31839. }
  31840. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31841. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  31842. LexerNoViableAltException.prototype.toString = function () {
  31843. var symbol = "";
  31844. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  31845. symbol = this.input.getText((this.startIndex, this.startIndex));
  31846. }
  31847. return "LexerNoViableAltException" + symbol;
  31848. };
  31849. // Indicates that the parser could not decide which of two or more paths
  31850. // to take based upon the remaining input. It tracks the starting token
  31851. // of the offending input and also knows where the parser was
  31852. // in the various paths when the error. Reported by reportNoViableAlternative()
  31853. //
  31854. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  31855. ctx = ctx || recognizer._ctx;
  31856. offendingToken = offendingToken || recognizer.getCurrentToken();
  31857. startToken = startToken || recognizer.getCurrentToken();
  31858. input = input || recognizer.getInputStream();
  31859. RecognitionException.call(this, { message: "", recognizer: recognizer, input: input, ctx: ctx });
  31860. // Which configurations did we try at input.index() that couldn't match
  31861. // input.LT(1)?//
  31862. this.deadEndConfigs = deadEndConfigs;
  31863. // The token object at the start index; the input stream might
  31864. // not be buffering tokens so get a reference to it. (At the
  31865. // time the error occurred, of course the stream needs to keep a
  31866. // buffer all of the tokens but later we might not have access to those.)
  31867. this.startToken = startToken;
  31868. this.offendingToken = offendingToken;
  31869. }
  31870. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  31871. NoViableAltException.prototype.constructor = NoViableAltException;
  31872. // This signifies any kind of mismatched input exceptions such as
  31873. // when the current input does not match the expected token.
  31874. //
  31875. function InputMismatchException(recognizer) {
  31876. RecognitionException.call(this, { message: "", recognizer: recognizer, input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31877. this.offendingToken = recognizer.getCurrentToken();
  31878. }
  31879. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  31880. InputMismatchException.prototype.constructor = InputMismatchException;
  31881. // A semantic predicate failed during validation. Validation of predicates
  31882. // occurs when normally parsing the alternative just like matching a token.
  31883. // Disambiguating predicate evaluation occurs when we test a predicate during
  31884. // prediction.
  31885. function FailedPredicateException(recognizer, predicate, message) {
  31886. RecognitionException.call(this, { message: this.formatMessage(predicate, message || null), recognizer: recognizer,
  31887. input: recognizer.getInputStream(), ctx: recognizer._ctx });
  31888. var s = recognizer._interp.atn.states[recognizer.state];
  31889. var trans = s.transitions[0];
  31890. if (trans instanceof PredicateTransition) {
  31891. this.ruleIndex = trans.ruleIndex;
  31892. this.predicateIndex = trans.predIndex;
  31893. } else {
  31894. this.ruleIndex = 0;
  31895. this.predicateIndex = 0;
  31896. }
  31897. this.predicate = predicate;
  31898. this.offendingToken = recognizer.getCurrentToken();
  31899. return this;
  31900. }
  31901. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  31902. FailedPredicateException.prototype.constructor = FailedPredicateException;
  31903. FailedPredicateException.prototype.formatMessage = function (predicate, message) {
  31904. if (message !== null) {
  31905. return message;
  31906. } else {
  31907. return "failed predicate: {" + predicate + "}?";
  31908. }
  31909. };
  31910. function ParseCancellationException() {
  31911. Error.call(this);
  31912. Error.captureStackTrace(this, ParseCancellationException);
  31913. return this;
  31914. }
  31915. ParseCancellationException.prototype = Object.create(Error.prototype);
  31916. ParseCancellationException.prototype.constructor = ParseCancellationException;
  31917. exports.RecognitionException = RecognitionException;
  31918. exports.NoViableAltException = NoViableAltException;
  31919. exports.LexerNoViableAltException = LexerNoViableAltException;
  31920. exports.InputMismatchException = InputMismatchException;
  31921. exports.FailedPredicateException = FailedPredicateException;
  31922. exports.ParseCancellationException = ParseCancellationException;
  31923. /***/ }),
  31924. /***/ "./node_modules/antlr4/error/index.js":
  31925. /*!********************************************!*\
  31926. !*** ./node_modules/antlr4/error/index.js ***!
  31927. \********************************************/
  31928. /*! no static exports found */
  31929. /***/ (function(module, exports, __webpack_require__) {
  31930. "use strict";
  31931. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31932. * Use of this file is governed by the BSD 3-clause license that
  31933. * can be found in the LICENSE.txt file in the project root.
  31934. */
  31935. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  31936. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  31937. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  31938. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  31939. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  31940. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  31941. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  31942. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  31943. /***/ }),
  31944. /***/ "./node_modules/antlr4/index.js":
  31945. /*!**************************************!*\
  31946. !*** ./node_modules/antlr4/index.js ***!
  31947. \**************************************/
  31948. /*! no static exports found */
  31949. /***/ (function(module, exports, __webpack_require__) {
  31950. "use strict";
  31951. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31952. * Use of this file is governed by the BSD 3-clause license that
  31953. * can be found in the LICENSE.txt file in the project root.
  31954. */
  31955. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  31956. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  31957. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  31958. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  31959. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  31960. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  31961. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  31962. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  31963. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  31964. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  31965. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  31966. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  31967. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  31968. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  31969. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  31970. exports.PredictionContextCache = pc.PredictionContextCache;
  31971. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  31972. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31973. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  31974. /***/ }),
  31975. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  31976. /*!******************************************************!*\
  31977. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  31978. \******************************************************/
  31979. /*! no static exports found */
  31980. /***/ (function(module, exports, __webpack_require__) {
  31981. "use strict";
  31982. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  31983. if (!String.prototype.codePointAt) {
  31984. (function () {
  31985. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  31986. var defineProperty = function () {
  31987. // IE 8 only supports `Object.defineProperty` on DOM elements
  31988. try {
  31989. var object = {};
  31990. var $defineProperty = Object.defineProperty;
  31991. var result = $defineProperty(object, object, object) && $defineProperty;
  31992. } catch (error) {}
  31993. return result;
  31994. }();
  31995. var codePointAt = function codePointAt(position) {
  31996. if (this == null) {
  31997. throw TypeError();
  31998. }
  31999. var string = String(this);
  32000. var size = string.length;
  32001. // `ToInteger`
  32002. var index = position ? Number(position) : 0;
  32003. if (index != index) {
  32004. // better `isNaN`
  32005. index = 0;
  32006. }
  32007. // Account for out-of-bounds indices:
  32008. if (index < 0 || index >= size) {
  32009. return undefined;
  32010. }
  32011. // Get the first code unit
  32012. var first = string.charCodeAt(index);
  32013. var second;
  32014. if ( // check if it’s the start of a surrogate pair
  32015. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  32016. size > index + 1 // there is a next code unit
  32017. ) {
  32018. second = string.charCodeAt(index + 1);
  32019. if (second >= 0xDC00 && second <= 0xDFFF) {
  32020. // low surrogate
  32021. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32022. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  32023. }
  32024. }
  32025. return first;
  32026. };
  32027. if (defineProperty) {
  32028. defineProperty(String.prototype, 'codePointAt', {
  32029. 'value': codePointAt,
  32030. 'configurable': true,
  32031. 'writable': true
  32032. });
  32033. } else {
  32034. String.prototype.codePointAt = codePointAt;
  32035. }
  32036. })();
  32037. }
  32038. /***/ }),
  32039. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  32040. /*!********************************************************!*\
  32041. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  32042. \********************************************************/
  32043. /*! no static exports found */
  32044. /***/ (function(module, exports, __webpack_require__) {
  32045. "use strict";
  32046. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  32047. if (!String.fromCodePoint) {
  32048. (function () {
  32049. var defineProperty = function () {
  32050. // IE 8 only supports `Object.defineProperty` on DOM elements
  32051. try {
  32052. var object = {};
  32053. var $defineProperty = Object.defineProperty;
  32054. var result = $defineProperty(object, object, object) && $defineProperty;
  32055. } catch (error) {}
  32056. return result;
  32057. }();
  32058. var stringFromCharCode = String.fromCharCode;
  32059. var floor = Math.floor;
  32060. var fromCodePoint = function fromCodePoint(_) {
  32061. var MAX_SIZE = 0x4000;
  32062. var codeUnits = [];
  32063. var highSurrogate;
  32064. var lowSurrogate;
  32065. var index = -1;
  32066. var length = arguments.length;
  32067. if (!length) {
  32068. return '';
  32069. }
  32070. var result = '';
  32071. while (++index < length) {
  32072. var codePoint = Number(arguments[index]);
  32073. if (!isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  32074. codePoint < 0 || // not a valid Unicode code point
  32075. codePoint > 0x10FFFF || // not a valid Unicode code point
  32076. floor(codePoint) != codePoint // not an integer
  32077. ) {
  32078. throw RangeError('Invalid code point: ' + codePoint);
  32079. }
  32080. if (codePoint <= 0xFFFF) {
  32081. // BMP code point
  32082. codeUnits.push(codePoint);
  32083. } else {
  32084. // Astral code point; split in surrogate halves
  32085. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  32086. codePoint -= 0x10000;
  32087. highSurrogate = (codePoint >> 10) + 0xD800;
  32088. lowSurrogate = codePoint % 0x400 + 0xDC00;
  32089. codeUnits.push(highSurrogate, lowSurrogate);
  32090. }
  32091. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  32092. result += stringFromCharCode.apply(null, codeUnits);
  32093. codeUnits.length = 0;
  32094. }
  32095. }
  32096. return result;
  32097. };
  32098. if (defineProperty) {
  32099. defineProperty(String, 'fromCodePoint', {
  32100. 'value': fromCodePoint,
  32101. 'configurable': true,
  32102. 'writable': true
  32103. });
  32104. } else {
  32105. String.fromCodePoint = fromCodePoint;
  32106. }
  32107. })();
  32108. }
  32109. /***/ }),
  32110. /***/ "./node_modules/antlr4/tree/Tree.js":
  32111. /*!******************************************!*\
  32112. !*** ./node_modules/antlr4/tree/Tree.js ***!
  32113. \******************************************/
  32114. /*! no static exports found */
  32115. /***/ (function(module, exports, __webpack_require__) {
  32116. "use strict";
  32117. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32118. * Use of this file is governed by the BSD 3-clause license that
  32119. * can be found in the LICENSE.txt file in the project root.
  32120. */
  32121. ///
  32122. // The basic notion of a tree has a parent, a payload, and a list of children.
  32123. // It is the most abstract interface for all the trees used by ANTLR.
  32124. ///
  32125. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32126. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  32127. var INVALID_INTERVAL = new Interval(-1, -2);
  32128. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  32129. function Tree() {
  32130. return this;
  32131. }
  32132. function SyntaxTree() {
  32133. Tree.call(this);
  32134. return this;
  32135. }
  32136. SyntaxTree.prototype = Object.create(Tree.prototype);
  32137. SyntaxTree.prototype.constructor = SyntaxTree;
  32138. function ParseTree() {
  32139. SyntaxTree.call(this);
  32140. return this;
  32141. }
  32142. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  32143. ParseTree.prototype.constructor = ParseTree;
  32144. function RuleNode() {
  32145. ParseTree.call(this);
  32146. return this;
  32147. }
  32148. RuleNode.prototype = Object.create(ParseTree.prototype);
  32149. RuleNode.prototype.constructor = RuleNode;
  32150. function TerminalNode() {
  32151. ParseTree.call(this);
  32152. return this;
  32153. }
  32154. TerminalNode.prototype = Object.create(ParseTree.prototype);
  32155. TerminalNode.prototype.constructor = TerminalNode;
  32156. function ErrorNode() {
  32157. TerminalNode.call(this);
  32158. return this;
  32159. }
  32160. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  32161. ErrorNode.prototype.constructor = ErrorNode;
  32162. function ParseTreeVisitor() {
  32163. return this;
  32164. }
  32165. ParseTreeVisitor.prototype.visit = function (ctx) {
  32166. if (Array.isArray(ctx)) {
  32167. return ctx.map(function (child) {
  32168. return child.accept(this);
  32169. }, this);
  32170. } else {
  32171. return ctx.accept(this);
  32172. }
  32173. };
  32174. ParseTreeVisitor.prototype.visitChildren = function (ctx) {
  32175. return this.visit(ctx.children);
  32176. };
  32177. ParseTreeVisitor.prototype.visitTerminal = function (node) {};
  32178. ParseTreeVisitor.prototype.visitErrorNode = function (node) {};
  32179. function ParseTreeListener() {
  32180. return this;
  32181. }
  32182. ParseTreeListener.prototype.visitTerminal = function (node) {};
  32183. ParseTreeListener.prototype.visitErrorNode = function (node) {};
  32184. ParseTreeListener.prototype.enterEveryRule = function (node) {};
  32185. ParseTreeListener.prototype.exitEveryRule = function (node) {};
  32186. function TerminalNodeImpl(symbol) {
  32187. TerminalNode.call(this);
  32188. this.parentCtx = null;
  32189. this.symbol = symbol;
  32190. return this;
  32191. }
  32192. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  32193. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  32194. TerminalNodeImpl.prototype.getChild = function (i) {
  32195. return null;
  32196. };
  32197. TerminalNodeImpl.prototype.getSymbol = function () {
  32198. return this.symbol;
  32199. };
  32200. TerminalNodeImpl.prototype.getParent = function () {
  32201. return this.parentCtx;
  32202. };
  32203. TerminalNodeImpl.prototype.getPayload = function () {
  32204. return this.symbol;
  32205. };
  32206. TerminalNodeImpl.prototype.getSourceInterval = function () {
  32207. if (this.symbol === null) {
  32208. return INVALID_INTERVAL;
  32209. }
  32210. var tokenIndex = this.symbol.tokenIndex;
  32211. return new Interval(tokenIndex, tokenIndex);
  32212. };
  32213. TerminalNodeImpl.prototype.getChildCount = function () {
  32214. return 0;
  32215. };
  32216. TerminalNodeImpl.prototype.accept = function (visitor) {
  32217. return visitor.visitTerminal(this);
  32218. };
  32219. TerminalNodeImpl.prototype.getText = function () {
  32220. return this.symbol.text;
  32221. };
  32222. TerminalNodeImpl.prototype.toString = function () {
  32223. if (this.symbol.type === Token.EOF) {
  32224. return "<EOF>";
  32225. } else {
  32226. return this.symbol.text;
  32227. }
  32228. };
  32229. // Represents a token that was consumed during resynchronization
  32230. // rather than during a valid match operation. For example,
  32231. // we will create this kind of a node during single token insertion
  32232. // and deletion as well as during "consume until error recovery set"
  32233. // upon no viable alternative exceptions.
  32234. function ErrorNodeImpl(token) {
  32235. TerminalNodeImpl.call(this, token);
  32236. return this;
  32237. }
  32238. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  32239. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  32240. ErrorNodeImpl.prototype.isErrorNode = function () {
  32241. return true;
  32242. };
  32243. ErrorNodeImpl.prototype.accept = function (visitor) {
  32244. return visitor.visitErrorNode(this);
  32245. };
  32246. function ParseTreeWalker() {
  32247. return this;
  32248. }
  32249. ParseTreeWalker.prototype.walk = function (listener, t) {
  32250. var errorNode = t instanceof ErrorNode || t.isErrorNode !== undefined && t.isErrorNode();
  32251. if (errorNode) {
  32252. listener.visitErrorNode(t);
  32253. } else if (t instanceof TerminalNode) {
  32254. listener.visitTerminal(t);
  32255. } else {
  32256. this.enterRule(listener, t);
  32257. for (var i = 0; i < t.getChildCount(); i++) {
  32258. var child = t.getChild(i);
  32259. this.walk(listener, child);
  32260. }
  32261. this.exitRule(listener, t);
  32262. }
  32263. };
  32264. //
  32265. // The discovery of a rule node, involves sending two events: the generic
  32266. // {@link ParseTreeListener//enterEveryRule} and a
  32267. // {@link RuleContext}-specific event. First we trigger the generic and then
  32268. // the rule specific. We to them in reverse order upon finishing the node.
  32269. //
  32270. ParseTreeWalker.prototype.enterRule = function (listener, r) {
  32271. var ctx = r.getRuleContext();
  32272. listener.enterEveryRule(ctx);
  32273. ctx.enterRule(listener);
  32274. };
  32275. ParseTreeWalker.prototype.exitRule = function (listener, r) {
  32276. var ctx = r.getRuleContext();
  32277. ctx.exitRule(listener);
  32278. listener.exitEveryRule(ctx);
  32279. };
  32280. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  32281. exports.RuleNode = RuleNode;
  32282. exports.ErrorNode = ErrorNode;
  32283. exports.TerminalNode = TerminalNode;
  32284. exports.ErrorNodeImpl = ErrorNodeImpl;
  32285. exports.TerminalNodeImpl = TerminalNodeImpl;
  32286. exports.ParseTreeListener = ParseTreeListener;
  32287. exports.ParseTreeVisitor = ParseTreeVisitor;
  32288. exports.ParseTreeWalker = ParseTreeWalker;
  32289. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  32290. /***/ }),
  32291. /***/ "./node_modules/antlr4/tree/Trees.js":
  32292. /*!*******************************************!*\
  32293. !*** ./node_modules/antlr4/tree/Trees.js ***!
  32294. \*******************************************/
  32295. /*! no static exports found */
  32296. /***/ (function(module, exports, __webpack_require__) {
  32297. "use strict";
  32298. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32299. * Use of this file is governed by the BSD 3-clause license that
  32300. * can be found in the LICENSE.txt file in the project root.
  32301. */
  32302. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  32303. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32304. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  32305. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  32306. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  32307. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  32308. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  32309. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  32310. /** A set of utility routines useful for all kinds of ANTLR trees. */
  32311. function Trees() {}
  32312. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  32313. // node payloads to get the text for the nodes. Detect
  32314. // parse trees and extract data appropriately.
  32315. Trees.toStringTree = function (tree, ruleNames, recog) {
  32316. ruleNames = ruleNames || null;
  32317. recog = recog || null;
  32318. if (recog !== null) {
  32319. ruleNames = recog.ruleNames;
  32320. }
  32321. var s = Trees.getNodeText(tree, ruleNames);
  32322. s = Utils.escapeWhitespace(s, false);
  32323. var c = tree.getChildCount();
  32324. if (c === 0) {
  32325. return s;
  32326. }
  32327. var res = "(" + s + ' ';
  32328. if (c > 0) {
  32329. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  32330. res = res.concat(s);
  32331. }
  32332. for (var i = 1; i < c; i++) {
  32333. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  32334. res = res.concat(' ' + s);
  32335. }
  32336. res = res.concat(")");
  32337. return res;
  32338. };
  32339. Trees.getNodeText = function (t, ruleNames, recog) {
  32340. ruleNames = ruleNames || null;
  32341. recog = recog || null;
  32342. if (recog !== null) {
  32343. ruleNames = recog.ruleNames;
  32344. }
  32345. if (ruleNames !== null) {
  32346. if (t instanceof RuleContext) {
  32347. var altNumber = t.getAltNumber();
  32348. if (altNumber != INVALID_ALT_NUMBER) {
  32349. return ruleNames[t.ruleIndex] + ":" + altNumber;
  32350. }
  32351. return ruleNames[t.ruleIndex];
  32352. } else if (t instanceof ErrorNode) {
  32353. return t.toString();
  32354. } else if (t instanceof TerminalNode) {
  32355. if (t.symbol !== null) {
  32356. return t.symbol.text;
  32357. }
  32358. }
  32359. }
  32360. // no recog for rule names
  32361. var payload = t.getPayload();
  32362. if (payload instanceof Token) {
  32363. return payload.text;
  32364. }
  32365. return t.getPayload().toString();
  32366. };
  32367. // Return ordered list of all children of this node
  32368. Trees.getChildren = function (t) {
  32369. var list = [];
  32370. for (var i = 0; i < t.getChildCount(); i++) {
  32371. list.push(t.getChild(i));
  32372. }
  32373. return list;
  32374. };
  32375. // Return a list of all ancestors of this node. The first node of
  32376. // list is the root and the last is the parent of this node.
  32377. //
  32378. Trees.getAncestors = function (t) {
  32379. var ancestors = [];
  32380. t = t.getParent();
  32381. while (t !== null) {
  32382. ancestors = [t].concat(ancestors);
  32383. t = t.getParent();
  32384. }
  32385. return ancestors;
  32386. };
  32387. Trees.findAllTokenNodes = function (t, ttype) {
  32388. return Trees.findAllNodes(t, ttype, true);
  32389. };
  32390. Trees.findAllRuleNodes = function (t, ruleIndex) {
  32391. return Trees.findAllNodes(t, ruleIndex, false);
  32392. };
  32393. Trees.findAllNodes = function (t, index, findTokens) {
  32394. var nodes = [];
  32395. Trees._findAllNodes(t, index, findTokens, nodes);
  32396. return nodes;
  32397. };
  32398. Trees._findAllNodes = function (t, index, findTokens, nodes) {
  32399. // check this node (the root) first
  32400. if (findTokens && t instanceof TerminalNode) {
  32401. if (t.symbol.type === index) {
  32402. nodes.push(t);
  32403. }
  32404. } else if (!findTokens && t instanceof ParserRuleContext) {
  32405. if (t.ruleIndex === index) {
  32406. nodes.push(t);
  32407. }
  32408. }
  32409. // check children
  32410. for (var i = 0; i < t.getChildCount(); i++) {
  32411. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  32412. }
  32413. };
  32414. Trees.descendants = function (t) {
  32415. var nodes = [t];
  32416. for (var i = 0; i < t.getChildCount(); i++) {
  32417. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  32418. }
  32419. return nodes;
  32420. };
  32421. exports.Trees = Trees;
  32422. /***/ }),
  32423. /***/ "./node_modules/antlr4/tree/index.js":
  32424. /*!*******************************************!*\
  32425. !*** ./node_modules/antlr4/tree/index.js ***!
  32426. \*******************************************/
  32427. /*! no static exports found */
  32428. /***/ (function(module, exports, __webpack_require__) {
  32429. "use strict";
  32430. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32431. * Use of this file is governed by the BSD 3-clause license that
  32432. * can be found in the LICENSE.txt file in the project root.
  32433. */
  32434. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  32435. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  32436. exports.RuleNode = Tree.RuleNode;
  32437. exports.ParseTreeListener = Tree.ParseTreeListener;
  32438. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  32439. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  32440. /***/ }),
  32441. /***/ "./node_modules/decimal.js/decimal.js":
  32442. /*!********************************************!*\
  32443. !*** ./node_modules/decimal.js/decimal.js ***!
  32444. \********************************************/
  32445. /*! no static exports found */
  32446. /***/ (function(module, exports, __webpack_require__) {
  32447. "use strict";
  32448. var __WEBPACK_AMD_DEFINE_RESULT__;
  32449. 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; };
  32450. /*! decimal.js v10.0.1 https://github.com/MikeMcl/decimal.js/LICENCE */
  32451. ;(function (globalScope) {
  32452. 'use strict';
  32453. /*
  32454. * decimal.js v10.0.1
  32455. * An arbitrary-precision Decimal type for JavaScript.
  32456. * https://github.com/MikeMcl/decimal.js
  32457. * Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
  32458. * MIT Licence
  32459. */
  32460. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  32461. // The maximum exponent magnitude.
  32462. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  32463. var EXP_LIMIT = 9e15,
  32464. // 0 to 9e15
  32465. // The limit on the value of `precision`, and on the value of the first argument to
  32466. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  32467. MAX_DIGITS = 1e9,
  32468. // 0 to 1e9
  32469. // Base conversion alphabet.
  32470. NUMERALS = '0123456789abcdef',
  32471. // The natural logarithm of 10 (1025 digits).
  32472. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  32473. // Pi (1025 digits).
  32474. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  32475. // The initial configuration properties of the Decimal constructor.
  32476. DEFAULTS = {
  32477. // These values must be integers within the stated ranges (inclusive).
  32478. // Most of these values can be changed at run-time using the `Decimal.config` method.
  32479. // The maximum number of significant digits of the result of a calculation or base conversion.
  32480. // E.g. `Decimal.config({ precision: 20 });`
  32481. precision: 20, // 1 to MAX_DIGITS
  32482. // The rounding mode used when rounding to `precision`.
  32483. //
  32484. // ROUND_UP 0 Away from zero.
  32485. // ROUND_DOWN 1 Towards zero.
  32486. // ROUND_CEIL 2 Towards +Infinity.
  32487. // ROUND_FLOOR 3 Towards -Infinity.
  32488. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  32489. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  32490. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  32491. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  32492. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  32493. //
  32494. // E.g.
  32495. // `Decimal.rounding = 4;`
  32496. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  32497. rounding: 4, // 0 to 8
  32498. // The modulo mode used when calculating the modulus: a mod n.
  32499. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  32500. // The remainder (r) is calculated as: r = a - n * q.
  32501. //
  32502. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  32503. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  32504. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  32505. // HALF_EVEN 6 The IEEE 754 remainder function.
  32506. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  32507. //
  32508. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  32509. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  32510. // be used, but they may not give useful results.
  32511. modulo: 1, // 0 to 9
  32512. // The exponent value at and beneath which `toString` returns exponential notation.
  32513. // JavaScript numbers: -7
  32514. toExpNeg: -7, // 0 to -EXP_LIMIT
  32515. // The exponent value at and above which `toString` returns exponential notation.
  32516. // JavaScript numbers: 21
  32517. toExpPos: 21, // 0 to EXP_LIMIT
  32518. // The minimum exponent value, beneath which underflow to zero occurs.
  32519. // JavaScript numbers: -324 (5e-324)
  32520. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  32521. // The maximum exponent value, above which overflow to Infinity occurs.
  32522. // JavaScript numbers: 308 (1.7976931348623157e+308)
  32523. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  32524. // Whether to use cryptographically-secure random number generation, if available.
  32525. crypto: false // true/false
  32526. },
  32527. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  32528. Decimal,
  32529. inexact,
  32530. noConflict,
  32531. quadrant,
  32532. external = true,
  32533. decimalError = '[DecimalError] ',
  32534. invalidArgument = decimalError + 'Invalid argument: ',
  32535. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  32536. cryptoUnavailable = decimalError + 'crypto unavailable',
  32537. mathfloor = Math.floor,
  32538. mathpow = Math.pow,
  32539. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  32540. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  32541. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  32542. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  32543. BASE = 1e7,
  32544. LOG_BASE = 7,
  32545. MAX_SAFE_INTEGER = 9007199254740991,
  32546. LN10_PRECISION = LN10.length - 1,
  32547. PI_PRECISION = PI.length - 1,
  32548. // Decimal.prototype object
  32549. P = { name: '[object Decimal]' };
  32550. // Decimal prototype methods
  32551. /*
  32552. * absoluteValue abs
  32553. * ceil
  32554. * comparedTo cmp
  32555. * cosine cos
  32556. * cubeRoot cbrt
  32557. * decimalPlaces dp
  32558. * dividedBy div
  32559. * dividedToIntegerBy divToInt
  32560. * equals eq
  32561. * floor
  32562. * greaterThan gt
  32563. * greaterThanOrEqualTo gte
  32564. * hyperbolicCosine cosh
  32565. * hyperbolicSine sinh
  32566. * hyperbolicTangent tanh
  32567. * inverseCosine acos
  32568. * inverseHyperbolicCosine acosh
  32569. * inverseHyperbolicSine asinh
  32570. * inverseHyperbolicTangent atanh
  32571. * inverseSine asin
  32572. * inverseTangent atan
  32573. * isFinite
  32574. * isInteger isInt
  32575. * isNaN
  32576. * isNegative isNeg
  32577. * isPositive isPos
  32578. * isZero
  32579. * lessThan lt
  32580. * lessThanOrEqualTo lte
  32581. * logarithm log
  32582. * [maximum] [max]
  32583. * [minimum] [min]
  32584. * minus sub
  32585. * modulo mod
  32586. * naturalExponential exp
  32587. * naturalLogarithm ln
  32588. * negated neg
  32589. * plus add
  32590. * precision sd
  32591. * round
  32592. * sine sin
  32593. * squareRoot sqrt
  32594. * tangent tan
  32595. * times mul
  32596. * toBinary
  32597. * toDecimalPlaces toDP
  32598. * toExponential
  32599. * toFixed
  32600. * toFraction
  32601. * toHexadecimal toHex
  32602. * toNearest
  32603. * toNumber
  32604. * toOctal
  32605. * toPower pow
  32606. * toPrecision
  32607. * toSignificantDigits toSD
  32608. * toString
  32609. * truncated trunc
  32610. * valueOf toJSON
  32611. */
  32612. /*
  32613. * Return a new Decimal whose value is the absolute value of this Decimal.
  32614. *
  32615. */
  32616. P.absoluteValue = P.abs = function () {
  32617. var x = new this.constructor(this);
  32618. if (x.s < 0) x.s = 1;
  32619. return finalise(x);
  32620. };
  32621. /*
  32622. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32623. * direction of positive Infinity.
  32624. *
  32625. */
  32626. P.ceil = function () {
  32627. return finalise(new this.constructor(this), this.e + 1, 2);
  32628. };
  32629. /*
  32630. * Return
  32631. * 1 if the value of this Decimal is greater than the value of `y`,
  32632. * -1 if the value of this Decimal is less than the value of `y`,
  32633. * 0 if they have the same value,
  32634. * NaN if the value of either Decimal is NaN.
  32635. *
  32636. */
  32637. P.comparedTo = P.cmp = function (y) {
  32638. var i,
  32639. j,
  32640. xdL,
  32641. ydL,
  32642. x = this,
  32643. xd = x.d,
  32644. yd = (y = new x.constructor(y)).d,
  32645. xs = x.s,
  32646. ys = y.s;
  32647. // Either NaN or ±Infinity?
  32648. if (!xd || !yd) {
  32649. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  32650. }
  32651. // Either zero?
  32652. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  32653. // Signs differ?
  32654. if (xs !== ys) return xs;
  32655. // Compare exponents.
  32656. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  32657. xdL = xd.length;
  32658. ydL = yd.length;
  32659. // Compare digit by digit.
  32660. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  32661. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  32662. }
  32663. // Compare lengths.
  32664. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  32665. };
  32666. /*
  32667. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  32668. *
  32669. * Domain: [-Infinity, Infinity]
  32670. * Range: [-1, 1]
  32671. *
  32672. * cos(0) = 1
  32673. * cos(-0) = 1
  32674. * cos(Infinity) = NaN
  32675. * cos(-Infinity) = NaN
  32676. * cos(NaN) = NaN
  32677. *
  32678. */
  32679. P.cosine = P.cos = function () {
  32680. var pr,
  32681. rm,
  32682. x = this,
  32683. Ctor = x.constructor;
  32684. if (!x.d) return new Ctor(NaN);
  32685. // cos(0) = cos(-0) = 1
  32686. if (!x.d[0]) return new Ctor(1);
  32687. pr = Ctor.precision;
  32688. rm = Ctor.rounding;
  32689. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  32690. Ctor.rounding = 1;
  32691. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  32692. Ctor.precision = pr;
  32693. Ctor.rounding = rm;
  32694. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  32695. };
  32696. /*
  32697. *
  32698. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  32699. * `precision` significant digits using rounding mode `rounding`.
  32700. *
  32701. * cbrt(0) = 0
  32702. * cbrt(-0) = -0
  32703. * cbrt(1) = 1
  32704. * cbrt(-1) = -1
  32705. * cbrt(N) = N
  32706. * cbrt(-I) = -I
  32707. * cbrt(I) = I
  32708. *
  32709. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  32710. *
  32711. */
  32712. P.cubeRoot = P.cbrt = function () {
  32713. var e,
  32714. m,
  32715. n,
  32716. r,
  32717. rep,
  32718. s,
  32719. sd,
  32720. t,
  32721. t3,
  32722. t3plusx,
  32723. x = this,
  32724. Ctor = x.constructor;
  32725. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32726. external = false;
  32727. // Initial estimate.
  32728. s = x.s * Math.pow(x.s * x, 1 / 3);
  32729. // Math.cbrt underflow/overflow?
  32730. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  32731. if (!s || Math.abs(s) == 1 / 0) {
  32732. n = digitsToString(x.d);
  32733. e = x.e;
  32734. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  32735. if (s = (e - n.length + 1) % 3) n += s == 1 || s == -2 ? '0' : '00';
  32736. s = Math.pow(n, 1 / 3);
  32737. // Rarely, e may be one less than the result exponent value.
  32738. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  32739. if (s == 1 / 0) {
  32740. n = '5e' + e;
  32741. } else {
  32742. n = s.toExponential();
  32743. n = n.slice(0, n.indexOf('e') + 1) + e;
  32744. }
  32745. r = new Ctor(n);
  32746. r.s = x.s;
  32747. } else {
  32748. r = new Ctor(s.toString());
  32749. }
  32750. sd = (e = Ctor.precision) + 3;
  32751. // Halley's method.
  32752. // TODO? Compare Newton's method.
  32753. for (;;) {
  32754. t = r;
  32755. t3 = t.times(t).times(t);
  32756. t3plusx = t3.plus(x);
  32757. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  32758. // TODO? Replace with for-loop and checkRoundingDigits.
  32759. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  32760. n = n.slice(sd - 3, sd + 1);
  32761. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  32762. // , i.e. approaching a rounding boundary, continue the iteration.
  32763. if (n == '9999' || !rep && n == '4999') {
  32764. // On the first iteration only, check to see if rounding up gives the exact result as the
  32765. // nines may infinitely repeat.
  32766. if (!rep) {
  32767. finalise(t, e + 1, 0);
  32768. if (t.times(t).times(t).eq(x)) {
  32769. r = t;
  32770. break;
  32771. }
  32772. }
  32773. sd += 4;
  32774. rep = 1;
  32775. } else {
  32776. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  32777. // If not, then there are further digits and m will be truthy.
  32778. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  32779. // Truncate to the first rounding digit.
  32780. finalise(r, e + 1, 1);
  32781. m = !r.times(r).times(r).eq(x);
  32782. }
  32783. break;
  32784. }
  32785. }
  32786. }
  32787. external = true;
  32788. return finalise(r, e, Ctor.rounding, m);
  32789. };
  32790. /*
  32791. * Return the number of decimal places of the value of this Decimal.
  32792. *
  32793. */
  32794. P.decimalPlaces = P.dp = function () {
  32795. var w,
  32796. d = this.d,
  32797. n = NaN;
  32798. if (d) {
  32799. w = d.length - 1;
  32800. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  32801. // Subtract the number of trailing zeros of the last word.
  32802. w = d[w];
  32803. if (w) for (; w % 10 == 0; w /= 10) {
  32804. n--;
  32805. }if (n < 0) n = 0;
  32806. }
  32807. return n;
  32808. };
  32809. /*
  32810. * n / 0 = I
  32811. * n / N = N
  32812. * n / I = 0
  32813. * 0 / n = 0
  32814. * 0 / 0 = N
  32815. * 0 / N = N
  32816. * 0 / I = 0
  32817. * N / n = N
  32818. * N / 0 = N
  32819. * N / N = N
  32820. * N / I = N
  32821. * I / n = I
  32822. * I / 0 = I
  32823. * I / N = N
  32824. * I / I = N
  32825. *
  32826. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  32827. * `precision` significant digits using rounding mode `rounding`.
  32828. *
  32829. */
  32830. P.dividedBy = P.div = function (y) {
  32831. return divide(this, new this.constructor(y));
  32832. };
  32833. /*
  32834. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  32835. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  32836. *
  32837. */
  32838. P.dividedToIntegerBy = P.divToInt = function (y) {
  32839. var x = this,
  32840. Ctor = x.constructor;
  32841. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  32842. };
  32843. /*
  32844. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  32845. *
  32846. */
  32847. P.equals = P.eq = function (y) {
  32848. return this.cmp(y) === 0;
  32849. };
  32850. /*
  32851. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  32852. * direction of negative Infinity.
  32853. *
  32854. */
  32855. P.floor = function () {
  32856. return finalise(new this.constructor(this), this.e + 1, 3);
  32857. };
  32858. /*
  32859. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  32860. * false.
  32861. *
  32862. */
  32863. P.greaterThan = P.gt = function (y) {
  32864. return this.cmp(y) > 0;
  32865. };
  32866. /*
  32867. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  32868. * otherwise return false.
  32869. *
  32870. */
  32871. P.greaterThanOrEqualTo = P.gte = function (y) {
  32872. var k = this.cmp(y);
  32873. return k == 1 || k === 0;
  32874. };
  32875. /*
  32876. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  32877. * Decimal.
  32878. *
  32879. * Domain: [-Infinity, Infinity]
  32880. * Range: [1, Infinity]
  32881. *
  32882. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  32883. *
  32884. * cosh(0) = 1
  32885. * cosh(-0) = 1
  32886. * cosh(Infinity) = Infinity
  32887. * cosh(-Infinity) = Infinity
  32888. * cosh(NaN) = NaN
  32889. *
  32890. * x time taken (ms) result
  32891. * 1000 9 9.8503555700852349694e+433
  32892. * 10000 25 4.4034091128314607936e+4342
  32893. * 100000 171 1.4033316802130615897e+43429
  32894. * 1000000 3817 1.5166076984010437725e+434294
  32895. * 10000000 abandoned after 2 minute wait
  32896. *
  32897. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  32898. *
  32899. */
  32900. P.hyperbolicCosine = P.cosh = function () {
  32901. var k,
  32902. n,
  32903. pr,
  32904. rm,
  32905. len,
  32906. x = this,
  32907. Ctor = x.constructor,
  32908. one = new Ctor(1);
  32909. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  32910. if (x.isZero()) return one;
  32911. pr = Ctor.precision;
  32912. rm = Ctor.rounding;
  32913. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  32914. Ctor.rounding = 1;
  32915. len = x.d.length;
  32916. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  32917. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  32918. // Estimate the optimum number of times to use the argument reduction.
  32919. // TODO? Estimation reused from cosine() and may not be optimal here.
  32920. if (len < 32) {
  32921. k = Math.ceil(len / 3);
  32922. n = Math.pow(4, -k).toString();
  32923. } else {
  32924. k = 16;
  32925. n = '2.3283064365386962890625e-10';
  32926. }
  32927. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  32928. // Reverse argument reduction
  32929. var cosh2_x,
  32930. i = k,
  32931. d8 = new Ctor(8);
  32932. for (; i--;) {
  32933. cosh2_x = x.times(x);
  32934. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  32935. }
  32936. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  32937. };
  32938. /*
  32939. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  32940. * Decimal.
  32941. *
  32942. * Domain: [-Infinity, Infinity]
  32943. * Range: [-Infinity, Infinity]
  32944. *
  32945. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  32946. *
  32947. * sinh(0) = 0
  32948. * sinh(-0) = -0
  32949. * sinh(Infinity) = Infinity
  32950. * sinh(-Infinity) = -Infinity
  32951. * sinh(NaN) = NaN
  32952. *
  32953. * x time taken (ms)
  32954. * 10 2 ms
  32955. * 100 5 ms
  32956. * 1000 14 ms
  32957. * 10000 82 ms
  32958. * 100000 886 ms 1.4033316802130615897e+43429
  32959. * 200000 2613 ms
  32960. * 300000 5407 ms
  32961. * 400000 8824 ms
  32962. * 500000 13026 ms 8.7080643612718084129e+217146
  32963. * 1000000 48543 ms
  32964. *
  32965. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  32966. *
  32967. */
  32968. P.hyperbolicSine = P.sinh = function () {
  32969. var k,
  32970. pr,
  32971. rm,
  32972. len,
  32973. x = this,
  32974. Ctor = x.constructor;
  32975. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  32976. pr = Ctor.precision;
  32977. rm = Ctor.rounding;
  32978. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  32979. Ctor.rounding = 1;
  32980. len = x.d.length;
  32981. if (len < 3) {
  32982. x = taylorSeries(Ctor, 2, x, x, true);
  32983. } else {
  32984. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  32985. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  32986. // 3 multiplications and 1 addition
  32987. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  32988. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  32989. // 4 multiplications and 2 additions
  32990. // Estimate the optimum number of times to use the argument reduction.
  32991. k = 1.4 * Math.sqrt(len);
  32992. k = k > 16 ? 16 : k | 0;
  32993. x = x.times(Math.pow(5, -k));
  32994. x = taylorSeries(Ctor, 2, x, x, true);
  32995. // Reverse argument reduction
  32996. var sinh2_x,
  32997. d5 = new Ctor(5),
  32998. d16 = new Ctor(16),
  32999. d20 = new Ctor(20);
  33000. for (; k--;) {
  33001. sinh2_x = x.times(x);
  33002. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  33003. }
  33004. }
  33005. Ctor.precision = pr;
  33006. Ctor.rounding = rm;
  33007. return finalise(x, pr, rm, true);
  33008. };
  33009. /*
  33010. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  33011. * Decimal.
  33012. *
  33013. * Domain: [-Infinity, Infinity]
  33014. * Range: [-1, 1]
  33015. *
  33016. * tanh(x) = sinh(x) / cosh(x)
  33017. *
  33018. * tanh(0) = 0
  33019. * tanh(-0) = -0
  33020. * tanh(Infinity) = 1
  33021. * tanh(-Infinity) = -1
  33022. * tanh(NaN) = NaN
  33023. *
  33024. */
  33025. P.hyperbolicTangent = P.tanh = function () {
  33026. var pr,
  33027. rm,
  33028. x = this,
  33029. Ctor = x.constructor;
  33030. if (!x.isFinite()) return new Ctor(x.s);
  33031. if (x.isZero()) return new Ctor(x);
  33032. pr = Ctor.precision;
  33033. rm = Ctor.rounding;
  33034. Ctor.precision = pr + 7;
  33035. Ctor.rounding = 1;
  33036. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  33037. };
  33038. /*
  33039. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  33040. * this Decimal.
  33041. *
  33042. * Domain: [-1, 1]
  33043. * Range: [0, pi]
  33044. *
  33045. * acos(x) = pi/2 - asin(x)
  33046. *
  33047. * acos(0) = pi/2
  33048. * acos(-0) = pi/2
  33049. * acos(1) = 0
  33050. * acos(-1) = pi
  33051. * acos(1/2) = pi/3
  33052. * acos(-1/2) = 2*pi/3
  33053. * acos(|x| > 1) = NaN
  33054. * acos(NaN) = NaN
  33055. *
  33056. */
  33057. P.inverseCosine = P.acos = function () {
  33058. var halfPi,
  33059. x = this,
  33060. Ctor = x.constructor,
  33061. k = x.abs().cmp(1),
  33062. pr = Ctor.precision,
  33063. rm = Ctor.rounding;
  33064. if (k !== -1) {
  33065. return k === 0
  33066. // |x| is 1
  33067. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  33068. // |x| > 1 or x is NaN
  33069. : new Ctor(NaN);
  33070. }
  33071. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  33072. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  33073. Ctor.precision = pr + 6;
  33074. Ctor.rounding = 1;
  33075. x = x.asin();
  33076. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33077. Ctor.precision = pr;
  33078. Ctor.rounding = rm;
  33079. return halfPi.minus(x);
  33080. };
  33081. /*
  33082. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  33083. * value of this Decimal.
  33084. *
  33085. * Domain: [1, Infinity]
  33086. * Range: [0, Infinity]
  33087. *
  33088. * acosh(x) = ln(x + sqrt(x^2 - 1))
  33089. *
  33090. * acosh(x < 1) = NaN
  33091. * acosh(NaN) = NaN
  33092. * acosh(Infinity) = Infinity
  33093. * acosh(-Infinity) = NaN
  33094. * acosh(0) = NaN
  33095. * acosh(-0) = NaN
  33096. * acosh(1) = 0
  33097. * acosh(-1) = NaN
  33098. *
  33099. */
  33100. P.inverseHyperbolicCosine = P.acosh = function () {
  33101. var pr,
  33102. rm,
  33103. x = this,
  33104. Ctor = x.constructor;
  33105. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  33106. if (!x.isFinite()) return new Ctor(x);
  33107. pr = Ctor.precision;
  33108. rm = Ctor.rounding;
  33109. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  33110. Ctor.rounding = 1;
  33111. external = false;
  33112. x = x.times(x).minus(1).sqrt().plus(x);
  33113. external = true;
  33114. Ctor.precision = pr;
  33115. Ctor.rounding = rm;
  33116. return x.ln();
  33117. };
  33118. /*
  33119. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  33120. * of this Decimal.
  33121. *
  33122. * Domain: [-Infinity, Infinity]
  33123. * Range: [-Infinity, Infinity]
  33124. *
  33125. * asinh(x) = ln(x + sqrt(x^2 + 1))
  33126. *
  33127. * asinh(NaN) = NaN
  33128. * asinh(Infinity) = Infinity
  33129. * asinh(-Infinity) = -Infinity
  33130. * asinh(0) = 0
  33131. * asinh(-0) = -0
  33132. *
  33133. */
  33134. P.inverseHyperbolicSine = P.asinh = function () {
  33135. var pr,
  33136. rm,
  33137. x = this,
  33138. Ctor = x.constructor;
  33139. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  33140. pr = Ctor.precision;
  33141. rm = Ctor.rounding;
  33142. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  33143. Ctor.rounding = 1;
  33144. external = false;
  33145. x = x.times(x).plus(1).sqrt().plus(x);
  33146. external = true;
  33147. Ctor.precision = pr;
  33148. Ctor.rounding = rm;
  33149. return x.ln();
  33150. };
  33151. /*
  33152. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  33153. * value of this Decimal.
  33154. *
  33155. * Domain: [-1, 1]
  33156. * Range: [-Infinity, Infinity]
  33157. *
  33158. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  33159. *
  33160. * atanh(|x| > 1) = NaN
  33161. * atanh(NaN) = NaN
  33162. * atanh(Infinity) = NaN
  33163. * atanh(-Infinity) = NaN
  33164. * atanh(0) = 0
  33165. * atanh(-0) = -0
  33166. * atanh(1) = Infinity
  33167. * atanh(-1) = -Infinity
  33168. *
  33169. */
  33170. P.inverseHyperbolicTangent = P.atanh = function () {
  33171. var pr,
  33172. rm,
  33173. wpr,
  33174. xsd,
  33175. x = this,
  33176. Ctor = x.constructor;
  33177. if (!x.isFinite()) return new Ctor(NaN);
  33178. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  33179. pr = Ctor.precision;
  33180. rm = Ctor.rounding;
  33181. xsd = x.sd();
  33182. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  33183. Ctor.precision = wpr = xsd - x.e;
  33184. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  33185. Ctor.precision = pr + 4;
  33186. Ctor.rounding = 1;
  33187. x = x.ln();
  33188. Ctor.precision = pr;
  33189. Ctor.rounding = rm;
  33190. return x.times(0.5);
  33191. };
  33192. /*
  33193. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  33194. * Decimal.
  33195. *
  33196. * Domain: [-Infinity, Infinity]
  33197. * Range: [-pi/2, pi/2]
  33198. *
  33199. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  33200. *
  33201. * asin(0) = 0
  33202. * asin(-0) = -0
  33203. * asin(1/2) = pi/6
  33204. * asin(-1/2) = -pi/6
  33205. * asin(1) = pi/2
  33206. * asin(-1) = -pi/2
  33207. * asin(|x| > 1) = NaN
  33208. * asin(NaN) = NaN
  33209. *
  33210. * TODO? Compare performance of Taylor series.
  33211. *
  33212. */
  33213. P.inverseSine = P.asin = function () {
  33214. var halfPi,
  33215. k,
  33216. pr,
  33217. rm,
  33218. x = this,
  33219. Ctor = x.constructor;
  33220. if (x.isZero()) return new Ctor(x);
  33221. k = x.abs().cmp(1);
  33222. pr = Ctor.precision;
  33223. rm = Ctor.rounding;
  33224. if (k !== -1) {
  33225. // |x| is 1
  33226. if (k === 0) {
  33227. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  33228. halfPi.s = x.s;
  33229. return halfPi;
  33230. }
  33231. // |x| > 1 or x is NaN
  33232. return new Ctor(NaN);
  33233. }
  33234. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  33235. Ctor.precision = pr + 6;
  33236. Ctor.rounding = 1;
  33237. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  33238. Ctor.precision = pr;
  33239. Ctor.rounding = rm;
  33240. return x.times(2);
  33241. };
  33242. /*
  33243. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  33244. * of this Decimal.
  33245. *
  33246. * Domain: [-Infinity, Infinity]
  33247. * Range: [-pi/2, pi/2]
  33248. *
  33249. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33250. *
  33251. * atan(0) = 0
  33252. * atan(-0) = -0
  33253. * atan(1) = pi/4
  33254. * atan(-1) = -pi/4
  33255. * atan(Infinity) = pi/2
  33256. * atan(-Infinity) = -pi/2
  33257. * atan(NaN) = NaN
  33258. *
  33259. */
  33260. P.inverseTangent = P.atan = function () {
  33261. var i,
  33262. j,
  33263. k,
  33264. n,
  33265. px,
  33266. t,
  33267. r,
  33268. wpr,
  33269. x2,
  33270. x = this,
  33271. Ctor = x.constructor,
  33272. pr = Ctor.precision,
  33273. rm = Ctor.rounding;
  33274. if (!x.isFinite()) {
  33275. if (!x.s) return new Ctor(NaN);
  33276. if (pr + 4 <= PI_PRECISION) {
  33277. r = getPi(Ctor, pr + 4, rm).times(0.5);
  33278. r.s = x.s;
  33279. return r;
  33280. }
  33281. } else if (x.isZero()) {
  33282. return new Ctor(x);
  33283. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  33284. r = getPi(Ctor, pr + 4, rm).times(0.25);
  33285. r.s = x.s;
  33286. return r;
  33287. }
  33288. Ctor.precision = wpr = pr + 10;
  33289. Ctor.rounding = 1;
  33290. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  33291. // Argument reduction
  33292. // Ensure |x| < 0.42
  33293. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  33294. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  33295. for (i = k; i; --i) {
  33296. x = x.div(x.times(x).plus(1).sqrt().plus(1));
  33297. }external = false;
  33298. j = Math.ceil(wpr / LOG_BASE);
  33299. n = 1;
  33300. x2 = x.times(x);
  33301. r = new Ctor(x);
  33302. px = x;
  33303. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  33304. for (; i !== -1;) {
  33305. px = px.times(x2);
  33306. t = r.minus(px.div(n += 2));
  33307. px = px.times(x2);
  33308. r = t.plus(px.div(n += 2));
  33309. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;) {}
  33310. }
  33311. if (k) r = r.times(2 << k - 1);
  33312. external = true;
  33313. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  33314. };
  33315. /*
  33316. * Return true if the value of this Decimal is a finite number, otherwise return false.
  33317. *
  33318. */
  33319. P.isFinite = function () {
  33320. return !!this.d;
  33321. };
  33322. /*
  33323. * Return true if the value of this Decimal is an integer, otherwise return false.
  33324. *
  33325. */
  33326. P.isInteger = P.isInt = function () {
  33327. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  33328. };
  33329. /*
  33330. * Return true if the value of this Decimal is NaN, otherwise return false.
  33331. *
  33332. */
  33333. P.isNaN = function () {
  33334. return !this.s;
  33335. };
  33336. /*
  33337. * Return true if the value of this Decimal is negative, otherwise return false.
  33338. *
  33339. */
  33340. P.isNegative = P.isNeg = function () {
  33341. return this.s < 0;
  33342. };
  33343. /*
  33344. * Return true if the value of this Decimal is positive, otherwise return false.
  33345. *
  33346. */
  33347. P.isPositive = P.isPos = function () {
  33348. return this.s > 0;
  33349. };
  33350. /*
  33351. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  33352. *
  33353. */
  33354. P.isZero = function () {
  33355. return !!this.d && this.d[0] === 0;
  33356. };
  33357. /*
  33358. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  33359. *
  33360. */
  33361. P.lessThan = P.lt = function (y) {
  33362. return this.cmp(y) < 0;
  33363. };
  33364. /*
  33365. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  33366. *
  33367. */
  33368. P.lessThanOrEqualTo = P.lte = function (y) {
  33369. return this.cmp(y) < 1;
  33370. };
  33371. /*
  33372. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  33373. * significant digits using rounding mode `rounding`.
  33374. *
  33375. * If no base is specified, return log[10](arg).
  33376. *
  33377. * log[base](arg) = ln(arg) / ln(base)
  33378. *
  33379. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  33380. * otherwise:
  33381. *
  33382. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  33383. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  33384. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  33385. *
  33386. * log[-b](a) = NaN
  33387. * log[0](a) = NaN
  33388. * log[1](a) = NaN
  33389. * log[NaN](a) = NaN
  33390. * log[Infinity](a) = NaN
  33391. * log[b](0) = -Infinity
  33392. * log[b](-0) = -Infinity
  33393. * log[b](-a) = NaN
  33394. * log[b](1) = 0
  33395. * log[b](Infinity) = Infinity
  33396. * log[b](NaN) = NaN
  33397. *
  33398. * [base] {number|string|Decimal} The base of the logarithm.
  33399. *
  33400. */
  33401. P.logarithm = P.log = function (base) {
  33402. var isBase10,
  33403. d,
  33404. denominator,
  33405. k,
  33406. inf,
  33407. num,
  33408. sd,
  33409. r,
  33410. arg = this,
  33411. Ctor = arg.constructor,
  33412. pr = Ctor.precision,
  33413. rm = Ctor.rounding,
  33414. guard = 5;
  33415. // Default base is 10.
  33416. if (base == null) {
  33417. base = new Ctor(10);
  33418. isBase10 = true;
  33419. } else {
  33420. base = new Ctor(base);
  33421. d = base.d;
  33422. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  33423. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  33424. isBase10 = base.eq(10);
  33425. }
  33426. d = arg.d;
  33427. // Is arg negative, non-finite, 0 or 1?
  33428. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  33429. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  33430. }
  33431. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  33432. // integer power of 10.
  33433. if (isBase10) {
  33434. if (d.length > 1) {
  33435. inf = true;
  33436. } else {
  33437. for (k = d[0]; k % 10 === 0;) {
  33438. k /= 10;
  33439. }inf = k !== 1;
  33440. }
  33441. }
  33442. external = false;
  33443. sd = pr + guard;
  33444. num = naturalLogarithm(arg, sd);
  33445. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33446. // The result will have 5 rounding digits.
  33447. r = divide(num, denominator, sd, 1);
  33448. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  33449. // calculate 10 further digits.
  33450. //
  33451. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  33452. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  33453. // further digits, the last 14 are nines, round up and assume the result is exact.
  33454. // Also assume the result is exact if the last 14 are zero.
  33455. //
  33456. // Example of a result that will be incorrectly rounded:
  33457. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  33458. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  33459. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  33460. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  33461. // place is still 2.6.
  33462. if (checkRoundingDigits(r.d, k = pr, rm)) {
  33463. do {
  33464. sd += 10;
  33465. num = naturalLogarithm(arg, sd);
  33466. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  33467. r = divide(num, denominator, sd, 1);
  33468. if (!inf) {
  33469. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  33470. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  33471. r = finalise(r, pr + 1, 0);
  33472. }
  33473. break;
  33474. }
  33475. } while (checkRoundingDigits(r.d, k += 10, rm));
  33476. }
  33477. external = true;
  33478. return finalise(r, pr, rm);
  33479. };
  33480. /*
  33481. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  33482. *
  33483. * arguments {number|string|Decimal}
  33484. *
  33485. P.max = function () {
  33486. Array.prototype.push.call(arguments, this);
  33487. return maxOrMin(this.constructor, arguments, 'lt');
  33488. };
  33489. */
  33490. /*
  33491. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  33492. *
  33493. * arguments {number|string|Decimal}
  33494. *
  33495. P.min = function () {
  33496. Array.prototype.push.call(arguments, this);
  33497. return maxOrMin(this.constructor, arguments, 'gt');
  33498. };
  33499. */
  33500. /*
  33501. * n - 0 = n
  33502. * n - N = N
  33503. * n - I = -I
  33504. * 0 - n = -n
  33505. * 0 - 0 = 0
  33506. * 0 - N = N
  33507. * 0 - I = -I
  33508. * N - n = N
  33509. * N - 0 = N
  33510. * N - N = N
  33511. * N - I = N
  33512. * I - n = I
  33513. * I - 0 = I
  33514. * I - N = N
  33515. * I - I = N
  33516. *
  33517. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  33518. * significant digits using rounding mode `rounding`.
  33519. *
  33520. */
  33521. P.minus = P.sub = function (y) {
  33522. var d,
  33523. e,
  33524. i,
  33525. j,
  33526. k,
  33527. len,
  33528. pr,
  33529. rm,
  33530. xd,
  33531. xe,
  33532. xLTy,
  33533. yd,
  33534. x = this,
  33535. Ctor = x.constructor;
  33536. y = new Ctor(y);
  33537. // If either is not finite...
  33538. if (!x.d || !y.d) {
  33539. // Return NaN if either is NaN.
  33540. if (!x.s || !y.s) y = new Ctor(NaN);
  33541. // Return y negated if x is finite and y is ±Infinity.
  33542. else if (x.d) y.s = -y.s;
  33543. // Return x if y is finite and x is ±Infinity.
  33544. // Return x if both are ±Infinity with different signs.
  33545. // Return NaN if both are ±Infinity with the same sign.
  33546. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  33547. return y;
  33548. }
  33549. // If signs differ...
  33550. if (x.s != y.s) {
  33551. y.s = -y.s;
  33552. return x.plus(y);
  33553. }
  33554. xd = x.d;
  33555. yd = y.d;
  33556. pr = Ctor.precision;
  33557. rm = Ctor.rounding;
  33558. // If either is zero...
  33559. if (!xd[0] || !yd[0]) {
  33560. // Return y negated if x is zero and y is non-zero.
  33561. if (yd[0]) y.s = -y.s;
  33562. // Return x if y is zero and x is non-zero.
  33563. else if (xd[0]) y = new Ctor(x);
  33564. // Return zero if both are zero.
  33565. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  33566. else return new Ctor(rm === 3 ? -0 : 0);
  33567. return external ? finalise(y, pr, rm) : y;
  33568. }
  33569. // x and y are finite, non-zero numbers with the same sign.
  33570. // Calculate base 1e7 exponents.
  33571. e = mathfloor(y.e / LOG_BASE);
  33572. xe = mathfloor(x.e / LOG_BASE);
  33573. xd = xd.slice();
  33574. k = xe - e;
  33575. // If base 1e7 exponents differ...
  33576. if (k) {
  33577. xLTy = k < 0;
  33578. if (xLTy) {
  33579. d = xd;
  33580. k = -k;
  33581. len = yd.length;
  33582. } else {
  33583. d = yd;
  33584. e = xe;
  33585. len = xd.length;
  33586. }
  33587. // Numbers with massively different exponents would result in a very high number of
  33588. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  33589. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  33590. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  33591. if (k > i) {
  33592. k = i;
  33593. d.length = 1;
  33594. }
  33595. // Prepend zeros to equalise exponents.
  33596. d.reverse();
  33597. for (i = k; i--;) {
  33598. d.push(0);
  33599. }d.reverse();
  33600. // Base 1e7 exponents equal.
  33601. } else {
  33602. // Check digits to determine which is the bigger number.
  33603. i = xd.length;
  33604. len = yd.length;
  33605. xLTy = i < len;
  33606. if (xLTy) len = i;
  33607. for (i = 0; i < len; i++) {
  33608. if (xd[i] != yd[i]) {
  33609. xLTy = xd[i] < yd[i];
  33610. break;
  33611. }
  33612. }
  33613. k = 0;
  33614. }
  33615. if (xLTy) {
  33616. d = xd;
  33617. xd = yd;
  33618. yd = d;
  33619. y.s = -y.s;
  33620. }
  33621. len = xd.length;
  33622. // Append zeros to `xd` if shorter.
  33623. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  33624. for (i = yd.length - len; i > 0; --i) {
  33625. xd[len++] = 0;
  33626. } // Subtract yd from xd.
  33627. for (i = yd.length; i > k;) {
  33628. if (xd[--i] < yd[i]) {
  33629. for (j = i; j && xd[--j] === 0;) {
  33630. xd[j] = BASE - 1;
  33631. }--xd[j];
  33632. xd[i] += BASE;
  33633. }
  33634. xd[i] -= yd[i];
  33635. }
  33636. // Remove trailing zeros.
  33637. for (; xd[--len] === 0;) {
  33638. xd.pop();
  33639. } // Remove leading zeros and adjust exponent accordingly.
  33640. for (; xd[0] === 0; xd.shift()) {
  33641. --e;
  33642. } // Zero?
  33643. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  33644. y.d = xd;
  33645. y.e = getBase10Exponent(xd, e);
  33646. return external ? finalise(y, pr, rm) : y;
  33647. };
  33648. /*
  33649. * n % 0 = N
  33650. * n % N = N
  33651. * n % I = n
  33652. * 0 % n = 0
  33653. * -0 % n = -0
  33654. * 0 % 0 = N
  33655. * 0 % N = N
  33656. * 0 % I = 0
  33657. * N % n = N
  33658. * N % 0 = N
  33659. * N % N = N
  33660. * N % I = N
  33661. * I % n = N
  33662. * I % 0 = N
  33663. * I % N = N
  33664. * I % I = N
  33665. *
  33666. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  33667. * `precision` significant digits using rounding mode `rounding`.
  33668. *
  33669. * The result depends on the modulo mode.
  33670. *
  33671. */
  33672. P.modulo = P.mod = function (y) {
  33673. var q,
  33674. x = this,
  33675. Ctor = x.constructor;
  33676. y = new Ctor(y);
  33677. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  33678. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  33679. // Return x if y is ±Infinity or x is ±0.
  33680. if (!y.d || x.d && !x.d[0]) {
  33681. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  33682. }
  33683. // Prevent rounding of intermediate calculations.
  33684. external = false;
  33685. if (Ctor.modulo == 9) {
  33686. // Euclidian division: q = sign(y) * floor(x / abs(y))
  33687. // result = x - q * y where 0 <= result < abs(y)
  33688. q = divide(x, y.abs(), 0, 3, 1);
  33689. q.s *= y.s;
  33690. } else {
  33691. q = divide(x, y, 0, Ctor.modulo, 1);
  33692. }
  33693. q = q.times(y);
  33694. external = true;
  33695. return x.minus(q);
  33696. };
  33697. /*
  33698. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  33699. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  33700. * significant digits using rounding mode `rounding`.
  33701. *
  33702. */
  33703. P.naturalExponential = P.exp = function () {
  33704. return naturalExponential(this);
  33705. };
  33706. /*
  33707. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  33708. * rounded to `precision` significant digits using rounding mode `rounding`.
  33709. *
  33710. */
  33711. P.naturalLogarithm = P.ln = function () {
  33712. return naturalLogarithm(this);
  33713. };
  33714. /*
  33715. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  33716. * -1.
  33717. *
  33718. */
  33719. P.negated = P.neg = function () {
  33720. var x = new this.constructor(this);
  33721. x.s = -x.s;
  33722. return finalise(x);
  33723. };
  33724. /*
  33725. * n + 0 = n
  33726. * n + N = N
  33727. * n + I = I
  33728. * 0 + n = n
  33729. * 0 + 0 = 0
  33730. * 0 + N = N
  33731. * 0 + I = I
  33732. * N + n = N
  33733. * N + 0 = N
  33734. * N + N = N
  33735. * N + I = N
  33736. * I + n = I
  33737. * I + 0 = I
  33738. * I + N = N
  33739. * I + I = I
  33740. *
  33741. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  33742. * significant digits using rounding mode `rounding`.
  33743. *
  33744. */
  33745. P.plus = P.add = function (y) {
  33746. var carry,
  33747. d,
  33748. e,
  33749. i,
  33750. k,
  33751. len,
  33752. pr,
  33753. rm,
  33754. xd,
  33755. yd,
  33756. x = this,
  33757. Ctor = x.constructor;
  33758. y = new Ctor(y);
  33759. // If either is not finite...
  33760. if (!x.d || !y.d) {
  33761. // Return NaN if either is NaN.
  33762. if (!x.s || !y.s) y = new Ctor(NaN);
  33763. // Return x if y is finite and x is ±Infinity.
  33764. // Return x if both are ±Infinity with the same sign.
  33765. // Return NaN if both are ±Infinity with different signs.
  33766. // Return y if x is finite and y is ±Infinity.
  33767. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  33768. return y;
  33769. }
  33770. // If signs differ...
  33771. if (x.s != y.s) {
  33772. y.s = -y.s;
  33773. return x.minus(y);
  33774. }
  33775. xd = x.d;
  33776. yd = y.d;
  33777. pr = Ctor.precision;
  33778. rm = Ctor.rounding;
  33779. // If either is zero...
  33780. if (!xd[0] || !yd[0]) {
  33781. // Return x if y is zero.
  33782. // Return y if y is non-zero.
  33783. if (!yd[0]) y = new Ctor(x);
  33784. return external ? finalise(y, pr, rm) : y;
  33785. }
  33786. // x and y are finite, non-zero numbers with the same sign.
  33787. // Calculate base 1e7 exponents.
  33788. k = mathfloor(x.e / LOG_BASE);
  33789. e = mathfloor(y.e / LOG_BASE);
  33790. xd = xd.slice();
  33791. i = k - e;
  33792. // If base 1e7 exponents differ...
  33793. if (i) {
  33794. if (i < 0) {
  33795. d = xd;
  33796. i = -i;
  33797. len = yd.length;
  33798. } else {
  33799. d = yd;
  33800. e = k;
  33801. len = xd.length;
  33802. }
  33803. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  33804. k = Math.ceil(pr / LOG_BASE);
  33805. len = k > len ? k + 1 : len + 1;
  33806. if (i > len) {
  33807. i = len;
  33808. d.length = 1;
  33809. }
  33810. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  33811. d.reverse();
  33812. for (; i--;) {
  33813. d.push(0);
  33814. }d.reverse();
  33815. }
  33816. len = xd.length;
  33817. i = yd.length;
  33818. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  33819. if (len - i < 0) {
  33820. i = len;
  33821. d = yd;
  33822. yd = xd;
  33823. xd = d;
  33824. }
  33825. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  33826. for (carry = 0; i;) {
  33827. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  33828. xd[i] %= BASE;
  33829. }
  33830. if (carry) {
  33831. xd.unshift(carry);
  33832. ++e;
  33833. }
  33834. // Remove trailing zeros.
  33835. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  33836. for (len = xd.length; xd[--len] == 0;) {
  33837. xd.pop();
  33838. }y.d = xd;
  33839. y.e = getBase10Exponent(xd, e);
  33840. return external ? finalise(y, pr, rm) : y;
  33841. };
  33842. /*
  33843. * Return the number of significant digits of the value of this Decimal.
  33844. *
  33845. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  33846. *
  33847. */
  33848. P.precision = P.sd = function (z) {
  33849. var k,
  33850. x = this;
  33851. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  33852. if (x.d) {
  33853. k = getPrecision(x.d);
  33854. if (z && x.e + 1 > k) k = x.e + 1;
  33855. } else {
  33856. k = NaN;
  33857. }
  33858. return k;
  33859. };
  33860. /*
  33861. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  33862. * rounding mode `rounding`.
  33863. *
  33864. */
  33865. P.round = function () {
  33866. var x = this,
  33867. Ctor = x.constructor;
  33868. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  33869. };
  33870. /*
  33871. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  33872. *
  33873. * Domain: [-Infinity, Infinity]
  33874. * Range: [-1, 1]
  33875. *
  33876. * sin(x) = x - x^3/3! + x^5/5! - ...
  33877. *
  33878. * sin(0) = 0
  33879. * sin(-0) = -0
  33880. * sin(Infinity) = NaN
  33881. * sin(-Infinity) = NaN
  33882. * sin(NaN) = NaN
  33883. *
  33884. */
  33885. P.sine = P.sin = function () {
  33886. var pr,
  33887. rm,
  33888. x = this,
  33889. Ctor = x.constructor;
  33890. if (!x.isFinite()) return new Ctor(NaN);
  33891. if (x.isZero()) return new Ctor(x);
  33892. pr = Ctor.precision;
  33893. rm = Ctor.rounding;
  33894. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  33895. Ctor.rounding = 1;
  33896. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  33897. Ctor.precision = pr;
  33898. Ctor.rounding = rm;
  33899. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  33900. };
  33901. /*
  33902. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  33903. * significant digits using rounding mode `rounding`.
  33904. *
  33905. * sqrt(-n) = N
  33906. * sqrt(N) = N
  33907. * sqrt(-I) = N
  33908. * sqrt(I) = I
  33909. * sqrt(0) = 0
  33910. * sqrt(-0) = -0
  33911. *
  33912. */
  33913. P.squareRoot = P.sqrt = function () {
  33914. var m,
  33915. n,
  33916. sd,
  33917. r,
  33918. rep,
  33919. t,
  33920. x = this,
  33921. d = x.d,
  33922. e = x.e,
  33923. s = x.s,
  33924. Ctor = x.constructor;
  33925. // Negative/NaN/Infinity/zero?
  33926. if (s !== 1 || !d || !d[0]) {
  33927. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  33928. }
  33929. external = false;
  33930. // Initial estimate.
  33931. s = Math.sqrt(+x);
  33932. // Math.sqrt underflow/overflow?
  33933. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  33934. if (s == 0 || s == 1 / 0) {
  33935. n = digitsToString(d);
  33936. if ((n.length + e) % 2 == 0) n += '0';
  33937. s = Math.sqrt(n);
  33938. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  33939. if (s == 1 / 0) {
  33940. n = '1e' + e;
  33941. } else {
  33942. n = s.toExponential();
  33943. n = n.slice(0, n.indexOf('e') + 1) + e;
  33944. }
  33945. r = new Ctor(n);
  33946. } else {
  33947. r = new Ctor(s.toString());
  33948. }
  33949. sd = (e = Ctor.precision) + 3;
  33950. // Newton-Raphson iteration.
  33951. for (;;) {
  33952. t = r;
  33953. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  33954. // TODO? Replace with for-loop and checkRoundingDigits.
  33955. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  33956. n = n.slice(sd - 3, sd + 1);
  33957. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  33958. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  33959. if (n == '9999' || !rep && n == '4999') {
  33960. // On the first iteration only, check to see if rounding up gives the exact result as the
  33961. // nines may infinitely repeat.
  33962. if (!rep) {
  33963. finalise(t, e + 1, 0);
  33964. if (t.times(t).eq(x)) {
  33965. r = t;
  33966. break;
  33967. }
  33968. }
  33969. sd += 4;
  33970. rep = 1;
  33971. } else {
  33972. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  33973. // If not, then there are further digits and m will be truthy.
  33974. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  33975. // Truncate to the first rounding digit.
  33976. finalise(r, e + 1, 1);
  33977. m = !r.times(r).eq(x);
  33978. }
  33979. break;
  33980. }
  33981. }
  33982. }
  33983. external = true;
  33984. return finalise(r, e, Ctor.rounding, m);
  33985. };
  33986. /*
  33987. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  33988. *
  33989. * Domain: [-Infinity, Infinity]
  33990. * Range: [-Infinity, Infinity]
  33991. *
  33992. * tan(0) = 0
  33993. * tan(-0) = -0
  33994. * tan(Infinity) = NaN
  33995. * tan(-Infinity) = NaN
  33996. * tan(NaN) = NaN
  33997. *
  33998. */
  33999. P.tangent = P.tan = function () {
  34000. var pr,
  34001. rm,
  34002. x = this,
  34003. Ctor = x.constructor;
  34004. if (!x.isFinite()) return new Ctor(NaN);
  34005. if (x.isZero()) return new Ctor(x);
  34006. pr = Ctor.precision;
  34007. rm = Ctor.rounding;
  34008. Ctor.precision = pr + 10;
  34009. Ctor.rounding = 1;
  34010. x = x.sin();
  34011. x.s = 1;
  34012. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  34013. Ctor.precision = pr;
  34014. Ctor.rounding = rm;
  34015. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  34016. };
  34017. /*
  34018. * n * 0 = 0
  34019. * n * N = N
  34020. * n * I = I
  34021. * 0 * n = 0
  34022. * 0 * 0 = 0
  34023. * 0 * N = N
  34024. * 0 * I = N
  34025. * N * n = N
  34026. * N * 0 = N
  34027. * N * N = N
  34028. * N * I = N
  34029. * I * n = I
  34030. * I * 0 = N
  34031. * I * N = N
  34032. * I * I = I
  34033. *
  34034. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  34035. * digits using rounding mode `rounding`.
  34036. *
  34037. */
  34038. P.times = P.mul = function (y) {
  34039. var carry,
  34040. e,
  34041. i,
  34042. k,
  34043. r,
  34044. rL,
  34045. t,
  34046. xdL,
  34047. ydL,
  34048. x = this,
  34049. Ctor = x.constructor,
  34050. xd = x.d,
  34051. yd = (y = new Ctor(y)).d;
  34052. y.s *= x.s;
  34053. // If either is NaN, ±Infinity or ±0...
  34054. if (!xd || !xd[0] || !yd || !yd[0]) {
  34055. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  34056. // Return NaN if either is NaN.
  34057. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  34058. ? NaN
  34059. // Return ±Infinity if either is ±Infinity.
  34060. // Return ±0 if either is ±0.
  34061. : !xd || !yd ? y.s / 0 : y.s * 0);
  34062. }
  34063. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  34064. xdL = xd.length;
  34065. ydL = yd.length;
  34066. // Ensure xd points to the longer array.
  34067. if (xdL < ydL) {
  34068. r = xd;
  34069. xd = yd;
  34070. yd = r;
  34071. rL = xdL;
  34072. xdL = ydL;
  34073. ydL = rL;
  34074. }
  34075. // Initialise the result array with zeros.
  34076. r = [];
  34077. rL = xdL + ydL;
  34078. for (i = rL; i--;) {
  34079. r.push(0);
  34080. } // Multiply!
  34081. for (i = ydL; --i >= 0;) {
  34082. carry = 0;
  34083. for (k = xdL + i; k > i;) {
  34084. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  34085. r[k--] = t % BASE | 0;
  34086. carry = t / BASE | 0;
  34087. }
  34088. r[k] = (r[k] + carry) % BASE | 0;
  34089. }
  34090. // Remove trailing zeros.
  34091. for (; !r[--rL];) {
  34092. r.pop();
  34093. }if (carry) ++e;else r.shift();
  34094. y.d = r;
  34095. y.e = getBase10Exponent(r, e);
  34096. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  34097. };
  34098. /*
  34099. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  34100. * digits using rounding mode `rm`.
  34101. *
  34102. * If the optional `sd` argument is present then return binary exponential notation.
  34103. *
  34104. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34105. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34106. *
  34107. */
  34108. P.toBinary = function (sd, rm) {
  34109. return toStringBinary(this, 2, sd, rm);
  34110. };
  34111. /*
  34112. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  34113. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  34114. *
  34115. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  34116. *
  34117. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34118. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34119. *
  34120. */
  34121. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  34122. var x = this,
  34123. Ctor = x.constructor;
  34124. x = new Ctor(x);
  34125. if (dp === void 0) return x;
  34126. checkInt32(dp, 0, MAX_DIGITS);
  34127. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34128. return finalise(x, dp + x.e + 1, rm);
  34129. };
  34130. /*
  34131. * Return a string representing the value of this Decimal in exponential notation rounded to
  34132. * `dp` fixed decimal places using rounding mode `rounding`.
  34133. *
  34134. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34135. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34136. *
  34137. */
  34138. P.toExponential = function (dp, rm) {
  34139. var str,
  34140. x = this,
  34141. Ctor = x.constructor;
  34142. if (dp === void 0) {
  34143. str = finiteToString(x, true);
  34144. } else {
  34145. checkInt32(dp, 0, MAX_DIGITS);
  34146. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34147. x = finalise(new Ctor(x), dp + 1, rm);
  34148. str = finiteToString(x, true, dp + 1);
  34149. }
  34150. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34151. };
  34152. /*
  34153. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  34154. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  34155. * omitted.
  34156. *
  34157. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  34158. *
  34159. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  34160. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34161. *
  34162. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  34163. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  34164. * (-0).toFixed(3) is '0.000'.
  34165. * (-0.5).toFixed(0) is '-0'.
  34166. *
  34167. */
  34168. P.toFixed = function (dp, rm) {
  34169. var str,
  34170. y,
  34171. x = this,
  34172. Ctor = x.constructor;
  34173. if (dp === void 0) {
  34174. str = finiteToString(x);
  34175. } else {
  34176. checkInt32(dp, 0, MAX_DIGITS);
  34177. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34178. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  34179. str = finiteToString(y, false, dp + y.e + 1);
  34180. }
  34181. // To determine whether to add the minus sign look at the value before it was rounded,
  34182. // i.e. look at `x` rather than `y`.
  34183. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34184. };
  34185. /*
  34186. * Return an array representing the value of this Decimal as a simple fraction with an integer
  34187. * numerator and an integer denominator.
  34188. *
  34189. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  34190. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  34191. * value necessary to represent the number exactly.
  34192. *
  34193. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  34194. *
  34195. */
  34196. P.toFraction = function (maxD) {
  34197. var d,
  34198. d0,
  34199. d1,
  34200. d2,
  34201. e,
  34202. k,
  34203. n,
  34204. n0,
  34205. n1,
  34206. pr,
  34207. q,
  34208. r,
  34209. x = this,
  34210. xd = x.d,
  34211. Ctor = x.constructor;
  34212. if (!xd) return new Ctor(x);
  34213. n1 = d0 = new Ctor(1);
  34214. d1 = n0 = new Ctor(0);
  34215. d = new Ctor(d1);
  34216. e = d.e = getPrecision(xd) - x.e - 1;
  34217. k = e % LOG_BASE;
  34218. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  34219. if (maxD == null) {
  34220. // d is 10**e, the minimum max-denominator needed.
  34221. maxD = e > 0 ? d : n1;
  34222. } else {
  34223. n = new Ctor(maxD);
  34224. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  34225. maxD = n.gt(d) ? e > 0 ? d : n1 : n;
  34226. }
  34227. external = false;
  34228. n = new Ctor(digitsToString(xd));
  34229. pr = Ctor.precision;
  34230. Ctor.precision = e = xd.length * LOG_BASE * 2;
  34231. for (;;) {
  34232. q = divide(n, d, 0, 1, 1);
  34233. d2 = d0.plus(q.times(d1));
  34234. if (d2.cmp(maxD) == 1) break;
  34235. d0 = d1;
  34236. d1 = d2;
  34237. d2 = n1;
  34238. n1 = n0.plus(q.times(d2));
  34239. n0 = d2;
  34240. d2 = d;
  34241. d = n.minus(q.times(d2));
  34242. n = d2;
  34243. }
  34244. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  34245. n0 = n0.plus(d2.times(n1));
  34246. d0 = d0.plus(d2.times(d1));
  34247. n0.s = n1.s = x.s;
  34248. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  34249. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1 ? [n1, d1] : [n0, d0];
  34250. Ctor.precision = pr;
  34251. external = true;
  34252. return r;
  34253. };
  34254. /*
  34255. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  34256. * digits using rounding mode `rm`.
  34257. *
  34258. * If the optional `sd` argument is present then return binary exponential notation.
  34259. *
  34260. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34261. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34262. *
  34263. */
  34264. P.toHexadecimal = P.toHex = function (sd, rm) {
  34265. return toStringBinary(this, 16, sd, rm);
  34266. };
  34267. /*
  34268. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  34269. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  34270. *
  34271. * The return value will always have the same sign as this Decimal, unless either this Decimal
  34272. * or `y` is NaN, in which case the return value will be also be NaN.
  34273. *
  34274. * The return value is not affected by the value of `precision`.
  34275. *
  34276. * y {number|string|Decimal} The magnitude to round to a multiple of.
  34277. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34278. *
  34279. * 'toNearest() rounding mode not an integer: {rm}'
  34280. * 'toNearest() rounding mode out of range: {rm}'
  34281. *
  34282. */
  34283. P.toNearest = function (y, rm) {
  34284. var x = this,
  34285. Ctor = x.constructor;
  34286. x = new Ctor(x);
  34287. if (y == null) {
  34288. // If x is not finite, return x.
  34289. if (!x.d) return x;
  34290. y = new Ctor(1);
  34291. rm = Ctor.rounding;
  34292. } else {
  34293. y = new Ctor(y);
  34294. if (rm === void 0) {
  34295. rm = Ctor.rounding;
  34296. } else {
  34297. checkInt32(rm, 0, 8);
  34298. }
  34299. // If x is not finite, return x if y is not NaN, else NaN.
  34300. if (!x.d) return y.s ? x : y;
  34301. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  34302. if (!y.d) {
  34303. if (y.s) y.s = x.s;
  34304. return y;
  34305. }
  34306. }
  34307. // If y is not zero, calculate the nearest multiple of y to x.
  34308. if (y.d[0]) {
  34309. external = false;
  34310. x = divide(x, y, 0, rm, 1).times(y);
  34311. external = true;
  34312. finalise(x);
  34313. // If y is zero, return zero with the sign of x.
  34314. } else {
  34315. y.s = x.s;
  34316. x = y;
  34317. }
  34318. return x;
  34319. };
  34320. /*
  34321. * Return the value of this Decimal converted to a number primitive.
  34322. * Zero keeps its sign.
  34323. *
  34324. */
  34325. P.toNumber = function () {
  34326. return +this;
  34327. };
  34328. /*
  34329. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  34330. * digits using rounding mode `rm`.
  34331. *
  34332. * If the optional `sd` argument is present then return binary exponential notation.
  34333. *
  34334. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34335. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34336. *
  34337. */
  34338. P.toOctal = function (sd, rm) {
  34339. return toStringBinary(this, 8, sd, rm);
  34340. };
  34341. /*
  34342. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  34343. * to `precision` significant digits using rounding mode `rounding`.
  34344. *
  34345. * ECMAScript compliant.
  34346. *
  34347. * pow(x, NaN) = NaN
  34348. * pow(x, ±0) = 1
  34349. * pow(NaN, non-zero) = NaN
  34350. * pow(abs(x) > 1, +Infinity) = +Infinity
  34351. * pow(abs(x) > 1, -Infinity) = +0
  34352. * pow(abs(x) == 1, ±Infinity) = NaN
  34353. * pow(abs(x) < 1, +Infinity) = +0
  34354. * pow(abs(x) < 1, -Infinity) = +Infinity
  34355. * pow(+Infinity, y > 0) = +Infinity
  34356. * pow(+Infinity, y < 0) = +0
  34357. * pow(-Infinity, odd integer > 0) = -Infinity
  34358. * pow(-Infinity, even integer > 0) = +Infinity
  34359. * pow(-Infinity, odd integer < 0) = -0
  34360. * pow(-Infinity, even integer < 0) = +0
  34361. * pow(+0, y > 0) = +0
  34362. * pow(+0, y < 0) = +Infinity
  34363. * pow(-0, odd integer > 0) = -0
  34364. * pow(-0, even integer > 0) = +0
  34365. * pow(-0, odd integer < 0) = -Infinity
  34366. * pow(-0, even integer < 0) = +Infinity
  34367. * pow(finite x < 0, finite non-integer) = NaN
  34368. *
  34369. * For non-integer or very large exponents pow(x, y) is calculated using
  34370. *
  34371. * x^y = exp(y*ln(x))
  34372. *
  34373. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  34374. * probability of an incorrectly rounded result
  34375. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  34376. * i.e. 1 in 250,000,000,000,000
  34377. *
  34378. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  34379. *
  34380. * y {number|string|Decimal} The power to which to raise this Decimal.
  34381. *
  34382. */
  34383. P.toPower = P.pow = function (y) {
  34384. var e,
  34385. k,
  34386. pr,
  34387. r,
  34388. rm,
  34389. s,
  34390. x = this,
  34391. Ctor = x.constructor,
  34392. yn = +(y = new Ctor(y));
  34393. // Either ±Infinity, NaN or ±0?
  34394. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  34395. x = new Ctor(x);
  34396. if (x.eq(1)) return x;
  34397. pr = Ctor.precision;
  34398. rm = Ctor.rounding;
  34399. if (y.eq(1)) return finalise(x, pr, rm);
  34400. // y exponent
  34401. e = mathfloor(y.e / LOG_BASE);
  34402. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  34403. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  34404. r = intPow(Ctor, x, k, pr);
  34405. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  34406. }
  34407. s = x.s;
  34408. // if x is negative
  34409. if (s < 0) {
  34410. // if y is not an integer
  34411. if (e < y.d.length - 1) return new Ctor(NaN);
  34412. // Result is positive if x is negative and the last digit of integer y is even.
  34413. if ((y.d[e] & 1) == 0) s = 1;
  34414. // if x.eq(-1)
  34415. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  34416. x.s = s;
  34417. return x;
  34418. }
  34419. }
  34420. // Estimate result exponent.
  34421. // x^y = 10^e, where e = y * log10(x)
  34422. // log10(x) = log10(x_significand) + x_exponent
  34423. // log10(x_significand) = ln(x_significand) / ln(10)
  34424. k = mathpow(+x, yn);
  34425. e = k == 0 || !isFinite(k) ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1)) : new Ctor(k + '').e;
  34426. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  34427. // Overflow/underflow?
  34428. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  34429. external = false;
  34430. Ctor.rounding = x.s = 1;
  34431. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  34432. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  34433. // new Decimal(2.32456).pow('2087987436534566.46411')
  34434. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  34435. k = Math.min(12, (e + '').length);
  34436. // r = x^y = exp(y*ln(x))
  34437. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  34438. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  34439. if (r.d) {
  34440. // Truncate to the required precision plus five rounding digits.
  34441. r = finalise(r, pr + 5, 1);
  34442. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  34443. // the result.
  34444. if (checkRoundingDigits(r.d, pr, rm)) {
  34445. e = pr + 10;
  34446. // Truncate to the increased precision plus five rounding digits.
  34447. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  34448. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  34449. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  34450. r = finalise(r, pr + 1, 0);
  34451. }
  34452. }
  34453. }
  34454. r.s = s;
  34455. external = true;
  34456. Ctor.rounding = rm;
  34457. return finalise(r, pr, rm);
  34458. };
  34459. /*
  34460. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  34461. * using rounding mode `rounding`.
  34462. *
  34463. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  34464. * the integer part of the value in normal notation.
  34465. *
  34466. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34467. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34468. *
  34469. */
  34470. P.toPrecision = function (sd, rm) {
  34471. var str,
  34472. x = this,
  34473. Ctor = x.constructor;
  34474. if (sd === void 0) {
  34475. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34476. } else {
  34477. checkInt32(sd, 1, MAX_DIGITS);
  34478. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34479. x = finalise(new Ctor(x), sd, rm);
  34480. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  34481. }
  34482. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34483. };
  34484. /*
  34485. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  34486. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  34487. * omitted.
  34488. *
  34489. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  34490. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  34491. *
  34492. * 'toSD() digits out of range: {sd}'
  34493. * 'toSD() digits not an integer: {sd}'
  34494. * 'toSD() rounding mode not an integer: {rm}'
  34495. * 'toSD() rounding mode out of range: {rm}'
  34496. *
  34497. */
  34498. P.toSignificantDigits = P.toSD = function (sd, rm) {
  34499. var x = this,
  34500. Ctor = x.constructor;
  34501. if (sd === void 0) {
  34502. sd = Ctor.precision;
  34503. rm = Ctor.rounding;
  34504. } else {
  34505. checkInt32(sd, 1, MAX_DIGITS);
  34506. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  34507. }
  34508. return finalise(new Ctor(x), sd, rm);
  34509. };
  34510. /*
  34511. * Return a string representing the value of this Decimal.
  34512. *
  34513. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  34514. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  34515. *
  34516. */
  34517. P.toString = function () {
  34518. var x = this,
  34519. Ctor = x.constructor,
  34520. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34521. return x.isNeg() && !x.isZero() ? '-' + str : str;
  34522. };
  34523. /*
  34524. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  34525. *
  34526. */
  34527. P.truncated = P.trunc = function () {
  34528. return finalise(new this.constructor(this), this.e + 1, 1);
  34529. };
  34530. /*
  34531. * Return a string representing the value of this Decimal.
  34532. * Unlike `toString`, negative zero will include the minus sign.
  34533. *
  34534. */
  34535. P.valueOf = P.toJSON = function () {
  34536. var x = this,
  34537. Ctor = x.constructor,
  34538. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  34539. return x.isNeg() ? '-' + str : str;
  34540. };
  34541. /*
  34542. // Add aliases to match BigDecimal method names.
  34543. // P.add = P.plus;
  34544. P.subtract = P.minus;
  34545. P.multiply = P.times;
  34546. P.divide = P.div;
  34547. P.remainder = P.mod;
  34548. P.compareTo = P.cmp;
  34549. P.negate = P.neg;
  34550. */
  34551. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  34552. /*
  34553. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  34554. * finiteToString, naturalExponential, naturalLogarithm
  34555. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  34556. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  34557. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  34558. * convertBase toStringBinary, parseOther
  34559. * cos P.cos
  34560. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  34561. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  34562. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  34563. * taylorSeries, atan2, parseOther
  34564. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  34565. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  34566. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  34567. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  34568. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  34569. * P.truncated, divide, getLn10, getPi, naturalExponential,
  34570. * naturalLogarithm, ceil, floor, round, trunc
  34571. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  34572. * toStringBinary
  34573. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  34574. * getLn10 P.logarithm, naturalLogarithm
  34575. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  34576. * getPrecision P.precision, P.toFraction
  34577. * getZeroString digitsToString, finiteToString
  34578. * intPow P.toPower, parseOther
  34579. * isOdd toLessThanHalfPi
  34580. * maxOrMin max, min
  34581. * naturalExponential P.naturalExponential, P.toPower
  34582. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  34583. * P.toPower, naturalExponential
  34584. * nonFiniteToString finiteToString, toStringBinary
  34585. * parseDecimal Decimal
  34586. * parseOther Decimal
  34587. * sin P.sin
  34588. * taylorSeries P.cosh, P.sinh, cos, sin
  34589. * toLessThanHalfPi P.cos, P.sin
  34590. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  34591. * truncate intPow
  34592. *
  34593. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  34594. * naturalLogarithm, config, parseOther, random, Decimal
  34595. */
  34596. function digitsToString(d) {
  34597. var i,
  34598. k,
  34599. ws,
  34600. indexOfLastWord = d.length - 1,
  34601. str = '',
  34602. w = d[0];
  34603. if (indexOfLastWord > 0) {
  34604. str += w;
  34605. for (i = 1; i < indexOfLastWord; i++) {
  34606. ws = d[i] + '';
  34607. k = LOG_BASE - ws.length;
  34608. if (k) str += getZeroString(k);
  34609. str += ws;
  34610. }
  34611. w = d[i];
  34612. ws = w + '';
  34613. k = LOG_BASE - ws.length;
  34614. if (k) str += getZeroString(k);
  34615. } else if (w === 0) {
  34616. return '0';
  34617. }
  34618. // Remove trailing zeros of last w.
  34619. for (; w % 10 === 0;) {
  34620. w /= 10;
  34621. }return str + w;
  34622. }
  34623. function checkInt32(i, min, max) {
  34624. if (i !== ~~i || i < min || i > max) {
  34625. throw Error(invalidArgument + i);
  34626. }
  34627. }
  34628. /*
  34629. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  34630. * `repeating == null` if caller is `log` or `pow`,
  34631. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  34632. */
  34633. function checkRoundingDigits(d, i, rm, repeating) {
  34634. var di, k, r, rd;
  34635. // Get the length of the first word of the array d.
  34636. for (k = d[0]; k >= 10; k /= 10) {
  34637. --i;
  34638. } // Is the rounding digit in the first word of d?
  34639. if (--i < 0) {
  34640. i += LOG_BASE;
  34641. di = 0;
  34642. } else {
  34643. di = Math.ceil((i + 1) / LOG_BASE);
  34644. i %= LOG_BASE;
  34645. }
  34646. // i is the index (0 - 6) of the rounding digit.
  34647. // E.g. if within the word 3487563 the first rounding digit is 5,
  34648. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  34649. k = mathpow(10, LOG_BASE - i);
  34650. rd = d[di] % k | 0;
  34651. if (repeating == null) {
  34652. if (i < 3) {
  34653. if (i == 0) rd = rd / 100 | 0;else if (i == 1) rd = rd / 10 | 0;
  34654. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  34655. } else {
  34656. 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;
  34657. }
  34658. } else {
  34659. if (i < 4) {
  34660. if (i == 0) rd = rd / 1000 | 0;else if (i == 1) rd = rd / 100 | 0;else if (i == 2) rd = rd / 10 | 0;
  34661. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  34662. } else {
  34663. 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;
  34664. }
  34665. }
  34666. return r;
  34667. }
  34668. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  34669. // Eg. convertBase('255', 10, 16) returns [15, 15].
  34670. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  34671. function convertBase(str, baseIn, baseOut) {
  34672. var j,
  34673. arr = [0],
  34674. arrL,
  34675. i = 0,
  34676. strL = str.length;
  34677. for (; i < strL;) {
  34678. for (arrL = arr.length; arrL--;) {
  34679. arr[arrL] *= baseIn;
  34680. }arr[0] += NUMERALS.indexOf(str.charAt(i++));
  34681. for (j = 0; j < arr.length; j++) {
  34682. if (arr[j] > baseOut - 1) {
  34683. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  34684. arr[j + 1] += arr[j] / baseOut | 0;
  34685. arr[j] %= baseOut;
  34686. }
  34687. }
  34688. }
  34689. return arr.reverse();
  34690. }
  34691. /*
  34692. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  34693. * |x| < pi/2
  34694. *
  34695. */
  34696. function cosine(Ctor, x) {
  34697. var k,
  34698. y,
  34699. len = x.d.length;
  34700. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  34701. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  34702. // Estimate the optimum number of times to use the argument reduction.
  34703. if (len < 32) {
  34704. k = Math.ceil(len / 3);
  34705. y = Math.pow(4, -k).toString();
  34706. } else {
  34707. k = 16;
  34708. y = '2.3283064365386962890625e-10';
  34709. }
  34710. Ctor.precision += k;
  34711. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  34712. // Reverse argument reduction
  34713. for (var i = k; i--;) {
  34714. var cos2x = x.times(x);
  34715. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  34716. }
  34717. Ctor.precision -= k;
  34718. return x;
  34719. }
  34720. /*
  34721. * Perform division in the specified base.
  34722. */
  34723. var divide = function () {
  34724. // Assumes non-zero x and k, and hence non-zero result.
  34725. function multiplyInteger(x, k, base) {
  34726. var temp,
  34727. carry = 0,
  34728. i = x.length;
  34729. for (x = x.slice(); i--;) {
  34730. temp = x[i] * k + carry;
  34731. x[i] = temp % base | 0;
  34732. carry = temp / base | 0;
  34733. }
  34734. if (carry) x.unshift(carry);
  34735. return x;
  34736. }
  34737. function compare(a, b, aL, bL) {
  34738. var i, r;
  34739. if (aL != bL) {
  34740. r = aL > bL ? 1 : -1;
  34741. } else {
  34742. for (i = r = 0; i < aL; i++) {
  34743. if (a[i] != b[i]) {
  34744. r = a[i] > b[i] ? 1 : -1;
  34745. break;
  34746. }
  34747. }
  34748. }
  34749. return r;
  34750. }
  34751. function subtract(a, b, aL, base) {
  34752. var i = 0;
  34753. // Subtract b from a.
  34754. for (; aL--;) {
  34755. a[aL] -= i;
  34756. i = a[aL] < b[aL] ? 1 : 0;
  34757. a[aL] = i * base + a[aL] - b[aL];
  34758. }
  34759. // Remove leading zeros.
  34760. for (; !a[0] && a.length > 1;) {
  34761. a.shift();
  34762. }
  34763. }
  34764. return function (x, y, pr, rm, dp, base) {
  34765. var cmp,
  34766. e,
  34767. i,
  34768. k,
  34769. logBase,
  34770. more,
  34771. prod,
  34772. prodL,
  34773. q,
  34774. qd,
  34775. rem,
  34776. remL,
  34777. rem0,
  34778. sd,
  34779. t,
  34780. xi,
  34781. xL,
  34782. yd0,
  34783. yL,
  34784. yz,
  34785. Ctor = x.constructor,
  34786. sign = x.s == y.s ? 1 : -1,
  34787. xd = x.d,
  34788. yd = y.d;
  34789. // Either NaN, Infinity or 0?
  34790. if (!xd || !xd[0] || !yd || !yd[0]) {
  34791. return new Ctor( // Return NaN if either NaN, or both Infinity or 0.
  34792. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  34793. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  34794. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  34795. }
  34796. if (base) {
  34797. logBase = 1;
  34798. e = x.e - y.e;
  34799. } else {
  34800. base = BASE;
  34801. logBase = LOG_BASE;
  34802. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  34803. }
  34804. yL = yd.length;
  34805. xL = xd.length;
  34806. q = new Ctor(sign);
  34807. qd = q.d = [];
  34808. // Result exponent may be one less than e.
  34809. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  34810. for (i = 0; yd[i] == (xd[i] || 0); i++) {}
  34811. if (yd[i] > (xd[i] || 0)) e--;
  34812. if (pr == null) {
  34813. sd = pr = Ctor.precision;
  34814. rm = Ctor.rounding;
  34815. } else if (dp) {
  34816. sd = pr + (x.e - y.e) + 1;
  34817. } else {
  34818. sd = pr;
  34819. }
  34820. if (sd < 0) {
  34821. qd.push(1);
  34822. more = true;
  34823. } else {
  34824. // Convert precision in number of base 10 digits to base 1e7 digits.
  34825. sd = sd / logBase + 2 | 0;
  34826. i = 0;
  34827. // divisor < 1e7
  34828. if (yL == 1) {
  34829. k = 0;
  34830. yd = yd[0];
  34831. sd++;
  34832. // k is the carry.
  34833. for (; (i < xL || k) && sd--; i++) {
  34834. t = k * base + (xd[i] || 0);
  34835. qd[i] = t / yd | 0;
  34836. k = t % yd | 0;
  34837. }
  34838. more = k || i < xL;
  34839. // divisor >= 1e7
  34840. } else {
  34841. // Normalise xd and yd so highest order digit of yd is >= base/2
  34842. k = base / (yd[0] + 1) | 0;
  34843. if (k > 1) {
  34844. yd = multiplyInteger(yd, k, base);
  34845. xd = multiplyInteger(xd, k, base);
  34846. yL = yd.length;
  34847. xL = xd.length;
  34848. }
  34849. xi = yL;
  34850. rem = xd.slice(0, yL);
  34851. remL = rem.length;
  34852. // Add zeros to make remainder as long as divisor.
  34853. for (; remL < yL;) {
  34854. rem[remL++] = 0;
  34855. }yz = yd.slice();
  34856. yz.unshift(0);
  34857. yd0 = yd[0];
  34858. if (yd[1] >= base / 2) ++yd0;
  34859. do {
  34860. k = 0;
  34861. // Compare divisor and remainder.
  34862. cmp = compare(yd, rem, yL, remL);
  34863. // If divisor < remainder.
  34864. if (cmp < 0) {
  34865. // Calculate trial digit, k.
  34866. rem0 = rem[0];
  34867. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  34868. // k will be how many times the divisor goes into the current remainder.
  34869. k = rem0 / yd0 | 0;
  34870. // Algorithm:
  34871. // 1. product = divisor * trial digit (k)
  34872. // 2. if product > remainder: product -= divisor, k--
  34873. // 3. remainder -= product
  34874. // 4. if product was < remainder at 2:
  34875. // 5. compare new remainder and divisor
  34876. // 6. If remainder > divisor: remainder -= divisor, k++
  34877. if (k > 1) {
  34878. if (k >= base) k = base - 1;
  34879. // product = divisor * trial digit.
  34880. prod = multiplyInteger(yd, k, base);
  34881. prodL = prod.length;
  34882. remL = rem.length;
  34883. // Compare product and remainder.
  34884. cmp = compare(prod, rem, prodL, remL);
  34885. // product > remainder.
  34886. if (cmp == 1) {
  34887. k--;
  34888. // Subtract divisor from product.
  34889. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  34890. }
  34891. } else {
  34892. // cmp is -1.
  34893. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  34894. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  34895. if (k == 0) cmp = k = 1;
  34896. prod = yd.slice();
  34897. }
  34898. prodL = prod.length;
  34899. if (prodL < remL) prod.unshift(0);
  34900. // Subtract product from remainder.
  34901. subtract(rem, prod, remL, base);
  34902. // If product was < previous remainder.
  34903. if (cmp == -1) {
  34904. remL = rem.length;
  34905. // Compare divisor and new remainder.
  34906. cmp = compare(yd, rem, yL, remL);
  34907. // If divisor < new remainder, subtract divisor from remainder.
  34908. if (cmp < 1) {
  34909. k++;
  34910. // Subtract divisor from remainder.
  34911. subtract(rem, yL < remL ? yz : yd, remL, base);
  34912. }
  34913. }
  34914. remL = rem.length;
  34915. } else if (cmp === 0) {
  34916. k++;
  34917. rem = [0];
  34918. } // if cmp === 1, k will be 0
  34919. // Add the next digit, k, to the result array.
  34920. qd[i++] = k;
  34921. // Update the remainder.
  34922. if (cmp && rem[0]) {
  34923. rem[remL++] = xd[xi] || 0;
  34924. } else {
  34925. rem = [xd[xi]];
  34926. remL = 1;
  34927. }
  34928. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  34929. more = rem[0] !== void 0;
  34930. }
  34931. // Leading zero?
  34932. if (!qd[0]) qd.shift();
  34933. }
  34934. // logBase is 1 when divide is being used for base conversion.
  34935. if (logBase == 1) {
  34936. q.e = e;
  34937. inexact = more;
  34938. } else {
  34939. // To calculate q.e, first get the number of digits of qd[0].
  34940. for (i = 1, k = qd[0]; k >= 10; k /= 10) {
  34941. i++;
  34942. }q.e = i + e * logBase - 1;
  34943. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  34944. }
  34945. return q;
  34946. };
  34947. }();
  34948. /*
  34949. * Round `x` to `sd` significant digits using rounding mode `rm`.
  34950. * Check for over/under-flow.
  34951. */
  34952. function finalise(x, sd, rm, isTruncated) {
  34953. var digits,
  34954. i,
  34955. j,
  34956. k,
  34957. rd,
  34958. roundUp,
  34959. w,
  34960. xd,
  34961. xdi,
  34962. Ctor = x.constructor;
  34963. // Don't round if sd is null or undefined.
  34964. out: if (sd != null) {
  34965. xd = x.d;
  34966. // Infinity/NaN.
  34967. if (!xd) return x;
  34968. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  34969. // w: the word of xd containing rd, a base 1e7 number.
  34970. // xdi: the index of w within xd.
  34971. // digits: the number of digits of w.
  34972. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  34973. // they had leading zeros)
  34974. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  34975. // Get the length of the first word of the digits array xd.
  34976. for (digits = 1, k = xd[0]; k >= 10; k /= 10) {
  34977. digits++;
  34978. }i = sd - digits;
  34979. // Is the rounding digit in the first word of xd?
  34980. if (i < 0) {
  34981. i += LOG_BASE;
  34982. j = sd;
  34983. w = xd[xdi = 0];
  34984. // Get the rounding digit at index j of w.
  34985. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  34986. } else {
  34987. xdi = Math.ceil((i + 1) / LOG_BASE);
  34988. k = xd.length;
  34989. if (xdi >= k) {
  34990. if (isTruncated) {
  34991. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  34992. for (; k++ <= xdi;) {
  34993. xd.push(0);
  34994. }w = rd = 0;
  34995. digits = 1;
  34996. i %= LOG_BASE;
  34997. j = i - LOG_BASE + 1;
  34998. } else {
  34999. break out;
  35000. }
  35001. } else {
  35002. w = k = xd[xdi];
  35003. // Get the number of digits of w.
  35004. for (digits = 1; k >= 10; k /= 10) {
  35005. digits++;
  35006. } // Get the index of rd within w.
  35007. i %= LOG_BASE;
  35008. // Get the index of rd within w, adjusted for leading zeros.
  35009. // The number of leading zeros of w is given by LOG_BASE - digits.
  35010. j = i - LOG_BASE + digits;
  35011. // Get the rounding digit at index j of w.
  35012. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  35013. }
  35014. }
  35015. // Are there any non-zero digits after the rounding digit?
  35016. isTruncated = isTruncated || sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  35017. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  35018. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  35019. // will give 714.
  35020. roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  35021. // Check whether the digit to the left of the rounding digit is odd.
  35022. (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
  35023. if (sd < 1 || !xd[0]) {
  35024. xd.length = 0;
  35025. if (roundUp) {
  35026. // Convert sd to decimal places.
  35027. sd -= x.e + 1;
  35028. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  35029. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  35030. x.e = -sd || 0;
  35031. } else {
  35032. // Zero.
  35033. xd[0] = x.e = 0;
  35034. }
  35035. return x;
  35036. }
  35037. // Remove excess digits.
  35038. if (i == 0) {
  35039. xd.length = xdi;
  35040. k = 1;
  35041. xdi--;
  35042. } else {
  35043. xd.length = xdi + 1;
  35044. k = mathpow(10, LOG_BASE - i);
  35045. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  35046. // j > 0 means i > number of leading zeros of w.
  35047. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  35048. }
  35049. if (roundUp) {
  35050. for (;;) {
  35051. // Is the digit to be rounded up in the first word of xd?
  35052. if (xdi == 0) {
  35053. // i will be the length of xd[0] before k is added.
  35054. for (i = 1, j = xd[0]; j >= 10; j /= 10) {
  35055. i++;
  35056. }j = xd[0] += k;
  35057. for (k = 1; j >= 10; j /= 10) {
  35058. k++;
  35059. } // if i != k the length has increased.
  35060. if (i != k) {
  35061. x.e++;
  35062. if (xd[0] == BASE) xd[0] = 1;
  35063. }
  35064. break;
  35065. } else {
  35066. xd[xdi] += k;
  35067. if (xd[xdi] != BASE) break;
  35068. xd[xdi--] = 0;
  35069. k = 1;
  35070. }
  35071. }
  35072. }
  35073. // Remove trailing zeros.
  35074. for (i = xd.length; xd[--i] === 0;) {
  35075. xd.pop();
  35076. }
  35077. }
  35078. if (external) {
  35079. // Overflow?
  35080. if (x.e > Ctor.maxE) {
  35081. // Infinity.
  35082. x.d = null;
  35083. x.e = NaN;
  35084. // Underflow?
  35085. } else if (x.e < Ctor.minE) {
  35086. // Zero.
  35087. x.e = 0;
  35088. x.d = [0];
  35089. // Ctor.underflow = true;
  35090. } // else Ctor.underflow = false;
  35091. }
  35092. return x;
  35093. }
  35094. function finiteToString(x, isExp, sd) {
  35095. if (!x.isFinite()) return nonFiniteToString(x);
  35096. var k,
  35097. e = x.e,
  35098. str = digitsToString(x.d),
  35099. len = str.length;
  35100. if (isExp) {
  35101. if (sd && (k = sd - len) > 0) {
  35102. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  35103. } else if (len > 1) {
  35104. str = str.charAt(0) + '.' + str.slice(1);
  35105. }
  35106. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  35107. } else if (e < 0) {
  35108. str = '0.' + getZeroString(-e - 1) + str;
  35109. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  35110. } else if (e >= len) {
  35111. str += getZeroString(e + 1 - len);
  35112. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  35113. } else {
  35114. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  35115. if (sd && (k = sd - len) > 0) {
  35116. if (e + 1 === len) str += '.';
  35117. str += getZeroString(k);
  35118. }
  35119. }
  35120. return str;
  35121. }
  35122. // Calculate the base 10 exponent from the base 1e7 exponent.
  35123. function getBase10Exponent(digits, e) {
  35124. var w = digits[0];
  35125. // Add the number of digits of the first word of the digits array.
  35126. for (e *= LOG_BASE; w >= 10; w /= 10) {
  35127. e++;
  35128. }return e;
  35129. }
  35130. function getLn10(Ctor, sd, pr) {
  35131. if (sd > LN10_PRECISION) {
  35132. // Reset global state in case the exception is caught.
  35133. external = true;
  35134. if (pr) Ctor.precision = pr;
  35135. throw Error(precisionLimitExceeded);
  35136. }
  35137. return finalise(new Ctor(LN10), sd, 1, true);
  35138. }
  35139. function getPi(Ctor, sd, rm) {
  35140. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  35141. return finalise(new Ctor(PI), sd, rm, true);
  35142. }
  35143. function getPrecision(digits) {
  35144. var w = digits.length - 1,
  35145. len = w * LOG_BASE + 1;
  35146. w = digits[w];
  35147. // If non-zero...
  35148. if (w) {
  35149. // Subtract the number of trailing zeros of the last word.
  35150. for (; w % 10 == 0; w /= 10) {
  35151. len--;
  35152. } // Add the number of digits of the first word.
  35153. for (w = digits[0]; w >= 10; w /= 10) {
  35154. len++;
  35155. }
  35156. }
  35157. return len;
  35158. }
  35159. function getZeroString(k) {
  35160. var zs = '';
  35161. for (; k--;) {
  35162. zs += '0';
  35163. }return zs;
  35164. }
  35165. /*
  35166. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  35167. * integer of type number.
  35168. *
  35169. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  35170. *
  35171. */
  35172. function intPow(Ctor, x, n, pr) {
  35173. var isTruncated,
  35174. r = new Ctor(1),
  35175. // Max n of 9007199254740991 takes 53 loop iterations.
  35176. // Maximum digits array length; leaves [28, 34] guard digits.
  35177. k = Math.ceil(pr / LOG_BASE + 4);
  35178. external = false;
  35179. for (;;) {
  35180. if (n % 2) {
  35181. r = r.times(x);
  35182. if (truncate(r.d, k)) isTruncated = true;
  35183. }
  35184. n = mathfloor(n / 2);
  35185. if (n === 0) {
  35186. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  35187. n = r.d.length - 1;
  35188. if (isTruncated && r.d[n] === 0) ++r.d[n];
  35189. break;
  35190. }
  35191. x = x.times(x);
  35192. truncate(x.d, k);
  35193. }
  35194. external = true;
  35195. return r;
  35196. }
  35197. function isOdd(n) {
  35198. return n.d[n.d.length - 1] & 1;
  35199. }
  35200. /*
  35201. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  35202. */
  35203. function maxOrMin(Ctor, args, ltgt) {
  35204. var y,
  35205. x = new Ctor(args[0]),
  35206. i = 0;
  35207. for (; ++i < args.length;) {
  35208. y = new Ctor(args[i]);
  35209. if (!y.s) {
  35210. x = y;
  35211. break;
  35212. } else if (x[ltgt](y)) {
  35213. x = y;
  35214. }
  35215. }
  35216. return x;
  35217. }
  35218. /*
  35219. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  35220. * digits.
  35221. *
  35222. * Taylor/Maclaurin series.
  35223. *
  35224. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  35225. *
  35226. * Argument reduction:
  35227. * Repeat x = x / 32, k += 5, until |x| < 0.1
  35228. * exp(x) = exp(x / 2^k)^(2^k)
  35229. *
  35230. * Previously, the argument was initially reduced by
  35231. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  35232. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  35233. * found to be slower than just dividing repeatedly by 32 as above.
  35234. *
  35235. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  35236. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  35237. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  35238. *
  35239. * exp(Infinity) = Infinity
  35240. * exp(-Infinity) = 0
  35241. * exp(NaN) = NaN
  35242. * exp(±0) = 1
  35243. *
  35244. * exp(x) is non-terminating for any finite, non-zero x.
  35245. *
  35246. * The result will always be correctly rounded.
  35247. *
  35248. */
  35249. function naturalExponential(x, sd) {
  35250. var denominator,
  35251. guard,
  35252. j,
  35253. pow,
  35254. sum,
  35255. t,
  35256. wpr,
  35257. rep = 0,
  35258. i = 0,
  35259. k = 0,
  35260. Ctor = x.constructor,
  35261. rm = Ctor.rounding,
  35262. pr = Ctor.precision;
  35263. // 0/NaN/Infinity?
  35264. if (!x.d || !x.d[0] || x.e > 17) {
  35265. return new Ctor(x.d ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0 : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  35266. }
  35267. if (sd == null) {
  35268. external = false;
  35269. wpr = pr;
  35270. } else {
  35271. wpr = sd;
  35272. }
  35273. t = new Ctor(0.03125);
  35274. // while abs(x) >= 0.1
  35275. while (x.e > -2) {
  35276. // x = x / 2^5
  35277. x = x.times(t);
  35278. k += 5;
  35279. }
  35280. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  35281. // necessary to ensure the first 4 rounding digits are correct.
  35282. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  35283. wpr += guard;
  35284. denominator = pow = sum = new Ctor(1);
  35285. Ctor.precision = wpr;
  35286. for (;;) {
  35287. pow = finalise(pow.times(x), wpr, 1);
  35288. denominator = denominator.times(++i);
  35289. t = sum.plus(divide(pow, denominator, wpr, 1));
  35290. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35291. j = k;
  35292. while (j--) {
  35293. sum = finalise(sum.times(sum), wpr, 1);
  35294. } // Check to see if the first 4 rounding digits are [49]999.
  35295. // If so, repeat the summation with a higher precision, otherwise
  35296. // e.g. with precision: 18, rounding: 1
  35297. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  35298. // `wpr - guard` is the index of first rounding digit.
  35299. if (sd == null) {
  35300. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35301. Ctor.precision = wpr += 10;
  35302. denominator = pow = t = new Ctor(1);
  35303. i = 0;
  35304. rep++;
  35305. } else {
  35306. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35307. }
  35308. } else {
  35309. Ctor.precision = pr;
  35310. return sum;
  35311. }
  35312. }
  35313. sum = t;
  35314. }
  35315. }
  35316. /*
  35317. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  35318. * digits.
  35319. *
  35320. * ln(-n) = NaN
  35321. * ln(0) = -Infinity
  35322. * ln(-0) = -Infinity
  35323. * ln(1) = 0
  35324. * ln(Infinity) = Infinity
  35325. * ln(-Infinity) = NaN
  35326. * ln(NaN) = NaN
  35327. *
  35328. * ln(n) (n != 1) is non-terminating.
  35329. *
  35330. */
  35331. function naturalLogarithm(y, sd) {
  35332. var c,
  35333. c0,
  35334. denominator,
  35335. e,
  35336. numerator,
  35337. rep,
  35338. sum,
  35339. t,
  35340. wpr,
  35341. x1,
  35342. x2,
  35343. n = 1,
  35344. guard = 10,
  35345. x = y,
  35346. xd = x.d,
  35347. Ctor = x.constructor,
  35348. rm = Ctor.rounding,
  35349. pr = Ctor.precision;
  35350. // Is x negative or Infinity, NaN, 0 or 1?
  35351. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  35352. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  35353. }
  35354. if (sd == null) {
  35355. external = false;
  35356. wpr = pr;
  35357. } else {
  35358. wpr = sd;
  35359. }
  35360. Ctor.precision = wpr += guard;
  35361. c = digitsToString(xd);
  35362. c0 = c.charAt(0);
  35363. if (Math.abs(e = x.e) < 1.5e15) {
  35364. // Argument reduction.
  35365. // The series converges faster the closer the argument is to 1, so using
  35366. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  35367. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  35368. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  35369. // later be divided by this number, then separate out the power of 10 using
  35370. // ln(a*10^b) = ln(a) + b*ln(10).
  35371. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  35372. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  35373. // max n is 6 (gives 0.7 - 1.3)
  35374. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  35375. x = x.times(y);
  35376. c = digitsToString(x.d);
  35377. c0 = c.charAt(0);
  35378. n++;
  35379. }
  35380. e = x.e;
  35381. if (c0 > 1) {
  35382. x = new Ctor('0.' + c);
  35383. e++;
  35384. } else {
  35385. x = new Ctor(c0 + '.' + c.slice(1));
  35386. }
  35387. } else {
  35388. // The argument reduction method above may result in overflow if the argument y is a massive
  35389. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  35390. // function using ln(x*10^e) = ln(x) + e*ln(10).
  35391. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  35392. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  35393. Ctor.precision = pr;
  35394. return sd == null ? finalise(x, pr, rm, external = true) : x;
  35395. }
  35396. // x1 is x reduced to a value near 1.
  35397. x1 = x;
  35398. // Taylor series.
  35399. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  35400. // where x = (y - 1)/(y + 1) (|x| < 1)
  35401. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  35402. x2 = finalise(x.times(x), wpr, 1);
  35403. denominator = 3;
  35404. for (;;) {
  35405. numerator = finalise(numerator.times(x2), wpr, 1);
  35406. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  35407. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  35408. sum = sum.times(2);
  35409. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  35410. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  35411. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  35412. sum = divide(sum, new Ctor(n), wpr, 1);
  35413. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  35414. // been repeated previously) and the first 4 rounding digits 9999?
  35415. // If so, restart the summation with a higher precision, otherwise
  35416. // e.g. with precision: 12, rounding: 1
  35417. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  35418. // `wpr - guard` is the index of first rounding digit.
  35419. if (sd == null) {
  35420. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  35421. Ctor.precision = wpr += guard;
  35422. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  35423. x2 = finalise(x.times(x), wpr, 1);
  35424. denominator = rep = 1;
  35425. } else {
  35426. return finalise(sum, Ctor.precision = pr, rm, external = true);
  35427. }
  35428. } else {
  35429. Ctor.precision = pr;
  35430. return sum;
  35431. }
  35432. }
  35433. sum = t;
  35434. denominator += 2;
  35435. }
  35436. }
  35437. // ±Infinity, NaN.
  35438. function nonFiniteToString(x) {
  35439. // Unsigned.
  35440. return String(x.s * x.s / 0);
  35441. }
  35442. /*
  35443. * Parse the value of a new Decimal `x` from string `str`.
  35444. */
  35445. function parseDecimal(x, str) {
  35446. var e, i, len;
  35447. // Decimal point?
  35448. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  35449. // Exponential form?
  35450. if ((i = str.search(/e/i)) > 0) {
  35451. // Determine exponent.
  35452. if (e < 0) e = i;
  35453. e += +str.slice(i + 1);
  35454. str = str.substring(0, i);
  35455. } else if (e < 0) {
  35456. // Integer.
  35457. e = str.length;
  35458. }
  35459. // Determine leading zeros.
  35460. for (i = 0; str.charCodeAt(i) === 48; i++) {}
  35461. // Determine trailing zeros.
  35462. for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {}
  35463. str = str.slice(i, len);
  35464. if (str) {
  35465. len -= i;
  35466. x.e = e = e - i - 1;
  35467. x.d = [];
  35468. // Transform base
  35469. // e is the base 10 exponent.
  35470. // i is where to slice str to get the first word of the digits array.
  35471. i = (e + 1) % LOG_BASE;
  35472. if (e < 0) i += LOG_BASE;
  35473. if (i < len) {
  35474. if (i) x.d.push(+str.slice(0, i));
  35475. for (len -= LOG_BASE; i < len;) {
  35476. x.d.push(+str.slice(i, i += LOG_BASE));
  35477. }str = str.slice(i);
  35478. i = LOG_BASE - str.length;
  35479. } else {
  35480. i -= len;
  35481. }
  35482. for (; i--;) {
  35483. str += '0';
  35484. }x.d.push(+str);
  35485. if (external) {
  35486. // Overflow?
  35487. if (x.e > x.constructor.maxE) {
  35488. // Infinity.
  35489. x.d = null;
  35490. x.e = NaN;
  35491. // Underflow?
  35492. } else if (x.e < x.constructor.minE) {
  35493. // Zero.
  35494. x.e = 0;
  35495. x.d = [0];
  35496. // x.constructor.underflow = true;
  35497. } // else x.constructor.underflow = false;
  35498. }
  35499. } else {
  35500. // Zero.
  35501. x.e = 0;
  35502. x.d = [0];
  35503. }
  35504. return x;
  35505. }
  35506. /*
  35507. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  35508. */
  35509. function parseOther(x, str) {
  35510. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  35511. if (str === 'Infinity' || str === 'NaN') {
  35512. if (!+str) x.s = NaN;
  35513. x.e = NaN;
  35514. x.d = null;
  35515. return x;
  35516. }
  35517. if (isHex.test(str)) {
  35518. base = 16;
  35519. str = str.toLowerCase();
  35520. } else if (isBinary.test(str)) {
  35521. base = 2;
  35522. } else if (isOctal.test(str)) {
  35523. base = 8;
  35524. } else {
  35525. throw Error(invalidArgument + str);
  35526. }
  35527. // Is there a binary exponent part?
  35528. i = str.search(/p/i);
  35529. if (i > 0) {
  35530. p = +str.slice(i + 1);
  35531. str = str.substring(2, i);
  35532. } else {
  35533. str = str.slice(2);
  35534. }
  35535. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  35536. // fraction part will be restored.
  35537. i = str.indexOf('.');
  35538. isFloat = i >= 0;
  35539. Ctor = x.constructor;
  35540. if (isFloat) {
  35541. str = str.replace('.', '');
  35542. len = str.length;
  35543. i = len - i;
  35544. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  35545. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  35546. }
  35547. xd = convertBase(str, base, BASE);
  35548. xe = xd.length - 1;
  35549. // Remove trailing zeros.
  35550. for (i = xe; xd[i] === 0; --i) {
  35551. xd.pop();
  35552. }if (i < 0) return new Ctor(x.s * 0);
  35553. x.e = getBase10Exponent(xd, xe);
  35554. x.d = xd;
  35555. external = false;
  35556. // At what precision to perform the division to ensure exact conversion?
  35557. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  35558. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  35559. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  35560. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  35561. // Therefore using 4 * the number of digits of str will always be enough.
  35562. if (isFloat) x = divide(x, divisor, len * 4);
  35563. // Multiply by the binary exponent part if present.
  35564. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  35565. external = true;
  35566. return x;
  35567. }
  35568. /*
  35569. * sin(x) = x - x^3/3! + x^5/5! - ...
  35570. * |x| < pi/2
  35571. *
  35572. */
  35573. function sine(Ctor, x) {
  35574. var k,
  35575. len = x.d.length;
  35576. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  35577. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  35578. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  35579. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  35580. // Estimate the optimum number of times to use the argument reduction.
  35581. k = 1.4 * Math.sqrt(len);
  35582. k = k > 16 ? 16 : k | 0;
  35583. // Max k before Math.pow precision loss is 22
  35584. x = x.times(Math.pow(5, -k));
  35585. x = taylorSeries(Ctor, 2, x, x);
  35586. // Reverse argument reduction
  35587. var sin2_x,
  35588. d5 = new Ctor(5),
  35589. d16 = new Ctor(16),
  35590. d20 = new Ctor(20);
  35591. for (; k--;) {
  35592. sin2_x = x.times(x);
  35593. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  35594. }
  35595. return x;
  35596. }
  35597. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  35598. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  35599. var j,
  35600. t,
  35601. u,
  35602. x2,
  35603. i = 1,
  35604. pr = Ctor.precision,
  35605. k = Math.ceil(pr / LOG_BASE);
  35606. external = false;
  35607. x2 = x.times(x);
  35608. u = new Ctor(y);
  35609. for (;;) {
  35610. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  35611. u = isHyperbolic ? y.plus(t) : y.minus(t);
  35612. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  35613. t = u.plus(y);
  35614. if (t.d[k] !== void 0) {
  35615. for (j = k; t.d[j] === u.d[j] && j--;) {}
  35616. if (j == -1) break;
  35617. }
  35618. j = u;
  35619. u = y;
  35620. y = t;
  35621. t = j;
  35622. i++;
  35623. }
  35624. external = true;
  35625. t.d.length = k + 1;
  35626. return t;
  35627. }
  35628. // Return the absolute value of `x` reduced to less than or equal to half pi.
  35629. function toLessThanHalfPi(Ctor, x) {
  35630. var t,
  35631. isNeg = x.s < 0,
  35632. pi = getPi(Ctor, Ctor.precision, 1),
  35633. halfPi = pi.times(0.5);
  35634. x = x.abs();
  35635. if (x.lte(halfPi)) {
  35636. quadrant = isNeg ? 4 : 1;
  35637. return x;
  35638. }
  35639. t = x.divToInt(pi);
  35640. if (t.isZero()) {
  35641. quadrant = isNeg ? 3 : 2;
  35642. } else {
  35643. x = x.minus(t.times(pi));
  35644. // 0 <= x < pi
  35645. if (x.lte(halfPi)) {
  35646. quadrant = isOdd(t) ? isNeg ? 2 : 3 : isNeg ? 4 : 1;
  35647. return x;
  35648. }
  35649. quadrant = isOdd(t) ? isNeg ? 1 : 4 : isNeg ? 3 : 2;
  35650. }
  35651. return x.minus(pi).abs();
  35652. }
  35653. /*
  35654. * Return the value of Decimal `x` as a string in base `baseOut`.
  35655. *
  35656. * If the optional `sd` argument is present include a binary exponent suffix.
  35657. */
  35658. function toStringBinary(x, baseOut, sd, rm) {
  35659. var base,
  35660. e,
  35661. i,
  35662. k,
  35663. len,
  35664. roundUp,
  35665. str,
  35666. xd,
  35667. y,
  35668. Ctor = x.constructor,
  35669. isExp = sd !== void 0;
  35670. if (isExp) {
  35671. checkInt32(sd, 1, MAX_DIGITS);
  35672. if (rm === void 0) rm = Ctor.rounding;else checkInt32(rm, 0, 8);
  35673. } else {
  35674. sd = Ctor.precision;
  35675. rm = Ctor.rounding;
  35676. }
  35677. if (!x.isFinite()) {
  35678. str = nonFiniteToString(x);
  35679. } else {
  35680. str = finiteToString(x);
  35681. i = str.indexOf('.');
  35682. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  35683. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  35684. // minBinaryExponent = floor(decimalExponent * log[2](10))
  35685. // log[2](10) = 3.321928094887362347870319429489390175864
  35686. if (isExp) {
  35687. base = 2;
  35688. if (baseOut == 16) {
  35689. sd = sd * 4 - 3;
  35690. } else if (baseOut == 8) {
  35691. sd = sd * 3 - 2;
  35692. }
  35693. } else {
  35694. base = baseOut;
  35695. }
  35696. // Convert the number as an integer then divide the result by its base raised to a power such
  35697. // that the fraction part will be restored.
  35698. // Non-integer.
  35699. if (i >= 0) {
  35700. str = str.replace('.', '');
  35701. y = new Ctor(1);
  35702. y.e = str.length - i;
  35703. y.d = convertBase(finiteToString(y), 10, base);
  35704. y.e = y.d.length;
  35705. }
  35706. xd = convertBase(str, 10, base);
  35707. e = len = xd.length;
  35708. // Remove trailing zeros.
  35709. for (; xd[--len] == 0;) {
  35710. xd.pop();
  35711. }if (!xd[0]) {
  35712. str = isExp ? '0p+0' : '0';
  35713. } else {
  35714. if (i < 0) {
  35715. e--;
  35716. } else {
  35717. x = new Ctor(x);
  35718. x.d = xd;
  35719. x.e = e;
  35720. x = divide(x, y, sd, rm, 0, base);
  35721. xd = x.d;
  35722. e = x.e;
  35723. roundUp = inexact;
  35724. }
  35725. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  35726. i = xd[sd];
  35727. k = base / 2;
  35728. roundUp = roundUp || xd[sd + 1] !== void 0;
  35729. 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));
  35730. xd.length = sd;
  35731. if (roundUp) {
  35732. // Rounding up may mean the previous digit has to be rounded up and so on.
  35733. for (; ++xd[--sd] > base - 1;) {
  35734. xd[sd] = 0;
  35735. if (!sd) {
  35736. ++e;
  35737. xd.unshift(1);
  35738. }
  35739. }
  35740. }
  35741. // Determine trailing zeros.
  35742. for (len = xd.length; !xd[len - 1]; --len) {}
  35743. // E.g. [4, 11, 15] becomes 4bf.
  35744. for (i = 0, str = ''; i < len; i++) {
  35745. str += NUMERALS.charAt(xd[i]);
  35746. } // Add binary exponent suffix?
  35747. if (isExp) {
  35748. if (len > 1) {
  35749. if (baseOut == 16 || baseOut == 8) {
  35750. i = baseOut == 16 ? 4 : 3;
  35751. for (--len; len % i; len++) {
  35752. str += '0';
  35753. }xd = convertBase(str, base, baseOut);
  35754. for (len = xd.length; !xd[len - 1]; --len) {}
  35755. // xd[0] will always be be 1
  35756. for (i = 1, str = '1.'; i < len; i++) {
  35757. str += NUMERALS.charAt(xd[i]);
  35758. }
  35759. } else {
  35760. str = str.charAt(0) + '.' + str.slice(1);
  35761. }
  35762. }
  35763. str = str + (e < 0 ? 'p' : 'p+') + e;
  35764. } else if (e < 0) {
  35765. for (; ++e;) {
  35766. str = '0' + str;
  35767. }str = '0.' + str;
  35768. } else {
  35769. if (++e > len) for (e -= len; e--;) {
  35770. str += '0';
  35771. } else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  35772. }
  35773. }
  35774. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  35775. }
  35776. return x.s < 0 ? '-' + str : str;
  35777. }
  35778. // Does not strip trailing zeros.
  35779. function truncate(arr, len) {
  35780. if (arr.length > len) {
  35781. arr.length = len;
  35782. return true;
  35783. }
  35784. }
  35785. // Decimal methods
  35786. /*
  35787. * abs
  35788. * acos
  35789. * acosh
  35790. * add
  35791. * asin
  35792. * asinh
  35793. * atan
  35794. * atanh
  35795. * atan2
  35796. * cbrt
  35797. * ceil
  35798. * clone
  35799. * config
  35800. * cos
  35801. * cosh
  35802. * div
  35803. * exp
  35804. * floor
  35805. * hypot
  35806. * ln
  35807. * log
  35808. * log2
  35809. * log10
  35810. * max
  35811. * min
  35812. * mod
  35813. * mul
  35814. * pow
  35815. * random
  35816. * round
  35817. * set
  35818. * sign
  35819. * sin
  35820. * sinh
  35821. * sqrt
  35822. * sub
  35823. * tan
  35824. * tanh
  35825. * trunc
  35826. */
  35827. /*
  35828. * Return a new Decimal whose value is the absolute value of `x`.
  35829. *
  35830. * x {number|string|Decimal}
  35831. *
  35832. */
  35833. function abs(x) {
  35834. return new this(x).abs();
  35835. }
  35836. /*
  35837. * Return a new Decimal whose value is the arccosine in radians of `x`.
  35838. *
  35839. * x {number|string|Decimal}
  35840. *
  35841. */
  35842. function acos(x) {
  35843. return new this(x).acos();
  35844. }
  35845. /*
  35846. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  35847. * `precision` significant digits using rounding mode `rounding`.
  35848. *
  35849. * x {number|string|Decimal} A value in radians.
  35850. *
  35851. */
  35852. function acosh(x) {
  35853. return new this(x).acosh();
  35854. }
  35855. /*
  35856. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  35857. * digits using rounding mode `rounding`.
  35858. *
  35859. * x {number|string|Decimal}
  35860. * y {number|string|Decimal}
  35861. *
  35862. */
  35863. function add(x, y) {
  35864. return new this(x).plus(y);
  35865. }
  35866. /*
  35867. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  35868. * significant digits using rounding mode `rounding`.
  35869. *
  35870. * x {number|string|Decimal}
  35871. *
  35872. */
  35873. function asin(x) {
  35874. return new this(x).asin();
  35875. }
  35876. /*
  35877. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  35878. * `precision` significant digits using rounding mode `rounding`.
  35879. *
  35880. * x {number|string|Decimal} A value in radians.
  35881. *
  35882. */
  35883. function asinh(x) {
  35884. return new this(x).asinh();
  35885. }
  35886. /*
  35887. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  35888. * significant digits using rounding mode `rounding`.
  35889. *
  35890. * x {number|string|Decimal}
  35891. *
  35892. */
  35893. function atan(x) {
  35894. return new this(x).atan();
  35895. }
  35896. /*
  35897. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  35898. * `precision` significant digits using rounding mode `rounding`.
  35899. *
  35900. * x {number|string|Decimal} A value in radians.
  35901. *
  35902. */
  35903. function atanh(x) {
  35904. return new this(x).atanh();
  35905. }
  35906. /*
  35907. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  35908. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  35909. *
  35910. * Domain: [-Infinity, Infinity]
  35911. * Range: [-pi, pi]
  35912. *
  35913. * y {number|string|Decimal} The y-coordinate.
  35914. * x {number|string|Decimal} The x-coordinate.
  35915. *
  35916. * atan2(±0, -0) = ±pi
  35917. * atan2(±0, +0) = ±0
  35918. * atan2(±0, -x) = ±pi for x > 0
  35919. * atan2(±0, x) = ±0 for x > 0
  35920. * atan2(-y, ±0) = -pi/2 for y > 0
  35921. * atan2(y, ±0) = pi/2 for y > 0
  35922. * atan2(±y, -Infinity) = ±pi for finite y > 0
  35923. * atan2(±y, +Infinity) = ±0 for finite y > 0
  35924. * atan2(±Infinity, x) = ±pi/2 for finite x
  35925. * atan2(±Infinity, -Infinity) = ±3*pi/4
  35926. * atan2(±Infinity, +Infinity) = ±pi/4
  35927. * atan2(NaN, x) = NaN
  35928. * atan2(y, NaN) = NaN
  35929. *
  35930. */
  35931. function atan2(y, x) {
  35932. y = new this(y);
  35933. x = new this(x);
  35934. var r,
  35935. pr = this.precision,
  35936. rm = this.rounding,
  35937. wpr = pr + 4;
  35938. // Either NaN
  35939. if (!y.s || !x.s) {
  35940. r = new this(NaN);
  35941. // Both ±Infinity
  35942. } else if (!y.d && !x.d) {
  35943. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  35944. r.s = y.s;
  35945. // x is ±Infinity or y is ±0
  35946. } else if (!x.d || y.isZero()) {
  35947. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  35948. r.s = y.s;
  35949. // y is ±Infinity or x is ±0
  35950. } else if (!y.d || x.isZero()) {
  35951. r = getPi(this, wpr, 1).times(0.5);
  35952. r.s = y.s;
  35953. // Both non-zero and finite
  35954. } else if (x.s < 0) {
  35955. this.precision = wpr;
  35956. this.rounding = 1;
  35957. r = this.atan(divide(y, x, wpr, 1));
  35958. x = getPi(this, wpr, 1);
  35959. this.precision = pr;
  35960. this.rounding = rm;
  35961. r = y.s < 0 ? r.minus(x) : r.plus(x);
  35962. } else {
  35963. r = this.atan(divide(y, x, wpr, 1));
  35964. }
  35965. return r;
  35966. }
  35967. /*
  35968. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  35969. * digits using rounding mode `rounding`.
  35970. *
  35971. * x {number|string|Decimal}
  35972. *
  35973. */
  35974. function cbrt(x) {
  35975. return new this(x).cbrt();
  35976. }
  35977. /*
  35978. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  35979. *
  35980. * x {number|string|Decimal}
  35981. *
  35982. */
  35983. function ceil(x) {
  35984. return finalise(x = new this(x), x.e + 1, 2);
  35985. }
  35986. /*
  35987. * Configure global settings for a Decimal constructor.
  35988. *
  35989. * `obj` is an object with one or more of the following properties,
  35990. *
  35991. * precision {number}
  35992. * rounding {number}
  35993. * toExpNeg {number}
  35994. * toExpPos {number}
  35995. * maxE {number}
  35996. * minE {number}
  35997. * modulo {number}
  35998. * crypto {boolean|number}
  35999. * defaults {true}
  36000. *
  36001. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  36002. *
  36003. */
  36004. function config(obj) {
  36005. if (!obj || (typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) !== 'object') throw Error(decimalError + 'Object expected');
  36006. var i,
  36007. p,
  36008. v,
  36009. useDefaults = obj.defaults === true,
  36010. 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];
  36011. for (i = 0; i < ps.length; i += 3) {
  36012. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  36013. if ((v = obj[p]) !== void 0) {
  36014. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;else throw Error(invalidArgument + p + ': ' + v);
  36015. }
  36016. }
  36017. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  36018. if ((v = obj[p]) !== void 0) {
  36019. if (v === true || v === false || v === 0 || v === 1) {
  36020. if (v) {
  36021. if (typeof crypto != 'undefined' && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
  36022. this[p] = true;
  36023. } else {
  36024. throw Error(cryptoUnavailable);
  36025. }
  36026. } else {
  36027. this[p] = false;
  36028. }
  36029. } else {
  36030. throw Error(invalidArgument + p + ': ' + v);
  36031. }
  36032. }
  36033. return this;
  36034. }
  36035. /*
  36036. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  36037. * digits using rounding mode `rounding`.
  36038. *
  36039. * x {number|string|Decimal} A value in radians.
  36040. *
  36041. */
  36042. function cos(x) {
  36043. return new this(x).cos();
  36044. }
  36045. /*
  36046. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  36047. * significant digits using rounding mode `rounding`.
  36048. *
  36049. * x {number|string|Decimal} A value in radians.
  36050. *
  36051. */
  36052. function cosh(x) {
  36053. return new this(x).cosh();
  36054. }
  36055. /*
  36056. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  36057. * constructor.
  36058. *
  36059. */
  36060. function clone(obj) {
  36061. var i, p, ps;
  36062. /*
  36063. * The Decimal constructor and exported function.
  36064. * Return a new Decimal instance.
  36065. *
  36066. * v {number|string|Decimal} A numeric value.
  36067. *
  36068. */
  36069. function Decimal(v) {
  36070. var e,
  36071. i,
  36072. t,
  36073. x = this;
  36074. // Decimal called without new.
  36075. if (!(x instanceof Decimal)) return new Decimal(v);
  36076. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  36077. // which points to Object.
  36078. x.constructor = Decimal;
  36079. // Duplicate.
  36080. if (v instanceof Decimal) {
  36081. x.s = v.s;
  36082. x.e = v.e;
  36083. x.d = (v = v.d) ? v.slice() : v;
  36084. return;
  36085. }
  36086. t = typeof v === 'undefined' ? 'undefined' : _typeof(v);
  36087. if (t === 'number') {
  36088. if (v === 0) {
  36089. x.s = 1 / v < 0 ? -1 : 1;
  36090. x.e = 0;
  36091. x.d = [0];
  36092. return;
  36093. }
  36094. if (v < 0) {
  36095. v = -v;
  36096. x.s = -1;
  36097. } else {
  36098. x.s = 1;
  36099. }
  36100. // Fast path for small integers.
  36101. if (v === ~~v && v < 1e7) {
  36102. for (e = 0, i = v; i >= 10; i /= 10) {
  36103. e++;
  36104. }x.e = e;
  36105. x.d = [v];
  36106. return;
  36107. // Infinity, NaN.
  36108. } else if (v * 0 !== 0) {
  36109. if (!v) x.s = NaN;
  36110. x.e = NaN;
  36111. x.d = null;
  36112. return;
  36113. }
  36114. return parseDecimal(x, v.toString());
  36115. } else if (t !== 'string') {
  36116. throw Error(invalidArgument + v);
  36117. }
  36118. // Minus sign?
  36119. if (v.charCodeAt(0) === 45) {
  36120. v = v.slice(1);
  36121. x.s = -1;
  36122. } else {
  36123. x.s = 1;
  36124. }
  36125. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  36126. }
  36127. Decimal.prototype = P;
  36128. Decimal.ROUND_UP = 0;
  36129. Decimal.ROUND_DOWN = 1;
  36130. Decimal.ROUND_CEIL = 2;
  36131. Decimal.ROUND_FLOOR = 3;
  36132. Decimal.ROUND_HALF_UP = 4;
  36133. Decimal.ROUND_HALF_DOWN = 5;
  36134. Decimal.ROUND_HALF_EVEN = 6;
  36135. Decimal.ROUND_HALF_CEIL = 7;
  36136. Decimal.ROUND_HALF_FLOOR = 8;
  36137. Decimal.EUCLID = 9;
  36138. Decimal.config = Decimal.set = config;
  36139. Decimal.clone = clone;
  36140. Decimal.isDecimal = isDecimalInstance;
  36141. Decimal.abs = abs;
  36142. Decimal.acos = acos;
  36143. Decimal.acosh = acosh; // ES6
  36144. Decimal.add = add;
  36145. Decimal.asin = asin;
  36146. Decimal.asinh = asinh; // ES6
  36147. Decimal.atan = atan;
  36148. Decimal.atanh = atanh; // ES6
  36149. Decimal.atan2 = atan2;
  36150. Decimal.cbrt = cbrt; // ES6
  36151. Decimal.ceil = ceil;
  36152. Decimal.cos = cos;
  36153. Decimal.cosh = cosh; // ES6
  36154. Decimal.div = div;
  36155. Decimal.exp = exp;
  36156. Decimal.floor = floor;
  36157. Decimal.hypot = hypot; // ES6
  36158. Decimal.ln = ln;
  36159. Decimal.log = log;
  36160. Decimal.log10 = log10; // ES6
  36161. Decimal.log2 = log2; // ES6
  36162. Decimal.max = max;
  36163. Decimal.min = min;
  36164. Decimal.mod = mod;
  36165. Decimal.mul = mul;
  36166. Decimal.pow = pow;
  36167. Decimal.random = random;
  36168. Decimal.round = round;
  36169. Decimal.sign = sign; // ES6
  36170. Decimal.sin = sin;
  36171. Decimal.sinh = sinh; // ES6
  36172. Decimal.sqrt = sqrt;
  36173. Decimal.sub = sub;
  36174. Decimal.tan = tan;
  36175. Decimal.tanh = tanh; // ES6
  36176. Decimal.trunc = trunc; // ES6
  36177. if (obj === void 0) obj = {};
  36178. if (obj) {
  36179. if (obj.defaults !== true) {
  36180. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  36181. for (i = 0; i < ps.length;) {
  36182. if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  36183. }
  36184. }
  36185. }
  36186. Decimal.config(obj);
  36187. return Decimal;
  36188. }
  36189. /*
  36190. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  36191. * digits using rounding mode `rounding`.
  36192. *
  36193. * x {number|string|Decimal}
  36194. * y {number|string|Decimal}
  36195. *
  36196. */
  36197. function div(x, y) {
  36198. return new this(x).div(y);
  36199. }
  36200. /*
  36201. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  36202. * significant digits using rounding mode `rounding`.
  36203. *
  36204. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  36205. *
  36206. */
  36207. function exp(x) {
  36208. return new this(x).exp();
  36209. }
  36210. /*
  36211. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  36212. *
  36213. * x {number|string|Decimal}
  36214. *
  36215. */
  36216. function floor(x) {
  36217. return finalise(x = new this(x), x.e + 1, 3);
  36218. }
  36219. /*
  36220. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  36221. * rounded to `precision` significant digits using rounding mode `rounding`.
  36222. *
  36223. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  36224. *
  36225. */
  36226. function hypot() {
  36227. var i,
  36228. n,
  36229. t = new this(0);
  36230. external = false;
  36231. for (i = 0; i < arguments.length;) {
  36232. n = new this(arguments[i++]);
  36233. if (!n.d) {
  36234. if (n.s) {
  36235. external = true;
  36236. return new this(1 / 0);
  36237. }
  36238. t = n;
  36239. } else if (t.d) {
  36240. t = t.plus(n.times(n));
  36241. }
  36242. }
  36243. external = true;
  36244. return t.sqrt();
  36245. }
  36246. /*
  36247. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  36248. * otherwise return false.
  36249. *
  36250. */
  36251. function isDecimalInstance(obj) {
  36252. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  36253. }
  36254. /*
  36255. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  36256. * significant digits using rounding mode `rounding`.
  36257. *
  36258. * x {number|string|Decimal}
  36259. *
  36260. */
  36261. function ln(x) {
  36262. return new this(x).ln();
  36263. }
  36264. /*
  36265. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  36266. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  36267. *
  36268. * log[y](x)
  36269. *
  36270. * x {number|string|Decimal} The argument of the logarithm.
  36271. * y {number|string|Decimal} The base of the logarithm.
  36272. *
  36273. */
  36274. function log(x, y) {
  36275. return new this(x).log(y);
  36276. }
  36277. /*
  36278. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  36279. * significant digits using rounding mode `rounding`.
  36280. *
  36281. * x {number|string|Decimal}
  36282. *
  36283. */
  36284. function log2(x) {
  36285. return new this(x).log(2);
  36286. }
  36287. /*
  36288. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  36289. * significant digits using rounding mode `rounding`.
  36290. *
  36291. * x {number|string|Decimal}
  36292. *
  36293. */
  36294. function log10(x) {
  36295. return new this(x).log(10);
  36296. }
  36297. /*
  36298. * Return a new Decimal whose value is the maximum of the arguments.
  36299. *
  36300. * arguments {number|string|Decimal}
  36301. *
  36302. */
  36303. function max() {
  36304. return maxOrMin(this, arguments, 'lt');
  36305. }
  36306. /*
  36307. * Return a new Decimal whose value is the minimum of the arguments.
  36308. *
  36309. * arguments {number|string|Decimal}
  36310. *
  36311. */
  36312. function min() {
  36313. return maxOrMin(this, arguments, 'gt');
  36314. }
  36315. /*
  36316. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  36317. * using rounding mode `rounding`.
  36318. *
  36319. * x {number|string|Decimal}
  36320. * y {number|string|Decimal}
  36321. *
  36322. */
  36323. function mod(x, y) {
  36324. return new this(x).mod(y);
  36325. }
  36326. /*
  36327. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  36328. * digits using rounding mode `rounding`.
  36329. *
  36330. * x {number|string|Decimal}
  36331. * y {number|string|Decimal}
  36332. *
  36333. */
  36334. function mul(x, y) {
  36335. return new this(x).mul(y);
  36336. }
  36337. /*
  36338. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  36339. * significant digits using rounding mode `rounding`.
  36340. *
  36341. * x {number|string|Decimal} The base.
  36342. * y {number|string|Decimal} The exponent.
  36343. *
  36344. */
  36345. function pow(x, y) {
  36346. return new this(x).pow(y);
  36347. }
  36348. /*
  36349. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  36350. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  36351. * are produced).
  36352. *
  36353. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  36354. *
  36355. */
  36356. function random(sd) {
  36357. var d,
  36358. e,
  36359. k,
  36360. n,
  36361. i = 0,
  36362. r = new this(1),
  36363. rd = [];
  36364. if (sd === void 0) sd = this.precision;else checkInt32(sd, 1, MAX_DIGITS);
  36365. k = Math.ceil(sd / LOG_BASE);
  36366. if (!this.crypto) {
  36367. for (; i < k;) {
  36368. rd[i++] = Math.random() * 1e7 | 0;
  36369. } // Browsers supporting crypto.getRandomValues.
  36370. } else if (crypto.getRandomValues) {
  36371. d = crypto.getRandomValues(new Uint32Array(k));
  36372. for (; i < k;) {
  36373. n = d[i];
  36374. // 0 <= n < 4294967296
  36375. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  36376. if (n >= 4.29e9) {
  36377. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  36378. } else {
  36379. // 0 <= n <= 4289999999
  36380. // 0 <= (n % 1e7) <= 9999999
  36381. rd[i++] = n % 1e7;
  36382. }
  36383. }
  36384. // Node.js supporting crypto.randomBytes.
  36385. } else if (crypto.randomBytes) {
  36386. // buffer
  36387. d = crypto.randomBytes(k *= 4);
  36388. for (; i < k;) {
  36389. // 0 <= n < 2147483648
  36390. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  36391. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  36392. if (n >= 2.14e9) {
  36393. crypto.randomBytes(4).copy(d, i);
  36394. } else {
  36395. // 0 <= n <= 2139999999
  36396. // 0 <= (n % 1e7) <= 9999999
  36397. rd.push(n % 1e7);
  36398. i += 4;
  36399. }
  36400. }
  36401. i = k / 4;
  36402. } else {
  36403. throw Error(cryptoUnavailable);
  36404. }
  36405. k = rd[--i];
  36406. sd %= LOG_BASE;
  36407. // Convert trailing digits to zeros according to sd.
  36408. if (k && sd) {
  36409. n = mathpow(10, LOG_BASE - sd);
  36410. rd[i] = (k / n | 0) * n;
  36411. }
  36412. // Remove trailing words which are zero.
  36413. for (; rd[i] === 0; i--) {
  36414. rd.pop();
  36415. } // Zero?
  36416. if (i < 0) {
  36417. e = 0;
  36418. rd = [0];
  36419. } else {
  36420. e = -1;
  36421. // Remove leading words which are zero and adjust exponent accordingly.
  36422. for (; rd[0] === 0; e -= LOG_BASE) {
  36423. rd.shift();
  36424. } // Count the digits of the first word of rd to determine leading zeros.
  36425. for (k = 1, n = rd[0]; n >= 10; n /= 10) {
  36426. k++;
  36427. } // Adjust the exponent for leading zeros of the first word of rd.
  36428. if (k < LOG_BASE) e -= LOG_BASE - k;
  36429. }
  36430. r.e = e;
  36431. r.d = rd;
  36432. return r;
  36433. }
  36434. /*
  36435. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  36436. *
  36437. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  36438. *
  36439. * x {number|string|Decimal}
  36440. *
  36441. */
  36442. function round(x) {
  36443. return finalise(x = new this(x), x.e + 1, this.rounding);
  36444. }
  36445. /*
  36446. * Return
  36447. * 1 if x > 0,
  36448. * -1 if x < 0,
  36449. * 0 if x is 0,
  36450. * -0 if x is -0,
  36451. * NaN otherwise
  36452. *
  36453. */
  36454. function sign(x) {
  36455. x = new this(x);
  36456. return x.d ? x.d[0] ? x.s : 0 * x.s : x.s || NaN;
  36457. }
  36458. /*
  36459. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  36460. * using rounding mode `rounding`.
  36461. *
  36462. * x {number|string|Decimal} A value in radians.
  36463. *
  36464. */
  36465. function sin(x) {
  36466. return new this(x).sin();
  36467. }
  36468. /*
  36469. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  36470. * significant digits using rounding mode `rounding`.
  36471. *
  36472. * x {number|string|Decimal} A value in radians.
  36473. *
  36474. */
  36475. function sinh(x) {
  36476. return new this(x).sinh();
  36477. }
  36478. /*
  36479. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  36480. * digits using rounding mode `rounding`.
  36481. *
  36482. * x {number|string|Decimal}
  36483. *
  36484. */
  36485. function sqrt(x) {
  36486. return new this(x).sqrt();
  36487. }
  36488. /*
  36489. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  36490. * using rounding mode `rounding`.
  36491. *
  36492. * x {number|string|Decimal}
  36493. * y {number|string|Decimal}
  36494. *
  36495. */
  36496. function sub(x, y) {
  36497. return new this(x).sub(y);
  36498. }
  36499. /*
  36500. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  36501. * digits using rounding mode `rounding`.
  36502. *
  36503. * x {number|string|Decimal} A value in radians.
  36504. *
  36505. */
  36506. function tan(x) {
  36507. return new this(x).tan();
  36508. }
  36509. /*
  36510. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  36511. * significant digits using rounding mode `rounding`.
  36512. *
  36513. * x {number|string|Decimal} A value in radians.
  36514. *
  36515. */
  36516. function tanh(x) {
  36517. return new this(x).tanh();
  36518. }
  36519. /*
  36520. * Return a new Decimal whose value is `x` truncated to an integer.
  36521. *
  36522. * x {number|string|Decimal}
  36523. *
  36524. */
  36525. function trunc(x) {
  36526. return finalise(x = new this(x), x.e + 1, 1);
  36527. }
  36528. // Create and configure initial Decimal constructor.
  36529. Decimal = clone(DEFAULTS);
  36530. Decimal['default'] = Decimal.Decimal = Decimal;
  36531. // Create the internal constants from their string values.
  36532. LN10 = new Decimal(LN10);
  36533. PI = new Decimal(PI);
  36534. // Export.
  36535. // AMD.
  36536. if (true) {
  36537. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  36538. return Decimal;
  36539. }).call(exports, __webpack_require__, exports, module),
  36540. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  36541. // Node and other environments that support module.exports.
  36542. } else {}
  36543. })(undefined);
  36544. /***/ }),
  36545. /***/ "./node_modules/jquery/dist/jquery.js":
  36546. /*!********************************************!*\
  36547. !*** ./node_modules/jquery/dist/jquery.js ***!
  36548. \********************************************/
  36549. /*! no static exports found */
  36550. /***/ (function(module, exports, __webpack_require__) {
  36551. "use strict";
  36552. /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;
  36553. 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; };
  36554. /*!
  36555. * jQuery JavaScript Library v3.3.1
  36556. * https://jquery.com/
  36557. *
  36558. * Includes Sizzle.js
  36559. * https://sizzlejs.com/
  36560. *
  36561. * Copyright JS Foundation and other contributors
  36562. * Released under the MIT license
  36563. * https://jquery.org/license
  36564. *
  36565. * Date: 2018-01-20T17:24Z
  36566. */
  36567. (function (global, factory) {
  36568. "use strict";
  36569. if (( false ? undefined : _typeof(module)) === "object" && _typeof(module.exports) === "object") {
  36570. // For CommonJS and CommonJS-like environments where a proper `window`
  36571. // is present, execute the factory and get jQuery.
  36572. // For environments that do not have a `window` with a `document`
  36573. // (such as Node.js), expose a factory as module.exports.
  36574. // This accentuates the need for the creation of a real `window`.
  36575. // e.g. var jQuery = require("jquery")(window);
  36576. // See ticket #14549 for more info.
  36577. module.exports = global.document ? factory(global, true) : function (w) {
  36578. if (!w.document) {
  36579. throw new Error("jQuery requires a window with a document");
  36580. }
  36581. return factory(w);
  36582. };
  36583. } else {
  36584. factory(global);
  36585. }
  36586. // Pass this if window is not defined yet
  36587. })(typeof window !== "undefined" ? window : undefined, function (window, noGlobal) {
  36588. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  36589. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  36590. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  36591. // enough that all such attempts are guarded in a try block.
  36592. "use strict";
  36593. var arr = [];
  36594. var document = window.document;
  36595. var getProto = Object.getPrototypeOf;
  36596. var _slice = arr.slice;
  36597. var concat = arr.concat;
  36598. var push = arr.push;
  36599. var indexOf = arr.indexOf;
  36600. var class2type = {};
  36601. var toString = class2type.toString;
  36602. var hasOwn = class2type.hasOwnProperty;
  36603. var fnToString = hasOwn.toString;
  36604. var ObjectFunctionString = fnToString.call(Object);
  36605. var support = {};
  36606. var isFunction = function isFunction(obj) {
  36607. // Support: Chrome <=57, Firefox <=52
  36608. // In some browsers, typeof returns "function" for HTML <object> elements
  36609. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  36610. // We don't want to classify *any* DOM node as a function.
  36611. return typeof obj === "function" && typeof obj.nodeType !== "number";
  36612. };
  36613. var isWindow = function isWindow(obj) {
  36614. return obj != null && obj === obj.window;
  36615. };
  36616. var preservedScriptAttributes = {
  36617. type: true,
  36618. src: true,
  36619. noModule: true
  36620. };
  36621. function DOMEval(code, doc, node) {
  36622. doc = doc || document;
  36623. var i,
  36624. script = doc.createElement("script");
  36625. script.text = code;
  36626. if (node) {
  36627. for (i in preservedScriptAttributes) {
  36628. if (node[i]) {
  36629. script[i] = node[i];
  36630. }
  36631. }
  36632. }
  36633. doc.head.appendChild(script).parentNode.removeChild(script);
  36634. }
  36635. function toType(obj) {
  36636. if (obj == null) {
  36637. return obj + "";
  36638. }
  36639. // Support: Android <=2.3 only (functionish RegExp)
  36640. return (typeof obj === "undefined" ? "undefined" : _typeof(obj)) === "object" || typeof obj === "function" ? class2type[toString.call(obj)] || "object" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
  36641. }
  36642. /* global Symbol */
  36643. // Defining this global in .eslintrc.json would create a danger of using the global
  36644. // unguarded in another place, it seems safer to define global only for this module
  36645. var version = "3.3.1",
  36646. // Define a local copy of jQuery
  36647. jQuery = function jQuery(selector, context) {
  36648. // The jQuery object is actually just the init constructor 'enhanced'
  36649. // Need init if jQuery is called (just allow error to be thrown if not included)
  36650. return new jQuery.fn.init(selector, context);
  36651. },
  36652. // Support: Android <=4.0 only
  36653. // Make sure we trim BOM and NBSP
  36654. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  36655. jQuery.fn = jQuery.prototype = {
  36656. // The current version of jQuery being used
  36657. jquery: version,
  36658. constructor: jQuery,
  36659. // The default length of a jQuery object is 0
  36660. length: 0,
  36661. toArray: function toArray() {
  36662. return _slice.call(this);
  36663. },
  36664. // Get the Nth element in the matched element set OR
  36665. // Get the whole matched element set as a clean array
  36666. get: function get(num) {
  36667. // Return all the elements in a clean array
  36668. if (num == null) {
  36669. return _slice.call(this);
  36670. }
  36671. // Return just the one element from the set
  36672. return num < 0 ? this[num + this.length] : this[num];
  36673. },
  36674. // Take an array of elements and push it onto the stack
  36675. // (returning the new matched element set)
  36676. pushStack: function pushStack(elems) {
  36677. // Build a new jQuery matched element set
  36678. var ret = jQuery.merge(this.constructor(), elems);
  36679. // Add the old object onto the stack (as a reference)
  36680. ret.prevObject = this;
  36681. // Return the newly-formed element set
  36682. return ret;
  36683. },
  36684. // Execute a callback for every element in the matched set.
  36685. each: function each(callback) {
  36686. return jQuery.each(this, callback);
  36687. },
  36688. map: function map(callback) {
  36689. return this.pushStack(jQuery.map(this, function (elem, i) {
  36690. return callback.call(elem, i, elem);
  36691. }));
  36692. },
  36693. slice: function slice() {
  36694. return this.pushStack(_slice.apply(this, arguments));
  36695. },
  36696. first: function first() {
  36697. return this.eq(0);
  36698. },
  36699. last: function last() {
  36700. return this.eq(-1);
  36701. },
  36702. eq: function eq(i) {
  36703. var len = this.length,
  36704. j = +i + (i < 0 ? len : 0);
  36705. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  36706. },
  36707. end: function end() {
  36708. return this.prevObject || this.constructor();
  36709. },
  36710. // For internal use only.
  36711. // Behaves like an Array's method, not like a jQuery method.
  36712. push: push,
  36713. sort: arr.sort,
  36714. splice: arr.splice
  36715. };
  36716. jQuery.extend = jQuery.fn.extend = function () {
  36717. var options,
  36718. name,
  36719. src,
  36720. copy,
  36721. copyIsArray,
  36722. clone,
  36723. target = arguments[0] || {},
  36724. i = 1,
  36725. length = arguments.length,
  36726. deep = false;
  36727. // Handle a deep copy situation
  36728. if (typeof target === "boolean") {
  36729. deep = target;
  36730. // Skip the boolean and the target
  36731. target = arguments[i] || {};
  36732. i++;
  36733. }
  36734. // Handle case when target is a string or something (possible in deep copy)
  36735. if ((typeof target === "undefined" ? "undefined" : _typeof(target)) !== "object" && !isFunction(target)) {
  36736. target = {};
  36737. }
  36738. // Extend jQuery itself if only one argument is passed
  36739. if (i === length) {
  36740. target = this;
  36741. i--;
  36742. }
  36743. for (; i < length; i++) {
  36744. // Only deal with non-null/undefined values
  36745. if ((options = arguments[i]) != null) {
  36746. // Extend the base object
  36747. for (name in options) {
  36748. src = target[name];
  36749. copy = options[name];
  36750. // Prevent never-ending loop
  36751. if (target === copy) {
  36752. continue;
  36753. }
  36754. // Recurse if we're merging plain objects or arrays
  36755. if (deep && copy && (jQuery.isPlainObject(copy) || (copyIsArray = Array.isArray(copy)))) {
  36756. if (copyIsArray) {
  36757. copyIsArray = false;
  36758. clone = src && Array.isArray(src) ? src : [];
  36759. } else {
  36760. clone = src && jQuery.isPlainObject(src) ? src : {};
  36761. }
  36762. // Never move original objects, clone them
  36763. target[name] = jQuery.extend(deep, clone, copy);
  36764. // Don't bring in undefined values
  36765. } else if (copy !== undefined) {
  36766. target[name] = copy;
  36767. }
  36768. }
  36769. }
  36770. }
  36771. // Return the modified object
  36772. return target;
  36773. };
  36774. jQuery.extend({
  36775. // Unique for each copy of jQuery on the page
  36776. expando: "jQuery" + (version + Math.random()).replace(/\D/g, ""),
  36777. // Assume jQuery is ready without the ready module
  36778. isReady: true,
  36779. error: function error(msg) {
  36780. throw new Error(msg);
  36781. },
  36782. noop: function noop() {},
  36783. isPlainObject: function isPlainObject(obj) {
  36784. var proto, Ctor;
  36785. // Detect obvious negatives
  36786. // Use toString instead of jQuery.type to catch host objects
  36787. if (!obj || toString.call(obj) !== "[object Object]") {
  36788. return false;
  36789. }
  36790. proto = getProto(obj);
  36791. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  36792. if (!proto) {
  36793. return true;
  36794. }
  36795. // Objects with prototype are plain iff they were constructed by a global Object function
  36796. Ctor = hasOwn.call(proto, "constructor") && proto.constructor;
  36797. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  36798. },
  36799. isEmptyObject: function isEmptyObject(obj) {
  36800. /* eslint-disable no-unused-vars */
  36801. // See https://github.com/eslint/eslint/issues/6125
  36802. var name;
  36803. for (name in obj) {
  36804. return false;
  36805. }
  36806. return true;
  36807. },
  36808. // Evaluates a script in a global context
  36809. globalEval: function globalEval(code) {
  36810. DOMEval(code);
  36811. },
  36812. each: function each(obj, callback) {
  36813. var length,
  36814. i = 0;
  36815. if (isArrayLike(obj)) {
  36816. length = obj.length;
  36817. for (; i < length; i++) {
  36818. if (callback.call(obj[i], i, obj[i]) === false) {
  36819. break;
  36820. }
  36821. }
  36822. } else {
  36823. for (i in obj) {
  36824. if (callback.call(obj[i], i, obj[i]) === false) {
  36825. break;
  36826. }
  36827. }
  36828. }
  36829. return obj;
  36830. },
  36831. // Support: Android <=4.0 only
  36832. trim: function trim(text) {
  36833. return text == null ? "" : (text + "").replace(rtrim, "");
  36834. },
  36835. // results is for internal usage only
  36836. makeArray: function makeArray(arr, results) {
  36837. var ret = results || [];
  36838. if (arr != null) {
  36839. if (isArrayLike(Object(arr))) {
  36840. jQuery.merge(ret, typeof arr === "string" ? [arr] : arr);
  36841. } else {
  36842. push.call(ret, arr);
  36843. }
  36844. }
  36845. return ret;
  36846. },
  36847. inArray: function inArray(elem, arr, i) {
  36848. return arr == null ? -1 : indexOf.call(arr, elem, i);
  36849. },
  36850. // Support: Android <=4.0 only, PhantomJS 1 only
  36851. // push.apply(_, arraylike) throws on ancient WebKit
  36852. merge: function merge(first, second) {
  36853. var len = +second.length,
  36854. j = 0,
  36855. i = first.length;
  36856. for (; j < len; j++) {
  36857. first[i++] = second[j];
  36858. }
  36859. first.length = i;
  36860. return first;
  36861. },
  36862. grep: function grep(elems, callback, invert) {
  36863. var callbackInverse,
  36864. matches = [],
  36865. i = 0,
  36866. length = elems.length,
  36867. callbackExpect = !invert;
  36868. // Go through the array, only saving the items
  36869. // that pass the validator function
  36870. for (; i < length; i++) {
  36871. callbackInverse = !callback(elems[i], i);
  36872. if (callbackInverse !== callbackExpect) {
  36873. matches.push(elems[i]);
  36874. }
  36875. }
  36876. return matches;
  36877. },
  36878. // arg is for internal usage only
  36879. map: function map(elems, callback, arg) {
  36880. var length,
  36881. value,
  36882. i = 0,
  36883. ret = [];
  36884. // Go through the array, translating each of the items to their new values
  36885. if (isArrayLike(elems)) {
  36886. length = elems.length;
  36887. for (; i < length; i++) {
  36888. value = callback(elems[i], i, arg);
  36889. if (value != null) {
  36890. ret.push(value);
  36891. }
  36892. }
  36893. // Go through every key on the object,
  36894. } else {
  36895. for (i in elems) {
  36896. value = callback(elems[i], i, arg);
  36897. if (value != null) {
  36898. ret.push(value);
  36899. }
  36900. }
  36901. }
  36902. // Flatten any nested arrays
  36903. return concat.apply([], ret);
  36904. },
  36905. // A global GUID counter for objects
  36906. guid: 1,
  36907. // jQuery.support is not used in Core but other projects attach their
  36908. // properties to it so it needs to exist.
  36909. support: support
  36910. });
  36911. if (typeof Symbol === "function") {
  36912. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  36913. }
  36914. // Populate the class2type map
  36915. jQuery.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function (i, name) {
  36916. class2type["[object " + name + "]"] = name.toLowerCase();
  36917. });
  36918. function isArrayLike(obj) {
  36919. // Support: real iOS 8.2 only (not reproducible in simulator)
  36920. // `in` check used to prevent JIT error (gh-2145)
  36921. // hasOwn isn't used here due to false negatives
  36922. // regarding Nodelist length in IE
  36923. var length = !!obj && "length" in obj && obj.length,
  36924. type = toType(obj);
  36925. if (isFunction(obj) || isWindow(obj)) {
  36926. return false;
  36927. }
  36928. return type === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  36929. }
  36930. var Sizzle =
  36931. /*!
  36932. * Sizzle CSS Selector Engine v2.3.3
  36933. * https://sizzlejs.com/
  36934. *
  36935. * Copyright jQuery Foundation and other contributors
  36936. * Released under the MIT license
  36937. * http://jquery.org/license
  36938. *
  36939. * Date: 2016-08-08
  36940. */
  36941. function (window) {
  36942. var i,
  36943. support,
  36944. Expr,
  36945. getText,
  36946. isXML,
  36947. tokenize,
  36948. compile,
  36949. select,
  36950. outermostContext,
  36951. sortInput,
  36952. hasDuplicate,
  36953. // Local document vars
  36954. setDocument,
  36955. document,
  36956. docElem,
  36957. documentIsHTML,
  36958. rbuggyQSA,
  36959. rbuggyMatches,
  36960. matches,
  36961. contains,
  36962. // Instance-specific data
  36963. expando = "sizzle" + 1 * new Date(),
  36964. preferredDoc = window.document,
  36965. dirruns = 0,
  36966. done = 0,
  36967. classCache = createCache(),
  36968. tokenCache = createCache(),
  36969. compilerCache = createCache(),
  36970. sortOrder = function sortOrder(a, b) {
  36971. if (a === b) {
  36972. hasDuplicate = true;
  36973. }
  36974. return 0;
  36975. },
  36976. // Instance methods
  36977. hasOwn = {}.hasOwnProperty,
  36978. arr = [],
  36979. pop = arr.pop,
  36980. push_native = arr.push,
  36981. push = arr.push,
  36982. slice = arr.slice,
  36983. // Use a stripped-down indexOf as it's faster than native
  36984. // https://jsperf.com/thor-indexof-vs-for/5
  36985. indexOf = function indexOf(list, elem) {
  36986. var i = 0,
  36987. len = list.length;
  36988. for (; i < len; i++) {
  36989. if (list[i] === elem) {
  36990. return i;
  36991. }
  36992. }
  36993. return -1;
  36994. },
  36995. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  36996. // Regular expressions
  36997. // http://www.w3.org/TR/css3-selectors/#whitespace
  36998. whitespace = "[\\x20\\t\\r\\n\\f]",
  36999. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  37000. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  37001. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  37002. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  37003. // Operator (capture 2)
  37004. "*([*^$|!~]?=)" + whitespace +
  37005. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  37006. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + "*\\]",
  37007. pseudos = ":(" + identifier + ")(?:\\((" +
  37008. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  37009. // 1. quoted (capture 3; capture 4 or capture 5)
  37010. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  37011. // 2. simple (capture 6)
  37012. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  37013. // 3. anything else (capture 2)
  37014. ".*" + ")\\)|)",
  37015. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  37016. rwhitespace = new RegExp(whitespace + "+", "g"),
  37017. rtrim = new RegExp("^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g"),
  37018. rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"),
  37019. rcombinators = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"),
  37020. rattributeQuotes = new RegExp("=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g"),
  37021. rpseudo = new RegExp(pseudos),
  37022. ridentifier = new RegExp("^" + identifier + "$"),
  37023. matchExpr = {
  37024. "ID": new RegExp("^#(" + identifier + ")"),
  37025. "CLASS": new RegExp("^\\.(" + identifier + ")"),
  37026. "TAG": new RegExp("^(" + identifier + "|[*])"),
  37027. "ATTR": new RegExp("^" + attributes),
  37028. "PSEUDO": new RegExp("^" + pseudos),
  37029. "CHILD": new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)", "i"),
  37030. "bool": new RegExp("^(?:" + booleans + ")$", "i"),
  37031. // For use in libraries implementing .is()
  37032. // We use this for POS matching in `select`
  37033. "needsContext": new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  37034. },
  37035. rinputs = /^(?:input|select|textarea|button)$/i,
  37036. rheader = /^h\d$/i,
  37037. rnative = /^[^{]+\{\s*\[native \w/,
  37038. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  37039. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  37040. rsibling = /[+~]/,
  37041. // CSS escapes
  37042. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  37043. runescape = new RegExp("\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig"),
  37044. funescape = function funescape(_, escaped, escapedWhitespace) {
  37045. var high = "0x" + escaped - 0x10000;
  37046. // NaN means non-codepoint
  37047. // Support: Firefox<24
  37048. // Workaround erroneous numeric interpretation of +"0x"
  37049. return high !== high || escapedWhitespace ? escaped : high < 0 ?
  37050. // BMP codepoint
  37051. String.fromCharCode(high + 0x10000) :
  37052. // Supplemental Plane codepoint (surrogate pair)
  37053. String.fromCharCode(high >> 10 | 0xD800, high & 0x3FF | 0xDC00);
  37054. },
  37055. // CSS string/identifier serialization
  37056. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  37057. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  37058. fcssescape = function fcssescape(ch, asCodePoint) {
  37059. if (asCodePoint) {
  37060. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  37061. if (ch === "\0") {
  37062. return "\uFFFD";
  37063. }
  37064. // Control characters and (dependent upon position) numbers get escaped as code points
  37065. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  37066. }
  37067. // Other potentially-special ASCII characters get backslash-escaped
  37068. return "\\" + ch;
  37069. },
  37070. // Used for iframes
  37071. // See setDocument()
  37072. // Removing the function wrapper causes a "Permission Denied"
  37073. // error in IE
  37074. unloadHandler = function unloadHandler() {
  37075. setDocument();
  37076. },
  37077. disabledAncestor = addCombinator(function (elem) {
  37078. return elem.disabled === true && ("form" in elem || "label" in elem);
  37079. }, { dir: "parentNode", next: "legend" });
  37080. // Optimize for push.apply( _, NodeList )
  37081. try {
  37082. push.apply(arr = slice.call(preferredDoc.childNodes), preferredDoc.childNodes);
  37083. // Support: Android<4.0
  37084. // Detect silently failing push.apply
  37085. arr[preferredDoc.childNodes.length].nodeType;
  37086. } catch (e) {
  37087. push = { apply: arr.length ?
  37088. // Leverage slice if possible
  37089. function (target, els) {
  37090. push_native.apply(target, slice.call(els));
  37091. } :
  37092. // Support: IE<9
  37093. // Otherwise append directly
  37094. function (target, els) {
  37095. var j = target.length,
  37096. i = 0;
  37097. // Can't trust NodeList.length
  37098. while (target[j++] = els[i++]) {}
  37099. target.length = j - 1;
  37100. }
  37101. };
  37102. }
  37103. function Sizzle(selector, context, results, seed) {
  37104. var m,
  37105. i,
  37106. elem,
  37107. nid,
  37108. match,
  37109. groups,
  37110. newSelector,
  37111. newContext = context && context.ownerDocument,
  37112. // nodeType defaults to 9, since context defaults to document
  37113. nodeType = context ? context.nodeType : 9;
  37114. results = results || [];
  37115. // Return early from calls with invalid selector or context
  37116. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  37117. return results;
  37118. }
  37119. // Try to shortcut find operations (as opposed to filters) in HTML documents
  37120. if (!seed) {
  37121. if ((context ? context.ownerDocument || context : preferredDoc) !== document) {
  37122. setDocument(context);
  37123. }
  37124. context = context || document;
  37125. if (documentIsHTML) {
  37126. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  37127. // (excepting DocumentFragment context, where the methods don't exist)
  37128. if (nodeType !== 11 && (match = rquickExpr.exec(selector))) {
  37129. // ID selector
  37130. if (m = match[1]) {
  37131. // Document context
  37132. if (nodeType === 9) {
  37133. if (elem = context.getElementById(m)) {
  37134. // Support: IE, Opera, Webkit
  37135. // TODO: identify versions
  37136. // getElementById can match elements by name instead of ID
  37137. if (elem.id === m) {
  37138. results.push(elem);
  37139. return results;
  37140. }
  37141. } else {
  37142. return results;
  37143. }
  37144. // Element context
  37145. } else {
  37146. // Support: IE, Opera, Webkit
  37147. // TODO: identify versions
  37148. // getElementById can match elements by name instead of ID
  37149. if (newContext && (elem = newContext.getElementById(m)) && contains(context, elem) && elem.id === m) {
  37150. results.push(elem);
  37151. return results;
  37152. }
  37153. }
  37154. // Type selector
  37155. } else if (match[2]) {
  37156. push.apply(results, context.getElementsByTagName(selector));
  37157. return results;
  37158. // Class selector
  37159. } else if ((m = match[3]) && support.getElementsByClassName && context.getElementsByClassName) {
  37160. push.apply(results, context.getElementsByClassName(m));
  37161. return results;
  37162. }
  37163. }
  37164. // Take advantage of querySelectorAll
  37165. if (support.qsa && !compilerCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  37166. if (nodeType !== 1) {
  37167. newContext = context;
  37168. newSelector = selector;
  37169. // qSA looks outside Element context, which is not what we want
  37170. // Thanks to Andrew Dupont for this workaround technique
  37171. // Support: IE <=8
  37172. // Exclude object elements
  37173. } else if (context.nodeName.toLowerCase() !== "object") {
  37174. // Capture the context ID, setting it first if necessary
  37175. if (nid = context.getAttribute("id")) {
  37176. nid = nid.replace(rcssescape, fcssescape);
  37177. } else {
  37178. context.setAttribute("id", nid = expando);
  37179. }
  37180. // Prefix every selector in the list
  37181. groups = tokenize(selector);
  37182. i = groups.length;
  37183. while (i--) {
  37184. groups[i] = "#" + nid + " " + toSelector(groups[i]);
  37185. }
  37186. newSelector = groups.join(",");
  37187. // Expand context for sibling selectors
  37188. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  37189. }
  37190. if (newSelector) {
  37191. try {
  37192. push.apply(results, newContext.querySelectorAll(newSelector));
  37193. return results;
  37194. } catch (qsaError) {} finally {
  37195. if (nid === expando) {
  37196. context.removeAttribute("id");
  37197. }
  37198. }
  37199. }
  37200. }
  37201. }
  37202. }
  37203. // All others
  37204. return select(selector.replace(rtrim, "$1"), context, results, seed);
  37205. }
  37206. /**
  37207. * Create key-value caches of limited size
  37208. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  37209. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  37210. * deleting the oldest entry
  37211. */
  37212. function createCache() {
  37213. var keys = [];
  37214. function cache(key, value) {
  37215. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  37216. if (keys.push(key + " ") > Expr.cacheLength) {
  37217. // Only keep the most recent entries
  37218. delete cache[keys.shift()];
  37219. }
  37220. return cache[key + " "] = value;
  37221. }
  37222. return cache;
  37223. }
  37224. /**
  37225. * Mark a function for special use by Sizzle
  37226. * @param {Function} fn The function to mark
  37227. */
  37228. function markFunction(fn) {
  37229. fn[expando] = true;
  37230. return fn;
  37231. }
  37232. /**
  37233. * Support testing using an element
  37234. * @param {Function} fn Passed the created element and returns a boolean result
  37235. */
  37236. function assert(fn) {
  37237. var el = document.createElement("fieldset");
  37238. try {
  37239. return !!fn(el);
  37240. } catch (e) {
  37241. return false;
  37242. } finally {
  37243. // Remove from its parent by default
  37244. if (el.parentNode) {
  37245. el.parentNode.removeChild(el);
  37246. }
  37247. // release memory in IE
  37248. el = null;
  37249. }
  37250. }
  37251. /**
  37252. * Adds the same handler for all of the specified attrs
  37253. * @param {String} attrs Pipe-separated list of attributes
  37254. * @param {Function} handler The method that will be applied
  37255. */
  37256. function addHandle(attrs, handler) {
  37257. var arr = attrs.split("|"),
  37258. i = arr.length;
  37259. while (i--) {
  37260. Expr.attrHandle[arr[i]] = handler;
  37261. }
  37262. }
  37263. /**
  37264. * Checks document order of two siblings
  37265. * @param {Element} a
  37266. * @param {Element} b
  37267. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  37268. */
  37269. function siblingCheck(a, b) {
  37270. var cur = b && a,
  37271. diff = cur && a.nodeType === 1 && b.nodeType === 1 && a.sourceIndex - b.sourceIndex;
  37272. // Use IE sourceIndex if available on both nodes
  37273. if (diff) {
  37274. return diff;
  37275. }
  37276. // Check if b follows a
  37277. if (cur) {
  37278. while (cur = cur.nextSibling) {
  37279. if (cur === b) {
  37280. return -1;
  37281. }
  37282. }
  37283. }
  37284. return a ? 1 : -1;
  37285. }
  37286. /**
  37287. * Returns a function to use in pseudos for input types
  37288. * @param {String} type
  37289. */
  37290. function createInputPseudo(type) {
  37291. return function (elem) {
  37292. var name = elem.nodeName.toLowerCase();
  37293. return name === "input" && elem.type === type;
  37294. };
  37295. }
  37296. /**
  37297. * Returns a function to use in pseudos for buttons
  37298. * @param {String} type
  37299. */
  37300. function createButtonPseudo(type) {
  37301. return function (elem) {
  37302. var name = elem.nodeName.toLowerCase();
  37303. return (name === "input" || name === "button") && elem.type === type;
  37304. };
  37305. }
  37306. /**
  37307. * Returns a function to use in pseudos for :enabled/:disabled
  37308. * @param {Boolean} disabled true for :disabled; false for :enabled
  37309. */
  37310. function createDisabledPseudo(disabled) {
  37311. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  37312. return function (elem) {
  37313. // Only certain elements can match :enabled or :disabled
  37314. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  37315. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  37316. if ("form" in elem) {
  37317. // Check for inherited disabledness on relevant non-disabled elements:
  37318. // * listed form-associated elements in a disabled fieldset
  37319. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  37320. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  37321. // * option elements in a disabled optgroup
  37322. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  37323. // All such elements have a "form" property.
  37324. if (elem.parentNode && elem.disabled === false) {
  37325. // Option elements defer to a parent optgroup if present
  37326. if ("label" in elem) {
  37327. if ("label" in elem.parentNode) {
  37328. return elem.parentNode.disabled === disabled;
  37329. } else {
  37330. return elem.disabled === disabled;
  37331. }
  37332. }
  37333. // Support: IE 6 - 11
  37334. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  37335. return elem.isDisabled === disabled ||
  37336. // Where there is no isDisabled, check manually
  37337. /* jshint -W018 */
  37338. elem.isDisabled !== !disabled && disabledAncestor(elem) === disabled;
  37339. }
  37340. return elem.disabled === disabled;
  37341. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  37342. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  37343. // even exist on them, let alone have a boolean value.
  37344. } else if ("label" in elem) {
  37345. return elem.disabled === disabled;
  37346. }
  37347. // Remaining elements are neither :enabled nor :disabled
  37348. return false;
  37349. };
  37350. }
  37351. /**
  37352. * Returns a function to use in pseudos for positionals
  37353. * @param {Function} fn
  37354. */
  37355. function createPositionalPseudo(fn) {
  37356. return markFunction(function (argument) {
  37357. argument = +argument;
  37358. return markFunction(function (seed, matches) {
  37359. var j,
  37360. matchIndexes = fn([], seed.length, argument),
  37361. i = matchIndexes.length;
  37362. // Match elements found at the specified indexes
  37363. while (i--) {
  37364. if (seed[j = matchIndexes[i]]) {
  37365. seed[j] = !(matches[j] = seed[j]);
  37366. }
  37367. }
  37368. });
  37369. });
  37370. }
  37371. /**
  37372. * Checks a node for validity as a Sizzle context
  37373. * @param {Element|Object=} context
  37374. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  37375. */
  37376. function testContext(context) {
  37377. return context && typeof context.getElementsByTagName !== "undefined" && context;
  37378. }
  37379. // Expose support vars for convenience
  37380. support = Sizzle.support = {};
  37381. /**
  37382. * Detects XML nodes
  37383. * @param {Element|Object} elem An element or a document
  37384. * @returns {Boolean} True iff elem is a non-HTML XML node
  37385. */
  37386. isXML = Sizzle.isXML = function (elem) {
  37387. // documentElement is verified for cases where it doesn't yet exist
  37388. // (such as loading iframes in IE - #4833)
  37389. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  37390. return documentElement ? documentElement.nodeName !== "HTML" : false;
  37391. };
  37392. /**
  37393. * Sets document-related variables once based on the current document
  37394. * @param {Element|Object} [doc] An element or document object to use to set the document
  37395. * @returns {Object} Returns the current document
  37396. */
  37397. setDocument = Sizzle.setDocument = function (node) {
  37398. var hasCompare,
  37399. subWindow,
  37400. doc = node ? node.ownerDocument || node : preferredDoc;
  37401. // Return early if doc is invalid or already selected
  37402. if (doc === document || doc.nodeType !== 9 || !doc.documentElement) {
  37403. return document;
  37404. }
  37405. // Update global variables
  37406. document = doc;
  37407. docElem = document.documentElement;
  37408. documentIsHTML = !isXML(document);
  37409. // Support: IE 9-11, Edge
  37410. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  37411. if (preferredDoc !== document && (subWindow = document.defaultView) && subWindow.top !== subWindow) {
  37412. // Support: IE 11, Edge
  37413. if (subWindow.addEventListener) {
  37414. subWindow.addEventListener("unload", unloadHandler, false);
  37415. // Support: IE 9 - 10 only
  37416. } else if (subWindow.attachEvent) {
  37417. subWindow.attachEvent("onunload", unloadHandler);
  37418. }
  37419. }
  37420. /* Attributes
  37421. ---------------------------------------------------------------------- */
  37422. // Support: IE<8
  37423. // Verify that getAttribute really returns attributes and not properties
  37424. // (excepting IE8 booleans)
  37425. support.attributes = assert(function (el) {
  37426. el.className = "i";
  37427. return !el.getAttribute("className");
  37428. });
  37429. /* getElement(s)By*
  37430. ---------------------------------------------------------------------- */
  37431. // Check if getElementsByTagName("*") returns only elements
  37432. support.getElementsByTagName = assert(function (el) {
  37433. el.appendChild(document.createComment(""));
  37434. return !el.getElementsByTagName("*").length;
  37435. });
  37436. // Support: IE<9
  37437. support.getElementsByClassName = rnative.test(document.getElementsByClassName);
  37438. // Support: IE<10
  37439. // Check if getElementById returns elements by name
  37440. // The broken getElementById methods don't pick up programmatically-set names,
  37441. // so use a roundabout getElementsByName test
  37442. support.getById = assert(function (el) {
  37443. docElem.appendChild(el).id = expando;
  37444. return !document.getElementsByName || !document.getElementsByName(expando).length;
  37445. });
  37446. // ID filter and find
  37447. if (support.getById) {
  37448. Expr.filter["ID"] = function (id) {
  37449. var attrId = id.replace(runescape, funescape);
  37450. return function (elem) {
  37451. return elem.getAttribute("id") === attrId;
  37452. };
  37453. };
  37454. Expr.find["ID"] = function (id, context) {
  37455. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37456. var elem = context.getElementById(id);
  37457. return elem ? [elem] : [];
  37458. }
  37459. };
  37460. } else {
  37461. Expr.filter["ID"] = function (id) {
  37462. var attrId = id.replace(runescape, funescape);
  37463. return function (elem) {
  37464. var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  37465. return node && node.value === attrId;
  37466. };
  37467. };
  37468. // Support: IE 6 - 7 only
  37469. // getElementById is not reliable as a find shortcut
  37470. Expr.find["ID"] = function (id, context) {
  37471. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  37472. var node,
  37473. i,
  37474. elems,
  37475. elem = context.getElementById(id);
  37476. if (elem) {
  37477. // Verify the id attribute
  37478. node = elem.getAttributeNode("id");
  37479. if (node && node.value === id) {
  37480. return [elem];
  37481. }
  37482. // Fall back on getElementsByName
  37483. elems = context.getElementsByName(id);
  37484. i = 0;
  37485. while (elem = elems[i++]) {
  37486. node = elem.getAttributeNode("id");
  37487. if (node && node.value === id) {
  37488. return [elem];
  37489. }
  37490. }
  37491. }
  37492. return [];
  37493. }
  37494. };
  37495. }
  37496. // Tag
  37497. Expr.find["TAG"] = support.getElementsByTagName ? function (tag, context) {
  37498. if (typeof context.getElementsByTagName !== "undefined") {
  37499. return context.getElementsByTagName(tag);
  37500. // DocumentFragment nodes don't have gEBTN
  37501. } else if (support.qsa) {
  37502. return context.querySelectorAll(tag);
  37503. }
  37504. } : function (tag, context) {
  37505. var elem,
  37506. tmp = [],
  37507. i = 0,
  37508. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  37509. results = context.getElementsByTagName(tag);
  37510. // Filter out possible comments
  37511. if (tag === "*") {
  37512. while (elem = results[i++]) {
  37513. if (elem.nodeType === 1) {
  37514. tmp.push(elem);
  37515. }
  37516. }
  37517. return tmp;
  37518. }
  37519. return results;
  37520. };
  37521. // Class
  37522. Expr.find["CLASS"] = support.getElementsByClassName && function (className, context) {
  37523. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  37524. return context.getElementsByClassName(className);
  37525. }
  37526. };
  37527. /* QSA/matchesSelector
  37528. ---------------------------------------------------------------------- */
  37529. // QSA and matchesSelector support
  37530. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  37531. rbuggyMatches = [];
  37532. // qSa(:focus) reports false when true (Chrome 21)
  37533. // We allow this because of a bug in IE8/9 that throws an error
  37534. // whenever `document.activeElement` is accessed on an iframe
  37535. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  37536. // See https://bugs.jquery.com/ticket/13378
  37537. rbuggyQSA = [];
  37538. if (support.qsa = rnative.test(document.querySelectorAll)) {
  37539. // Build QSA regex
  37540. // Regex strategy adopted from Diego Perini
  37541. assert(function (el) {
  37542. // Select is set to empty string on purpose
  37543. // This is to test IE's treatment of not explicitly
  37544. // setting a boolean content attribute,
  37545. // since its presence should be enough
  37546. // https://bugs.jquery.com/ticket/12359
  37547. docElem.appendChild(el).innerHTML = "<a id='" + expando + "'></a>" + "<select id='" + expando + "-\r\\' msallowcapture=''>" + "<option selected=''></option></select>";
  37548. // Support: IE8, Opera 11-12.16
  37549. // Nothing should be selected when empty strings follow ^= or $= or *=
  37550. // The test attribute must be unknown in Opera but "safe" for WinRT
  37551. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  37552. if (el.querySelectorAll("[msallowcapture^='']").length) {
  37553. rbuggyQSA.push("[*^$]=" + whitespace + "*(?:''|\"\")");
  37554. }
  37555. // Support: IE8
  37556. // Boolean attributes and "value" are not treated correctly
  37557. if (!el.querySelectorAll("[selected]").length) {
  37558. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  37559. }
  37560. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  37561. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  37562. rbuggyQSA.push("~=");
  37563. }
  37564. // Webkit/Opera - :checked should return selected option elements
  37565. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  37566. // IE8 throws error here and will not see later tests
  37567. if (!el.querySelectorAll(":checked").length) {
  37568. rbuggyQSA.push(":checked");
  37569. }
  37570. // Support: Safari 8+, iOS 8+
  37571. // https://bugs.webkit.org/show_bug.cgi?id=136851
  37572. // In-page `selector#id sibling-combinator selector` fails
  37573. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  37574. rbuggyQSA.push(".#.+[+~]");
  37575. }
  37576. });
  37577. assert(function (el) {
  37578. el.innerHTML = "<a href='' disabled='disabled'></a>" + "<select disabled='disabled'><option/></select>";
  37579. // Support: Windows 8 Native Apps
  37580. // The type and name attributes are restricted during .innerHTML assignment
  37581. var input = document.createElement("input");
  37582. input.setAttribute("type", "hidden");
  37583. el.appendChild(input).setAttribute("name", "D");
  37584. // Support: IE8
  37585. // Enforce case-sensitivity of name attribute
  37586. if (el.querySelectorAll("[name=d]").length) {
  37587. rbuggyQSA.push("name" + whitespace + "*[*^$|!~]?=");
  37588. }
  37589. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  37590. // IE8 throws error here and will not see later tests
  37591. if (el.querySelectorAll(":enabled").length !== 2) {
  37592. rbuggyQSA.push(":enabled", ":disabled");
  37593. }
  37594. // Support: IE9-11+
  37595. // IE's :disabled selector does not pick up the children of disabled fieldsets
  37596. docElem.appendChild(el).disabled = true;
  37597. if (el.querySelectorAll(":disabled").length !== 2) {
  37598. rbuggyQSA.push(":enabled", ":disabled");
  37599. }
  37600. // Opera 10-11 does not throw on post-comma invalid pseudos
  37601. el.querySelectorAll("*,:x");
  37602. rbuggyQSA.push(",.*:");
  37603. });
  37604. }
  37605. if (support.matchesSelector = rnative.test(matches = docElem.matches || docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector)) {
  37606. assert(function (el) {
  37607. // Check to see if it's possible to do matchesSelector
  37608. // on a disconnected node (IE 9)
  37609. support.disconnectedMatch = matches.call(el, "*");
  37610. // This should fail with an exception
  37611. // Gecko does not error, returns false instead
  37612. matches.call(el, "[s!='']:x");
  37613. rbuggyMatches.push("!=", pseudos);
  37614. });
  37615. }
  37616. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  37617. rbuggyMatches = rbuggyMatches.length && new RegExp(rbuggyMatches.join("|"));
  37618. /* Contains
  37619. ---------------------------------------------------------------------- */
  37620. hasCompare = rnative.test(docElem.compareDocumentPosition);
  37621. // Element contains another
  37622. // Purposefully self-exclusive
  37623. // As in, an element does not contain itself
  37624. contains = hasCompare || rnative.test(docElem.contains) ? function (a, b) {
  37625. var adown = a.nodeType === 9 ? a.documentElement : a,
  37626. bup = b && b.parentNode;
  37627. return a === bup || !!(bup && bup.nodeType === 1 && (adown.contains ? adown.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  37628. } : function (a, b) {
  37629. if (b) {
  37630. while (b = b.parentNode) {
  37631. if (b === a) {
  37632. return true;
  37633. }
  37634. }
  37635. }
  37636. return false;
  37637. };
  37638. /* Sorting
  37639. ---------------------------------------------------------------------- */
  37640. // Document order sorting
  37641. sortOrder = hasCompare ? function (a, b) {
  37642. // Flag for duplicate removal
  37643. if (a === b) {
  37644. hasDuplicate = true;
  37645. return 0;
  37646. }
  37647. // Sort on method existence if only one input has compareDocumentPosition
  37648. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  37649. if (compare) {
  37650. return compare;
  37651. }
  37652. // Calculate position if both inputs belong to the same document
  37653. compare = (a.ownerDocument || a) === (b.ownerDocument || b) ? a.compareDocumentPosition(b) :
  37654. // Otherwise we know they are disconnected
  37655. 1;
  37656. // Disconnected nodes
  37657. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  37658. // Choose the first element that is related to our preferred document
  37659. if (a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a)) {
  37660. return -1;
  37661. }
  37662. if (b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b)) {
  37663. return 1;
  37664. }
  37665. // Maintain original order
  37666. return sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37667. }
  37668. return compare & 4 ? -1 : 1;
  37669. } : function (a, b) {
  37670. // Exit early if the nodes are identical
  37671. if (a === b) {
  37672. hasDuplicate = true;
  37673. return 0;
  37674. }
  37675. var cur,
  37676. i = 0,
  37677. aup = a.parentNode,
  37678. bup = b.parentNode,
  37679. ap = [a],
  37680. bp = [b];
  37681. // Parentless nodes are either documents or disconnected
  37682. if (!aup || !bup) {
  37683. return a === document ? -1 : b === document ? 1 : aup ? -1 : bup ? 1 : sortInput ? indexOf(sortInput, a) - indexOf(sortInput, b) : 0;
  37684. // If the nodes are siblings, we can do a quick check
  37685. } else if (aup === bup) {
  37686. return siblingCheck(a, b);
  37687. }
  37688. // Otherwise we need full lists of their ancestors for comparison
  37689. cur = a;
  37690. while (cur = cur.parentNode) {
  37691. ap.unshift(cur);
  37692. }
  37693. cur = b;
  37694. while (cur = cur.parentNode) {
  37695. bp.unshift(cur);
  37696. }
  37697. // Walk down the tree looking for a discrepancy
  37698. while (ap[i] === bp[i]) {
  37699. i++;
  37700. }
  37701. return i ?
  37702. // Do a sibling check if the nodes have a common ancestor
  37703. siblingCheck(ap[i], bp[i]) :
  37704. // Otherwise nodes in our document sort first
  37705. ap[i] === preferredDoc ? -1 : bp[i] === preferredDoc ? 1 : 0;
  37706. };
  37707. return document;
  37708. };
  37709. Sizzle.matches = function (expr, elements) {
  37710. return Sizzle(expr, null, null, elements);
  37711. };
  37712. Sizzle.matchesSelector = function (elem, expr) {
  37713. // Set document vars if needed
  37714. if ((elem.ownerDocument || elem) !== document) {
  37715. setDocument(elem);
  37716. }
  37717. // Make sure that attribute selectors are quoted
  37718. expr = expr.replace(rattributeQuotes, "='$1']");
  37719. if (support.matchesSelector && documentIsHTML && !compilerCache[expr + " "] && (!rbuggyMatches || !rbuggyMatches.test(expr)) && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  37720. try {
  37721. var ret = matches.call(elem, expr);
  37722. // IE 9's matchesSelector returns false on disconnected nodes
  37723. if (ret || support.disconnectedMatch ||
  37724. // As well, disconnected nodes are said to be in a document
  37725. // fragment in IE 9
  37726. elem.document && elem.document.nodeType !== 11) {
  37727. return ret;
  37728. }
  37729. } catch (e) {}
  37730. }
  37731. return Sizzle(expr, document, null, [elem]).length > 0;
  37732. };
  37733. Sizzle.contains = function (context, elem) {
  37734. // Set document vars if needed
  37735. if ((context.ownerDocument || context) !== document) {
  37736. setDocument(context);
  37737. }
  37738. return contains(context, elem);
  37739. };
  37740. Sizzle.attr = function (elem, name) {
  37741. // Set document vars if needed
  37742. if ((elem.ownerDocument || elem) !== document) {
  37743. setDocument(elem);
  37744. }
  37745. var fn = Expr.attrHandle[name.toLowerCase()],
  37746. // Don't get fooled by Object.prototype properties (jQuery #13807)
  37747. val = fn && hasOwn.call(Expr.attrHandle, name.toLowerCase()) ? fn(elem, name, !documentIsHTML) : undefined;
  37748. return val !== undefined ? val : support.attributes || !documentIsHTML ? elem.getAttribute(name) : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  37749. };
  37750. Sizzle.escape = function (sel) {
  37751. return (sel + "").replace(rcssescape, fcssescape);
  37752. };
  37753. Sizzle.error = function (msg) {
  37754. throw new Error("Syntax error, unrecognized expression: " + msg);
  37755. };
  37756. /**
  37757. * Document sorting and removing duplicates
  37758. * @param {ArrayLike} results
  37759. */
  37760. Sizzle.uniqueSort = function (results) {
  37761. var elem,
  37762. duplicates = [],
  37763. j = 0,
  37764. i = 0;
  37765. // Unless we *know* we can detect duplicates, assume their presence
  37766. hasDuplicate = !support.detectDuplicates;
  37767. sortInput = !support.sortStable && results.slice(0);
  37768. results.sort(sortOrder);
  37769. if (hasDuplicate) {
  37770. while (elem = results[i++]) {
  37771. if (elem === results[i]) {
  37772. j = duplicates.push(i);
  37773. }
  37774. }
  37775. while (j--) {
  37776. results.splice(duplicates[j], 1);
  37777. }
  37778. }
  37779. // Clear input after sorting to release objects
  37780. // See https://github.com/jquery/sizzle/pull/225
  37781. sortInput = null;
  37782. return results;
  37783. };
  37784. /**
  37785. * Utility function for retrieving the text value of an array of DOM nodes
  37786. * @param {Array|Element} elem
  37787. */
  37788. getText = Sizzle.getText = function (elem) {
  37789. var node,
  37790. ret = "",
  37791. i = 0,
  37792. nodeType = elem.nodeType;
  37793. if (!nodeType) {
  37794. // If no nodeType, this is expected to be an array
  37795. while (node = elem[i++]) {
  37796. // Do not traverse comment nodes
  37797. ret += getText(node);
  37798. }
  37799. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  37800. // Use textContent for elements
  37801. // innerText usage removed for consistency of new lines (jQuery #11153)
  37802. if (typeof elem.textContent === "string") {
  37803. return elem.textContent;
  37804. } else {
  37805. // Traverse its children
  37806. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  37807. ret += getText(elem);
  37808. }
  37809. }
  37810. } else if (nodeType === 3 || nodeType === 4) {
  37811. return elem.nodeValue;
  37812. }
  37813. // Do not include comment or processing instruction nodes
  37814. return ret;
  37815. };
  37816. Expr = Sizzle.selectors = {
  37817. // Can be adjusted by the user
  37818. cacheLength: 50,
  37819. createPseudo: markFunction,
  37820. match: matchExpr,
  37821. attrHandle: {},
  37822. find: {},
  37823. relative: {
  37824. ">": { dir: "parentNode", first: true },
  37825. " ": { dir: "parentNode" },
  37826. "+": { dir: "previousSibling", first: true },
  37827. "~": { dir: "previousSibling" }
  37828. },
  37829. preFilter: {
  37830. "ATTR": function ATTR(match) {
  37831. match[1] = match[1].replace(runescape, funescape);
  37832. // Move the given value to match[3] whether quoted or unquoted
  37833. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  37834. if (match[2] === "~=") {
  37835. match[3] = " " + match[3] + " ";
  37836. }
  37837. return match.slice(0, 4);
  37838. },
  37839. "CHILD": function CHILD(match) {
  37840. /* matches from matchExpr["CHILD"]
  37841. 1 type (only|nth|...)
  37842. 2 what (child|of-type)
  37843. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  37844. 4 xn-component of xn+y argument ([+-]?\d*n|)
  37845. 5 sign of xn-component
  37846. 6 x of xn-component
  37847. 7 sign of y-component
  37848. 8 y of y-component
  37849. */
  37850. match[1] = match[1].toLowerCase();
  37851. if (match[1].slice(0, 3) === "nth") {
  37852. // nth-* requires argument
  37853. if (!match[3]) {
  37854. Sizzle.error(match[0]);
  37855. }
  37856. // numeric x and y parameters for Expr.filter.CHILD
  37857. // remember that false/true cast respectively to 0/1
  37858. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  37859. match[5] = +(match[7] + match[8] || match[3] === "odd");
  37860. // other types prohibit arguments
  37861. } else if (match[3]) {
  37862. Sizzle.error(match[0]);
  37863. }
  37864. return match;
  37865. },
  37866. "PSEUDO": function PSEUDO(match) {
  37867. var excess,
  37868. unquoted = !match[6] && match[2];
  37869. if (matchExpr["CHILD"].test(match[0])) {
  37870. return null;
  37871. }
  37872. // Accept quoted arguments as-is
  37873. if (match[3]) {
  37874. match[2] = match[4] || match[5] || "";
  37875. // Strip excess characters from unquoted arguments
  37876. } else if (unquoted && rpseudo.test(unquoted) && (
  37877. // Get excess from tokenize (recursively)
  37878. excess = tokenize(unquoted, true)) && (
  37879. // advance to the next closing parenthesis
  37880. excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  37881. // excess is a negative index
  37882. match[0] = match[0].slice(0, excess);
  37883. match[2] = unquoted.slice(0, excess);
  37884. }
  37885. // Return only captures needed by the pseudo filter method (type and argument)
  37886. return match.slice(0, 3);
  37887. }
  37888. },
  37889. filter: {
  37890. "TAG": function TAG(nodeNameSelector) {
  37891. var nodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  37892. return nodeNameSelector === "*" ? function () {
  37893. return true;
  37894. } : function (elem) {
  37895. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  37896. };
  37897. },
  37898. "CLASS": function CLASS(className) {
  37899. var pattern = classCache[className + " "];
  37900. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function (elem) {
  37901. return pattern.test(typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "");
  37902. });
  37903. },
  37904. "ATTR": function ATTR(name, operator, check) {
  37905. return function (elem) {
  37906. var result = Sizzle.attr(elem, name);
  37907. if (result == null) {
  37908. return operator === "!=";
  37909. }
  37910. if (!operator) {
  37911. return true;
  37912. }
  37913. result += "";
  37914. 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;
  37915. };
  37916. },
  37917. "CHILD": function CHILD(type, what, argument, first, last) {
  37918. var simple = type.slice(0, 3) !== "nth",
  37919. forward = type.slice(-4) !== "last",
  37920. ofType = what === "of-type";
  37921. return first === 1 && last === 0 ?
  37922. // Shortcut for :nth-*(n)
  37923. function (elem) {
  37924. return !!elem.parentNode;
  37925. } : function (elem, context, xml) {
  37926. var cache,
  37927. uniqueCache,
  37928. outerCache,
  37929. node,
  37930. nodeIndex,
  37931. start,
  37932. dir = simple !== forward ? "nextSibling" : "previousSibling",
  37933. parent = elem.parentNode,
  37934. name = ofType && elem.nodeName.toLowerCase(),
  37935. useCache = !xml && !ofType,
  37936. diff = false;
  37937. if (parent) {
  37938. // :(first|last|only)-(child|of-type)
  37939. if (simple) {
  37940. while (dir) {
  37941. node = elem;
  37942. while (node = node[dir]) {
  37943. if (ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) {
  37944. return false;
  37945. }
  37946. }
  37947. // Reverse direction for :only-* (if we haven't yet done so)
  37948. start = dir = type === "only" && !start && "nextSibling";
  37949. }
  37950. return true;
  37951. }
  37952. start = [forward ? parent.firstChild : parent.lastChild];
  37953. // non-xml :nth-child(...) stores cache data on `parent`
  37954. if (forward && useCache) {
  37955. // Seek `elem` from a previously-cached index
  37956. // ...in a gzip-friendly way
  37957. node = parent;
  37958. outerCache = node[expando] || (node[expando] = {});
  37959. // Support: IE <9 only
  37960. // Defend against cloned attroperties (jQuery gh-1709)
  37961. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  37962. cache = uniqueCache[type] || [];
  37963. nodeIndex = cache[0] === dirruns && cache[1];
  37964. diff = nodeIndex && cache[2];
  37965. node = nodeIndex && parent.childNodes[nodeIndex];
  37966. while (node = ++nodeIndex && node && node[dir] || (
  37967. // Fallback to seeking `elem` from the start
  37968. diff = nodeIndex = 0) || start.pop()) {
  37969. // When found, cache indexes on `parent` and break
  37970. if (node.nodeType === 1 && ++diff && node === elem) {
  37971. uniqueCache[type] = [dirruns, nodeIndex, diff];
  37972. break;
  37973. }
  37974. }
  37975. } else {
  37976. // Use previously-cached element index if available
  37977. if (useCache) {
  37978. // ...in a gzip-friendly way
  37979. node = elem;
  37980. outerCache = node[expando] || (node[expando] = {});
  37981. // Support: IE <9 only
  37982. // Defend against cloned attroperties (jQuery gh-1709)
  37983. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  37984. cache = uniqueCache[type] || [];
  37985. nodeIndex = cache[0] === dirruns && cache[1];
  37986. diff = nodeIndex;
  37987. }
  37988. // xml :nth-child(...)
  37989. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  37990. if (diff === false) {
  37991. // Use the same loop as above to seek `elem` from the start
  37992. while (node = ++nodeIndex && node && node[dir] || (diff = nodeIndex = 0) || start.pop()) {
  37993. if ((ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1) && ++diff) {
  37994. // Cache the index of each encountered element
  37995. if (useCache) {
  37996. outerCache = node[expando] || (node[expando] = {});
  37997. // Support: IE <9 only
  37998. // Defend against cloned attroperties (jQuery gh-1709)
  37999. uniqueCache = outerCache[node.uniqueID] || (outerCache[node.uniqueID] = {});
  38000. uniqueCache[type] = [dirruns, diff];
  38001. }
  38002. if (node === elem) {
  38003. break;
  38004. }
  38005. }
  38006. }
  38007. }
  38008. }
  38009. // Incorporate the offset, then check against cycle size
  38010. diff -= last;
  38011. return diff === first || diff % first === 0 && diff / first >= 0;
  38012. }
  38013. };
  38014. },
  38015. "PSEUDO": function PSEUDO(pseudo, argument) {
  38016. // pseudo-class names are case-insensitive
  38017. // http://www.w3.org/TR/selectors/#pseudo-classes
  38018. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  38019. // Remember that setFilters inherits from pseudos
  38020. var args,
  38021. fn = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || Sizzle.error("unsupported pseudo: " + pseudo);
  38022. // The user may use createPseudo to indicate that
  38023. // arguments are needed to create the filter function
  38024. // just as Sizzle does
  38025. if (fn[expando]) {
  38026. return fn(argument);
  38027. }
  38028. // But maintain support for old signatures
  38029. if (fn.length > 1) {
  38030. args = [pseudo, pseudo, "", argument];
  38031. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function (seed, matches) {
  38032. var idx,
  38033. matched = fn(seed, argument),
  38034. i = matched.length;
  38035. while (i--) {
  38036. idx = indexOf(seed, matched[i]);
  38037. seed[idx] = !(matches[idx] = matched[i]);
  38038. }
  38039. }) : function (elem) {
  38040. return fn(elem, 0, args);
  38041. };
  38042. }
  38043. return fn;
  38044. }
  38045. },
  38046. pseudos: {
  38047. // Potentially complex pseudos
  38048. "not": markFunction(function (selector) {
  38049. // Trim the selector passed to compile
  38050. // to avoid treating leading and trailing
  38051. // spaces as combinators
  38052. var input = [],
  38053. results = [],
  38054. matcher = compile(selector.replace(rtrim, "$1"));
  38055. return matcher[expando] ? markFunction(function (seed, matches, context, xml) {
  38056. var elem,
  38057. unmatched = matcher(seed, null, xml, []),
  38058. i = seed.length;
  38059. // Match elements unmatched by `matcher`
  38060. while (i--) {
  38061. if (elem = unmatched[i]) {
  38062. seed[i] = !(matches[i] = elem);
  38063. }
  38064. }
  38065. }) : function (elem, context, xml) {
  38066. input[0] = elem;
  38067. matcher(input, null, xml, results);
  38068. // Don't keep the element (issue #299)
  38069. input[0] = null;
  38070. return !results.pop();
  38071. };
  38072. }),
  38073. "has": markFunction(function (selector) {
  38074. return function (elem) {
  38075. return Sizzle(selector, elem).length > 0;
  38076. };
  38077. }),
  38078. "contains": markFunction(function (text) {
  38079. text = text.replace(runescape, funescape);
  38080. return function (elem) {
  38081. return (elem.textContent || elem.innerText || getText(elem)).indexOf(text) > -1;
  38082. };
  38083. }),
  38084. // "Whether an element is represented by a :lang() selector
  38085. // is based solely on the element's language value
  38086. // being equal to the identifier C,
  38087. // or beginning with the identifier C immediately followed by "-".
  38088. // The matching of C against the element's language value is performed case-insensitively.
  38089. // The identifier C does not have to be a valid language name."
  38090. // http://www.w3.org/TR/selectors/#lang-pseudo
  38091. "lang": markFunction(function (lang) {
  38092. // lang value must be a valid identifier
  38093. if (!ridentifier.test(lang || "")) {
  38094. Sizzle.error("unsupported lang: " + lang);
  38095. }
  38096. lang = lang.replace(runescape, funescape).toLowerCase();
  38097. return function (elem) {
  38098. var elemLang;
  38099. do {
  38100. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  38101. elemLang = elemLang.toLowerCase();
  38102. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  38103. }
  38104. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  38105. return false;
  38106. };
  38107. }),
  38108. // Miscellaneous
  38109. "target": function target(elem) {
  38110. var hash = window.location && window.location.hash;
  38111. return hash && hash.slice(1) === elem.id;
  38112. },
  38113. "root": function root(elem) {
  38114. return elem === docElem;
  38115. },
  38116. "focus": function focus(elem) {
  38117. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  38118. },
  38119. // Boolean properties
  38120. "enabled": createDisabledPseudo(false),
  38121. "disabled": createDisabledPseudo(true),
  38122. "checked": function checked(elem) {
  38123. // In CSS3, :checked should return both checked and selected elements
  38124. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  38125. var nodeName = elem.nodeName.toLowerCase();
  38126. return nodeName === "input" && !!elem.checked || nodeName === "option" && !!elem.selected;
  38127. },
  38128. "selected": function selected(elem) {
  38129. // Accessing this property makes selected-by-default
  38130. // options in Safari work properly
  38131. if (elem.parentNode) {
  38132. elem.parentNode.selectedIndex;
  38133. }
  38134. return elem.selected === true;
  38135. },
  38136. // Contents
  38137. "empty": function empty(elem) {
  38138. // http://www.w3.org/TR/selectors/#empty-pseudo
  38139. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  38140. // but not by others (comment: 8; processing instruction: 7; etc.)
  38141. // nodeType < 6 works because attributes (2) do not appear as children
  38142. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  38143. if (elem.nodeType < 6) {
  38144. return false;
  38145. }
  38146. }
  38147. return true;
  38148. },
  38149. "parent": function parent(elem) {
  38150. return !Expr.pseudos["empty"](elem);
  38151. },
  38152. // Element/input types
  38153. "header": function header(elem) {
  38154. return rheader.test(elem.nodeName);
  38155. },
  38156. "input": function input(elem) {
  38157. return rinputs.test(elem.nodeName);
  38158. },
  38159. "button": function button(elem) {
  38160. var name = elem.nodeName.toLowerCase();
  38161. return name === "input" && elem.type === "button" || name === "button";
  38162. },
  38163. "text": function text(elem) {
  38164. var attr;
  38165. return elem.nodeName.toLowerCase() === "input" && elem.type === "text" && (
  38166. // Support: IE<8
  38167. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  38168. (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  38169. },
  38170. // Position-in-collection
  38171. "first": createPositionalPseudo(function () {
  38172. return [0];
  38173. }),
  38174. "last": createPositionalPseudo(function (matchIndexes, length) {
  38175. return [length - 1];
  38176. }),
  38177. "eq": createPositionalPseudo(function (matchIndexes, length, argument) {
  38178. return [argument < 0 ? argument + length : argument];
  38179. }),
  38180. "even": createPositionalPseudo(function (matchIndexes, length) {
  38181. var i = 0;
  38182. for (; i < length; i += 2) {
  38183. matchIndexes.push(i);
  38184. }
  38185. return matchIndexes;
  38186. }),
  38187. "odd": createPositionalPseudo(function (matchIndexes, length) {
  38188. var i = 1;
  38189. for (; i < length; i += 2) {
  38190. matchIndexes.push(i);
  38191. }
  38192. return matchIndexes;
  38193. }),
  38194. "lt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38195. var i = argument < 0 ? argument + length : argument;
  38196. for (; --i >= 0;) {
  38197. matchIndexes.push(i);
  38198. }
  38199. return matchIndexes;
  38200. }),
  38201. "gt": createPositionalPseudo(function (matchIndexes, length, argument) {
  38202. var i = argument < 0 ? argument + length : argument;
  38203. for (; ++i < length;) {
  38204. matchIndexes.push(i);
  38205. }
  38206. return matchIndexes;
  38207. })
  38208. }
  38209. };
  38210. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  38211. // Add button/input type pseudos
  38212. for (i in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  38213. Expr.pseudos[i] = createInputPseudo(i);
  38214. }
  38215. for (i in { submit: true, reset: true }) {
  38216. Expr.pseudos[i] = createButtonPseudo(i);
  38217. }
  38218. // Easy API for creating new setFilters
  38219. function setFilters() {}
  38220. setFilters.prototype = Expr.filters = Expr.pseudos;
  38221. Expr.setFilters = new setFilters();
  38222. tokenize = Sizzle.tokenize = function (selector, parseOnly) {
  38223. var matched,
  38224. match,
  38225. tokens,
  38226. type,
  38227. soFar,
  38228. groups,
  38229. preFilters,
  38230. cached = tokenCache[selector + " "];
  38231. if (cached) {
  38232. return parseOnly ? 0 : cached.slice(0);
  38233. }
  38234. soFar = selector;
  38235. groups = [];
  38236. preFilters = Expr.preFilter;
  38237. while (soFar) {
  38238. // Comma and first run
  38239. if (!matched || (match = rcomma.exec(soFar))) {
  38240. if (match) {
  38241. // Don't consume trailing commas as valid
  38242. soFar = soFar.slice(match[0].length) || soFar;
  38243. }
  38244. groups.push(tokens = []);
  38245. }
  38246. matched = false;
  38247. // Combinators
  38248. if (match = rcombinators.exec(soFar)) {
  38249. matched = match.shift();
  38250. tokens.push({
  38251. value: matched,
  38252. // Cast descendant combinators to space
  38253. type: match[0].replace(rtrim, " ")
  38254. });
  38255. soFar = soFar.slice(matched.length);
  38256. }
  38257. // Filters
  38258. for (type in Expr.filter) {
  38259. if ((match = matchExpr[type].exec(soFar)) && (!preFilters[type] || (match = preFilters[type](match)))) {
  38260. matched = match.shift();
  38261. tokens.push({
  38262. value: matched,
  38263. type: type,
  38264. matches: match
  38265. });
  38266. soFar = soFar.slice(matched.length);
  38267. }
  38268. }
  38269. if (!matched) {
  38270. break;
  38271. }
  38272. }
  38273. // Return the length of the invalid excess
  38274. // if we're just parsing
  38275. // Otherwise, throw an error or return tokens
  38276. return parseOnly ? soFar.length : soFar ? Sizzle.error(selector) :
  38277. // Cache the tokens
  38278. tokenCache(selector, groups).slice(0);
  38279. };
  38280. function toSelector(tokens) {
  38281. var i = 0,
  38282. len = tokens.length,
  38283. selector = "";
  38284. for (; i < len; i++) {
  38285. selector += tokens[i].value;
  38286. }
  38287. return selector;
  38288. }
  38289. function addCombinator(matcher, combinator, base) {
  38290. var dir = combinator.dir,
  38291. skip = combinator.next,
  38292. key = skip || dir,
  38293. checkNonElements = base && key === "parentNode",
  38294. doneName = done++;
  38295. return combinator.first ?
  38296. // Check against closest ancestor/preceding element
  38297. function (elem, context, xml) {
  38298. while (elem = elem[dir]) {
  38299. if (elem.nodeType === 1 || checkNonElements) {
  38300. return matcher(elem, context, xml);
  38301. }
  38302. }
  38303. return false;
  38304. } :
  38305. // Check against all ancestor/preceding elements
  38306. function (elem, context, xml) {
  38307. var oldCache,
  38308. uniqueCache,
  38309. outerCache,
  38310. newCache = [dirruns, doneName];
  38311. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  38312. if (xml) {
  38313. while (elem = elem[dir]) {
  38314. if (elem.nodeType === 1 || checkNonElements) {
  38315. if (matcher(elem, context, xml)) {
  38316. return true;
  38317. }
  38318. }
  38319. }
  38320. } else {
  38321. while (elem = elem[dir]) {
  38322. if (elem.nodeType === 1 || checkNonElements) {
  38323. outerCache = elem[expando] || (elem[expando] = {});
  38324. // Support: IE <9 only
  38325. // Defend against cloned attroperties (jQuery gh-1709)
  38326. uniqueCache = outerCache[elem.uniqueID] || (outerCache[elem.uniqueID] = {});
  38327. if (skip && skip === elem.nodeName.toLowerCase()) {
  38328. elem = elem[dir] || elem;
  38329. } else if ((oldCache = uniqueCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  38330. // Assign to newCache so results back-propagate to previous elements
  38331. return newCache[2] = oldCache[2];
  38332. } else {
  38333. // Reuse newcache so results back-propagate to previous elements
  38334. uniqueCache[key] = newCache;
  38335. // A match means we're done; a fail means we have to keep checking
  38336. if (newCache[2] = matcher(elem, context, xml)) {
  38337. return true;
  38338. }
  38339. }
  38340. }
  38341. }
  38342. }
  38343. return false;
  38344. };
  38345. }
  38346. function elementMatcher(matchers) {
  38347. return matchers.length > 1 ? function (elem, context, xml) {
  38348. var i = matchers.length;
  38349. while (i--) {
  38350. if (!matchers[i](elem, context, xml)) {
  38351. return false;
  38352. }
  38353. }
  38354. return true;
  38355. } : matchers[0];
  38356. }
  38357. function multipleContexts(selector, contexts, results) {
  38358. var i = 0,
  38359. len = contexts.length;
  38360. for (; i < len; i++) {
  38361. Sizzle(selector, contexts[i], results);
  38362. }
  38363. return results;
  38364. }
  38365. function condense(unmatched, map, filter, context, xml) {
  38366. var elem,
  38367. newUnmatched = [],
  38368. i = 0,
  38369. len = unmatched.length,
  38370. mapped = map != null;
  38371. for (; i < len; i++) {
  38372. if (elem = unmatched[i]) {
  38373. if (!filter || filter(elem, context, xml)) {
  38374. newUnmatched.push(elem);
  38375. if (mapped) {
  38376. map.push(i);
  38377. }
  38378. }
  38379. }
  38380. }
  38381. return newUnmatched;
  38382. }
  38383. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  38384. if (postFilter && !postFilter[expando]) {
  38385. postFilter = setMatcher(postFilter);
  38386. }
  38387. if (postFinder && !postFinder[expando]) {
  38388. postFinder = setMatcher(postFinder, postSelector);
  38389. }
  38390. return markFunction(function (seed, results, context, xml) {
  38391. var temp,
  38392. i,
  38393. elem,
  38394. preMap = [],
  38395. postMap = [],
  38396. preexisting = results.length,
  38397. // Get initial elements from seed or context
  38398. elems = seed || multipleContexts(selector || "*", context.nodeType ? [context] : context, []),
  38399. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  38400. matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems,
  38401. matcherOut = matcher ?
  38402. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  38403. postFinder || (seed ? preFilter : preexisting || postFilter) ?
  38404. // ...intermediate processing is necessary
  38405. [] :
  38406. // ...otherwise use results directly
  38407. results : matcherIn;
  38408. // Find primary matches
  38409. if (matcher) {
  38410. matcher(matcherIn, matcherOut, context, xml);
  38411. }
  38412. // Apply postFilter
  38413. if (postFilter) {
  38414. temp = condense(matcherOut, postMap);
  38415. postFilter(temp, [], context, xml);
  38416. // Un-match failing elements by moving them back to matcherIn
  38417. i = temp.length;
  38418. while (i--) {
  38419. if (elem = temp[i]) {
  38420. matcherOut[postMap[i]] = !(matcherIn[postMap[i]] = elem);
  38421. }
  38422. }
  38423. }
  38424. if (seed) {
  38425. if (postFinder || preFilter) {
  38426. if (postFinder) {
  38427. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  38428. temp = [];
  38429. i = matcherOut.length;
  38430. while (i--) {
  38431. if (elem = matcherOut[i]) {
  38432. // Restore matcherIn since elem is not yet a final match
  38433. temp.push(matcherIn[i] = elem);
  38434. }
  38435. }
  38436. postFinder(null, matcherOut = [], temp, xml);
  38437. }
  38438. // Move matched elements from seed to results to keep them synchronized
  38439. i = matcherOut.length;
  38440. while (i--) {
  38441. if ((elem = matcherOut[i]) && (temp = postFinder ? indexOf(seed, elem) : preMap[i]) > -1) {
  38442. seed[temp] = !(results[temp] = elem);
  38443. }
  38444. }
  38445. }
  38446. // Add elements to results, through postFinder if defined
  38447. } else {
  38448. matcherOut = condense(matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut);
  38449. if (postFinder) {
  38450. postFinder(null, results, matcherOut, xml);
  38451. } else {
  38452. push.apply(results, matcherOut);
  38453. }
  38454. }
  38455. });
  38456. }
  38457. function matcherFromTokens(tokens) {
  38458. var checkContext,
  38459. matcher,
  38460. j,
  38461. len = tokens.length,
  38462. leadingRelative = Expr.relative[tokens[0].type],
  38463. implicitRelative = leadingRelative || Expr.relative[" "],
  38464. i = leadingRelative ? 1 : 0,
  38465. // The foundational matcher ensures that elements are reachable from top-level context(s)
  38466. matchContext = addCombinator(function (elem) {
  38467. return elem === checkContext;
  38468. }, implicitRelative, true),
  38469. matchAnyContext = addCombinator(function (elem) {
  38470. return indexOf(checkContext, elem) > -1;
  38471. }, implicitRelative, true),
  38472. matchers = [function (elem, context, xml) {
  38473. var ret = !leadingRelative && (xml || context !== outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  38474. // Avoid hanging onto element (issue #299)
  38475. checkContext = null;
  38476. return ret;
  38477. }];
  38478. for (; i < len; i++) {
  38479. if (matcher = Expr.relative[tokens[i].type]) {
  38480. matchers = [addCombinator(elementMatcher(matchers), matcher)];
  38481. } else {
  38482. matcher = Expr.filter[tokens[i].type].apply(null, tokens[i].matches);
  38483. // Return special upon seeing a positional matcher
  38484. if (matcher[expando]) {
  38485. // Find the next relative operator (if any) for proper handling
  38486. j = ++i;
  38487. for (; j < len; j++) {
  38488. if (Expr.relative[tokens[j].type]) {
  38489. break;
  38490. }
  38491. }
  38492. return setMatcher(i > 1 && elementMatcher(matchers), i > 1 && toSelector(
  38493. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  38494. 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));
  38495. }
  38496. matchers.push(matcher);
  38497. }
  38498. }
  38499. return elementMatcher(matchers);
  38500. }
  38501. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  38502. var bySet = setMatchers.length > 0,
  38503. byElement = elementMatchers.length > 0,
  38504. superMatcher = function superMatcher(seed, context, xml, results, outermost) {
  38505. var elem,
  38506. j,
  38507. matcher,
  38508. matchedCount = 0,
  38509. i = "0",
  38510. unmatched = seed && [],
  38511. setMatched = [],
  38512. contextBackup = outermostContext,
  38513. // We must always have either seed elements or outermost context
  38514. elems = seed || byElement && Expr.find["TAG"]("*", outermost),
  38515. // Use integer dirruns iff this is the outermost matcher
  38516. dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1,
  38517. len = elems.length;
  38518. if (outermost) {
  38519. outermostContext = context === document || context || outermost;
  38520. }
  38521. // Add elements passing elementMatchers directly to results
  38522. // Support: IE<9, Safari
  38523. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  38524. for (; i !== len && (elem = elems[i]) != null; i++) {
  38525. if (byElement && elem) {
  38526. j = 0;
  38527. if (!context && elem.ownerDocument !== document) {
  38528. setDocument(elem);
  38529. xml = !documentIsHTML;
  38530. }
  38531. while (matcher = elementMatchers[j++]) {
  38532. if (matcher(elem, context || document, xml)) {
  38533. results.push(elem);
  38534. break;
  38535. }
  38536. }
  38537. if (outermost) {
  38538. dirruns = dirrunsUnique;
  38539. }
  38540. }
  38541. // Track unmatched elements for set filters
  38542. if (bySet) {
  38543. // They will have gone through all possible matchers
  38544. if (elem = !matcher && elem) {
  38545. matchedCount--;
  38546. }
  38547. // Lengthen the array for every element, matched or not
  38548. if (seed) {
  38549. unmatched.push(elem);
  38550. }
  38551. }
  38552. }
  38553. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  38554. // makes the latter nonnegative.
  38555. matchedCount += i;
  38556. // Apply set filters to unmatched elements
  38557. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  38558. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  38559. // no element matchers and no seed.
  38560. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  38561. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  38562. // numerically zero.
  38563. if (bySet && i !== matchedCount) {
  38564. j = 0;
  38565. while (matcher = setMatchers[j++]) {
  38566. matcher(unmatched, setMatched, context, xml);
  38567. }
  38568. if (seed) {
  38569. // Reintegrate element matches to eliminate the need for sorting
  38570. if (matchedCount > 0) {
  38571. while (i--) {
  38572. if (!(unmatched[i] || setMatched[i])) {
  38573. setMatched[i] = pop.call(results);
  38574. }
  38575. }
  38576. }
  38577. // Discard index placeholder values to get only actual matches
  38578. setMatched = condense(setMatched);
  38579. }
  38580. // Add matches to results
  38581. push.apply(results, setMatched);
  38582. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  38583. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  38584. Sizzle.uniqueSort(results);
  38585. }
  38586. }
  38587. // Override manipulation of globals by nested matchers
  38588. if (outermost) {
  38589. dirruns = dirrunsUnique;
  38590. outermostContext = contextBackup;
  38591. }
  38592. return unmatched;
  38593. };
  38594. return bySet ? markFunction(superMatcher) : superMatcher;
  38595. }
  38596. compile = Sizzle.compile = function (selector, match /* Internal Use Only */) {
  38597. var i,
  38598. setMatchers = [],
  38599. elementMatchers = [],
  38600. cached = compilerCache[selector + " "];
  38601. if (!cached) {
  38602. // Generate a function of recursive functions that can be used to check each element
  38603. if (!match) {
  38604. match = tokenize(selector);
  38605. }
  38606. i = match.length;
  38607. while (i--) {
  38608. cached = matcherFromTokens(match[i]);
  38609. if (cached[expando]) {
  38610. setMatchers.push(cached);
  38611. } else {
  38612. elementMatchers.push(cached);
  38613. }
  38614. }
  38615. // Cache the compiled function
  38616. cached = compilerCache(selector, matcherFromGroupMatchers(elementMatchers, setMatchers));
  38617. // Save selector and tokenization
  38618. cached.selector = selector;
  38619. }
  38620. return cached;
  38621. };
  38622. /**
  38623. * A low-level selection function that works with Sizzle's compiled
  38624. * selector functions
  38625. * @param {String|Function} selector A selector or a pre-compiled
  38626. * selector function built with Sizzle.compile
  38627. * @param {Element} context
  38628. * @param {Array} [results]
  38629. * @param {Array} [seed] A set of elements to match against
  38630. */
  38631. select = Sizzle.select = function (selector, context, results, seed) {
  38632. var i,
  38633. tokens,
  38634. token,
  38635. type,
  38636. find,
  38637. compiled = typeof selector === "function" && selector,
  38638. match = !seed && tokenize(selector = compiled.selector || selector);
  38639. results = results || [];
  38640. // Try to minimize operations if there is only one selector in the list and no seed
  38641. // (the latter of which guarantees us context)
  38642. if (match.length === 1) {
  38643. // Reduce context if the leading compound selector is an ID
  38644. tokens = match[0] = match[0].slice(0);
  38645. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  38646. context = (Expr.find["ID"](token.matches[0].replace(runescape, funescape), context) || [])[0];
  38647. if (!context) {
  38648. return results;
  38649. // Precompiled matchers will still verify ancestry, so step up a level
  38650. } else if (compiled) {
  38651. context = context.parentNode;
  38652. }
  38653. selector = selector.slice(tokens.shift().value.length);
  38654. }
  38655. // Fetch a seed set for right-to-left matching
  38656. i = matchExpr["needsContext"].test(selector) ? 0 : tokens.length;
  38657. while (i--) {
  38658. token = tokens[i];
  38659. // Abort if we hit a combinator
  38660. if (Expr.relative[type = token.type]) {
  38661. break;
  38662. }
  38663. if (find = Expr.find[type]) {
  38664. // Search, expanding context for leading sibling combinators
  38665. if (seed = find(token.matches[0].replace(runescape, funescape), rsibling.test(tokens[0].type) && testContext(context.parentNode) || context)) {
  38666. // If seed is empty or no tokens remain, we can return early
  38667. tokens.splice(i, 1);
  38668. selector = seed.length && toSelector(tokens);
  38669. if (!selector) {
  38670. push.apply(results, seed);
  38671. return results;
  38672. }
  38673. break;
  38674. }
  38675. }
  38676. }
  38677. }
  38678. // Compile and execute a filtering function if one is not provided
  38679. // Provide `match` to avoid retokenization if we modified the selector above
  38680. (compiled || compile(selector, match))(seed, context, !documentIsHTML, results, !context || rsibling.test(selector) && testContext(context.parentNode) || context);
  38681. return results;
  38682. };
  38683. // One-time assignments
  38684. // Sort stability
  38685. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  38686. // Support: Chrome 14-35+
  38687. // Always assume duplicates if they aren't passed to the comparison function
  38688. support.detectDuplicates = !!hasDuplicate;
  38689. // Initialize against the default document
  38690. setDocument();
  38691. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  38692. // Detached nodes confoundingly follow *each other*
  38693. support.sortDetached = assert(function (el) {
  38694. // Should return 1, but returns 4 (following)
  38695. return el.compareDocumentPosition(document.createElement("fieldset")) & 1;
  38696. });
  38697. // Support: IE<8
  38698. // Prevent attribute/property "interpolation"
  38699. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  38700. if (!assert(function (el) {
  38701. el.innerHTML = "<a href='#'></a>";
  38702. return el.firstChild.getAttribute("href") === "#";
  38703. })) {
  38704. addHandle("type|href|height|width", function (elem, name, isXML) {
  38705. if (!isXML) {
  38706. return elem.getAttribute(name, name.toLowerCase() === "type" ? 1 : 2);
  38707. }
  38708. });
  38709. }
  38710. // Support: IE<9
  38711. // Use defaultValue in place of getAttribute("value")
  38712. if (!support.attributes || !assert(function (el) {
  38713. el.innerHTML = "<input/>";
  38714. el.firstChild.setAttribute("value", "");
  38715. return el.firstChild.getAttribute("value") === "";
  38716. })) {
  38717. addHandle("value", function (elem, name, isXML) {
  38718. if (!isXML && elem.nodeName.toLowerCase() === "input") {
  38719. return elem.defaultValue;
  38720. }
  38721. });
  38722. }
  38723. // Support: IE<9
  38724. // Use getAttributeNode to fetch booleans when getAttribute lies
  38725. if (!assert(function (el) {
  38726. return el.getAttribute("disabled") == null;
  38727. })) {
  38728. addHandle(booleans, function (elem, name, isXML) {
  38729. var val;
  38730. if (!isXML) {
  38731. return elem[name] === true ? name.toLowerCase() : (val = elem.getAttributeNode(name)) && val.specified ? val.value : null;
  38732. }
  38733. });
  38734. }
  38735. return Sizzle;
  38736. }(window);
  38737. jQuery.find = Sizzle;
  38738. jQuery.expr = Sizzle.selectors;
  38739. // Deprecated
  38740. jQuery.expr[":"] = jQuery.expr.pseudos;
  38741. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  38742. jQuery.text = Sizzle.getText;
  38743. jQuery.isXMLDoc = Sizzle.isXML;
  38744. jQuery.contains = Sizzle.contains;
  38745. jQuery.escapeSelector = Sizzle.escape;
  38746. var dir = function dir(elem, _dir, until) {
  38747. var matched = [],
  38748. truncate = until !== undefined;
  38749. while ((elem = elem[_dir]) && elem.nodeType !== 9) {
  38750. if (elem.nodeType === 1) {
  38751. if (truncate && jQuery(elem).is(until)) {
  38752. break;
  38753. }
  38754. matched.push(elem);
  38755. }
  38756. }
  38757. return matched;
  38758. };
  38759. var _siblings = function _siblings(n, elem) {
  38760. var matched = [];
  38761. for (; n; n = n.nextSibling) {
  38762. if (n.nodeType === 1 && n !== elem) {
  38763. matched.push(n);
  38764. }
  38765. }
  38766. return matched;
  38767. };
  38768. var rneedsContext = jQuery.expr.match.needsContext;
  38769. function nodeName(elem, name) {
  38770. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  38771. };
  38772. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  38773. // Implement the identical functionality for filter and not
  38774. function winnow(elements, qualifier, not) {
  38775. if (isFunction(qualifier)) {
  38776. return jQuery.grep(elements, function (elem, i) {
  38777. return !!qualifier.call(elem, i, elem) !== not;
  38778. });
  38779. }
  38780. // Single element
  38781. if (qualifier.nodeType) {
  38782. return jQuery.grep(elements, function (elem) {
  38783. return elem === qualifier !== not;
  38784. });
  38785. }
  38786. // Arraylike of elements (jQuery, arguments, Array)
  38787. if (typeof qualifier !== "string") {
  38788. return jQuery.grep(elements, function (elem) {
  38789. return indexOf.call(qualifier, elem) > -1 !== not;
  38790. });
  38791. }
  38792. // Filtered directly for both simple and complex selectors
  38793. return jQuery.filter(qualifier, elements, not);
  38794. }
  38795. jQuery.filter = function (expr, elems, not) {
  38796. var elem = elems[0];
  38797. if (not) {
  38798. expr = ":not(" + expr + ")";
  38799. }
  38800. if (elems.length === 1 && elem.nodeType === 1) {
  38801. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  38802. }
  38803. return jQuery.find.matches(expr, jQuery.grep(elems, function (elem) {
  38804. return elem.nodeType === 1;
  38805. }));
  38806. };
  38807. jQuery.fn.extend({
  38808. find: function find(selector) {
  38809. var i,
  38810. ret,
  38811. len = this.length,
  38812. self = this;
  38813. if (typeof selector !== "string") {
  38814. return this.pushStack(jQuery(selector).filter(function () {
  38815. for (i = 0; i < len; i++) {
  38816. if (jQuery.contains(self[i], this)) {
  38817. return true;
  38818. }
  38819. }
  38820. }));
  38821. }
  38822. ret = this.pushStack([]);
  38823. for (i = 0; i < len; i++) {
  38824. jQuery.find(selector, self[i], ret);
  38825. }
  38826. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  38827. },
  38828. filter: function filter(selector) {
  38829. return this.pushStack(winnow(this, selector || [], false));
  38830. },
  38831. not: function not(selector) {
  38832. return this.pushStack(winnow(this, selector || [], true));
  38833. },
  38834. is: function is(selector) {
  38835. return !!winnow(this,
  38836. // If this is a positional/relative selector, check membership in the returned set
  38837. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  38838. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [], false).length;
  38839. }
  38840. });
  38841. // Initialize a jQuery object
  38842. // A central reference to the root jQuery(document)
  38843. var rootjQuery,
  38844. // A simple way to check for HTML strings
  38845. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  38846. // Strict HTML recognition (#11290: must start with <)
  38847. // Shortcut simple #id case for speed
  38848. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  38849. init = jQuery.fn.init = function (selector, context, root) {
  38850. var match, elem;
  38851. // HANDLE: $(""), $(null), $(undefined), $(false)
  38852. if (!selector) {
  38853. return this;
  38854. }
  38855. // Method init() accepts an alternate rootjQuery
  38856. // so migrate can support jQuery.sub (gh-2101)
  38857. root = root || rootjQuery;
  38858. // Handle HTML strings
  38859. if (typeof selector === "string") {
  38860. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  38861. // Assume that strings that start and end with <> are HTML and skip the regex check
  38862. match = [null, selector, null];
  38863. } else {
  38864. match = rquickExpr.exec(selector);
  38865. }
  38866. // Match html or make sure no context is specified for #id
  38867. if (match && (match[1] || !context)) {
  38868. // HANDLE: $(html) -> $(array)
  38869. if (match[1]) {
  38870. context = context instanceof jQuery ? context[0] : context;
  38871. // Option to run scripts is true for back-compat
  38872. // Intentionally let the error be thrown if parseHTML is not present
  38873. jQuery.merge(this, jQuery.parseHTML(match[1], context && context.nodeType ? context.ownerDocument || context : document, true));
  38874. // HANDLE: $(html, props)
  38875. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  38876. for (match in context) {
  38877. // Properties of context are called as methods if possible
  38878. if (isFunction(this[match])) {
  38879. this[match](context[match]);
  38880. // ...and otherwise set as attributes
  38881. } else {
  38882. this.attr(match, context[match]);
  38883. }
  38884. }
  38885. }
  38886. return this;
  38887. // HANDLE: $(#id)
  38888. } else {
  38889. elem = document.getElementById(match[2]);
  38890. if (elem) {
  38891. // Inject the element directly into the jQuery object
  38892. this[0] = elem;
  38893. this.length = 1;
  38894. }
  38895. return this;
  38896. }
  38897. // HANDLE: $(expr, $(...))
  38898. } else if (!context || context.jquery) {
  38899. return (context || root).find(selector);
  38900. // HANDLE: $(expr, context)
  38901. // (which is just equivalent to: $(context).find(expr)
  38902. } else {
  38903. return this.constructor(context).find(selector);
  38904. }
  38905. // HANDLE: $(DOMElement)
  38906. } else if (selector.nodeType) {
  38907. this[0] = selector;
  38908. this.length = 1;
  38909. return this;
  38910. // HANDLE: $(function)
  38911. // Shortcut for document ready
  38912. } else if (isFunction(selector)) {
  38913. return root.ready !== undefined ? root.ready(selector) :
  38914. // Execute immediately if ready is not present
  38915. selector(jQuery);
  38916. }
  38917. return jQuery.makeArray(selector, this);
  38918. };
  38919. // Give the init function the jQuery prototype for later instantiation
  38920. init.prototype = jQuery.fn;
  38921. // Initialize central reference
  38922. rootjQuery = jQuery(document);
  38923. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  38924. // Methods guaranteed to produce a unique set when starting from a unique set
  38925. guaranteedUnique = {
  38926. children: true,
  38927. contents: true,
  38928. next: true,
  38929. prev: true
  38930. };
  38931. jQuery.fn.extend({
  38932. has: function has(target) {
  38933. var targets = jQuery(target, this),
  38934. l = targets.length;
  38935. return this.filter(function () {
  38936. var i = 0;
  38937. for (; i < l; i++) {
  38938. if (jQuery.contains(this, targets[i])) {
  38939. return true;
  38940. }
  38941. }
  38942. });
  38943. },
  38944. closest: function closest(selectors, context) {
  38945. var cur,
  38946. i = 0,
  38947. l = this.length,
  38948. matched = [],
  38949. targets = typeof selectors !== "string" && jQuery(selectors);
  38950. // Positional selectors never match, since there's no _selection_ context
  38951. if (!rneedsContext.test(selectors)) {
  38952. for (; i < l; i++) {
  38953. for (cur = this[i]; cur && cur !== context; cur = cur.parentNode) {
  38954. // Always skip document fragments
  38955. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 :
  38956. // Don't pass non-elements to Sizzle
  38957. cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  38958. matched.push(cur);
  38959. break;
  38960. }
  38961. }
  38962. }
  38963. }
  38964. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  38965. },
  38966. // Determine the position of an element within the set
  38967. index: function index(elem) {
  38968. // No argument, return index in parent
  38969. if (!elem) {
  38970. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  38971. }
  38972. // Index in selector
  38973. if (typeof elem === "string") {
  38974. return indexOf.call(jQuery(elem), this[0]);
  38975. }
  38976. // Locate the position of the desired element
  38977. return indexOf.call(this,
  38978. // If it receives a jQuery object, the first element is used
  38979. elem.jquery ? elem[0] : elem);
  38980. },
  38981. add: function add(selector, context) {
  38982. return this.pushStack(jQuery.uniqueSort(jQuery.merge(this.get(), jQuery(selector, context))));
  38983. },
  38984. addBack: function addBack(selector) {
  38985. return this.add(selector == null ? this.prevObject : this.prevObject.filter(selector));
  38986. }
  38987. });
  38988. function sibling(cur, dir) {
  38989. while ((cur = cur[dir]) && cur.nodeType !== 1) {}
  38990. return cur;
  38991. }
  38992. jQuery.each({
  38993. parent: function parent(elem) {
  38994. var parent = elem.parentNode;
  38995. return parent && parent.nodeType !== 11 ? parent : null;
  38996. },
  38997. parents: function parents(elem) {
  38998. return dir(elem, "parentNode");
  38999. },
  39000. parentsUntil: function parentsUntil(elem, i, until) {
  39001. return dir(elem, "parentNode", until);
  39002. },
  39003. next: function next(elem) {
  39004. return sibling(elem, "nextSibling");
  39005. },
  39006. prev: function prev(elem) {
  39007. return sibling(elem, "previousSibling");
  39008. },
  39009. nextAll: function nextAll(elem) {
  39010. return dir(elem, "nextSibling");
  39011. },
  39012. prevAll: function prevAll(elem) {
  39013. return dir(elem, "previousSibling");
  39014. },
  39015. nextUntil: function nextUntil(elem, i, until) {
  39016. return dir(elem, "nextSibling", until);
  39017. },
  39018. prevUntil: function prevUntil(elem, i, until) {
  39019. return dir(elem, "previousSibling", until);
  39020. },
  39021. siblings: function siblings(elem) {
  39022. return _siblings((elem.parentNode || {}).firstChild, elem);
  39023. },
  39024. children: function children(elem) {
  39025. return _siblings(elem.firstChild);
  39026. },
  39027. contents: function contents(elem) {
  39028. if (nodeName(elem, "iframe")) {
  39029. return elem.contentDocument;
  39030. }
  39031. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  39032. // Treat the template element as a regular one in browsers that
  39033. // don't support it.
  39034. if (nodeName(elem, "template")) {
  39035. elem = elem.content || elem;
  39036. }
  39037. return jQuery.merge([], elem.childNodes);
  39038. }
  39039. }, function (name, fn) {
  39040. jQuery.fn[name] = function (until, selector) {
  39041. var matched = jQuery.map(this, fn, until);
  39042. if (name.slice(-5) !== "Until") {
  39043. selector = until;
  39044. }
  39045. if (selector && typeof selector === "string") {
  39046. matched = jQuery.filter(selector, matched);
  39047. }
  39048. if (this.length > 1) {
  39049. // Remove duplicates
  39050. if (!guaranteedUnique[name]) {
  39051. jQuery.uniqueSort(matched);
  39052. }
  39053. // Reverse order for parents* and prev-derivatives
  39054. if (rparentsprev.test(name)) {
  39055. matched.reverse();
  39056. }
  39057. }
  39058. return this.pushStack(matched);
  39059. };
  39060. });
  39061. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  39062. // Convert String-formatted options into Object-formatted ones
  39063. function createOptions(options) {
  39064. var object = {};
  39065. jQuery.each(options.match(rnothtmlwhite) || [], function (_, flag) {
  39066. object[flag] = true;
  39067. });
  39068. return object;
  39069. }
  39070. /*
  39071. * Create a callback list using the following parameters:
  39072. *
  39073. * options: an optional list of space-separated options that will change how
  39074. * the callback list behaves or a more traditional option object
  39075. *
  39076. * By default a callback list will act like an event callback list and can be
  39077. * "fired" multiple times.
  39078. *
  39079. * Possible options:
  39080. *
  39081. * once: will ensure the callback list can only be fired once (like a Deferred)
  39082. *
  39083. * memory: will keep track of previous values and will call any callback added
  39084. * after the list has been fired right away with the latest "memorized"
  39085. * values (like a Deferred)
  39086. *
  39087. * unique: will ensure a callback can only be added once (no duplicate in the list)
  39088. *
  39089. * stopOnFalse: interrupt callings when a callback returns false
  39090. *
  39091. */
  39092. jQuery.Callbacks = function (options) {
  39093. // Convert options from String-formatted to Object-formatted if needed
  39094. // (we check in cache first)
  39095. options = typeof options === "string" ? createOptions(options) : jQuery.extend({}, options);
  39096. var // Flag to know if list is currently firing
  39097. firing,
  39098. // Last fire value for non-forgettable lists
  39099. memory,
  39100. // Flag to know if list was already fired
  39101. _fired,
  39102. // Flag to prevent firing
  39103. _locked,
  39104. // Actual callback list
  39105. list = [],
  39106. // Queue of execution data for repeatable lists
  39107. queue = [],
  39108. // Index of currently firing callback (modified by add/remove as needed)
  39109. firingIndex = -1,
  39110. // Fire callbacks
  39111. fire = function fire() {
  39112. // Enforce single-firing
  39113. _locked = _locked || options.once;
  39114. // Execute callbacks for all pending executions,
  39115. // respecting firingIndex overrides and runtime changes
  39116. _fired = firing = true;
  39117. for (; queue.length; firingIndex = -1) {
  39118. memory = queue.shift();
  39119. while (++firingIndex < list.length) {
  39120. // Run callback and check for early termination
  39121. if (list[firingIndex].apply(memory[0], memory[1]) === false && options.stopOnFalse) {
  39122. // Jump to end and forget the data so .add doesn't re-fire
  39123. firingIndex = list.length;
  39124. memory = false;
  39125. }
  39126. }
  39127. }
  39128. // Forget the data if we're done with it
  39129. if (!options.memory) {
  39130. memory = false;
  39131. }
  39132. firing = false;
  39133. // Clean up if we're done firing for good
  39134. if (_locked) {
  39135. // Keep an empty list if we have data for future add calls
  39136. if (memory) {
  39137. list = [];
  39138. // Otherwise, this object is spent
  39139. } else {
  39140. list = "";
  39141. }
  39142. }
  39143. },
  39144. // Actual Callbacks object
  39145. self = {
  39146. // Add a callback or a collection of callbacks to the list
  39147. add: function add() {
  39148. if (list) {
  39149. // If we have memory from a past run, we should fire after adding
  39150. if (memory && !firing) {
  39151. firingIndex = list.length - 1;
  39152. queue.push(memory);
  39153. }
  39154. (function add(args) {
  39155. jQuery.each(args, function (_, arg) {
  39156. if (isFunction(arg)) {
  39157. if (!options.unique || !self.has(arg)) {
  39158. list.push(arg);
  39159. }
  39160. } else if (arg && arg.length && toType(arg) !== "string") {
  39161. // Inspect recursively
  39162. add(arg);
  39163. }
  39164. });
  39165. })(arguments);
  39166. if (memory && !firing) {
  39167. fire();
  39168. }
  39169. }
  39170. return this;
  39171. },
  39172. // Remove a callback from the list
  39173. remove: function remove() {
  39174. jQuery.each(arguments, function (_, arg) {
  39175. var index;
  39176. while ((index = jQuery.inArray(arg, list, index)) > -1) {
  39177. list.splice(index, 1);
  39178. // Handle firing indexes
  39179. if (index <= firingIndex) {
  39180. firingIndex--;
  39181. }
  39182. }
  39183. });
  39184. return this;
  39185. },
  39186. // Check if a given callback is in the list.
  39187. // If no argument is given, return whether or not list has callbacks attached.
  39188. has: function has(fn) {
  39189. return fn ? jQuery.inArray(fn, list) > -1 : list.length > 0;
  39190. },
  39191. // Remove all callbacks from the list
  39192. empty: function empty() {
  39193. if (list) {
  39194. list = [];
  39195. }
  39196. return this;
  39197. },
  39198. // Disable .fire and .add
  39199. // Abort any current/pending executions
  39200. // Clear all callbacks and values
  39201. disable: function disable() {
  39202. _locked = queue = [];
  39203. list = memory = "";
  39204. return this;
  39205. },
  39206. disabled: function disabled() {
  39207. return !list;
  39208. },
  39209. // Disable .fire
  39210. // Also disable .add unless we have memory (since it would have no effect)
  39211. // Abort any pending executions
  39212. lock: function lock() {
  39213. _locked = queue = [];
  39214. if (!memory && !firing) {
  39215. list = memory = "";
  39216. }
  39217. return this;
  39218. },
  39219. locked: function locked() {
  39220. return !!_locked;
  39221. },
  39222. // Call all callbacks with the given context and arguments
  39223. fireWith: function fireWith(context, args) {
  39224. if (!_locked) {
  39225. args = args || [];
  39226. args = [context, args.slice ? args.slice() : args];
  39227. queue.push(args);
  39228. if (!firing) {
  39229. fire();
  39230. }
  39231. }
  39232. return this;
  39233. },
  39234. // Call all the callbacks with the given arguments
  39235. fire: function fire() {
  39236. self.fireWith(this, arguments);
  39237. return this;
  39238. },
  39239. // To know if the callbacks have already been called at least once
  39240. fired: function fired() {
  39241. return !!_fired;
  39242. }
  39243. };
  39244. return self;
  39245. };
  39246. function Identity(v) {
  39247. return v;
  39248. }
  39249. function Thrower(ex) {
  39250. throw ex;
  39251. }
  39252. function adoptValue(value, resolve, reject, noValue) {
  39253. var method;
  39254. try {
  39255. // Check for promise aspect first to privilege synchronous behavior
  39256. if (value && isFunction(method = value.promise)) {
  39257. method.call(value).done(resolve).fail(reject);
  39258. // Other thenables
  39259. } else if (value && isFunction(method = value.then)) {
  39260. method.call(value, resolve, reject);
  39261. // Other non-thenables
  39262. } else {
  39263. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  39264. // * false: [ value ].slice( 0 ) => resolve( value )
  39265. // * true: [ value ].slice( 1 ) => resolve()
  39266. resolve.apply(undefined, [value].slice(noValue));
  39267. }
  39268. // For Promises/A+, convert exceptions into rejections
  39269. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  39270. // Deferred#then to conditionally suppress rejection.
  39271. } catch (value) {
  39272. // Support: Android 4.0 only
  39273. // Strict mode functions invoked without .call/.apply get global-object context
  39274. reject.apply(undefined, [value]);
  39275. }
  39276. }
  39277. jQuery.extend({
  39278. Deferred: function Deferred(func) {
  39279. var tuples = [
  39280. // action, add listener, callbacks,
  39281. // ... .then handlers, argument index, [final state]
  39282. ["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"]],
  39283. _state = "pending",
  39284. _promise = {
  39285. state: function state() {
  39286. return _state;
  39287. },
  39288. always: function always() {
  39289. deferred.done(arguments).fail(arguments);
  39290. return this;
  39291. },
  39292. "catch": function _catch(fn) {
  39293. return _promise.then(null, fn);
  39294. },
  39295. // Keep pipe for back-compat
  39296. pipe: function pipe() /* fnDone, fnFail, fnProgress */{
  39297. var fns = arguments;
  39298. return jQuery.Deferred(function (newDefer) {
  39299. jQuery.each(tuples, function (i, tuple) {
  39300. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  39301. var fn = isFunction(fns[tuple[4]]) && fns[tuple[4]];
  39302. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  39303. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  39304. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  39305. deferred[tuple[1]](function () {
  39306. var returned = fn && fn.apply(this, arguments);
  39307. if (returned && isFunction(returned.promise)) {
  39308. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  39309. } else {
  39310. newDefer[tuple[0] + "With"](this, fn ? [returned] : arguments);
  39311. }
  39312. });
  39313. });
  39314. fns = null;
  39315. }).promise();
  39316. },
  39317. then: function then(onFulfilled, onRejected, onProgress) {
  39318. var maxDepth = 0;
  39319. function resolve(depth, deferred, handler, special) {
  39320. return function () {
  39321. var that = this,
  39322. args = arguments,
  39323. mightThrow = function mightThrow() {
  39324. var returned, then;
  39325. // Support: Promises/A+ section 2.3.3.3.3
  39326. // https://promisesaplus.com/#point-59
  39327. // Ignore double-resolution attempts
  39328. if (depth < maxDepth) {
  39329. return;
  39330. }
  39331. returned = handler.apply(that, args);
  39332. // Support: Promises/A+ section 2.3.1
  39333. // https://promisesaplus.com/#point-48
  39334. if (returned === deferred.promise()) {
  39335. throw new TypeError("Thenable self-resolution");
  39336. }
  39337. // Support: Promises/A+ sections 2.3.3.1, 3.5
  39338. // https://promisesaplus.com/#point-54
  39339. // https://promisesaplus.com/#point-75
  39340. // Retrieve `then` only once
  39341. then = returned && (
  39342. // Support: Promises/A+ section 2.3.4
  39343. // https://promisesaplus.com/#point-64
  39344. // Only check objects and functions for thenability
  39345. (typeof returned === "undefined" ? "undefined" : _typeof(returned)) === "object" || typeof returned === "function") && returned.then;
  39346. // Handle a returned thenable
  39347. if (isFunction(then)) {
  39348. // Special processors (notify) just wait for resolution
  39349. if (special) {
  39350. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special));
  39351. // Normal processors (resolve) also hook into progress
  39352. } else {
  39353. // ...and disregard older resolution values
  39354. maxDepth++;
  39355. then.call(returned, resolve(maxDepth, deferred, Identity, special), resolve(maxDepth, deferred, Thrower, special), resolve(maxDepth, deferred, Identity, deferred.notifyWith));
  39356. }
  39357. // Handle all other returned values
  39358. } else {
  39359. // Only substitute handlers pass on context
  39360. // and multiple values (non-spec behavior)
  39361. if (handler !== Identity) {
  39362. that = undefined;
  39363. args = [returned];
  39364. }
  39365. // Process the value(s)
  39366. // Default process is resolve
  39367. (special || deferred.resolveWith)(that, args);
  39368. }
  39369. },
  39370. // Only normal processors (resolve) catch and reject exceptions
  39371. process = special ? mightThrow : function () {
  39372. try {
  39373. mightThrow();
  39374. } catch (e) {
  39375. if (jQuery.Deferred.exceptionHook) {
  39376. jQuery.Deferred.exceptionHook(e, process.stackTrace);
  39377. }
  39378. // Support: Promises/A+ section 2.3.3.3.4.1
  39379. // https://promisesaplus.com/#point-61
  39380. // Ignore post-resolution exceptions
  39381. if (depth + 1 >= maxDepth) {
  39382. // Only substitute handlers pass on context
  39383. // and multiple values (non-spec behavior)
  39384. if (handler !== Thrower) {
  39385. that = undefined;
  39386. args = [e];
  39387. }
  39388. deferred.rejectWith(that, args);
  39389. }
  39390. }
  39391. };
  39392. // Support: Promises/A+ section 2.3.3.3.1
  39393. // https://promisesaplus.com/#point-57
  39394. // Re-resolve promises immediately to dodge false rejection from
  39395. // subsequent errors
  39396. if (depth) {
  39397. process();
  39398. } else {
  39399. // Call an optional hook to record the stack, in case of exception
  39400. // since it's otherwise lost when execution goes async
  39401. if (jQuery.Deferred.getStackHook) {
  39402. process.stackTrace = jQuery.Deferred.getStackHook();
  39403. }
  39404. window.setTimeout(process);
  39405. }
  39406. };
  39407. }
  39408. return jQuery.Deferred(function (newDefer) {
  39409. // progress_handlers.add( ... )
  39410. tuples[0][3].add(resolve(0, newDefer, isFunction(onProgress) ? onProgress : Identity, newDefer.notifyWith));
  39411. // fulfilled_handlers.add( ... )
  39412. tuples[1][3].add(resolve(0, newDefer, isFunction(onFulfilled) ? onFulfilled : Identity));
  39413. // rejected_handlers.add( ... )
  39414. tuples[2][3].add(resolve(0, newDefer, isFunction(onRejected) ? onRejected : Thrower));
  39415. }).promise();
  39416. },
  39417. // Get a promise for this deferred
  39418. // If obj is provided, the promise aspect is added to the object
  39419. promise: function promise(obj) {
  39420. return obj != null ? jQuery.extend(obj, _promise) : _promise;
  39421. }
  39422. },
  39423. deferred = {};
  39424. // Add list-specific methods
  39425. jQuery.each(tuples, function (i, tuple) {
  39426. var list = tuple[2],
  39427. stateString = tuple[5];
  39428. // promise.progress = list.add
  39429. // promise.done = list.add
  39430. // promise.fail = list.add
  39431. _promise[tuple[1]] = list.add;
  39432. // Handle state
  39433. if (stateString) {
  39434. list.add(function () {
  39435. // state = "resolved" (i.e., fulfilled)
  39436. // state = "rejected"
  39437. _state = stateString;
  39438. },
  39439. // rejected_callbacks.disable
  39440. // fulfilled_callbacks.disable
  39441. tuples[3 - i][2].disable,
  39442. // rejected_handlers.disable
  39443. // fulfilled_handlers.disable
  39444. tuples[3 - i][3].disable,
  39445. // progress_callbacks.lock
  39446. tuples[0][2].lock,
  39447. // progress_handlers.lock
  39448. tuples[0][3].lock);
  39449. }
  39450. // progress_handlers.fire
  39451. // fulfilled_handlers.fire
  39452. // rejected_handlers.fire
  39453. list.add(tuple[3].fire);
  39454. // deferred.notify = function() { deferred.notifyWith(...) }
  39455. // deferred.resolve = function() { deferred.resolveWith(...) }
  39456. // deferred.reject = function() { deferred.rejectWith(...) }
  39457. deferred[tuple[0]] = function () {
  39458. deferred[tuple[0] + "With"](this === deferred ? undefined : this, arguments);
  39459. return this;
  39460. };
  39461. // deferred.notifyWith = list.fireWith
  39462. // deferred.resolveWith = list.fireWith
  39463. // deferred.rejectWith = list.fireWith
  39464. deferred[tuple[0] + "With"] = list.fireWith;
  39465. });
  39466. // Make the deferred a promise
  39467. _promise.promise(deferred);
  39468. // Call given func if any
  39469. if (func) {
  39470. func.call(deferred, deferred);
  39471. }
  39472. // All done!
  39473. return deferred;
  39474. },
  39475. // Deferred helper
  39476. when: function when(singleValue) {
  39477. var
  39478. // count of uncompleted subordinates
  39479. remaining = arguments.length,
  39480. // count of unprocessed arguments
  39481. i = remaining,
  39482. // subordinate fulfillment data
  39483. resolveContexts = Array(i),
  39484. resolveValues = _slice.call(arguments),
  39485. // the master Deferred
  39486. master = jQuery.Deferred(),
  39487. // subordinate callback factory
  39488. updateFunc = function updateFunc(i) {
  39489. return function (value) {
  39490. resolveContexts[i] = this;
  39491. resolveValues[i] = arguments.length > 1 ? _slice.call(arguments) : value;
  39492. if (! --remaining) {
  39493. master.resolveWith(resolveContexts, resolveValues);
  39494. }
  39495. };
  39496. };
  39497. // Single- and empty arguments are adopted like Promise.resolve
  39498. if (remaining <= 1) {
  39499. adoptValue(singleValue, master.done(updateFunc(i)).resolve, master.reject, !remaining);
  39500. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  39501. if (master.state() === "pending" || isFunction(resolveValues[i] && resolveValues[i].then)) {
  39502. return master.then();
  39503. }
  39504. }
  39505. // Multiple arguments are aggregated like Promise.all array elements
  39506. while (i--) {
  39507. adoptValue(resolveValues[i], updateFunc(i), master.reject);
  39508. }
  39509. return master.promise();
  39510. }
  39511. });
  39512. // These usually indicate a programmer mistake during development,
  39513. // warn about them ASAP rather than swallowing them by default.
  39514. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  39515. jQuery.Deferred.exceptionHook = function (error, stack) {
  39516. // Support: IE 8 - 9 only
  39517. // Console exists when dev tools are open, which can happen at any time
  39518. if (window.console && window.console.warn && error && rerrorNames.test(error.name)) {
  39519. window.console.warn("jQuery.Deferred exception: " + error.message, error.stack, stack);
  39520. }
  39521. };
  39522. jQuery.readyException = function (error) {
  39523. window.setTimeout(function () {
  39524. throw error;
  39525. });
  39526. };
  39527. // The deferred used on DOM ready
  39528. var readyList = jQuery.Deferred();
  39529. jQuery.fn.ready = function (fn) {
  39530. readyList.then(fn)
  39531. // Wrap jQuery.readyException in a function so that the lookup
  39532. // happens at the time of error handling instead of callback
  39533. // registration.
  39534. .catch(function (error) {
  39535. jQuery.readyException(error);
  39536. });
  39537. return this;
  39538. };
  39539. jQuery.extend({
  39540. // Is the DOM ready to be used? Set to true once it occurs.
  39541. isReady: false,
  39542. // A counter to track how many items to wait for before
  39543. // the ready event fires. See #6781
  39544. readyWait: 1,
  39545. // Handle when the DOM is ready
  39546. ready: function ready(wait) {
  39547. // Abort if there are pending holds or we're already ready
  39548. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  39549. return;
  39550. }
  39551. // Remember that the DOM is ready
  39552. jQuery.isReady = true;
  39553. // If a normal DOM Ready event fired, decrement, and wait if need be
  39554. if (wait !== true && --jQuery.readyWait > 0) {
  39555. return;
  39556. }
  39557. // If there are functions bound, to execute
  39558. readyList.resolveWith(document, [jQuery]);
  39559. }
  39560. });
  39561. jQuery.ready.then = readyList.then;
  39562. // The ready event handler and self cleanup method
  39563. function completed() {
  39564. document.removeEventListener("DOMContentLoaded", completed);
  39565. window.removeEventListener("load", completed);
  39566. jQuery.ready();
  39567. }
  39568. // Catch cases where $(document).ready() is called
  39569. // after the browser event has already occurred.
  39570. // Support: IE <=9 - 10 only
  39571. // Older IE sometimes signals "interactive" too soon
  39572. if (document.readyState === "complete" || document.readyState !== "loading" && !document.documentElement.doScroll) {
  39573. // Handle it asynchronously to allow scripts the opportunity to delay ready
  39574. window.setTimeout(jQuery.ready);
  39575. } else {
  39576. // Use the handy event callback
  39577. document.addEventListener("DOMContentLoaded", completed);
  39578. // A fallback to window.onload, that will always work
  39579. window.addEventListener("load", completed);
  39580. }
  39581. // Multifunctional method to get and set values of a collection
  39582. // The value/s can optionally be executed if it's a function
  39583. var access = function access(elems, fn, key, value, chainable, emptyGet, raw) {
  39584. var i = 0,
  39585. len = elems.length,
  39586. bulk = key == null;
  39587. // Sets many values
  39588. if (toType(key) === "object") {
  39589. chainable = true;
  39590. for (i in key) {
  39591. access(elems, fn, i, key[i], true, emptyGet, raw);
  39592. }
  39593. // Sets one value
  39594. } else if (value !== undefined) {
  39595. chainable = true;
  39596. if (!isFunction(value)) {
  39597. raw = true;
  39598. }
  39599. if (bulk) {
  39600. // Bulk operations run against the entire set
  39601. if (raw) {
  39602. fn.call(elems, value);
  39603. fn = null;
  39604. // ...except when executing function values
  39605. } else {
  39606. bulk = fn;
  39607. fn = function fn(elem, key, value) {
  39608. return bulk.call(jQuery(elem), value);
  39609. };
  39610. }
  39611. }
  39612. if (fn) {
  39613. for (; i < len; i++) {
  39614. fn(elems[i], key, raw ? value : value.call(elems[i], i, fn(elems[i], key)));
  39615. }
  39616. }
  39617. }
  39618. if (chainable) {
  39619. return elems;
  39620. }
  39621. // Gets
  39622. if (bulk) {
  39623. return fn.call(elems);
  39624. }
  39625. return len ? fn(elems[0], key) : emptyGet;
  39626. };
  39627. // Matches dashed string for camelizing
  39628. var rmsPrefix = /^-ms-/,
  39629. rdashAlpha = /-([a-z])/g;
  39630. // Used by camelCase as callback to replace()
  39631. function fcamelCase(all, letter) {
  39632. return letter.toUpperCase();
  39633. }
  39634. // Convert dashed to camelCase; used by the css and data modules
  39635. // Support: IE <=9 - 11, Edge 12 - 15
  39636. // Microsoft forgot to hump their vendor prefix (#9572)
  39637. function camelCase(string) {
  39638. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  39639. }
  39640. var acceptData = function acceptData(owner) {
  39641. // Accepts only:
  39642. // - Node
  39643. // - Node.ELEMENT_NODE
  39644. // - Node.DOCUMENT_NODE
  39645. // - Object
  39646. // - Any
  39647. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  39648. };
  39649. function Data() {
  39650. this.expando = jQuery.expando + Data.uid++;
  39651. }
  39652. Data.uid = 1;
  39653. Data.prototype = {
  39654. cache: function cache(owner) {
  39655. // Check if the owner object already has a cache
  39656. var value = owner[this.expando];
  39657. // If not, create one
  39658. if (!value) {
  39659. value = {};
  39660. // We can accept data for non-element nodes in modern browsers,
  39661. // but we should not, see #8335.
  39662. // Always return an empty object.
  39663. if (acceptData(owner)) {
  39664. // If it is a node unlikely to be stringify-ed or looped over
  39665. // use plain assignment
  39666. if (owner.nodeType) {
  39667. owner[this.expando] = value;
  39668. // Otherwise secure it in a non-enumerable property
  39669. // configurable must be true to allow the property to be
  39670. // deleted when data is removed
  39671. } else {
  39672. Object.defineProperty(owner, this.expando, {
  39673. value: value,
  39674. configurable: true
  39675. });
  39676. }
  39677. }
  39678. }
  39679. return value;
  39680. },
  39681. set: function set(owner, data, value) {
  39682. var prop,
  39683. cache = this.cache(owner);
  39684. // Handle: [ owner, key, value ] args
  39685. // Always use camelCase key (gh-2257)
  39686. if (typeof data === "string") {
  39687. cache[camelCase(data)] = value;
  39688. // Handle: [ owner, { properties } ] args
  39689. } else {
  39690. // Copy the properties one-by-one to the cache object
  39691. for (prop in data) {
  39692. cache[camelCase(prop)] = data[prop];
  39693. }
  39694. }
  39695. return cache;
  39696. },
  39697. get: function get(owner, key) {
  39698. return key === undefined ? this.cache(owner) :
  39699. // Always use camelCase key (gh-2257)
  39700. owner[this.expando] && owner[this.expando][camelCase(key)];
  39701. },
  39702. access: function access(owner, key, value) {
  39703. // In cases where either:
  39704. //
  39705. // 1. No key was specified
  39706. // 2. A string key was specified, but no value provided
  39707. //
  39708. // Take the "read" path and allow the get method to determine
  39709. // which value to return, respectively either:
  39710. //
  39711. // 1. The entire cache object
  39712. // 2. The data stored at the key
  39713. //
  39714. if (key === undefined || key && typeof key === "string" && value === undefined) {
  39715. return this.get(owner, key);
  39716. }
  39717. // When the key is not a string, or both a key and value
  39718. // are specified, set or extend (existing objects) with either:
  39719. //
  39720. // 1. An object of properties
  39721. // 2. A key and value
  39722. //
  39723. this.set(owner, key, value);
  39724. // Since the "set" path can have two possible entry points
  39725. // return the expected data based on which path was taken[*]
  39726. return value !== undefined ? value : key;
  39727. },
  39728. remove: function remove(owner, key) {
  39729. var i,
  39730. cache = owner[this.expando];
  39731. if (cache === undefined) {
  39732. return;
  39733. }
  39734. if (key !== undefined) {
  39735. // Support array or space separated string of keys
  39736. if (Array.isArray(key)) {
  39737. // If key is an array of keys...
  39738. // We always set camelCase keys, so remove that.
  39739. key = key.map(camelCase);
  39740. } else {
  39741. key = camelCase(key);
  39742. // If a key with the spaces exists, use it.
  39743. // Otherwise, create an array by matching non-whitespace
  39744. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  39745. }
  39746. i = key.length;
  39747. while (i--) {
  39748. delete cache[key[i]];
  39749. }
  39750. }
  39751. // Remove the expando if there's no more data
  39752. if (key === undefined || jQuery.isEmptyObject(cache)) {
  39753. // Support: Chrome <=35 - 45
  39754. // Webkit & Blink performance suffers when deleting properties
  39755. // from DOM nodes, so set to undefined instead
  39756. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  39757. if (owner.nodeType) {
  39758. owner[this.expando] = undefined;
  39759. } else {
  39760. delete owner[this.expando];
  39761. }
  39762. }
  39763. },
  39764. hasData: function hasData(owner) {
  39765. var cache = owner[this.expando];
  39766. return cache !== undefined && !jQuery.isEmptyObject(cache);
  39767. }
  39768. };
  39769. var dataPriv = new Data();
  39770. var dataUser = new Data();
  39771. // Implementation Summary
  39772. //
  39773. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  39774. // 2. Improve the module's maintainability by reducing the storage
  39775. // paths to a single mechanism.
  39776. // 3. Use the same single mechanism to support "private" and "user" data.
  39777. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  39778. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  39779. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  39780. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  39781. rmultiDash = /[A-Z]/g;
  39782. function getData(data) {
  39783. if (data === "true") {
  39784. return true;
  39785. }
  39786. if (data === "false") {
  39787. return false;
  39788. }
  39789. if (data === "null") {
  39790. return null;
  39791. }
  39792. // Only convert to a number if it doesn't change the string
  39793. if (data === +data + "") {
  39794. return +data;
  39795. }
  39796. if (rbrace.test(data)) {
  39797. return JSON.parse(data);
  39798. }
  39799. return data;
  39800. }
  39801. function dataAttr(elem, key, data) {
  39802. var name;
  39803. // If nothing was found internally, try to fetch any
  39804. // data from the HTML5 data-* attribute
  39805. if (data === undefined && elem.nodeType === 1) {
  39806. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  39807. data = elem.getAttribute(name);
  39808. if (typeof data === "string") {
  39809. try {
  39810. data = getData(data);
  39811. } catch (e) {}
  39812. // Make sure we set the data so it isn't changed later
  39813. dataUser.set(elem, key, data);
  39814. } else {
  39815. data = undefined;
  39816. }
  39817. }
  39818. return data;
  39819. }
  39820. jQuery.extend({
  39821. hasData: function hasData(elem) {
  39822. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  39823. },
  39824. data: function data(elem, name, _data) {
  39825. return dataUser.access(elem, name, _data);
  39826. },
  39827. removeData: function removeData(elem, name) {
  39828. dataUser.remove(elem, name);
  39829. },
  39830. // TODO: Now that all calls to _data and _removeData have been replaced
  39831. // with direct calls to dataPriv methods, these can be deprecated.
  39832. _data: function _data(elem, name, data) {
  39833. return dataPriv.access(elem, name, data);
  39834. },
  39835. _removeData: function _removeData(elem, name) {
  39836. dataPriv.remove(elem, name);
  39837. }
  39838. });
  39839. jQuery.fn.extend({
  39840. data: function data(key, value) {
  39841. var i,
  39842. name,
  39843. data,
  39844. elem = this[0],
  39845. attrs = elem && elem.attributes;
  39846. // Gets all values
  39847. if (key === undefined) {
  39848. if (this.length) {
  39849. data = dataUser.get(elem);
  39850. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  39851. i = attrs.length;
  39852. while (i--) {
  39853. // Support: IE 11 only
  39854. // The attrs elements can be null (#14894)
  39855. if (attrs[i]) {
  39856. name = attrs[i].name;
  39857. if (name.indexOf("data-") === 0) {
  39858. name = camelCase(name.slice(5));
  39859. dataAttr(elem, name, data[name]);
  39860. }
  39861. }
  39862. }
  39863. dataPriv.set(elem, "hasDataAttrs", true);
  39864. }
  39865. }
  39866. return data;
  39867. }
  39868. // Sets multiple values
  39869. if ((typeof key === "undefined" ? "undefined" : _typeof(key)) === "object") {
  39870. return this.each(function () {
  39871. dataUser.set(this, key);
  39872. });
  39873. }
  39874. return access(this, function (value) {
  39875. var data;
  39876. // The calling jQuery object (element matches) is not empty
  39877. // (and therefore has an element appears at this[ 0 ]) and the
  39878. // `value` parameter was not undefined. An empty jQuery object
  39879. // will result in `undefined` for elem = this[ 0 ] which will
  39880. // throw an exception if an attempt to read a data cache is made.
  39881. if (elem && value === undefined) {
  39882. // Attempt to get data from the cache
  39883. // The key will always be camelCased in Data
  39884. data = dataUser.get(elem, key);
  39885. if (data !== undefined) {
  39886. return data;
  39887. }
  39888. // Attempt to "discover" the data in
  39889. // HTML5 custom data-* attrs
  39890. data = dataAttr(elem, key);
  39891. if (data !== undefined) {
  39892. return data;
  39893. }
  39894. // We tried really hard, but the data doesn't exist.
  39895. return;
  39896. }
  39897. // Set the data...
  39898. this.each(function () {
  39899. // We always store the camelCased key
  39900. dataUser.set(this, key, value);
  39901. });
  39902. }, null, value, arguments.length > 1, null, true);
  39903. },
  39904. removeData: function removeData(key) {
  39905. return this.each(function () {
  39906. dataUser.remove(this, key);
  39907. });
  39908. }
  39909. });
  39910. jQuery.extend({
  39911. queue: function queue(elem, type, data) {
  39912. var queue;
  39913. if (elem) {
  39914. type = (type || "fx") + "queue";
  39915. queue = dataPriv.get(elem, type);
  39916. // Speed up dequeue by getting out quickly if this is just a lookup
  39917. if (data) {
  39918. if (!queue || Array.isArray(data)) {
  39919. queue = dataPriv.access(elem, type, jQuery.makeArray(data));
  39920. } else {
  39921. queue.push(data);
  39922. }
  39923. }
  39924. return queue || [];
  39925. }
  39926. },
  39927. dequeue: function dequeue(elem, type) {
  39928. type = type || "fx";
  39929. var queue = jQuery.queue(elem, type),
  39930. startLength = queue.length,
  39931. fn = queue.shift(),
  39932. hooks = jQuery._queueHooks(elem, type),
  39933. next = function next() {
  39934. jQuery.dequeue(elem, type);
  39935. };
  39936. // If the fx queue is dequeued, always remove the progress sentinel
  39937. if (fn === "inprogress") {
  39938. fn = queue.shift();
  39939. startLength--;
  39940. }
  39941. if (fn) {
  39942. // Add a progress sentinel to prevent the fx queue from being
  39943. // automatically dequeued
  39944. if (type === "fx") {
  39945. queue.unshift("inprogress");
  39946. }
  39947. // Clear up the last queue stop function
  39948. delete hooks.stop;
  39949. fn.call(elem, next, hooks);
  39950. }
  39951. if (!startLength && hooks) {
  39952. hooks.empty.fire();
  39953. }
  39954. },
  39955. // Not public - generate a queueHooks object, or return the current one
  39956. _queueHooks: function _queueHooks(elem, type) {
  39957. var key = type + "queueHooks";
  39958. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  39959. empty: jQuery.Callbacks("once memory").add(function () {
  39960. dataPriv.remove(elem, [type + "queue", key]);
  39961. })
  39962. });
  39963. }
  39964. });
  39965. jQuery.fn.extend({
  39966. queue: function queue(type, data) {
  39967. var setter = 2;
  39968. if (typeof type !== "string") {
  39969. data = type;
  39970. type = "fx";
  39971. setter--;
  39972. }
  39973. if (arguments.length < setter) {
  39974. return jQuery.queue(this[0], type);
  39975. }
  39976. return data === undefined ? this : this.each(function () {
  39977. var queue = jQuery.queue(this, type, data);
  39978. // Ensure a hooks for this queue
  39979. jQuery._queueHooks(this, type);
  39980. if (type === "fx" && queue[0] !== "inprogress") {
  39981. jQuery.dequeue(this, type);
  39982. }
  39983. });
  39984. },
  39985. dequeue: function dequeue(type) {
  39986. return this.each(function () {
  39987. jQuery.dequeue(this, type);
  39988. });
  39989. },
  39990. clearQueue: function clearQueue(type) {
  39991. return this.queue(type || "fx", []);
  39992. },
  39993. // Get a promise resolved when queues of a certain type
  39994. // are emptied (fx is the type by default)
  39995. promise: function promise(type, obj) {
  39996. var tmp,
  39997. count = 1,
  39998. defer = jQuery.Deferred(),
  39999. elements = this,
  40000. i = this.length,
  40001. resolve = function resolve() {
  40002. if (! --count) {
  40003. defer.resolveWith(elements, [elements]);
  40004. }
  40005. };
  40006. if (typeof type !== "string") {
  40007. obj = type;
  40008. type = undefined;
  40009. }
  40010. type = type || "fx";
  40011. while (i--) {
  40012. tmp = dataPriv.get(elements[i], type + "queueHooks");
  40013. if (tmp && tmp.empty) {
  40014. count++;
  40015. tmp.empty.add(resolve);
  40016. }
  40017. }
  40018. resolve();
  40019. return defer.promise(obj);
  40020. }
  40021. });
  40022. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  40023. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  40024. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  40025. var isHiddenWithinTree = function isHiddenWithinTree(elem, el) {
  40026. // isHiddenWithinTree might be called from jQuery#filter function;
  40027. // in that case, element will be second argument
  40028. elem = el || elem;
  40029. // Inline style trumps all
  40030. return elem.style.display === "none" || elem.style.display === "" &&
  40031. // Otherwise, check computed style
  40032. // Support: Firefox <=43 - 45
  40033. // Disconnected elements can have computed display: none, so first confirm that elem is
  40034. // in the document.
  40035. jQuery.contains(elem.ownerDocument, elem) && jQuery.css(elem, "display") === "none";
  40036. };
  40037. var swap = function swap(elem, options, callback, args) {
  40038. var ret,
  40039. name,
  40040. old = {};
  40041. // Remember the old values, and insert the new ones
  40042. for (name in options) {
  40043. old[name] = elem.style[name];
  40044. elem.style[name] = options[name];
  40045. }
  40046. ret = callback.apply(elem, args || []);
  40047. // Revert the old values
  40048. for (name in options) {
  40049. elem.style[name] = old[name];
  40050. }
  40051. return ret;
  40052. };
  40053. function adjustCSS(elem, prop, valueParts, tween) {
  40054. var adjusted,
  40055. scale,
  40056. maxIterations = 20,
  40057. currentValue = tween ? function () {
  40058. return tween.cur();
  40059. } : function () {
  40060. return jQuery.css(elem, prop, "");
  40061. },
  40062. initial = currentValue(),
  40063. unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"),
  40064. // Starting value computation is required for potential unit mismatches
  40065. initialInUnit = (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  40066. if (initialInUnit && initialInUnit[3] !== unit) {
  40067. // Support: Firefox <=54
  40068. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  40069. initial = initial / 2;
  40070. // Trust units reported by jQuery.css
  40071. unit = unit || initialInUnit[3];
  40072. // Iteratively approximate from a nonzero starting point
  40073. initialInUnit = +initial || 1;
  40074. while (maxIterations--) {
  40075. // Evaluate and update our best guess (doubling guesses that zero out).
  40076. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  40077. jQuery.style(elem, prop, initialInUnit + unit);
  40078. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  40079. maxIterations = 0;
  40080. }
  40081. initialInUnit = initialInUnit / scale;
  40082. }
  40083. initialInUnit = initialInUnit * 2;
  40084. jQuery.style(elem, prop, initialInUnit + unit);
  40085. // Make sure we update the tween properties later on
  40086. valueParts = valueParts || [];
  40087. }
  40088. if (valueParts) {
  40089. initialInUnit = +initialInUnit || +initial || 0;
  40090. // Apply relative offset (+=/-=) if specified
  40091. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  40092. if (tween) {
  40093. tween.unit = unit;
  40094. tween.start = initialInUnit;
  40095. tween.end = adjusted;
  40096. }
  40097. }
  40098. return adjusted;
  40099. }
  40100. var defaultDisplayMap = {};
  40101. function getDefaultDisplay(elem) {
  40102. var temp,
  40103. doc = elem.ownerDocument,
  40104. nodeName = elem.nodeName,
  40105. display = defaultDisplayMap[nodeName];
  40106. if (display) {
  40107. return display;
  40108. }
  40109. temp = doc.body.appendChild(doc.createElement(nodeName));
  40110. display = jQuery.css(temp, "display");
  40111. temp.parentNode.removeChild(temp);
  40112. if (display === "none") {
  40113. display = "block";
  40114. }
  40115. defaultDisplayMap[nodeName] = display;
  40116. return display;
  40117. }
  40118. function showHide(elements, show) {
  40119. var display,
  40120. elem,
  40121. values = [],
  40122. index = 0,
  40123. length = elements.length;
  40124. // Determine new display value for elements that need to change
  40125. for (; index < length; index++) {
  40126. elem = elements[index];
  40127. if (!elem.style) {
  40128. continue;
  40129. }
  40130. display = elem.style.display;
  40131. if (show) {
  40132. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  40133. // check is required in this first loop unless we have a nonempty display value (either
  40134. // inline or about-to-be-restored)
  40135. if (display === "none") {
  40136. values[index] = dataPriv.get(elem, "display") || null;
  40137. if (!values[index]) {
  40138. elem.style.display = "";
  40139. }
  40140. }
  40141. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  40142. values[index] = getDefaultDisplay(elem);
  40143. }
  40144. } else {
  40145. if (display !== "none") {
  40146. values[index] = "none";
  40147. // Remember what we're overwriting
  40148. dataPriv.set(elem, "display", display);
  40149. }
  40150. }
  40151. }
  40152. // Set the display of the elements in a second loop to avoid constant reflow
  40153. for (index = 0; index < length; index++) {
  40154. if (values[index] != null) {
  40155. elements[index].style.display = values[index];
  40156. }
  40157. }
  40158. return elements;
  40159. }
  40160. jQuery.fn.extend({
  40161. show: function show() {
  40162. return showHide(this, true);
  40163. },
  40164. hide: function hide() {
  40165. return showHide(this);
  40166. },
  40167. toggle: function toggle(state) {
  40168. if (typeof state === "boolean") {
  40169. return state ? this.show() : this.hide();
  40170. }
  40171. return this.each(function () {
  40172. if (isHiddenWithinTree(this)) {
  40173. jQuery(this).show();
  40174. } else {
  40175. jQuery(this).hide();
  40176. }
  40177. });
  40178. }
  40179. });
  40180. var rcheckableType = /^(?:checkbox|radio)$/i;
  40181. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]+)/i;
  40182. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  40183. // We have to close these tags to support XHTML (#13200)
  40184. var wrapMap = {
  40185. // Support: IE <=9 only
  40186. option: [1, "<select multiple='multiple'>", "</select>"],
  40187. // XHTML parsers do not magically insert elements in the
  40188. // same way that tag soup parsers do. So we cannot shorten
  40189. // this by omitting <tbody> or other required elements.
  40190. thead: [1, "<table>", "</table>"],
  40191. col: [2, "<table><colgroup>", "</colgroup></table>"],
  40192. tr: [2, "<table><tbody>", "</tbody></table>"],
  40193. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  40194. _default: [0, "", ""]
  40195. };
  40196. // Support: IE <=9 only
  40197. wrapMap.optgroup = wrapMap.option;
  40198. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  40199. wrapMap.th = wrapMap.td;
  40200. function getAll(context, tag) {
  40201. // Support: IE <=9 - 11 only
  40202. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  40203. var ret;
  40204. if (typeof context.getElementsByTagName !== "undefined") {
  40205. ret = context.getElementsByTagName(tag || "*");
  40206. } else if (typeof context.querySelectorAll !== "undefined") {
  40207. ret = context.querySelectorAll(tag || "*");
  40208. } else {
  40209. ret = [];
  40210. }
  40211. if (tag === undefined || tag && nodeName(context, tag)) {
  40212. return jQuery.merge([context], ret);
  40213. }
  40214. return ret;
  40215. }
  40216. // Mark scripts as having already been evaluated
  40217. function setGlobalEval(elems, refElements) {
  40218. var i = 0,
  40219. l = elems.length;
  40220. for (; i < l; i++) {
  40221. dataPriv.set(elems[i], "globalEval", !refElements || dataPriv.get(refElements[i], "globalEval"));
  40222. }
  40223. }
  40224. var rhtml = /<|&#?\w+;/;
  40225. function buildFragment(elems, context, scripts, selection, ignored) {
  40226. var elem,
  40227. tmp,
  40228. tag,
  40229. wrap,
  40230. contains,
  40231. j,
  40232. fragment = context.createDocumentFragment(),
  40233. nodes = [],
  40234. i = 0,
  40235. l = elems.length;
  40236. for (; i < l; i++) {
  40237. elem = elems[i];
  40238. if (elem || elem === 0) {
  40239. // Add nodes directly
  40240. if (toType(elem) === "object") {
  40241. // Support: Android <=4.0 only, PhantomJS 1 only
  40242. // push.apply(_, arraylike) throws on ancient WebKit
  40243. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  40244. // Convert non-html into a text node
  40245. } else if (!rhtml.test(elem)) {
  40246. nodes.push(context.createTextNode(elem));
  40247. // Convert html into DOM nodes
  40248. } else {
  40249. tmp = tmp || fragment.appendChild(context.createElement("div"));
  40250. // Deserialize a standard representation
  40251. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  40252. wrap = wrapMap[tag] || wrapMap._default;
  40253. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  40254. // Descend through wrappers to the right content
  40255. j = wrap[0];
  40256. while (j--) {
  40257. tmp = tmp.lastChild;
  40258. }
  40259. // Support: Android <=4.0 only, PhantomJS 1 only
  40260. // push.apply(_, arraylike) throws on ancient WebKit
  40261. jQuery.merge(nodes, tmp.childNodes);
  40262. // Remember the top-level container
  40263. tmp = fragment.firstChild;
  40264. // Ensure the created nodes are orphaned (#12392)
  40265. tmp.textContent = "";
  40266. }
  40267. }
  40268. }
  40269. // Remove wrapper from fragment
  40270. fragment.textContent = "";
  40271. i = 0;
  40272. while (elem = nodes[i++]) {
  40273. // Skip elements already in the context collection (trac-4087)
  40274. if (selection && jQuery.inArray(elem, selection) > -1) {
  40275. if (ignored) {
  40276. ignored.push(elem);
  40277. }
  40278. continue;
  40279. }
  40280. contains = jQuery.contains(elem.ownerDocument, elem);
  40281. // Append to fragment
  40282. tmp = getAll(fragment.appendChild(elem), "script");
  40283. // Preserve script evaluation history
  40284. if (contains) {
  40285. setGlobalEval(tmp);
  40286. }
  40287. // Capture executables
  40288. if (scripts) {
  40289. j = 0;
  40290. while (elem = tmp[j++]) {
  40291. if (rscriptType.test(elem.type || "")) {
  40292. scripts.push(elem);
  40293. }
  40294. }
  40295. }
  40296. }
  40297. return fragment;
  40298. }
  40299. (function () {
  40300. var fragment = document.createDocumentFragment(),
  40301. div = fragment.appendChild(document.createElement("div")),
  40302. input = document.createElement("input");
  40303. // Support: Android 4.0 - 4.3 only
  40304. // Check state lost if the name is set (#11217)
  40305. // Support: Windows Web Apps (WWA)
  40306. // `name` and `type` must use .setAttribute for WWA (#14901)
  40307. input.setAttribute("type", "radio");
  40308. input.setAttribute("checked", "checked");
  40309. input.setAttribute("name", "t");
  40310. div.appendChild(input);
  40311. // Support: Android <=4.1 only
  40312. // Older WebKit doesn't clone checked state correctly in fragments
  40313. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  40314. // Support: IE <=11 only
  40315. // Make sure textarea (and checkbox) defaultValue is properly cloned
  40316. div.innerHTML = "<textarea>x</textarea>";
  40317. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  40318. })();
  40319. var documentElement = document.documentElement;
  40320. var rkeyEvent = /^key/,
  40321. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  40322. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  40323. function returnTrue() {
  40324. return true;
  40325. }
  40326. function returnFalse() {
  40327. return false;
  40328. }
  40329. // Support: IE <=9 only
  40330. // See #13393 for more info
  40331. function safeActiveElement() {
  40332. try {
  40333. return document.activeElement;
  40334. } catch (err) {}
  40335. }
  40336. function _on(elem, types, selector, data, fn, one) {
  40337. var origFn, type;
  40338. // Types can be a map of types/handlers
  40339. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40340. // ( types-Object, selector, data )
  40341. if (typeof selector !== "string") {
  40342. // ( types-Object, data )
  40343. data = data || selector;
  40344. selector = undefined;
  40345. }
  40346. for (type in types) {
  40347. _on(elem, type, selector, data, types[type], one);
  40348. }
  40349. return elem;
  40350. }
  40351. if (data == null && fn == null) {
  40352. // ( types, fn )
  40353. fn = selector;
  40354. data = selector = undefined;
  40355. } else if (fn == null) {
  40356. if (typeof selector === "string") {
  40357. // ( types, selector, fn )
  40358. fn = data;
  40359. data = undefined;
  40360. } else {
  40361. // ( types, data, fn )
  40362. fn = data;
  40363. data = selector;
  40364. selector = undefined;
  40365. }
  40366. }
  40367. if (fn === false) {
  40368. fn = returnFalse;
  40369. } else if (!fn) {
  40370. return elem;
  40371. }
  40372. if (one === 1) {
  40373. origFn = fn;
  40374. fn = function fn(event) {
  40375. // Can use an empty set, since event contains the info
  40376. jQuery().off(event);
  40377. return origFn.apply(this, arguments);
  40378. };
  40379. // Use same guid so caller can remove using origFn
  40380. fn.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  40381. }
  40382. return elem.each(function () {
  40383. jQuery.event.add(this, types, fn, data, selector);
  40384. });
  40385. }
  40386. /*
  40387. * Helper functions for managing events -- not part of the public interface.
  40388. * Props to Dean Edwards' addEvent library for many of the ideas.
  40389. */
  40390. jQuery.event = {
  40391. global: {},
  40392. add: function add(elem, types, handler, data, selector) {
  40393. var handleObjIn,
  40394. eventHandle,
  40395. tmp,
  40396. events,
  40397. t,
  40398. handleObj,
  40399. special,
  40400. handlers,
  40401. type,
  40402. namespaces,
  40403. origType,
  40404. elemData = dataPriv.get(elem);
  40405. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  40406. if (!elemData) {
  40407. return;
  40408. }
  40409. // Caller can pass in an object of custom data in lieu of the handler
  40410. if (handler.handler) {
  40411. handleObjIn = handler;
  40412. handler = handleObjIn.handler;
  40413. selector = handleObjIn.selector;
  40414. }
  40415. // Ensure that invalid selectors throw exceptions at attach time
  40416. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  40417. if (selector) {
  40418. jQuery.find.matchesSelector(documentElement, selector);
  40419. }
  40420. // Make sure that the handler has a unique ID, used to find/remove it later
  40421. if (!handler.guid) {
  40422. handler.guid = jQuery.guid++;
  40423. }
  40424. // Init the element's event structure and main handler, if this is the first
  40425. if (!(events = elemData.events)) {
  40426. events = elemData.events = {};
  40427. }
  40428. if (!(eventHandle = elemData.handle)) {
  40429. eventHandle = elemData.handle = function (e) {
  40430. // Discard the second event of a jQuery.event.trigger() and
  40431. // when an event is called after a page has unloaded
  40432. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : undefined;
  40433. };
  40434. }
  40435. // Handle multiple events separated by a space
  40436. types = (types || "").match(rnothtmlwhite) || [""];
  40437. t = types.length;
  40438. while (t--) {
  40439. tmp = rtypenamespace.exec(types[t]) || [];
  40440. type = origType = tmp[1];
  40441. namespaces = (tmp[2] || "").split(".").sort();
  40442. // There *must* be a type, no attaching namespace-only handlers
  40443. if (!type) {
  40444. continue;
  40445. }
  40446. // If event changes its type, use the special event handlers for the changed type
  40447. special = jQuery.event.special[type] || {};
  40448. // If selector defined, determine special event api type, otherwise given type
  40449. type = (selector ? special.delegateType : special.bindType) || type;
  40450. // Update special based on newly reset type
  40451. special = jQuery.event.special[type] || {};
  40452. // handleObj is passed to all event handlers
  40453. handleObj = jQuery.extend({
  40454. type: type,
  40455. origType: origType,
  40456. data: data,
  40457. handler: handler,
  40458. guid: handler.guid,
  40459. selector: selector,
  40460. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  40461. namespace: namespaces.join(".")
  40462. }, handleObjIn);
  40463. // Init the event handler queue if we're the first
  40464. if (!(handlers = events[type])) {
  40465. handlers = events[type] = [];
  40466. handlers.delegateCount = 0;
  40467. // Only use addEventListener if the special events handler returns false
  40468. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  40469. if (elem.addEventListener) {
  40470. elem.addEventListener(type, eventHandle);
  40471. }
  40472. }
  40473. }
  40474. if (special.add) {
  40475. special.add.call(elem, handleObj);
  40476. if (!handleObj.handler.guid) {
  40477. handleObj.handler.guid = handler.guid;
  40478. }
  40479. }
  40480. // Add to the element's handler list, delegates in front
  40481. if (selector) {
  40482. handlers.splice(handlers.delegateCount++, 0, handleObj);
  40483. } else {
  40484. handlers.push(handleObj);
  40485. }
  40486. // Keep track of which events have ever been used, for event optimization
  40487. jQuery.event.global[type] = true;
  40488. }
  40489. },
  40490. // Detach an event or set of events from an element
  40491. remove: function remove(elem, types, handler, selector, mappedTypes) {
  40492. var j,
  40493. origCount,
  40494. tmp,
  40495. events,
  40496. t,
  40497. handleObj,
  40498. special,
  40499. handlers,
  40500. type,
  40501. namespaces,
  40502. origType,
  40503. elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  40504. if (!elemData || !(events = elemData.events)) {
  40505. return;
  40506. }
  40507. // Once for each type.namespace in types; type may be omitted
  40508. types = (types || "").match(rnothtmlwhite) || [""];
  40509. t = types.length;
  40510. while (t--) {
  40511. tmp = rtypenamespace.exec(types[t]) || [];
  40512. type = origType = tmp[1];
  40513. namespaces = (tmp[2] || "").split(".").sort();
  40514. // Unbind all events (on this namespace, if provided) for the element
  40515. if (!type) {
  40516. for (type in events) {
  40517. jQuery.event.remove(elem, type + types[t], handler, selector, true);
  40518. }
  40519. continue;
  40520. }
  40521. special = jQuery.event.special[type] || {};
  40522. type = (selector ? special.delegateType : special.bindType) || type;
  40523. handlers = events[type] || [];
  40524. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  40525. // Remove matching events
  40526. origCount = j = handlers.length;
  40527. while (j--) {
  40528. handleObj = handlers[j];
  40529. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  40530. handlers.splice(j, 1);
  40531. if (handleObj.selector) {
  40532. handlers.delegateCount--;
  40533. }
  40534. if (special.remove) {
  40535. special.remove.call(elem, handleObj);
  40536. }
  40537. }
  40538. }
  40539. // Remove generic event handler if we removed something and no more handlers exist
  40540. // (avoids potential for endless recursion during removal of special event handlers)
  40541. if (origCount && !handlers.length) {
  40542. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  40543. jQuery.removeEvent(elem, type, elemData.handle);
  40544. }
  40545. delete events[type];
  40546. }
  40547. }
  40548. // Remove data and the expando if it's no longer used
  40549. if (jQuery.isEmptyObject(events)) {
  40550. dataPriv.remove(elem, "handle events");
  40551. }
  40552. },
  40553. dispatch: function dispatch(nativeEvent) {
  40554. // Make a writable jQuery.Event from the native event object
  40555. var event = jQuery.event.fix(nativeEvent);
  40556. var i,
  40557. j,
  40558. ret,
  40559. matched,
  40560. handleObj,
  40561. handlerQueue,
  40562. args = new Array(arguments.length),
  40563. handlers = (dataPriv.get(this, "events") || {})[event.type] || [],
  40564. special = jQuery.event.special[event.type] || {};
  40565. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  40566. args[0] = event;
  40567. for (i = 1; i < arguments.length; i++) {
  40568. args[i] = arguments[i];
  40569. }
  40570. event.delegateTarget = this;
  40571. // Call the preDispatch hook for the mapped type, and let it bail if desired
  40572. if (special.preDispatch && special.preDispatch.call(this, event) === false) {
  40573. return;
  40574. }
  40575. // Determine handlers
  40576. handlerQueue = jQuery.event.handlers.call(this, event, handlers);
  40577. // Run delegates first; they may want to stop propagation beneath us
  40578. i = 0;
  40579. while ((matched = handlerQueue[i++]) && !event.isPropagationStopped()) {
  40580. event.currentTarget = matched.elem;
  40581. j = 0;
  40582. while ((handleObj = matched.handlers[j++]) && !event.isImmediatePropagationStopped()) {
  40583. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  40584. // a subset or equal to those in the bound event (both can have no namespace).
  40585. if (!event.rnamespace || event.rnamespace.test(handleObj.namespace)) {
  40586. event.handleObj = handleObj;
  40587. event.data = handleObj.data;
  40588. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  40589. if (ret !== undefined) {
  40590. if ((event.result = ret) === false) {
  40591. event.preventDefault();
  40592. event.stopPropagation();
  40593. }
  40594. }
  40595. }
  40596. }
  40597. }
  40598. // Call the postDispatch hook for the mapped type
  40599. if (special.postDispatch) {
  40600. special.postDispatch.call(this, event);
  40601. }
  40602. return event.result;
  40603. },
  40604. handlers: function handlers(event, _handlers) {
  40605. var i,
  40606. handleObj,
  40607. sel,
  40608. matchedHandlers,
  40609. matchedSelectors,
  40610. handlerQueue = [],
  40611. delegateCount = _handlers.delegateCount,
  40612. cur = event.target;
  40613. // Find delegate handlers
  40614. if (delegateCount &&
  40615. // Support: IE <=9
  40616. // Black-hole SVG <use> instance trees (trac-13180)
  40617. cur.nodeType &&
  40618. // Support: Firefox <=42
  40619. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  40620. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  40621. // Support: IE 11 only
  40622. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  40623. !(event.type === "click" && event.button >= 1)) {
  40624. for (; cur !== this; cur = cur.parentNode || this) {
  40625. // Don't check non-elements (#13208)
  40626. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  40627. if (cur.nodeType === 1 && !(event.type === "click" && cur.disabled === true)) {
  40628. matchedHandlers = [];
  40629. matchedSelectors = {};
  40630. for (i = 0; i < delegateCount; i++) {
  40631. handleObj = _handlers[i];
  40632. // Don't conflict with Object.prototype properties (#13203)
  40633. sel = handleObj.selector + " ";
  40634. if (matchedSelectors[sel] === undefined) {
  40635. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  40636. }
  40637. if (matchedSelectors[sel]) {
  40638. matchedHandlers.push(handleObj);
  40639. }
  40640. }
  40641. if (matchedHandlers.length) {
  40642. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  40643. }
  40644. }
  40645. }
  40646. }
  40647. // Add the remaining (directly-bound) handlers
  40648. cur = this;
  40649. if (delegateCount < _handlers.length) {
  40650. handlerQueue.push({ elem: cur, handlers: _handlers.slice(delegateCount) });
  40651. }
  40652. return handlerQueue;
  40653. },
  40654. addProp: function addProp(name, hook) {
  40655. Object.defineProperty(jQuery.Event.prototype, name, {
  40656. enumerable: true,
  40657. configurable: true,
  40658. get: isFunction(hook) ? function () {
  40659. if (this.originalEvent) {
  40660. return hook(this.originalEvent);
  40661. }
  40662. } : function () {
  40663. if (this.originalEvent) {
  40664. return this.originalEvent[name];
  40665. }
  40666. },
  40667. set: function set(value) {
  40668. Object.defineProperty(this, name, {
  40669. enumerable: true,
  40670. configurable: true,
  40671. writable: true,
  40672. value: value
  40673. });
  40674. }
  40675. });
  40676. },
  40677. fix: function fix(originalEvent) {
  40678. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  40679. },
  40680. special: {
  40681. load: {
  40682. // Prevent triggered image.load events from bubbling to window.load
  40683. noBubble: true
  40684. },
  40685. focus: {
  40686. // Fire native event if possible so blur/focus sequence is correct
  40687. trigger: function trigger() {
  40688. if (this !== safeActiveElement() && this.focus) {
  40689. this.focus();
  40690. return false;
  40691. }
  40692. },
  40693. delegateType: "focusin"
  40694. },
  40695. blur: {
  40696. trigger: function trigger() {
  40697. if (this === safeActiveElement() && this.blur) {
  40698. this.blur();
  40699. return false;
  40700. }
  40701. },
  40702. delegateType: "focusout"
  40703. },
  40704. click: {
  40705. // For checkbox, fire native event so checked state will be right
  40706. trigger: function trigger() {
  40707. if (this.type === "checkbox" && this.click && nodeName(this, "input")) {
  40708. this.click();
  40709. return false;
  40710. }
  40711. },
  40712. // For cross-browser consistency, don't fire native .click() on links
  40713. _default: function _default(event) {
  40714. return nodeName(event.target, "a");
  40715. }
  40716. },
  40717. beforeunload: {
  40718. postDispatch: function postDispatch(event) {
  40719. // Support: Firefox 20+
  40720. // Firefox doesn't alert if the returnValue field is not set.
  40721. if (event.result !== undefined && event.originalEvent) {
  40722. event.originalEvent.returnValue = event.result;
  40723. }
  40724. }
  40725. }
  40726. }
  40727. };
  40728. jQuery.removeEvent = function (elem, type, handle) {
  40729. // This "if" is needed for plain objects
  40730. if (elem.removeEventListener) {
  40731. elem.removeEventListener(type, handle);
  40732. }
  40733. };
  40734. jQuery.Event = function (src, props) {
  40735. // Allow instantiation without the 'new' keyword
  40736. if (!(this instanceof jQuery.Event)) {
  40737. return new jQuery.Event(src, props);
  40738. }
  40739. // Event object
  40740. if (src && src.type) {
  40741. this.originalEvent = src;
  40742. this.type = src.type;
  40743. // Events bubbling up the document may have been marked as prevented
  40744. // by a handler lower down the tree; reflect the correct value.
  40745. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === undefined &&
  40746. // Support: Android <=2.3 only
  40747. src.returnValue === false ? returnTrue : returnFalse;
  40748. // Create target properties
  40749. // Support: Safari <=6 - 7 only
  40750. // Target should not be a text node (#504, #13143)
  40751. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  40752. this.currentTarget = src.currentTarget;
  40753. this.relatedTarget = src.relatedTarget;
  40754. // Event type
  40755. } else {
  40756. this.type = src;
  40757. }
  40758. // Put explicitly provided properties onto the event object
  40759. if (props) {
  40760. jQuery.extend(this, props);
  40761. }
  40762. // Create a timestamp if incoming event doesn't have one
  40763. this.timeStamp = src && src.timeStamp || Date.now();
  40764. // Mark it as fixed
  40765. this[jQuery.expando] = true;
  40766. };
  40767. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  40768. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  40769. jQuery.Event.prototype = {
  40770. constructor: jQuery.Event,
  40771. isDefaultPrevented: returnFalse,
  40772. isPropagationStopped: returnFalse,
  40773. isImmediatePropagationStopped: returnFalse,
  40774. isSimulated: false,
  40775. preventDefault: function preventDefault() {
  40776. var e = this.originalEvent;
  40777. this.isDefaultPrevented = returnTrue;
  40778. if (e && !this.isSimulated) {
  40779. e.preventDefault();
  40780. }
  40781. },
  40782. stopPropagation: function stopPropagation() {
  40783. var e = this.originalEvent;
  40784. this.isPropagationStopped = returnTrue;
  40785. if (e && !this.isSimulated) {
  40786. e.stopPropagation();
  40787. }
  40788. },
  40789. stopImmediatePropagation: function stopImmediatePropagation() {
  40790. var e = this.originalEvent;
  40791. this.isImmediatePropagationStopped = returnTrue;
  40792. if (e && !this.isSimulated) {
  40793. e.stopImmediatePropagation();
  40794. }
  40795. this.stopPropagation();
  40796. }
  40797. };
  40798. // Includes all common event props including KeyEvent and MouseEvent specific props
  40799. jQuery.each({
  40800. altKey: true,
  40801. bubbles: true,
  40802. cancelable: true,
  40803. changedTouches: true,
  40804. ctrlKey: true,
  40805. detail: true,
  40806. eventPhase: true,
  40807. metaKey: true,
  40808. pageX: true,
  40809. pageY: true,
  40810. shiftKey: true,
  40811. view: true,
  40812. "char": true,
  40813. charCode: true,
  40814. key: true,
  40815. keyCode: true,
  40816. button: true,
  40817. buttons: true,
  40818. clientX: true,
  40819. clientY: true,
  40820. offsetX: true,
  40821. offsetY: true,
  40822. pointerId: true,
  40823. pointerType: true,
  40824. screenX: true,
  40825. screenY: true,
  40826. targetTouches: true,
  40827. toElement: true,
  40828. touches: true,
  40829. which: function which(event) {
  40830. var button = event.button;
  40831. // Add which for key events
  40832. if (event.which == null && rkeyEvent.test(event.type)) {
  40833. return event.charCode != null ? event.charCode : event.keyCode;
  40834. }
  40835. // Add which for click: 1 === left; 2 === middle; 3 === right
  40836. if (!event.which && button !== undefined && rmouseEvent.test(event.type)) {
  40837. if (button & 1) {
  40838. return 1;
  40839. }
  40840. if (button & 2) {
  40841. return 3;
  40842. }
  40843. if (button & 4) {
  40844. return 2;
  40845. }
  40846. return 0;
  40847. }
  40848. return event.which;
  40849. }
  40850. }, jQuery.event.addProp);
  40851. // Create mouseenter/leave events using mouseover/out and event-time checks
  40852. // so that event delegation works in jQuery.
  40853. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  40854. //
  40855. // Support: Safari 7 only
  40856. // Safari sends mouseenter too often; see:
  40857. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  40858. // for the description of the bug (it existed in older Chrome versions as well).
  40859. jQuery.each({
  40860. mouseenter: "mouseover",
  40861. mouseleave: "mouseout",
  40862. pointerenter: "pointerover",
  40863. pointerleave: "pointerout"
  40864. }, function (orig, fix) {
  40865. jQuery.event.special[orig] = {
  40866. delegateType: fix,
  40867. bindType: fix,
  40868. handle: function handle(event) {
  40869. var ret,
  40870. target = this,
  40871. related = event.relatedTarget,
  40872. handleObj = event.handleObj;
  40873. // For mouseenter/leave call the handler if related is outside the target.
  40874. // NB: No relatedTarget if the mouse left/entered the browser window
  40875. if (!related || related !== target && !jQuery.contains(target, related)) {
  40876. event.type = handleObj.origType;
  40877. ret = handleObj.handler.apply(this, arguments);
  40878. event.type = fix;
  40879. }
  40880. return ret;
  40881. }
  40882. };
  40883. });
  40884. jQuery.fn.extend({
  40885. on: function on(types, selector, data, fn) {
  40886. return _on(this, types, selector, data, fn);
  40887. },
  40888. one: function one(types, selector, data, fn) {
  40889. return _on(this, types, selector, data, fn, 1);
  40890. },
  40891. off: function off(types, selector, fn) {
  40892. var handleObj, type;
  40893. if (types && types.preventDefault && types.handleObj) {
  40894. // ( event ) dispatched jQuery.Event
  40895. handleObj = types.handleObj;
  40896. jQuery(types.delegateTarget).off(handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, handleObj.selector, handleObj.handler);
  40897. return this;
  40898. }
  40899. if ((typeof types === "undefined" ? "undefined" : _typeof(types)) === "object") {
  40900. // ( types-object [, selector] )
  40901. for (type in types) {
  40902. this.off(type, selector, types[type]);
  40903. }
  40904. return this;
  40905. }
  40906. if (selector === false || typeof selector === "function") {
  40907. // ( types [, fn] )
  40908. fn = selector;
  40909. selector = undefined;
  40910. }
  40911. if (fn === false) {
  40912. fn = returnFalse;
  40913. }
  40914. return this.each(function () {
  40915. jQuery.event.remove(this, types, fn, selector);
  40916. });
  40917. }
  40918. });
  40919. var
  40920. /* eslint-disable max-len */
  40921. // See https://github.com/eslint/eslint/issues/3229
  40922. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  40923. /* eslint-enable */
  40924. // Support: IE <=10 - 11, Edge 12 - 13 only
  40925. // In IE/Edge using regex groups here causes severe slowdowns.
  40926. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  40927. rnoInnerhtml = /<script|<style|<link/i,
  40928. // checked="checked" or checked
  40929. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  40930. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  40931. // Prefer a tbody over its parent table for containing new rows
  40932. function manipulationTarget(elem, content) {
  40933. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  40934. return jQuery(elem).children("tbody")[0] || elem;
  40935. }
  40936. return elem;
  40937. }
  40938. // Replace/restore the type attribute of script elements for safe DOM manipulation
  40939. function disableScript(elem) {
  40940. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  40941. return elem;
  40942. }
  40943. function restoreScript(elem) {
  40944. if ((elem.type || "").slice(0, 5) === "true/") {
  40945. elem.type = elem.type.slice(5);
  40946. } else {
  40947. elem.removeAttribute("type");
  40948. }
  40949. return elem;
  40950. }
  40951. function cloneCopyEvent(src, dest) {
  40952. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  40953. if (dest.nodeType !== 1) {
  40954. return;
  40955. }
  40956. // 1. Copy private data: events, handlers, etc.
  40957. if (dataPriv.hasData(src)) {
  40958. pdataOld = dataPriv.access(src);
  40959. pdataCur = dataPriv.set(dest, pdataOld);
  40960. events = pdataOld.events;
  40961. if (events) {
  40962. delete pdataCur.handle;
  40963. pdataCur.events = {};
  40964. for (type in events) {
  40965. for (i = 0, l = events[type].length; i < l; i++) {
  40966. jQuery.event.add(dest, type, events[type][i]);
  40967. }
  40968. }
  40969. }
  40970. }
  40971. // 2. Copy user data
  40972. if (dataUser.hasData(src)) {
  40973. udataOld = dataUser.access(src);
  40974. udataCur = jQuery.extend({}, udataOld);
  40975. dataUser.set(dest, udataCur);
  40976. }
  40977. }
  40978. // Fix IE bugs, see support tests
  40979. function fixInput(src, dest) {
  40980. var nodeName = dest.nodeName.toLowerCase();
  40981. // Fails to persist the checked state of a cloned checkbox or radio button.
  40982. if (nodeName === "input" && rcheckableType.test(src.type)) {
  40983. dest.checked = src.checked;
  40984. // Fails to return the selected option to the default selected state when cloning options
  40985. } else if (nodeName === "input" || nodeName === "textarea") {
  40986. dest.defaultValue = src.defaultValue;
  40987. }
  40988. }
  40989. function domManip(collection, args, callback, ignored) {
  40990. // Flatten any nested arrays
  40991. args = concat.apply([], args);
  40992. var fragment,
  40993. first,
  40994. scripts,
  40995. hasScripts,
  40996. node,
  40997. doc,
  40998. i = 0,
  40999. l = collection.length,
  41000. iNoClone = l - 1,
  41001. value = args[0],
  41002. valueIsFunction = isFunction(value);
  41003. // We can't cloneNode fragments that contain checked, in WebKit
  41004. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  41005. return collection.each(function (index) {
  41006. var self = collection.eq(index);
  41007. if (valueIsFunction) {
  41008. args[0] = value.call(this, index, self.html());
  41009. }
  41010. domManip(self, args, callback, ignored);
  41011. });
  41012. }
  41013. if (l) {
  41014. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  41015. first = fragment.firstChild;
  41016. if (fragment.childNodes.length === 1) {
  41017. fragment = first;
  41018. }
  41019. // Require either new content or an interest in ignored elements to invoke the callback
  41020. if (first || ignored) {
  41021. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  41022. hasScripts = scripts.length;
  41023. // Use the original fragment for the last item
  41024. // instead of the first because it can end up
  41025. // being emptied incorrectly in certain situations (#8070).
  41026. for (; i < l; i++) {
  41027. node = fragment;
  41028. if (i !== iNoClone) {
  41029. node = jQuery.clone(node, true, true);
  41030. // Keep references to cloned scripts for later restoration
  41031. if (hasScripts) {
  41032. // Support: Android <=4.0 only, PhantomJS 1 only
  41033. // push.apply(_, arraylike) throws on ancient WebKit
  41034. jQuery.merge(scripts, getAll(node, "script"));
  41035. }
  41036. }
  41037. callback.call(collection[i], node, i);
  41038. }
  41039. if (hasScripts) {
  41040. doc = scripts[scripts.length - 1].ownerDocument;
  41041. // Reenable scripts
  41042. jQuery.map(scripts, restoreScript);
  41043. // Evaluate executable scripts on first document insertion
  41044. for (i = 0; i < hasScripts; i++) {
  41045. node = scripts[i];
  41046. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  41047. if (node.src && (node.type || "").toLowerCase() !== "module") {
  41048. // Optional AJAX dependency, but won't run scripts if not present
  41049. if (jQuery._evalUrl) {
  41050. jQuery._evalUrl(node.src);
  41051. }
  41052. } else {
  41053. DOMEval(node.textContent.replace(rcleanScript, ""), doc, node);
  41054. }
  41055. }
  41056. }
  41057. }
  41058. }
  41059. }
  41060. return collection;
  41061. }
  41062. function _remove(elem, selector, keepData) {
  41063. var node,
  41064. nodes = selector ? jQuery.filter(selector, elem) : elem,
  41065. i = 0;
  41066. for (; (node = nodes[i]) != null; i++) {
  41067. if (!keepData && node.nodeType === 1) {
  41068. jQuery.cleanData(getAll(node));
  41069. }
  41070. if (node.parentNode) {
  41071. if (keepData && jQuery.contains(node.ownerDocument, node)) {
  41072. setGlobalEval(getAll(node, "script"));
  41073. }
  41074. node.parentNode.removeChild(node);
  41075. }
  41076. }
  41077. return elem;
  41078. }
  41079. jQuery.extend({
  41080. htmlPrefilter: function htmlPrefilter(html) {
  41081. return html.replace(rxhtmlTag, "<$1></$2>");
  41082. },
  41083. clone: function clone(elem, dataAndEvents, deepDataAndEvents) {
  41084. var i,
  41085. l,
  41086. srcElements,
  41087. destElements,
  41088. clone = elem.cloneNode(true),
  41089. inPage = jQuery.contains(elem.ownerDocument, elem);
  41090. // Fix IE cloning issues
  41091. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  41092. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  41093. destElements = getAll(clone);
  41094. srcElements = getAll(elem);
  41095. for (i = 0, l = srcElements.length; i < l; i++) {
  41096. fixInput(srcElements[i], destElements[i]);
  41097. }
  41098. }
  41099. // Copy the events from the original to the clone
  41100. if (dataAndEvents) {
  41101. if (deepDataAndEvents) {
  41102. srcElements = srcElements || getAll(elem);
  41103. destElements = destElements || getAll(clone);
  41104. for (i = 0, l = srcElements.length; i < l; i++) {
  41105. cloneCopyEvent(srcElements[i], destElements[i]);
  41106. }
  41107. } else {
  41108. cloneCopyEvent(elem, clone);
  41109. }
  41110. }
  41111. // Preserve script evaluation history
  41112. destElements = getAll(clone, "script");
  41113. if (destElements.length > 0) {
  41114. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  41115. }
  41116. // Return the cloned set
  41117. return clone;
  41118. },
  41119. cleanData: function cleanData(elems) {
  41120. var data,
  41121. elem,
  41122. type,
  41123. special = jQuery.event.special,
  41124. i = 0;
  41125. for (; (elem = elems[i]) !== undefined; i++) {
  41126. if (acceptData(elem)) {
  41127. if (data = elem[dataPriv.expando]) {
  41128. if (data.events) {
  41129. for (type in data.events) {
  41130. if (special[type]) {
  41131. jQuery.event.remove(elem, type);
  41132. // This is a shortcut to avoid jQuery.event.remove's overhead
  41133. } else {
  41134. jQuery.removeEvent(elem, type, data.handle);
  41135. }
  41136. }
  41137. }
  41138. // Support: Chrome <=35 - 45+
  41139. // Assign undefined instead of using delete, see Data#remove
  41140. elem[dataPriv.expando] = undefined;
  41141. }
  41142. if (elem[dataUser.expando]) {
  41143. // Support: Chrome <=35 - 45+
  41144. // Assign undefined instead of using delete, see Data#remove
  41145. elem[dataUser.expando] = undefined;
  41146. }
  41147. }
  41148. }
  41149. }
  41150. });
  41151. jQuery.fn.extend({
  41152. detach: function detach(selector) {
  41153. return _remove(this, selector, true);
  41154. },
  41155. remove: function remove(selector) {
  41156. return _remove(this, selector);
  41157. },
  41158. text: function text(value) {
  41159. return access(this, function (value) {
  41160. return value === undefined ? jQuery.text(this) : this.empty().each(function () {
  41161. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41162. this.textContent = value;
  41163. }
  41164. });
  41165. }, null, value, arguments.length);
  41166. },
  41167. append: function append() {
  41168. return domManip(this, arguments, function (elem) {
  41169. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41170. var target = manipulationTarget(this, elem);
  41171. target.appendChild(elem);
  41172. }
  41173. });
  41174. },
  41175. prepend: function prepend() {
  41176. return domManip(this, arguments, function (elem) {
  41177. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  41178. var target = manipulationTarget(this, elem);
  41179. target.insertBefore(elem, target.firstChild);
  41180. }
  41181. });
  41182. },
  41183. before: function before() {
  41184. return domManip(this, arguments, function (elem) {
  41185. if (this.parentNode) {
  41186. this.parentNode.insertBefore(elem, this);
  41187. }
  41188. });
  41189. },
  41190. after: function after() {
  41191. return domManip(this, arguments, function (elem) {
  41192. if (this.parentNode) {
  41193. this.parentNode.insertBefore(elem, this.nextSibling);
  41194. }
  41195. });
  41196. },
  41197. empty: function empty() {
  41198. var elem,
  41199. i = 0;
  41200. for (; (elem = this[i]) != null; i++) {
  41201. if (elem.nodeType === 1) {
  41202. // Prevent memory leaks
  41203. jQuery.cleanData(getAll(elem, false));
  41204. // Remove any remaining nodes
  41205. elem.textContent = "";
  41206. }
  41207. }
  41208. return this;
  41209. },
  41210. clone: function clone(dataAndEvents, deepDataAndEvents) {
  41211. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  41212. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  41213. return this.map(function () {
  41214. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  41215. });
  41216. },
  41217. html: function html(value) {
  41218. return access(this, function (value) {
  41219. var elem = this[0] || {},
  41220. i = 0,
  41221. l = this.length;
  41222. if (value === undefined && elem.nodeType === 1) {
  41223. return elem.innerHTML;
  41224. }
  41225. // See if we can take a shortcut and just use innerHTML
  41226. if (typeof value === "string" && !rnoInnerhtml.test(value) && !wrapMap[(rtagName.exec(value) || ["", ""])[1].toLowerCase()]) {
  41227. value = jQuery.htmlPrefilter(value);
  41228. try {
  41229. for (; i < l; i++) {
  41230. elem = this[i] || {};
  41231. // Remove element nodes and prevent memory leaks
  41232. if (elem.nodeType === 1) {
  41233. jQuery.cleanData(getAll(elem, false));
  41234. elem.innerHTML = value;
  41235. }
  41236. }
  41237. elem = 0;
  41238. // If using innerHTML throws an exception, use the fallback method
  41239. } catch (e) {}
  41240. }
  41241. if (elem) {
  41242. this.empty().append(value);
  41243. }
  41244. }, null, value, arguments.length);
  41245. },
  41246. replaceWith: function replaceWith() {
  41247. var ignored = [];
  41248. // Make the changes, replacing each non-ignored context element with the new content
  41249. return domManip(this, arguments, function (elem) {
  41250. var parent = this.parentNode;
  41251. if (jQuery.inArray(this, ignored) < 0) {
  41252. jQuery.cleanData(getAll(this));
  41253. if (parent) {
  41254. parent.replaceChild(elem, this);
  41255. }
  41256. }
  41257. // Force callback invocation
  41258. }, ignored);
  41259. }
  41260. });
  41261. jQuery.each({
  41262. appendTo: "append",
  41263. prependTo: "prepend",
  41264. insertBefore: "before",
  41265. insertAfter: "after",
  41266. replaceAll: "replaceWith"
  41267. }, function (name, original) {
  41268. jQuery.fn[name] = function (selector) {
  41269. var elems,
  41270. ret = [],
  41271. insert = jQuery(selector),
  41272. last = insert.length - 1,
  41273. i = 0;
  41274. for (; i <= last; i++) {
  41275. elems = i === last ? this : this.clone(true);
  41276. jQuery(insert[i])[original](elems);
  41277. // Support: Android <=4.0 only, PhantomJS 1 only
  41278. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  41279. push.apply(ret, elems.get());
  41280. }
  41281. return this.pushStack(ret);
  41282. };
  41283. });
  41284. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  41285. var getStyles = function getStyles(elem) {
  41286. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  41287. // IE throws on elements created in popups
  41288. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  41289. var view = elem.ownerDocument.defaultView;
  41290. if (!view || !view.opener) {
  41291. view = window;
  41292. }
  41293. return view.getComputedStyle(elem);
  41294. };
  41295. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  41296. (function () {
  41297. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  41298. // so they're executed at the same time to save the second computation.
  41299. function computeStyleTests() {
  41300. // This is a singleton, we need to execute it only once
  41301. if (!div) {
  41302. return;
  41303. }
  41304. container.style.cssText = "position:absolute;left:-11111px;width:60px;" + "margin-top:1px;padding:0;border:0";
  41305. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;" + "margin:auto;border:1px;padding:1px;" + "width:60%;top:1%";
  41306. documentElement.appendChild(container).appendChild(div);
  41307. var divStyle = window.getComputedStyle(div);
  41308. pixelPositionVal = divStyle.top !== "1%";
  41309. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  41310. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  41311. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  41312. // Some styles come back with percentage values, even though they shouldn't
  41313. div.style.right = "60%";
  41314. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  41315. // Support: IE 9 - 11 only
  41316. // Detect misreporting of content dimensions for box-sizing:border-box elements
  41317. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  41318. // Support: IE 9 only
  41319. // Detect overflow:scroll screwiness (gh-3699)
  41320. div.style.position = "absolute";
  41321. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  41322. documentElement.removeChild(container);
  41323. // Nullify the div so it wouldn't be stored in the memory and
  41324. // it will also be a sign that checks already performed
  41325. div = null;
  41326. }
  41327. function roundPixelMeasures(measure) {
  41328. return Math.round(parseFloat(measure));
  41329. }
  41330. var pixelPositionVal,
  41331. boxSizingReliableVal,
  41332. scrollboxSizeVal,
  41333. pixelBoxStylesVal,
  41334. reliableMarginLeftVal,
  41335. container = document.createElement("div"),
  41336. div = document.createElement("div");
  41337. // Finish early in limited (non-browser) environments
  41338. if (!div.style) {
  41339. return;
  41340. }
  41341. // Support: IE <=9 - 11 only
  41342. // Style of cloned element affects source element cloned (#8908)
  41343. div.style.backgroundClip = "content-box";
  41344. div.cloneNode(true).style.backgroundClip = "";
  41345. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  41346. jQuery.extend(support, {
  41347. boxSizingReliable: function boxSizingReliable() {
  41348. computeStyleTests();
  41349. return boxSizingReliableVal;
  41350. },
  41351. pixelBoxStyles: function pixelBoxStyles() {
  41352. computeStyleTests();
  41353. return pixelBoxStylesVal;
  41354. },
  41355. pixelPosition: function pixelPosition() {
  41356. computeStyleTests();
  41357. return pixelPositionVal;
  41358. },
  41359. reliableMarginLeft: function reliableMarginLeft() {
  41360. computeStyleTests();
  41361. return reliableMarginLeftVal;
  41362. },
  41363. scrollboxSize: function scrollboxSize() {
  41364. computeStyleTests();
  41365. return scrollboxSizeVal;
  41366. }
  41367. });
  41368. })();
  41369. function curCSS(elem, name, computed) {
  41370. var width,
  41371. minWidth,
  41372. maxWidth,
  41373. ret,
  41374. // Support: Firefox 51+
  41375. // Retrieving style before computed somehow
  41376. // fixes an issue with getting wrong values
  41377. // on detached elements
  41378. style = elem.style;
  41379. computed = computed || getStyles(elem);
  41380. // getPropertyValue is needed for:
  41381. // .css('filter') (IE 9 only, #12537)
  41382. // .css('--customProperty) (#3144)
  41383. if (computed) {
  41384. ret = computed.getPropertyValue(name) || computed[name];
  41385. if (ret === "" && !jQuery.contains(elem.ownerDocument, elem)) {
  41386. ret = jQuery.style(elem, name);
  41387. }
  41388. // A tribute to the "awesome hack by Dean Edwards"
  41389. // Android Browser returns percentage for some values,
  41390. // but width seems to be reliably pixels.
  41391. // This is against the CSSOM draft spec:
  41392. // https://drafts.csswg.org/cssom/#resolved-values
  41393. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  41394. // Remember the original values
  41395. width = style.width;
  41396. minWidth = style.minWidth;
  41397. maxWidth = style.maxWidth;
  41398. // Put in the new values to get a computed value out
  41399. style.minWidth = style.maxWidth = style.width = ret;
  41400. ret = computed.width;
  41401. // Revert the changed values
  41402. style.width = width;
  41403. style.minWidth = minWidth;
  41404. style.maxWidth = maxWidth;
  41405. }
  41406. }
  41407. return ret !== undefined ?
  41408. // Support: IE <=9 - 11 only
  41409. // IE returns zIndex value as an integer.
  41410. ret + "" : ret;
  41411. }
  41412. function addGetHookIf(conditionFn, hookFn) {
  41413. // Define the hook, we'll check on the first run if it's really needed.
  41414. return {
  41415. get: function get() {
  41416. if (conditionFn()) {
  41417. // Hook not needed (or it's not possible to use it due
  41418. // to missing dependency), remove it.
  41419. delete this.get;
  41420. return;
  41421. }
  41422. // Hook needed; redefine it so that the support test is not executed again.
  41423. return (this.get = hookFn).apply(this, arguments);
  41424. }
  41425. };
  41426. }
  41427. var
  41428. // Swappable if display is none or starts with table
  41429. // except "table", "table-cell", or "table-caption"
  41430. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  41431. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  41432. rcustomProp = /^--/,
  41433. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  41434. cssNormalTransform = {
  41435. letterSpacing: "0",
  41436. fontWeight: "400"
  41437. },
  41438. cssPrefixes = ["Webkit", "Moz", "ms"],
  41439. emptyStyle = document.createElement("div").style;
  41440. // Return a css property mapped to a potentially vendor prefixed property
  41441. function vendorPropName(name) {
  41442. // Shortcut for names that are not vendor prefixed
  41443. if (name in emptyStyle) {
  41444. return name;
  41445. }
  41446. // Check for vendor prefixed names
  41447. var capName = name[0].toUpperCase() + name.slice(1),
  41448. i = cssPrefixes.length;
  41449. while (i--) {
  41450. name = cssPrefixes[i] + capName;
  41451. if (name in emptyStyle) {
  41452. return name;
  41453. }
  41454. }
  41455. }
  41456. // Return a property mapped along what jQuery.cssProps suggests or to
  41457. // a vendor prefixed property.
  41458. function finalPropName(name) {
  41459. var ret = jQuery.cssProps[name];
  41460. if (!ret) {
  41461. ret = jQuery.cssProps[name] = vendorPropName(name) || name;
  41462. }
  41463. return ret;
  41464. }
  41465. function setPositiveNumber(elem, value, subtract) {
  41466. // Any relative (+/-) values have already been
  41467. // normalized at this point
  41468. var matches = rcssNum.exec(value);
  41469. return matches ?
  41470. // Guard against undefined "subtract", e.g., when used as in cssHooks
  41471. Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  41472. }
  41473. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  41474. var i = dimension === "width" ? 1 : 0,
  41475. extra = 0,
  41476. delta = 0;
  41477. // Adjustment may not be necessary
  41478. if (box === (isBorderBox ? "border" : "content")) {
  41479. return 0;
  41480. }
  41481. for (; i < 4; i += 2) {
  41482. // Both box models exclude margin
  41483. if (box === "margin") {
  41484. delta += jQuery.css(elem, box + cssExpand[i], true, styles);
  41485. }
  41486. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  41487. if (!isBorderBox) {
  41488. // Add padding
  41489. delta += jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41490. // For "border" or "margin", add border
  41491. if (box !== "padding") {
  41492. delta += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41493. // But still keep track of it otherwise
  41494. } else {
  41495. extra += jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41496. }
  41497. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  41498. // "padding" or "margin"
  41499. } else {
  41500. // For "content", subtract padding
  41501. if (box === "content") {
  41502. delta -= jQuery.css(elem, "padding" + cssExpand[i], true, styles);
  41503. }
  41504. // For "content" or "padding", subtract border
  41505. if (box !== "margin") {
  41506. delta -= jQuery.css(elem, "border" + cssExpand[i] + "Width", true, styles);
  41507. }
  41508. }
  41509. }
  41510. // Account for positive content-box scroll gutter when requested by providing computedVal
  41511. if (!isBorderBox && computedVal >= 0) {
  41512. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  41513. // Assuming integer scroll gutter, subtract the rest and round down
  41514. delta += Math.max(0, Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5));
  41515. }
  41516. return delta;
  41517. }
  41518. function getWidthOrHeight(elem, dimension, extra) {
  41519. // Start with computed style
  41520. var styles = getStyles(elem),
  41521. val = curCSS(elem, dimension, styles),
  41522. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41523. valueIsBorderBox = isBorderBox;
  41524. // Support: Firefox <=54
  41525. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  41526. if (rnumnonpx.test(val)) {
  41527. if (!extra) {
  41528. return val;
  41529. }
  41530. val = "auto";
  41531. }
  41532. // Check for style in case a browser which returns unreliable values
  41533. // for getComputedStyle silently falls back to the reliable elem.style
  41534. valueIsBorderBox = valueIsBorderBox && (support.boxSizingReliable() || val === elem.style[dimension]);
  41535. // Fall back to offsetWidth/offsetHeight when value is "auto"
  41536. // This happens for inline elements with no explicit setting (gh-3571)
  41537. // Support: Android <=4.1 - 4.3 only
  41538. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  41539. if (val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") {
  41540. val = elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)];
  41541. // offsetWidth/offsetHeight provide border-box values
  41542. valueIsBorderBox = true;
  41543. }
  41544. // Normalize "" and auto
  41545. val = parseFloat(val) || 0;
  41546. // Adjust for the element's box model
  41547. return val + boxModelAdjustment(elem, dimension, extra || (isBorderBox ? "border" : "content"), valueIsBorderBox, styles,
  41548. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  41549. val) + "px";
  41550. }
  41551. jQuery.extend({
  41552. // Add in style property hooks for overriding the default
  41553. // behavior of getting and setting a style property
  41554. cssHooks: {
  41555. opacity: {
  41556. get: function get(elem, computed) {
  41557. if (computed) {
  41558. // We should always get a number back from opacity
  41559. var ret = curCSS(elem, "opacity");
  41560. return ret === "" ? "1" : ret;
  41561. }
  41562. }
  41563. }
  41564. },
  41565. // Don't automatically add "px" to these possibly-unitless properties
  41566. cssNumber: {
  41567. "animationIterationCount": true,
  41568. "columnCount": true,
  41569. "fillOpacity": true,
  41570. "flexGrow": true,
  41571. "flexShrink": true,
  41572. "fontWeight": true,
  41573. "lineHeight": true,
  41574. "opacity": true,
  41575. "order": true,
  41576. "orphans": true,
  41577. "widows": true,
  41578. "zIndex": true,
  41579. "zoom": true
  41580. },
  41581. // Add in properties whose names you wish to fix before
  41582. // setting or getting the value
  41583. cssProps: {},
  41584. // Get and set the style property on a DOM Node
  41585. style: function style(elem, name, value, extra) {
  41586. // Don't set styles on text and comment nodes
  41587. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  41588. return;
  41589. }
  41590. // Make sure that we're working with the right name
  41591. var ret,
  41592. type,
  41593. hooks,
  41594. origName = camelCase(name),
  41595. isCustomProp = rcustomProp.test(name),
  41596. style = elem.style;
  41597. // Make sure that we're working with the right name. We don't
  41598. // want to query the value if it is a CSS custom property
  41599. // since they are user-defined.
  41600. if (!isCustomProp) {
  41601. name = finalPropName(origName);
  41602. }
  41603. // Gets hook for the prefixed version, then unprefixed version
  41604. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41605. // Check if we're setting a value
  41606. if (value !== undefined) {
  41607. type = typeof value === "undefined" ? "undefined" : _typeof(value);
  41608. // Convert "+=" or "-=" to relative numbers (#7345)
  41609. if (type === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  41610. value = adjustCSS(elem, name, ret);
  41611. // Fixes bug #9237
  41612. type = "number";
  41613. }
  41614. // Make sure that null and NaN values aren't set (#7116)
  41615. if (value == null || value !== value) {
  41616. return;
  41617. }
  41618. // If a number was passed in, add the unit (except for certain CSS properties)
  41619. if (type === "number") {
  41620. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  41621. }
  41622. // background-* props affect original clone's values
  41623. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  41624. style[name] = "inherit";
  41625. }
  41626. // If a hook was provided, use that value, otherwise just set the specified value
  41627. if (!hooks || !("set" in hooks) || (value = hooks.set(elem, value, extra)) !== undefined) {
  41628. if (isCustomProp) {
  41629. style.setProperty(name, value);
  41630. } else {
  41631. style[name] = value;
  41632. }
  41633. }
  41634. } else {
  41635. // If a hook was provided get the non-computed value from there
  41636. if (hooks && "get" in hooks && (ret = hooks.get(elem, false, extra)) !== undefined) {
  41637. return ret;
  41638. }
  41639. // Otherwise just get the value from the style object
  41640. return style[name];
  41641. }
  41642. },
  41643. css: function css(elem, name, extra, styles) {
  41644. var val,
  41645. num,
  41646. hooks,
  41647. origName = camelCase(name),
  41648. isCustomProp = rcustomProp.test(name);
  41649. // Make sure that we're working with the right name. We don't
  41650. // want to modify the value if it is a CSS custom property
  41651. // since they are user-defined.
  41652. if (!isCustomProp) {
  41653. name = finalPropName(origName);
  41654. }
  41655. // Try prefixed name followed by the unprefixed name
  41656. hooks = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  41657. // If a hook was provided get the computed value from there
  41658. if (hooks && "get" in hooks) {
  41659. val = hooks.get(elem, true, extra);
  41660. }
  41661. // Otherwise, if a way to get the computed value exists, use that
  41662. if (val === undefined) {
  41663. val = curCSS(elem, name, styles);
  41664. }
  41665. // Convert "normal" to computed value
  41666. if (val === "normal" && name in cssNormalTransform) {
  41667. val = cssNormalTransform[name];
  41668. }
  41669. // Make numeric if forced or a qualifier was provided and val looks numeric
  41670. if (extra === "" || extra) {
  41671. num = parseFloat(val);
  41672. return extra === true || isFinite(num) ? num || 0 : val;
  41673. }
  41674. return val;
  41675. }
  41676. });
  41677. jQuery.each(["height", "width"], function (i, dimension) {
  41678. jQuery.cssHooks[dimension] = {
  41679. get: function get(elem, computed, extra) {
  41680. if (computed) {
  41681. // Certain elements can have dimension info if we invisibly show them
  41682. // but it must have a current display style that would benefit
  41683. return rdisplayswap.test(jQuery.css(elem, "display")) && (
  41684. // Support: Safari 8+
  41685. // Table columns in Safari have non-zero offsetWidth & zero
  41686. // getBoundingClientRect().width unless display is changed.
  41687. // Support: IE <=11 only
  41688. // Running getBoundingClientRect on a disconnected node
  41689. // in IE throws an error.
  41690. !elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function () {
  41691. return getWidthOrHeight(elem, dimension, extra);
  41692. }) : getWidthOrHeight(elem, dimension, extra);
  41693. }
  41694. },
  41695. set: function set(elem, value, extra) {
  41696. var matches,
  41697. styles = getStyles(elem),
  41698. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box",
  41699. subtract = extra && boxModelAdjustment(elem, dimension, extra, isBorderBox, styles);
  41700. // Account for unreliable border-box dimensions by comparing offset* to computed and
  41701. // faking a content-box to get border and padding (gh-3699)
  41702. if (isBorderBox && support.scrollboxSize() === styles.position) {
  41703. subtract -= Math.ceil(elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5);
  41704. }
  41705. // Convert to pixels if value adjustment is needed
  41706. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  41707. elem.style[dimension] = value;
  41708. value = jQuery.css(elem, dimension);
  41709. }
  41710. return setPositiveNumber(elem, value, subtract);
  41711. }
  41712. };
  41713. });
  41714. jQuery.cssHooks.marginLeft = addGetHookIf(support.reliableMarginLeft, function (elem, computed) {
  41715. if (computed) {
  41716. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function () {
  41717. return elem.getBoundingClientRect().left;
  41718. })) + "px";
  41719. }
  41720. });
  41721. // These hooks are used by animate to expand properties
  41722. jQuery.each({
  41723. margin: "",
  41724. padding: "",
  41725. border: "Width"
  41726. }, function (prefix, suffix) {
  41727. jQuery.cssHooks[prefix + suffix] = {
  41728. expand: function expand(value) {
  41729. var i = 0,
  41730. expanded = {},
  41731. // Assumes a single number if not a string
  41732. parts = typeof value === "string" ? value.split(" ") : [value];
  41733. for (; i < 4; i++) {
  41734. expanded[prefix + cssExpand[i] + suffix] = parts[i] || parts[i - 2] || parts[0];
  41735. }
  41736. return expanded;
  41737. }
  41738. };
  41739. if (prefix !== "margin") {
  41740. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  41741. }
  41742. });
  41743. jQuery.fn.extend({
  41744. css: function css(name, value) {
  41745. return access(this, function (elem, name, value) {
  41746. var styles,
  41747. len,
  41748. map = {},
  41749. i = 0;
  41750. if (Array.isArray(name)) {
  41751. styles = getStyles(elem);
  41752. len = name.length;
  41753. for (; i < len; i++) {
  41754. map[name[i]] = jQuery.css(elem, name[i], false, styles);
  41755. }
  41756. return map;
  41757. }
  41758. return value !== undefined ? jQuery.style(elem, name, value) : jQuery.css(elem, name);
  41759. }, name, value, arguments.length > 1);
  41760. }
  41761. });
  41762. function Tween(elem, options, prop, end, easing) {
  41763. return new Tween.prototype.init(elem, options, prop, end, easing);
  41764. }
  41765. jQuery.Tween = Tween;
  41766. Tween.prototype = {
  41767. constructor: Tween,
  41768. init: function init(elem, options, prop, end, easing, unit) {
  41769. this.elem = elem;
  41770. this.prop = prop;
  41771. this.easing = easing || jQuery.easing._default;
  41772. this.options = options;
  41773. this.start = this.now = this.cur();
  41774. this.end = end;
  41775. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  41776. },
  41777. cur: function cur() {
  41778. var hooks = Tween.propHooks[this.prop];
  41779. return hooks && hooks.get ? hooks.get(this) : Tween.propHooks._default.get(this);
  41780. },
  41781. run: function run(percent) {
  41782. var eased,
  41783. hooks = Tween.propHooks[this.prop];
  41784. if (this.options.duration) {
  41785. this.pos = eased = jQuery.easing[this.easing](percent, this.options.duration * percent, 0, 1, this.options.duration);
  41786. } else {
  41787. this.pos = eased = percent;
  41788. }
  41789. this.now = (this.end - this.start) * eased + this.start;
  41790. if (this.options.step) {
  41791. this.options.step.call(this.elem, this.now, this);
  41792. }
  41793. if (hooks && hooks.set) {
  41794. hooks.set(this);
  41795. } else {
  41796. Tween.propHooks._default.set(this);
  41797. }
  41798. return this;
  41799. }
  41800. };
  41801. Tween.prototype.init.prototype = Tween.prototype;
  41802. Tween.propHooks = {
  41803. _default: {
  41804. get: function get(tween) {
  41805. var result;
  41806. // Use a property on the element directly when it is not a DOM element,
  41807. // or when there is no matching style property that exists.
  41808. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  41809. return tween.elem[tween.prop];
  41810. }
  41811. // Passing an empty string as a 3rd parameter to .css will automatically
  41812. // attempt a parseFloat and fallback to a string if the parse fails.
  41813. // Simple values such as "10px" are parsed to Float;
  41814. // complex values such as "rotate(1rad)" are returned as-is.
  41815. result = jQuery.css(tween.elem, tween.prop, "");
  41816. // Empty strings, null, undefined and "auto" are converted to 0.
  41817. return !result || result === "auto" ? 0 : result;
  41818. },
  41819. set: function set(tween) {
  41820. // Use step hook for back compat.
  41821. // Use cssHook if its there.
  41822. // Use .style if available and use plain properties where available.
  41823. if (jQuery.fx.step[tween.prop]) {
  41824. jQuery.fx.step[tween.prop](tween);
  41825. } else if (tween.elem.nodeType === 1 && (tween.elem.style[jQuery.cssProps[tween.prop]] != null || jQuery.cssHooks[tween.prop])) {
  41826. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  41827. } else {
  41828. tween.elem[tween.prop] = tween.now;
  41829. }
  41830. }
  41831. }
  41832. };
  41833. // Support: IE <=9 only
  41834. // Panic based approach to setting things on disconnected nodes
  41835. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  41836. set: function set(tween) {
  41837. if (tween.elem.nodeType && tween.elem.parentNode) {
  41838. tween.elem[tween.prop] = tween.now;
  41839. }
  41840. }
  41841. };
  41842. jQuery.easing = {
  41843. linear: function linear(p) {
  41844. return p;
  41845. },
  41846. swing: function swing(p) {
  41847. return 0.5 - Math.cos(p * Math.PI) / 2;
  41848. },
  41849. _default: "swing"
  41850. };
  41851. jQuery.fx = Tween.prototype.init;
  41852. // Back compat <1.8 extension point
  41853. jQuery.fx.step = {};
  41854. var fxNow,
  41855. inProgress,
  41856. rfxtypes = /^(?:toggle|show|hide)$/,
  41857. rrun = /queueHooks$/;
  41858. function schedule() {
  41859. if (inProgress) {
  41860. if (document.hidden === false && window.requestAnimationFrame) {
  41861. window.requestAnimationFrame(schedule);
  41862. } else {
  41863. window.setTimeout(schedule, jQuery.fx.interval);
  41864. }
  41865. jQuery.fx.tick();
  41866. }
  41867. }
  41868. // Animations created synchronously will run synchronously
  41869. function createFxNow() {
  41870. window.setTimeout(function () {
  41871. fxNow = undefined;
  41872. });
  41873. return fxNow = Date.now();
  41874. }
  41875. // Generate parameters to create a standard animation
  41876. function genFx(type, includeWidth) {
  41877. var which,
  41878. i = 0,
  41879. attrs = { height: type };
  41880. // If we include width, step value is 1 to do all cssExpand values,
  41881. // otherwise step value is 2 to skip over Left and Right
  41882. includeWidth = includeWidth ? 1 : 0;
  41883. for (; i < 4; i += 2 - includeWidth) {
  41884. which = cssExpand[i];
  41885. attrs["margin" + which] = attrs["padding" + which] = type;
  41886. }
  41887. if (includeWidth) {
  41888. attrs.opacity = attrs.width = type;
  41889. }
  41890. return attrs;
  41891. }
  41892. function createTween(value, prop, animation) {
  41893. var tween,
  41894. collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]),
  41895. index = 0,
  41896. length = collection.length;
  41897. for (; index < length; index++) {
  41898. if (tween = collection[index].call(animation, prop, value)) {
  41899. // We're done with this property
  41900. return tween;
  41901. }
  41902. }
  41903. }
  41904. function defaultPrefilter(elem, props, opts) {
  41905. var prop,
  41906. value,
  41907. toggle,
  41908. hooks,
  41909. oldfire,
  41910. propTween,
  41911. restoreDisplay,
  41912. display,
  41913. isBox = "width" in props || "height" in props,
  41914. anim = this,
  41915. orig = {},
  41916. style = elem.style,
  41917. hidden = elem.nodeType && isHiddenWithinTree(elem),
  41918. dataShow = dataPriv.get(elem, "fxshow");
  41919. // Queue-skipping animations hijack the fx hooks
  41920. if (!opts.queue) {
  41921. hooks = jQuery._queueHooks(elem, "fx");
  41922. if (hooks.unqueued == null) {
  41923. hooks.unqueued = 0;
  41924. oldfire = hooks.empty.fire;
  41925. hooks.empty.fire = function () {
  41926. if (!hooks.unqueued) {
  41927. oldfire();
  41928. }
  41929. };
  41930. }
  41931. hooks.unqueued++;
  41932. anim.always(function () {
  41933. // Ensure the complete handler is called before this completes
  41934. anim.always(function () {
  41935. hooks.unqueued--;
  41936. if (!jQuery.queue(elem, "fx").length) {
  41937. hooks.empty.fire();
  41938. }
  41939. });
  41940. });
  41941. }
  41942. // Detect show/hide animations
  41943. for (prop in props) {
  41944. value = props[prop];
  41945. if (rfxtypes.test(value)) {
  41946. delete props[prop];
  41947. toggle = toggle || value === "toggle";
  41948. if (value === (hidden ? "hide" : "show")) {
  41949. // Pretend to be hidden if this is a "show" and
  41950. // there is still data from a stopped show/hide
  41951. if (value === "show" && dataShow && dataShow[prop] !== undefined) {
  41952. hidden = true;
  41953. // Ignore all other no-op show/hide data
  41954. } else {
  41955. continue;
  41956. }
  41957. }
  41958. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  41959. }
  41960. }
  41961. // Bail out if this is a no-op like .hide().hide()
  41962. propTween = !jQuery.isEmptyObject(props);
  41963. if (!propTween && jQuery.isEmptyObject(orig)) {
  41964. return;
  41965. }
  41966. // Restrict "overflow" and "display" styles during box animations
  41967. if (isBox && elem.nodeType === 1) {
  41968. // Support: IE <=9 - 11, Edge 12 - 15
  41969. // Record all 3 overflow attributes because IE does not infer the shorthand
  41970. // from identically-valued overflowX and overflowY and Edge just mirrors
  41971. // the overflowX value there.
  41972. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  41973. // Identify a display type, preferring old show/hide data over the CSS cascade
  41974. restoreDisplay = dataShow && dataShow.display;
  41975. if (restoreDisplay == null) {
  41976. restoreDisplay = dataPriv.get(elem, "display");
  41977. }
  41978. display = jQuery.css(elem, "display");
  41979. if (display === "none") {
  41980. if (restoreDisplay) {
  41981. display = restoreDisplay;
  41982. } else {
  41983. // Get nonempty value(s) by temporarily forcing visibility
  41984. showHide([elem], true);
  41985. restoreDisplay = elem.style.display || restoreDisplay;
  41986. display = jQuery.css(elem, "display");
  41987. showHide([elem]);
  41988. }
  41989. }
  41990. // Animate inline elements as inline-block
  41991. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  41992. if (jQuery.css(elem, "float") === "none") {
  41993. // Restore the original display value at the end of pure show/hide animations
  41994. if (!propTween) {
  41995. anim.done(function () {
  41996. style.display = restoreDisplay;
  41997. });
  41998. if (restoreDisplay == null) {
  41999. display = style.display;
  42000. restoreDisplay = display === "none" ? "" : display;
  42001. }
  42002. }
  42003. style.display = "inline-block";
  42004. }
  42005. }
  42006. }
  42007. if (opts.overflow) {
  42008. style.overflow = "hidden";
  42009. anim.always(function () {
  42010. style.overflow = opts.overflow[0];
  42011. style.overflowX = opts.overflow[1];
  42012. style.overflowY = opts.overflow[2];
  42013. });
  42014. }
  42015. // Implement show/hide animations
  42016. propTween = false;
  42017. for (prop in orig) {
  42018. // General show/hide setup for this element animation
  42019. if (!propTween) {
  42020. if (dataShow) {
  42021. if ("hidden" in dataShow) {
  42022. hidden = dataShow.hidden;
  42023. }
  42024. } else {
  42025. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  42026. }
  42027. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  42028. if (toggle) {
  42029. dataShow.hidden = !hidden;
  42030. }
  42031. // Show elements before animating them
  42032. if (hidden) {
  42033. showHide([elem], true);
  42034. }
  42035. /* eslint-disable no-loop-func */
  42036. anim.done(function () {
  42037. /* eslint-enable no-loop-func */
  42038. // The final step of a "hide" animation is actually hiding the element
  42039. if (!hidden) {
  42040. showHide([elem]);
  42041. }
  42042. dataPriv.remove(elem, "fxshow");
  42043. for (prop in orig) {
  42044. jQuery.style(elem, prop, orig[prop]);
  42045. }
  42046. });
  42047. }
  42048. // Per-property setup
  42049. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  42050. if (!(prop in dataShow)) {
  42051. dataShow[prop] = propTween.start;
  42052. if (hidden) {
  42053. propTween.end = propTween.start;
  42054. propTween.start = 0;
  42055. }
  42056. }
  42057. }
  42058. }
  42059. function propFilter(props, specialEasing) {
  42060. var index, name, easing, value, hooks;
  42061. // camelCase, specialEasing and expand cssHook pass
  42062. for (index in props) {
  42063. name = camelCase(index);
  42064. easing = specialEasing[name];
  42065. value = props[index];
  42066. if (Array.isArray(value)) {
  42067. easing = value[1];
  42068. value = props[index] = value[0];
  42069. }
  42070. if (index !== name) {
  42071. props[name] = value;
  42072. delete props[index];
  42073. }
  42074. hooks = jQuery.cssHooks[name];
  42075. if (hooks && "expand" in hooks) {
  42076. value = hooks.expand(value);
  42077. delete props[name];
  42078. // Not quite $.extend, this won't overwrite existing keys.
  42079. // Reusing 'index' because we have the correct "name"
  42080. for (index in value) {
  42081. if (!(index in props)) {
  42082. props[index] = value[index];
  42083. specialEasing[index] = easing;
  42084. }
  42085. }
  42086. } else {
  42087. specialEasing[name] = easing;
  42088. }
  42089. }
  42090. }
  42091. function Animation(elem, properties, options) {
  42092. var result,
  42093. stopped,
  42094. index = 0,
  42095. length = Animation.prefilters.length,
  42096. deferred = jQuery.Deferred().always(function () {
  42097. // Don't match elem in the :animated selector
  42098. delete tick.elem;
  42099. }),
  42100. tick = function tick() {
  42101. if (stopped) {
  42102. return false;
  42103. }
  42104. var currentTime = fxNow || createFxNow(),
  42105. remaining = Math.max(0, animation.startTime + animation.duration - currentTime),
  42106. // Support: Android 2.3 only
  42107. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  42108. temp = remaining / animation.duration || 0,
  42109. percent = 1 - temp,
  42110. index = 0,
  42111. length = animation.tweens.length;
  42112. for (; index < length; index++) {
  42113. animation.tweens[index].run(percent);
  42114. }
  42115. deferred.notifyWith(elem, [animation, percent, remaining]);
  42116. // If there's more to do, yield
  42117. if (percent < 1 && length) {
  42118. return remaining;
  42119. }
  42120. // If this was an empty animation, synthesize a final progress notification
  42121. if (!length) {
  42122. deferred.notifyWith(elem, [animation, 1, 0]);
  42123. }
  42124. // Resolve the animation and report its conclusion
  42125. deferred.resolveWith(elem, [animation]);
  42126. return false;
  42127. },
  42128. animation = deferred.promise({
  42129. elem: elem,
  42130. props: jQuery.extend({}, properties),
  42131. opts: jQuery.extend(true, {
  42132. specialEasing: {},
  42133. easing: jQuery.easing._default
  42134. }, options),
  42135. originalProperties: properties,
  42136. originalOptions: options,
  42137. startTime: fxNow || createFxNow(),
  42138. duration: options.duration,
  42139. tweens: [],
  42140. createTween: function createTween(prop, end) {
  42141. var tween = jQuery.Tween(elem, animation.opts, prop, end, animation.opts.specialEasing[prop] || animation.opts.easing);
  42142. animation.tweens.push(tween);
  42143. return tween;
  42144. },
  42145. stop: function stop(gotoEnd) {
  42146. var index = 0,
  42147. // If we are going to the end, we want to run all the tweens
  42148. // otherwise we skip this part
  42149. length = gotoEnd ? animation.tweens.length : 0;
  42150. if (stopped) {
  42151. return this;
  42152. }
  42153. stopped = true;
  42154. for (; index < length; index++) {
  42155. animation.tweens[index].run(1);
  42156. }
  42157. // Resolve when we played the last frame; otherwise, reject
  42158. if (gotoEnd) {
  42159. deferred.notifyWith(elem, [animation, 1, 0]);
  42160. deferred.resolveWith(elem, [animation, gotoEnd]);
  42161. } else {
  42162. deferred.rejectWith(elem, [animation, gotoEnd]);
  42163. }
  42164. return this;
  42165. }
  42166. }),
  42167. props = animation.props;
  42168. propFilter(props, animation.opts.specialEasing);
  42169. for (; index < length; index++) {
  42170. result = Animation.prefilters[index].call(animation, elem, props, animation.opts);
  42171. if (result) {
  42172. if (isFunction(result.stop)) {
  42173. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  42174. }
  42175. return result;
  42176. }
  42177. }
  42178. jQuery.map(props, createTween, animation);
  42179. if (isFunction(animation.opts.start)) {
  42180. animation.opts.start.call(elem, animation);
  42181. }
  42182. // Attach callbacks from options
  42183. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  42184. jQuery.fx.timer(jQuery.extend(tick, {
  42185. elem: elem,
  42186. anim: animation,
  42187. queue: animation.opts.queue
  42188. }));
  42189. return animation;
  42190. }
  42191. jQuery.Animation = jQuery.extend(Animation, {
  42192. tweeners: {
  42193. "*": [function (prop, value) {
  42194. var tween = this.createTween(prop, value);
  42195. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  42196. return tween;
  42197. }]
  42198. },
  42199. tweener: function tweener(props, callback) {
  42200. if (isFunction(props)) {
  42201. callback = props;
  42202. props = ["*"];
  42203. } else {
  42204. props = props.match(rnothtmlwhite);
  42205. }
  42206. var prop,
  42207. index = 0,
  42208. length = props.length;
  42209. for (; index < length; index++) {
  42210. prop = props[index];
  42211. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  42212. Animation.tweeners[prop].unshift(callback);
  42213. }
  42214. },
  42215. prefilters: [defaultPrefilter],
  42216. prefilter: function prefilter(callback, prepend) {
  42217. if (prepend) {
  42218. Animation.prefilters.unshift(callback);
  42219. } else {
  42220. Animation.prefilters.push(callback);
  42221. }
  42222. }
  42223. });
  42224. jQuery.speed = function (speed, easing, fn) {
  42225. var opt = speed && (typeof speed === "undefined" ? "undefined" : _typeof(speed)) === "object" ? jQuery.extend({}, speed) : {
  42226. complete: fn || !fn && easing || isFunction(speed) && speed,
  42227. duration: speed,
  42228. easing: fn && easing || easing && !isFunction(easing) && easing
  42229. };
  42230. // Go to the end state if fx are off
  42231. if (jQuery.fx.off) {
  42232. opt.duration = 0;
  42233. } else {
  42234. if (typeof opt.duration !== "number") {
  42235. if (opt.duration in jQuery.fx.speeds) {
  42236. opt.duration = jQuery.fx.speeds[opt.duration];
  42237. } else {
  42238. opt.duration = jQuery.fx.speeds._default;
  42239. }
  42240. }
  42241. }
  42242. // Normalize opt.queue - true/undefined/null -> "fx"
  42243. if (opt.queue == null || opt.queue === true) {
  42244. opt.queue = "fx";
  42245. }
  42246. // Queueing
  42247. opt.old = opt.complete;
  42248. opt.complete = function () {
  42249. if (isFunction(opt.old)) {
  42250. opt.old.call(this);
  42251. }
  42252. if (opt.queue) {
  42253. jQuery.dequeue(this, opt.queue);
  42254. }
  42255. };
  42256. return opt;
  42257. };
  42258. jQuery.fn.extend({
  42259. fadeTo: function fadeTo(speed, to, easing, callback) {
  42260. // Show any hidden elements after setting opacity to 0
  42261. return this.filter(isHiddenWithinTree).css("opacity", 0).show()
  42262. // Animate to the value specified
  42263. .end().animate({ opacity: to }, speed, easing, callback);
  42264. },
  42265. animate: function animate(prop, speed, easing, callback) {
  42266. var empty = jQuery.isEmptyObject(prop),
  42267. optall = jQuery.speed(speed, easing, callback),
  42268. doAnimation = function doAnimation() {
  42269. // Operate on a copy of prop so per-property easing won't be lost
  42270. var anim = Animation(this, jQuery.extend({}, prop), optall);
  42271. // Empty animations, or finishing resolves immediately
  42272. if (empty || dataPriv.get(this, "finish")) {
  42273. anim.stop(true);
  42274. }
  42275. };
  42276. doAnimation.finish = doAnimation;
  42277. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  42278. },
  42279. stop: function stop(type, clearQueue, gotoEnd) {
  42280. var stopQueue = function stopQueue(hooks) {
  42281. var stop = hooks.stop;
  42282. delete hooks.stop;
  42283. stop(gotoEnd);
  42284. };
  42285. if (typeof type !== "string") {
  42286. gotoEnd = clearQueue;
  42287. clearQueue = type;
  42288. type = undefined;
  42289. }
  42290. if (clearQueue && type !== false) {
  42291. this.queue(type || "fx", []);
  42292. }
  42293. return this.each(function () {
  42294. var dequeue = true,
  42295. index = type != null && type + "queueHooks",
  42296. timers = jQuery.timers,
  42297. data = dataPriv.get(this);
  42298. if (index) {
  42299. if (data[index] && data[index].stop) {
  42300. stopQueue(data[index]);
  42301. }
  42302. } else {
  42303. for (index in data) {
  42304. if (data[index] && data[index].stop && rrun.test(index)) {
  42305. stopQueue(data[index]);
  42306. }
  42307. }
  42308. }
  42309. for (index = timers.length; index--;) {
  42310. if (timers[index].elem === this && (type == null || timers[index].queue === type)) {
  42311. timers[index].anim.stop(gotoEnd);
  42312. dequeue = false;
  42313. timers.splice(index, 1);
  42314. }
  42315. }
  42316. // Start the next in the queue if the last step wasn't forced.
  42317. // Timers currently will call their complete callbacks, which
  42318. // will dequeue but only if they were gotoEnd.
  42319. if (dequeue || !gotoEnd) {
  42320. jQuery.dequeue(this, type);
  42321. }
  42322. });
  42323. },
  42324. finish: function finish(type) {
  42325. if (type !== false) {
  42326. type = type || "fx";
  42327. }
  42328. return this.each(function () {
  42329. var index,
  42330. data = dataPriv.get(this),
  42331. queue = data[type + "queue"],
  42332. hooks = data[type + "queueHooks"],
  42333. timers = jQuery.timers,
  42334. length = queue ? queue.length : 0;
  42335. // Enable finishing flag on private data
  42336. data.finish = true;
  42337. // Empty the queue first
  42338. jQuery.queue(this, type, []);
  42339. if (hooks && hooks.stop) {
  42340. hooks.stop.call(this, true);
  42341. }
  42342. // Look for any active animations, and finish them
  42343. for (index = timers.length; index--;) {
  42344. if (timers[index].elem === this && timers[index].queue === type) {
  42345. timers[index].anim.stop(true);
  42346. timers.splice(index, 1);
  42347. }
  42348. }
  42349. // Look for any animations in the old queue and finish them
  42350. for (index = 0; index < length; index++) {
  42351. if (queue[index] && queue[index].finish) {
  42352. queue[index].finish.call(this);
  42353. }
  42354. }
  42355. // Turn off finishing flag
  42356. delete data.finish;
  42357. });
  42358. }
  42359. });
  42360. jQuery.each(["toggle", "show", "hide"], function (i, name) {
  42361. var cssFn = jQuery.fn[name];
  42362. jQuery.fn[name] = function (speed, easing, callback) {
  42363. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback);
  42364. };
  42365. });
  42366. // Generate shortcuts for custom animations
  42367. jQuery.each({
  42368. slideDown: genFx("show"),
  42369. slideUp: genFx("hide"),
  42370. slideToggle: genFx("toggle"),
  42371. fadeIn: { opacity: "show" },
  42372. fadeOut: { opacity: "hide" },
  42373. fadeToggle: { opacity: "toggle" }
  42374. }, function (name, props) {
  42375. jQuery.fn[name] = function (speed, easing, callback) {
  42376. return this.animate(props, speed, easing, callback);
  42377. };
  42378. });
  42379. jQuery.timers = [];
  42380. jQuery.fx.tick = function () {
  42381. var timer,
  42382. i = 0,
  42383. timers = jQuery.timers;
  42384. fxNow = Date.now();
  42385. for (; i < timers.length; i++) {
  42386. timer = timers[i];
  42387. // Run the timer and safely remove it when done (allowing for external removal)
  42388. if (!timer() && timers[i] === timer) {
  42389. timers.splice(i--, 1);
  42390. }
  42391. }
  42392. if (!timers.length) {
  42393. jQuery.fx.stop();
  42394. }
  42395. fxNow = undefined;
  42396. };
  42397. jQuery.fx.timer = function (timer) {
  42398. jQuery.timers.push(timer);
  42399. jQuery.fx.start();
  42400. };
  42401. jQuery.fx.interval = 13;
  42402. jQuery.fx.start = function () {
  42403. if (inProgress) {
  42404. return;
  42405. }
  42406. inProgress = true;
  42407. schedule();
  42408. };
  42409. jQuery.fx.stop = function () {
  42410. inProgress = null;
  42411. };
  42412. jQuery.fx.speeds = {
  42413. slow: 600,
  42414. fast: 200,
  42415. // Default speed
  42416. _default: 400
  42417. };
  42418. // Based off of the plugin by Clint Helfers, with permission.
  42419. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  42420. jQuery.fn.delay = function (time, type) {
  42421. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  42422. type = type || "fx";
  42423. return this.queue(type, function (next, hooks) {
  42424. var timeout = window.setTimeout(next, time);
  42425. hooks.stop = function () {
  42426. window.clearTimeout(timeout);
  42427. };
  42428. });
  42429. };
  42430. (function () {
  42431. var input = document.createElement("input"),
  42432. select = document.createElement("select"),
  42433. opt = select.appendChild(document.createElement("option"));
  42434. input.type = "checkbox";
  42435. // Support: Android <=4.3 only
  42436. // Default value for a checkbox should be "on"
  42437. support.checkOn = input.value !== "";
  42438. // Support: IE <=11 only
  42439. // Must access selectedIndex to make default options select
  42440. support.optSelected = opt.selected;
  42441. // Support: IE <=11 only
  42442. // An input loses its value after becoming a radio
  42443. input = document.createElement("input");
  42444. input.value = "t";
  42445. input.type = "radio";
  42446. support.radioValue = input.value === "t";
  42447. })();
  42448. var boolHook,
  42449. attrHandle = jQuery.expr.attrHandle;
  42450. jQuery.fn.extend({
  42451. attr: function attr(name, value) {
  42452. return access(this, jQuery.attr, name, value, arguments.length > 1);
  42453. },
  42454. removeAttr: function removeAttr(name) {
  42455. return this.each(function () {
  42456. jQuery.removeAttr(this, name);
  42457. });
  42458. }
  42459. });
  42460. jQuery.extend({
  42461. attr: function attr(elem, name, value) {
  42462. var ret,
  42463. hooks,
  42464. nType = elem.nodeType;
  42465. // Don't get/set attributes on text, comment and attribute nodes
  42466. if (nType === 3 || nType === 8 || nType === 2) {
  42467. return;
  42468. }
  42469. // Fallback to prop when attributes are not supported
  42470. if (typeof elem.getAttribute === "undefined") {
  42471. return jQuery.prop(elem, name, value);
  42472. }
  42473. // Attribute hooks are determined by the lowercase version
  42474. // Grab necessary hook if one is defined
  42475. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42476. hooks = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : undefined);
  42477. }
  42478. if (value !== undefined) {
  42479. if (value === null) {
  42480. jQuery.removeAttr(elem, name);
  42481. return;
  42482. }
  42483. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42484. return ret;
  42485. }
  42486. elem.setAttribute(name, value + "");
  42487. return value;
  42488. }
  42489. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42490. return ret;
  42491. }
  42492. ret = jQuery.find.attr(elem, name);
  42493. // Non-existent attributes return null, we normalize to undefined
  42494. return ret == null ? undefined : ret;
  42495. },
  42496. attrHooks: {
  42497. type: {
  42498. set: function set(elem, value) {
  42499. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  42500. var val = elem.value;
  42501. elem.setAttribute("type", value);
  42502. if (val) {
  42503. elem.value = val;
  42504. }
  42505. return value;
  42506. }
  42507. }
  42508. }
  42509. },
  42510. removeAttr: function removeAttr(elem, value) {
  42511. var name,
  42512. i = 0,
  42513. // Attribute names can contain non-HTML whitespace characters
  42514. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  42515. attrNames = value && value.match(rnothtmlwhite);
  42516. if (attrNames && elem.nodeType === 1) {
  42517. while (name = attrNames[i++]) {
  42518. elem.removeAttribute(name);
  42519. }
  42520. }
  42521. }
  42522. });
  42523. // Hooks for boolean attributes
  42524. boolHook = {
  42525. set: function set(elem, value, name) {
  42526. if (value === false) {
  42527. // Remove boolean attributes when set to false
  42528. jQuery.removeAttr(elem, name);
  42529. } else {
  42530. elem.setAttribute(name, name);
  42531. }
  42532. return name;
  42533. }
  42534. };
  42535. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function (i, name) {
  42536. var getter = attrHandle[name] || jQuery.find.attr;
  42537. attrHandle[name] = function (elem, name, isXML) {
  42538. var ret,
  42539. handle,
  42540. lowercaseName = name.toLowerCase();
  42541. if (!isXML) {
  42542. // Avoid an infinite loop by temporarily removing this function from the getter
  42543. handle = attrHandle[lowercaseName];
  42544. attrHandle[lowercaseName] = ret;
  42545. ret = getter(elem, name, isXML) != null ? lowercaseName : null;
  42546. attrHandle[lowercaseName] = handle;
  42547. }
  42548. return ret;
  42549. };
  42550. });
  42551. var rfocusable = /^(?:input|select|textarea|button)$/i,
  42552. rclickable = /^(?:a|area)$/i;
  42553. jQuery.fn.extend({
  42554. prop: function prop(name, value) {
  42555. return access(this, jQuery.prop, name, value, arguments.length > 1);
  42556. },
  42557. removeProp: function removeProp(name) {
  42558. return this.each(function () {
  42559. delete this[jQuery.propFix[name] || name];
  42560. });
  42561. }
  42562. });
  42563. jQuery.extend({
  42564. prop: function prop(elem, name, value) {
  42565. var ret,
  42566. hooks,
  42567. nType = elem.nodeType;
  42568. // Don't get/set properties on text, comment and attribute nodes
  42569. if (nType === 3 || nType === 8 || nType === 2) {
  42570. return;
  42571. }
  42572. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  42573. // Fix name and attach hooks
  42574. name = jQuery.propFix[name] || name;
  42575. hooks = jQuery.propHooks[name];
  42576. }
  42577. if (value !== undefined) {
  42578. if (hooks && "set" in hooks && (ret = hooks.set(elem, value, name)) !== undefined) {
  42579. return ret;
  42580. }
  42581. return elem[name] = value;
  42582. }
  42583. if (hooks && "get" in hooks && (ret = hooks.get(elem, name)) !== null) {
  42584. return ret;
  42585. }
  42586. return elem[name];
  42587. },
  42588. propHooks: {
  42589. tabIndex: {
  42590. get: function get(elem) {
  42591. // Support: IE <=9 - 11 only
  42592. // elem.tabIndex doesn't always return the
  42593. // correct value when it hasn't been explicitly set
  42594. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  42595. // Use proper attribute retrieval(#12072)
  42596. var tabindex = jQuery.find.attr(elem, "tabindex");
  42597. if (tabindex) {
  42598. return parseInt(tabindex, 10);
  42599. }
  42600. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  42601. return 0;
  42602. }
  42603. return -1;
  42604. }
  42605. }
  42606. },
  42607. propFix: {
  42608. "for": "htmlFor",
  42609. "class": "className"
  42610. }
  42611. });
  42612. // Support: IE <=11 only
  42613. // Accessing the selectedIndex property
  42614. // forces the browser to respect setting selected
  42615. // on the option
  42616. // The getter ensures a default option is selected
  42617. // when in an optgroup
  42618. // eslint rule "no-unused-expressions" is disabled for this code
  42619. // since it considers such accessions noop
  42620. if (!support.optSelected) {
  42621. jQuery.propHooks.selected = {
  42622. get: function get(elem) {
  42623. /* eslint no-unused-expressions: "off" */
  42624. var parent = elem.parentNode;
  42625. if (parent && parent.parentNode) {
  42626. parent.parentNode.selectedIndex;
  42627. }
  42628. return null;
  42629. },
  42630. set: function set(elem) {
  42631. /* eslint no-unused-expressions: "off" */
  42632. var parent = elem.parentNode;
  42633. if (parent) {
  42634. parent.selectedIndex;
  42635. if (parent.parentNode) {
  42636. parent.parentNode.selectedIndex;
  42637. }
  42638. }
  42639. }
  42640. };
  42641. }
  42642. jQuery.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function () {
  42643. jQuery.propFix[this.toLowerCase()] = this;
  42644. });
  42645. // Strip and collapse whitespace according to HTML spec
  42646. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  42647. function stripAndCollapse(value) {
  42648. var tokens = value.match(rnothtmlwhite) || [];
  42649. return tokens.join(" ");
  42650. }
  42651. function getClass(elem) {
  42652. return elem.getAttribute && elem.getAttribute("class") || "";
  42653. }
  42654. function classesToArray(value) {
  42655. if (Array.isArray(value)) {
  42656. return value;
  42657. }
  42658. if (typeof value === "string") {
  42659. return value.match(rnothtmlwhite) || [];
  42660. }
  42661. return [];
  42662. }
  42663. jQuery.fn.extend({
  42664. addClass: function addClass(value) {
  42665. var classes,
  42666. elem,
  42667. cur,
  42668. curValue,
  42669. clazz,
  42670. j,
  42671. finalValue,
  42672. i = 0;
  42673. if (isFunction(value)) {
  42674. return this.each(function (j) {
  42675. jQuery(this).addClass(value.call(this, j, getClass(this)));
  42676. });
  42677. }
  42678. classes = classesToArray(value);
  42679. if (classes.length) {
  42680. while (elem = this[i++]) {
  42681. curValue = getClass(elem);
  42682. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42683. if (cur) {
  42684. j = 0;
  42685. while (clazz = classes[j++]) {
  42686. if (cur.indexOf(" " + clazz + " ") < 0) {
  42687. cur += clazz + " ";
  42688. }
  42689. }
  42690. // Only assign if different to avoid unneeded rendering.
  42691. finalValue = stripAndCollapse(cur);
  42692. if (curValue !== finalValue) {
  42693. elem.setAttribute("class", finalValue);
  42694. }
  42695. }
  42696. }
  42697. }
  42698. return this;
  42699. },
  42700. removeClass: function removeClass(value) {
  42701. var classes,
  42702. elem,
  42703. cur,
  42704. curValue,
  42705. clazz,
  42706. j,
  42707. finalValue,
  42708. i = 0;
  42709. if (isFunction(value)) {
  42710. return this.each(function (j) {
  42711. jQuery(this).removeClass(value.call(this, j, getClass(this)));
  42712. });
  42713. }
  42714. if (!arguments.length) {
  42715. return this.attr("class", "");
  42716. }
  42717. classes = classesToArray(value);
  42718. if (classes.length) {
  42719. while (elem = this[i++]) {
  42720. curValue = getClass(elem);
  42721. // This expression is here for better compressibility (see addClass)
  42722. cur = elem.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  42723. if (cur) {
  42724. j = 0;
  42725. while (clazz = classes[j++]) {
  42726. // Remove *all* instances
  42727. while (cur.indexOf(" " + clazz + " ") > -1) {
  42728. cur = cur.replace(" " + clazz + " ", " ");
  42729. }
  42730. }
  42731. // Only assign if different to avoid unneeded rendering.
  42732. finalValue = stripAndCollapse(cur);
  42733. if (curValue !== finalValue) {
  42734. elem.setAttribute("class", finalValue);
  42735. }
  42736. }
  42737. }
  42738. }
  42739. return this;
  42740. },
  42741. toggleClass: function toggleClass(value, stateVal) {
  42742. var type = typeof value === "undefined" ? "undefined" : _typeof(value),
  42743. isValidValue = type === "string" || Array.isArray(value);
  42744. if (typeof stateVal === "boolean" && isValidValue) {
  42745. return stateVal ? this.addClass(value) : this.removeClass(value);
  42746. }
  42747. if (isFunction(value)) {
  42748. return this.each(function (i) {
  42749. jQuery(this).toggleClass(value.call(this, i, getClass(this), stateVal), stateVal);
  42750. });
  42751. }
  42752. return this.each(function () {
  42753. var className, i, self, classNames;
  42754. if (isValidValue) {
  42755. // Toggle individual class names
  42756. i = 0;
  42757. self = jQuery(this);
  42758. classNames = classesToArray(value);
  42759. while (className = classNames[i++]) {
  42760. // Check each className given, space separated list
  42761. if (self.hasClass(className)) {
  42762. self.removeClass(className);
  42763. } else {
  42764. self.addClass(className);
  42765. }
  42766. }
  42767. // Toggle whole class name
  42768. } else if (value === undefined || type === "boolean") {
  42769. className = getClass(this);
  42770. if (className) {
  42771. // Store className if set
  42772. dataPriv.set(this, "__className__", className);
  42773. }
  42774. // If the element has a class name or if we're passed `false`,
  42775. // then remove the whole classname (if there was one, the above saved it).
  42776. // Otherwise bring back whatever was previously saved (if anything),
  42777. // falling back to the empty string if nothing was stored.
  42778. if (this.setAttribute) {
  42779. this.setAttribute("class", className || value === false ? "" : dataPriv.get(this, "__className__") || "");
  42780. }
  42781. }
  42782. });
  42783. },
  42784. hasClass: function hasClass(selector) {
  42785. var className,
  42786. elem,
  42787. i = 0;
  42788. className = " " + selector + " ";
  42789. while (elem = this[i++]) {
  42790. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass(elem)) + " ").indexOf(className) > -1) {
  42791. return true;
  42792. }
  42793. }
  42794. return false;
  42795. }
  42796. });
  42797. var rreturn = /\r/g;
  42798. jQuery.fn.extend({
  42799. val: function val(value) {
  42800. var hooks,
  42801. ret,
  42802. valueIsFunction,
  42803. elem = this[0];
  42804. if (!arguments.length) {
  42805. if (elem) {
  42806. hooks = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  42807. if (hooks && "get" in hooks && (ret = hooks.get(elem, "value")) !== undefined) {
  42808. return ret;
  42809. }
  42810. ret = elem.value;
  42811. // Handle most common string cases
  42812. if (typeof ret === "string") {
  42813. return ret.replace(rreturn, "");
  42814. }
  42815. // Handle cases where value is null/undef or number
  42816. return ret == null ? "" : ret;
  42817. }
  42818. return;
  42819. }
  42820. valueIsFunction = isFunction(value);
  42821. return this.each(function (i) {
  42822. var val;
  42823. if (this.nodeType !== 1) {
  42824. return;
  42825. }
  42826. if (valueIsFunction) {
  42827. val = value.call(this, i, jQuery(this).val());
  42828. } else {
  42829. val = value;
  42830. }
  42831. // Treat null/undefined as ""; convert numbers to string
  42832. if (val == null) {
  42833. val = "";
  42834. } else if (typeof val === "number") {
  42835. val += "";
  42836. } else if (Array.isArray(val)) {
  42837. val = jQuery.map(val, function (value) {
  42838. return value == null ? "" : value + "";
  42839. });
  42840. }
  42841. hooks = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  42842. // If set returns undefined, fall back to normal setting
  42843. if (!hooks || !("set" in hooks) || hooks.set(this, val, "value") === undefined) {
  42844. this.value = val;
  42845. }
  42846. });
  42847. }
  42848. });
  42849. jQuery.extend({
  42850. valHooks: {
  42851. option: {
  42852. get: function get(elem) {
  42853. var val = jQuery.find.attr(elem, "value");
  42854. return val != null ? val :
  42855. // Support: IE <=10 - 11 only
  42856. // option.text throws exceptions (#14686, #14858)
  42857. // Strip and collapse whitespace
  42858. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  42859. stripAndCollapse(jQuery.text(elem));
  42860. }
  42861. },
  42862. select: {
  42863. get: function get(elem) {
  42864. var value,
  42865. option,
  42866. i,
  42867. options = elem.options,
  42868. index = elem.selectedIndex,
  42869. one = elem.type === "select-one",
  42870. values = one ? null : [],
  42871. max = one ? index + 1 : options.length;
  42872. if (index < 0) {
  42873. i = max;
  42874. } else {
  42875. i = one ? index : 0;
  42876. }
  42877. // Loop through all the selected options
  42878. for (; i < max; i++) {
  42879. option = options[i];
  42880. // Support: IE <=9 only
  42881. // IE8-9 doesn't update selected after form reset (#2551)
  42882. if ((option.selected || i === index) &&
  42883. // Don't return options that are disabled or in a disabled optgroup
  42884. !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  42885. // Get the specific value for the option
  42886. value = jQuery(option).val();
  42887. // We don't need an array for one selects
  42888. if (one) {
  42889. return value;
  42890. }
  42891. // Multi-Selects return an array
  42892. values.push(value);
  42893. }
  42894. }
  42895. return values;
  42896. },
  42897. set: function set(elem, value) {
  42898. var optionSet,
  42899. option,
  42900. options = elem.options,
  42901. values = jQuery.makeArray(value),
  42902. i = options.length;
  42903. while (i--) {
  42904. option = options[i];
  42905. /* eslint-disable no-cond-assign */
  42906. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values) > -1) {
  42907. optionSet = true;
  42908. }
  42909. /* eslint-enable no-cond-assign */
  42910. }
  42911. // Force browsers to behave consistently when non-matching value is set
  42912. if (!optionSet) {
  42913. elem.selectedIndex = -1;
  42914. }
  42915. return values;
  42916. }
  42917. }
  42918. }
  42919. });
  42920. // Radios and checkboxes getter/setter
  42921. jQuery.each(["radio", "checkbox"], function () {
  42922. jQuery.valHooks[this] = {
  42923. set: function set(elem, value) {
  42924. if (Array.isArray(value)) {
  42925. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  42926. }
  42927. }
  42928. };
  42929. if (!support.checkOn) {
  42930. jQuery.valHooks[this].get = function (elem) {
  42931. return elem.getAttribute("value") === null ? "on" : elem.value;
  42932. };
  42933. }
  42934. });
  42935. // Return jQuery for attributes-only inclusion
  42936. support.focusin = "onfocusin" in window;
  42937. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  42938. stopPropagationCallback = function stopPropagationCallback(e) {
  42939. e.stopPropagation();
  42940. };
  42941. jQuery.extend(jQuery.event, {
  42942. trigger: function trigger(event, data, elem, onlyHandlers) {
  42943. var i,
  42944. cur,
  42945. tmp,
  42946. bubbleType,
  42947. ontype,
  42948. handle,
  42949. special,
  42950. lastElement,
  42951. eventPath = [elem || document],
  42952. type = hasOwn.call(event, "type") ? event.type : event,
  42953. namespaces = hasOwn.call(event, "namespace") ? event.namespace.split(".") : [];
  42954. cur = lastElement = tmp = elem = elem || document;
  42955. // Don't do events on text and comment nodes
  42956. if (elem.nodeType === 3 || elem.nodeType === 8) {
  42957. return;
  42958. }
  42959. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  42960. if (rfocusMorph.test(type + jQuery.event.triggered)) {
  42961. return;
  42962. }
  42963. if (type.indexOf(".") > -1) {
  42964. // Namespaced trigger; create a regexp to match event type in handle()
  42965. namespaces = type.split(".");
  42966. type = namespaces.shift();
  42967. namespaces.sort();
  42968. }
  42969. ontype = type.indexOf(":") < 0 && "on" + type;
  42970. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  42971. event = event[jQuery.expando] ? event : new jQuery.Event(type, (typeof event === "undefined" ? "undefined" : _typeof(event)) === "object" && event);
  42972. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  42973. event.isTrigger = onlyHandlers ? 2 : 3;
  42974. event.namespace = namespaces.join(".");
  42975. event.rnamespace = event.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  42976. // Clean up the event in case it is being reused
  42977. event.result = undefined;
  42978. if (!event.target) {
  42979. event.target = elem;
  42980. }
  42981. // Clone any incoming data and prepend the event, creating the handler arg list
  42982. data = data == null ? [event] : jQuery.makeArray(data, [event]);
  42983. // Allow special events to draw outside the lines
  42984. special = jQuery.event.special[type] || {};
  42985. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  42986. return;
  42987. }
  42988. // Determine event propagation path in advance, per W3C events spec (#9951)
  42989. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  42990. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  42991. bubbleType = special.delegateType || type;
  42992. if (!rfocusMorph.test(bubbleType + type)) {
  42993. cur = cur.parentNode;
  42994. }
  42995. for (; cur; cur = cur.parentNode) {
  42996. eventPath.push(cur);
  42997. tmp = cur;
  42998. }
  42999. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  43000. if (tmp === (elem.ownerDocument || document)) {
  43001. eventPath.push(tmp.defaultView || tmp.parentWindow || window);
  43002. }
  43003. }
  43004. // Fire handlers on the event path
  43005. i = 0;
  43006. while ((cur = eventPath[i++]) && !event.isPropagationStopped()) {
  43007. lastElement = cur;
  43008. event.type = i > 1 ? bubbleType : special.bindType || type;
  43009. // jQuery handler
  43010. handle = (dataPriv.get(cur, "events") || {})[event.type] && dataPriv.get(cur, "handle");
  43011. if (handle) {
  43012. handle.apply(cur, data);
  43013. }
  43014. // Native handler
  43015. handle = ontype && cur[ontype];
  43016. if (handle && handle.apply && acceptData(cur)) {
  43017. event.result = handle.apply(cur, data);
  43018. if (event.result === false) {
  43019. event.preventDefault();
  43020. }
  43021. }
  43022. }
  43023. event.type = type;
  43024. // If nobody prevented the default action, do it now
  43025. if (!onlyHandlers && !event.isDefaultPrevented()) {
  43026. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  43027. // Call a native DOM method on the target with the same name as the event.
  43028. // Don't do default actions on window, that's where global variables be (#6170)
  43029. if (ontype && isFunction(elem[type]) && !isWindow(elem)) {
  43030. // Don't re-trigger an onFOO event when we call its FOO() method
  43031. tmp = elem[ontype];
  43032. if (tmp) {
  43033. elem[ontype] = null;
  43034. }
  43035. // Prevent re-triggering of the same event, since we already bubbled it above
  43036. jQuery.event.triggered = type;
  43037. if (event.isPropagationStopped()) {
  43038. lastElement.addEventListener(type, stopPropagationCallback);
  43039. }
  43040. elem[type]();
  43041. if (event.isPropagationStopped()) {
  43042. lastElement.removeEventListener(type, stopPropagationCallback);
  43043. }
  43044. jQuery.event.triggered = undefined;
  43045. if (tmp) {
  43046. elem[ontype] = tmp;
  43047. }
  43048. }
  43049. }
  43050. }
  43051. return event.result;
  43052. },
  43053. // Piggyback on a donor event to simulate a different one
  43054. // Used only for `focus(in | out)` events
  43055. simulate: function simulate(type, elem, event) {
  43056. var e = jQuery.extend(new jQuery.Event(), event, {
  43057. type: type,
  43058. isSimulated: true
  43059. });
  43060. jQuery.event.trigger(e, null, elem);
  43061. }
  43062. });
  43063. jQuery.fn.extend({
  43064. trigger: function trigger(type, data) {
  43065. return this.each(function () {
  43066. jQuery.event.trigger(type, data, this);
  43067. });
  43068. },
  43069. triggerHandler: function triggerHandler(type, data) {
  43070. var elem = this[0];
  43071. if (elem) {
  43072. return jQuery.event.trigger(type, data, elem, true);
  43073. }
  43074. }
  43075. });
  43076. // Support: Firefox <=44
  43077. // Firefox doesn't have focus(in | out) events
  43078. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  43079. //
  43080. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  43081. // focus(in | out) events fire after focus & blur events,
  43082. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  43083. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  43084. if (!support.focusin) {
  43085. jQuery.each({ focus: "focusin", blur: "focusout" }, function (orig, fix) {
  43086. // Attach a single capturing handler on the document while someone wants focusin/focusout
  43087. var handler = function handler(event) {
  43088. jQuery.event.simulate(fix, event.target, jQuery.event.fix(event));
  43089. };
  43090. jQuery.event.special[fix] = {
  43091. setup: function setup() {
  43092. var doc = this.ownerDocument || this,
  43093. attaches = dataPriv.access(doc, fix);
  43094. if (!attaches) {
  43095. doc.addEventListener(orig, handler, true);
  43096. }
  43097. dataPriv.access(doc, fix, (attaches || 0) + 1);
  43098. },
  43099. teardown: function teardown() {
  43100. var doc = this.ownerDocument || this,
  43101. attaches = dataPriv.access(doc, fix) - 1;
  43102. if (!attaches) {
  43103. doc.removeEventListener(orig, handler, true);
  43104. dataPriv.remove(doc, fix);
  43105. } else {
  43106. dataPriv.access(doc, fix, attaches);
  43107. }
  43108. }
  43109. };
  43110. });
  43111. }
  43112. var location = window.location;
  43113. var nonce = Date.now();
  43114. var rquery = /\?/;
  43115. // Cross-browser xml parsing
  43116. jQuery.parseXML = function (data) {
  43117. var xml;
  43118. if (!data || typeof data !== "string") {
  43119. return null;
  43120. }
  43121. // Support: IE 9 - 11 only
  43122. // IE throws on parseFromString with invalid input.
  43123. try {
  43124. xml = new window.DOMParser().parseFromString(data, "text/xml");
  43125. } catch (e) {
  43126. xml = undefined;
  43127. }
  43128. if (!xml || xml.getElementsByTagName("parsererror").length) {
  43129. jQuery.error("Invalid XML: " + data);
  43130. }
  43131. return xml;
  43132. };
  43133. var rbracket = /\[\]$/,
  43134. rCRLF = /\r?\n/g,
  43135. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  43136. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  43137. function buildParams(prefix, obj, traditional, add) {
  43138. var name;
  43139. if (Array.isArray(obj)) {
  43140. // Serialize array item.
  43141. jQuery.each(obj, function (i, v) {
  43142. if (traditional || rbracket.test(prefix)) {
  43143. // Treat each array item as a scalar.
  43144. add(prefix, v);
  43145. } else {
  43146. // Item is non-scalar (array or object), encode its numeric index.
  43147. buildParams(prefix + "[" + ((typeof v === "undefined" ? "undefined" : _typeof(v)) === "object" && v != null ? i : "") + "]", v, traditional, add);
  43148. }
  43149. });
  43150. } else if (!traditional && toType(obj) === "object") {
  43151. // Serialize object item.
  43152. for (name in obj) {
  43153. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  43154. }
  43155. } else {
  43156. // Serialize scalar item.
  43157. add(prefix, obj);
  43158. }
  43159. }
  43160. // Serialize an array of form elements or a set of
  43161. // key/values into a query string
  43162. jQuery.param = function (a, traditional) {
  43163. var prefix,
  43164. s = [],
  43165. add = function add(key, valueOrFunction) {
  43166. // If value is a function, invoke it and use its return value
  43167. var value = isFunction(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  43168. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  43169. };
  43170. // If an array was passed in, assume that it is an array of form elements.
  43171. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  43172. // Serialize the form elements
  43173. jQuery.each(a, function () {
  43174. add(this.name, this.value);
  43175. });
  43176. } else {
  43177. // If traditional, encode the "old" way (the way 1.3.2 or older
  43178. // did it), otherwise encode params recursively.
  43179. for (prefix in a) {
  43180. buildParams(prefix, a[prefix], traditional, add);
  43181. }
  43182. }
  43183. // Return the resulting serialization
  43184. return s.join("&");
  43185. };
  43186. jQuery.fn.extend({
  43187. serialize: function serialize() {
  43188. return jQuery.param(this.serializeArray());
  43189. },
  43190. serializeArray: function serializeArray() {
  43191. return this.map(function () {
  43192. // Can add propHook for "elements" to filter or add form elements
  43193. var elements = jQuery.prop(this, "elements");
  43194. return elements ? jQuery.makeArray(elements) : this;
  43195. }).filter(function () {
  43196. var type = this.type;
  43197. // Use .is( ":disabled" ) so that fieldset[disabled] works
  43198. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type) && (this.checked || !rcheckableType.test(type));
  43199. }).map(function (i, elem) {
  43200. var val = jQuery(this).val();
  43201. if (val == null) {
  43202. return null;
  43203. }
  43204. if (Array.isArray(val)) {
  43205. return jQuery.map(val, function (val) {
  43206. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43207. });
  43208. }
  43209. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  43210. }).get();
  43211. }
  43212. });
  43213. var r20 = /%20/g,
  43214. rhash = /#.*$/,
  43215. rantiCache = /([?&])_=[^&]*/,
  43216. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  43217. // #7653, #8125, #8152: local protocol detection
  43218. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  43219. rnoContent = /^(?:GET|HEAD)$/,
  43220. rprotocol = /^\/\//,
  43221. /* Prefilters
  43222. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  43223. * 2) These are called:
  43224. * - BEFORE asking for a transport
  43225. * - AFTER param serialization (s.data is a string if s.processData is true)
  43226. * 3) key is the dataType
  43227. * 4) the catchall symbol "*" can be used
  43228. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  43229. */
  43230. prefilters = {},
  43231. /* Transports bindings
  43232. * 1) key is the dataType
  43233. * 2) the catchall symbol "*" can be used
  43234. * 3) selection will start with transport dataType and THEN go to "*" if needed
  43235. */
  43236. transports = {},
  43237. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  43238. allTypes = "*/".concat("*"),
  43239. // Anchor tag for parsing the document origin
  43240. originAnchor = document.createElement("a");
  43241. originAnchor.href = location.href;
  43242. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  43243. function addToPrefiltersOrTransports(structure) {
  43244. // dataTypeExpression is optional and defaults to "*"
  43245. return function (dataTypeExpression, func) {
  43246. if (typeof dataTypeExpression !== "string") {
  43247. func = dataTypeExpression;
  43248. dataTypeExpression = "*";
  43249. }
  43250. var dataType,
  43251. i = 0,
  43252. dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  43253. if (isFunction(func)) {
  43254. // For each dataType in the dataTypeExpression
  43255. while (dataType = dataTypes[i++]) {
  43256. // Prepend if requested
  43257. if (dataType[0] === "+") {
  43258. dataType = dataType.slice(1) || "*";
  43259. (structure[dataType] = structure[dataType] || []).unshift(func);
  43260. // Otherwise append
  43261. } else {
  43262. (structure[dataType] = structure[dataType] || []).push(func);
  43263. }
  43264. }
  43265. }
  43266. };
  43267. }
  43268. // Base inspection function for prefilters and transports
  43269. function inspectPrefiltersOrTransports(structure, options, originalOptions, jqXHR) {
  43270. var inspected = {},
  43271. seekingTransport = structure === transports;
  43272. function inspect(dataType) {
  43273. var selected;
  43274. inspected[dataType] = true;
  43275. jQuery.each(structure[dataType] || [], function (_, prefilterOrFactory) {
  43276. var dataTypeOrTransport = prefilterOrFactory(options, originalOptions, jqXHR);
  43277. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  43278. options.dataTypes.unshift(dataTypeOrTransport);
  43279. inspect(dataTypeOrTransport);
  43280. return false;
  43281. } else if (seekingTransport) {
  43282. return !(selected = dataTypeOrTransport);
  43283. }
  43284. });
  43285. return selected;
  43286. }
  43287. return inspect(options.dataTypes[0]) || !inspected["*"] && inspect("*");
  43288. }
  43289. // A special extend for ajax options
  43290. // that takes "flat" options (not to be deep extended)
  43291. // Fixes #9887
  43292. function ajaxExtend(target, src) {
  43293. var key,
  43294. deep,
  43295. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  43296. for (key in src) {
  43297. if (src[key] !== undefined) {
  43298. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  43299. }
  43300. }
  43301. if (deep) {
  43302. jQuery.extend(true, target, deep);
  43303. }
  43304. return target;
  43305. }
  43306. /* Handles responses to an ajax request:
  43307. * - finds the right dataType (mediates between content-type and expected dataType)
  43308. * - returns the corresponding response
  43309. */
  43310. function ajaxHandleResponses(s, jqXHR, responses) {
  43311. var ct,
  43312. type,
  43313. finalDataType,
  43314. firstDataType,
  43315. contents = s.contents,
  43316. dataTypes = s.dataTypes;
  43317. // Remove auto dataType and get content-type in the process
  43318. while (dataTypes[0] === "*") {
  43319. dataTypes.shift();
  43320. if (ct === undefined) {
  43321. ct = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  43322. }
  43323. }
  43324. // Check if we're dealing with a known content-type
  43325. if (ct) {
  43326. for (type in contents) {
  43327. if (contents[type] && contents[type].test(ct)) {
  43328. dataTypes.unshift(type);
  43329. break;
  43330. }
  43331. }
  43332. }
  43333. // Check to see if we have a response for the expected dataType
  43334. if (dataTypes[0] in responses) {
  43335. finalDataType = dataTypes[0];
  43336. } else {
  43337. // Try convertible dataTypes
  43338. for (type in responses) {
  43339. if (!dataTypes[0] || s.converters[type + " " + dataTypes[0]]) {
  43340. finalDataType = type;
  43341. break;
  43342. }
  43343. if (!firstDataType) {
  43344. firstDataType = type;
  43345. }
  43346. }
  43347. // Or just use first one
  43348. finalDataType = finalDataType || firstDataType;
  43349. }
  43350. // If we found a dataType
  43351. // We add the dataType to the list if needed
  43352. // and return the corresponding response
  43353. if (finalDataType) {
  43354. if (finalDataType !== dataTypes[0]) {
  43355. dataTypes.unshift(finalDataType);
  43356. }
  43357. return responses[finalDataType];
  43358. }
  43359. }
  43360. /* Chain conversions given the request and the original response
  43361. * Also sets the responseXXX fields on the jqXHR instance
  43362. */
  43363. function ajaxConvert(s, response, jqXHR, isSuccess) {
  43364. var conv2,
  43365. current,
  43366. conv,
  43367. tmp,
  43368. prev,
  43369. converters = {},
  43370. // Work with a copy of dataTypes in case we need to modify it for conversion
  43371. dataTypes = s.dataTypes.slice();
  43372. // Create converters map with lowercased keys
  43373. if (dataTypes[1]) {
  43374. for (conv in s.converters) {
  43375. converters[conv.toLowerCase()] = s.converters[conv];
  43376. }
  43377. }
  43378. current = dataTypes.shift();
  43379. // Convert to each sequential dataType
  43380. while (current) {
  43381. if (s.responseFields[current]) {
  43382. jqXHR[s.responseFields[current]] = response;
  43383. }
  43384. // Apply the dataFilter if provided
  43385. if (!prev && isSuccess && s.dataFilter) {
  43386. response = s.dataFilter(response, s.dataType);
  43387. }
  43388. prev = current;
  43389. current = dataTypes.shift();
  43390. if (current) {
  43391. // There's only work to do if current dataType is non-auto
  43392. if (current === "*") {
  43393. current = prev;
  43394. // Convert response if prev dataType is non-auto and differs from current
  43395. } else if (prev !== "*" && prev !== current) {
  43396. // Seek a direct converter
  43397. conv = converters[prev + " " + current] || converters["* " + current];
  43398. // If none found, seek a pair
  43399. if (!conv) {
  43400. for (conv2 in converters) {
  43401. // If conv2 outputs current
  43402. tmp = conv2.split(" ");
  43403. if (tmp[1] === current) {
  43404. // If prev can be converted to accepted input
  43405. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  43406. if (conv) {
  43407. // Condense equivalence converters
  43408. if (conv === true) {
  43409. conv = converters[conv2];
  43410. // Otherwise, insert the intermediate dataType
  43411. } else if (converters[conv2] !== true) {
  43412. current = tmp[0];
  43413. dataTypes.unshift(tmp[1]);
  43414. }
  43415. break;
  43416. }
  43417. }
  43418. }
  43419. }
  43420. // Apply converter (if not an equivalence)
  43421. if (conv !== true) {
  43422. // Unless errors are allowed to bubble, catch and return them
  43423. if (conv && s.throws) {
  43424. response = conv(response);
  43425. } else {
  43426. try {
  43427. response = conv(response);
  43428. } catch (e) {
  43429. return {
  43430. state: "parsererror",
  43431. error: conv ? e : "No conversion from " + prev + " to " + current
  43432. };
  43433. }
  43434. }
  43435. }
  43436. }
  43437. }
  43438. }
  43439. return { state: "success", data: response };
  43440. }
  43441. jQuery.extend({
  43442. // Counter for holding the number of active queries
  43443. active: 0,
  43444. // Last-Modified header cache for next request
  43445. lastModified: {},
  43446. etag: {},
  43447. ajaxSettings: {
  43448. url: location.href,
  43449. type: "GET",
  43450. isLocal: rlocalProtocol.test(location.protocol),
  43451. global: true,
  43452. processData: true,
  43453. async: true,
  43454. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  43455. /*
  43456. timeout: 0,
  43457. data: null,
  43458. dataType: null,
  43459. username: null,
  43460. password: null,
  43461. cache: null,
  43462. throws: false,
  43463. traditional: false,
  43464. headers: {},
  43465. */
  43466. accepts: {
  43467. "*": allTypes,
  43468. text: "text/plain",
  43469. html: "text/html",
  43470. xml: "application/xml, text/xml",
  43471. json: "application/json, text/javascript"
  43472. },
  43473. contents: {
  43474. xml: /\bxml\b/,
  43475. html: /\bhtml/,
  43476. json: /\bjson\b/
  43477. },
  43478. responseFields: {
  43479. xml: "responseXML",
  43480. text: "responseText",
  43481. json: "responseJSON"
  43482. },
  43483. // Data converters
  43484. // Keys separate source (or catchall "*") and destination types with a single space
  43485. converters: {
  43486. // Convert anything to text
  43487. "* text": String,
  43488. // Text to html (true = no transformation)
  43489. "text html": true,
  43490. // Evaluate text as a json expression
  43491. "text json": JSON.parse,
  43492. // Parse text as xml
  43493. "text xml": jQuery.parseXML
  43494. },
  43495. // For options that shouldn't be deep extended:
  43496. // you can add your own custom options here if
  43497. // and when you create one that shouldn't be
  43498. // deep extended (see ajaxExtend)
  43499. flatOptions: {
  43500. url: true,
  43501. context: true
  43502. }
  43503. },
  43504. // Creates a full fledged settings object into target
  43505. // with both ajaxSettings and settings fields.
  43506. // If target is omitted, writes into ajaxSettings.
  43507. ajaxSetup: function ajaxSetup(target, settings) {
  43508. return settings ?
  43509. // Building a settings object
  43510. ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) :
  43511. // Extending ajaxSettings
  43512. ajaxExtend(jQuery.ajaxSettings, target);
  43513. },
  43514. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  43515. ajaxTransport: addToPrefiltersOrTransports(transports),
  43516. // Main method
  43517. ajax: function ajax(url, options) {
  43518. // If url is an object, simulate pre-1.5 signature
  43519. if ((typeof url === "undefined" ? "undefined" : _typeof(url)) === "object") {
  43520. options = url;
  43521. url = undefined;
  43522. }
  43523. // Force options to be an object
  43524. options = options || {};
  43525. var transport,
  43526. // URL without anti-cache param
  43527. cacheURL,
  43528. // Response headers
  43529. responseHeadersString,
  43530. responseHeaders,
  43531. // timeout handle
  43532. timeoutTimer,
  43533. // Url cleanup var
  43534. urlAnchor,
  43535. // Request state (becomes false upon send and true upon completion)
  43536. completed,
  43537. // To know if global events are to be dispatched
  43538. fireGlobals,
  43539. // Loop variable
  43540. i,
  43541. // uncached part of the url
  43542. uncached,
  43543. // Create the final options object
  43544. s = jQuery.ajaxSetup({}, options),
  43545. // Callbacks context
  43546. callbackContext = s.context || s,
  43547. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  43548. globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event,
  43549. // Deferreds
  43550. deferred = jQuery.Deferred(),
  43551. completeDeferred = jQuery.Callbacks("once memory"),
  43552. // Status-dependent callbacks
  43553. _statusCode = s.statusCode || {},
  43554. // Headers (they are sent all at once)
  43555. requestHeaders = {},
  43556. requestHeadersNames = {},
  43557. // Default abort message
  43558. strAbort = "canceled",
  43559. // Fake xhr
  43560. jqXHR = {
  43561. readyState: 0,
  43562. // Builds headers hashtable if needed
  43563. getResponseHeader: function getResponseHeader(key) {
  43564. var match;
  43565. if (completed) {
  43566. if (!responseHeaders) {
  43567. responseHeaders = {};
  43568. while (match = rheaders.exec(responseHeadersString)) {
  43569. responseHeaders[match[1].toLowerCase()] = match[2];
  43570. }
  43571. }
  43572. match = responseHeaders[key.toLowerCase()];
  43573. }
  43574. return match == null ? null : match;
  43575. },
  43576. // Raw string
  43577. getAllResponseHeaders: function getAllResponseHeaders() {
  43578. return completed ? responseHeadersString : null;
  43579. },
  43580. // Caches the header
  43581. setRequestHeader: function setRequestHeader(name, value) {
  43582. if (completed == null) {
  43583. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  43584. requestHeaders[name] = value;
  43585. }
  43586. return this;
  43587. },
  43588. // Overrides response content-type header
  43589. overrideMimeType: function overrideMimeType(type) {
  43590. if (completed == null) {
  43591. s.mimeType = type;
  43592. }
  43593. return this;
  43594. },
  43595. // Status-dependent callbacks
  43596. statusCode: function statusCode(map) {
  43597. var code;
  43598. if (map) {
  43599. if (completed) {
  43600. // Execute the appropriate callbacks
  43601. jqXHR.always(map[jqXHR.status]);
  43602. } else {
  43603. // Lazy-add the new callbacks in a way that preserves old ones
  43604. for (code in map) {
  43605. _statusCode[code] = [_statusCode[code], map[code]];
  43606. }
  43607. }
  43608. }
  43609. return this;
  43610. },
  43611. // Cancel the request
  43612. abort: function abort(statusText) {
  43613. var finalText = statusText || strAbort;
  43614. if (transport) {
  43615. transport.abort(finalText);
  43616. }
  43617. done(0, finalText);
  43618. return this;
  43619. }
  43620. };
  43621. // Attach deferreds
  43622. deferred.promise(jqXHR);
  43623. // Add protocol if not provided (prefilters might expect it)
  43624. // Handle falsy url in the settings object (#10093: consistency with old signature)
  43625. // We also use the url parameter if available
  43626. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  43627. // Alias method option to type as per ticket #12004
  43628. s.type = options.method || options.type || s.method || s.type;
  43629. // Extract dataTypes list
  43630. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  43631. // A cross-domain request is in order when the origin doesn't match the current origin.
  43632. if (s.crossDomain == null) {
  43633. urlAnchor = document.createElement("a");
  43634. // Support: IE <=8 - 11, Edge 12 - 15
  43635. // IE throws exception on accessing the href property if url is malformed,
  43636. // e.g. http://example.com:80x/
  43637. try {
  43638. urlAnchor.href = s.url;
  43639. // Support: IE <=8 - 11 only
  43640. // Anchor's host property isn't correctly set when s.url is relative
  43641. urlAnchor.href = urlAnchor.href;
  43642. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  43643. } catch (e) {
  43644. // If there is an error parsing the URL, assume it is crossDomain,
  43645. // it can be rejected by the transport if it is invalid
  43646. s.crossDomain = true;
  43647. }
  43648. }
  43649. // Convert data if not already a string
  43650. if (s.data && s.processData && typeof s.data !== "string") {
  43651. s.data = jQuery.param(s.data, s.traditional);
  43652. }
  43653. // Apply prefilters
  43654. inspectPrefiltersOrTransports(prefilters, s, options, jqXHR);
  43655. // If request was aborted inside a prefilter, stop there
  43656. if (completed) {
  43657. return jqXHR;
  43658. }
  43659. // We can fire global events as of now if asked to
  43660. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  43661. fireGlobals = jQuery.event && s.global;
  43662. // Watch for a new set of requests
  43663. if (fireGlobals && jQuery.active++ === 0) {
  43664. jQuery.event.trigger("ajaxStart");
  43665. }
  43666. // Uppercase the type
  43667. s.type = s.type.toUpperCase();
  43668. // Determine if request has content
  43669. s.hasContent = !rnoContent.test(s.type);
  43670. // Save the URL in case we're toying with the If-Modified-Since
  43671. // and/or If-None-Match header later on
  43672. // Remove hash to simplify url manipulation
  43673. cacheURL = s.url.replace(rhash, "");
  43674. // More options handling for requests with no content
  43675. if (!s.hasContent) {
  43676. // Remember the hash so we can put it back
  43677. uncached = s.url.slice(cacheURL.length);
  43678. // If data is available and should be processed, append data to url
  43679. if (s.data && (s.processData || typeof s.data === "string")) {
  43680. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  43681. // #9682: remove data so that it's not used in an eventual retry
  43682. delete s.data;
  43683. }
  43684. // Add or update anti-cache param if needed
  43685. if (s.cache === false) {
  43686. cacheURL = cacheURL.replace(rantiCache, "$1");
  43687. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce++ + uncached;
  43688. }
  43689. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  43690. s.url = cacheURL + uncached;
  43691. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  43692. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  43693. s.data = s.data.replace(r20, "+");
  43694. }
  43695. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43696. if (s.ifModified) {
  43697. if (jQuery.lastModified[cacheURL]) {
  43698. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  43699. }
  43700. if (jQuery.etag[cacheURL]) {
  43701. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  43702. }
  43703. }
  43704. // Set the correct header, if data is being sent
  43705. if (s.data && s.hasContent && s.contentType !== false || options.contentType) {
  43706. jqXHR.setRequestHeader("Content-Type", s.contentType);
  43707. }
  43708. // Set the Accepts header for the server, depending on the dataType
  43709. 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["*"]);
  43710. // Check for headers option
  43711. for (i in s.headers) {
  43712. jqXHR.setRequestHeader(i, s.headers[i]);
  43713. }
  43714. // Allow custom headers/mimetypes and early abort
  43715. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed)) {
  43716. // Abort if not done already and return
  43717. return jqXHR.abort();
  43718. }
  43719. // Aborting is no longer a cancellation
  43720. strAbort = "abort";
  43721. // Install callbacks on deferreds
  43722. completeDeferred.add(s.complete);
  43723. jqXHR.done(s.success);
  43724. jqXHR.fail(s.error);
  43725. // Get transport
  43726. transport = inspectPrefiltersOrTransports(transports, s, options, jqXHR);
  43727. // If no transport, we auto-abort
  43728. if (!transport) {
  43729. done(-1, "No Transport");
  43730. } else {
  43731. jqXHR.readyState = 1;
  43732. // Send global event
  43733. if (fireGlobals) {
  43734. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  43735. }
  43736. // If request was aborted inside ajaxSend, stop there
  43737. if (completed) {
  43738. return jqXHR;
  43739. }
  43740. // Timeout
  43741. if (s.async && s.timeout > 0) {
  43742. timeoutTimer = window.setTimeout(function () {
  43743. jqXHR.abort("timeout");
  43744. }, s.timeout);
  43745. }
  43746. try {
  43747. completed = false;
  43748. transport.send(requestHeaders, done);
  43749. } catch (e) {
  43750. // Rethrow post-completion exceptions
  43751. if (completed) {
  43752. throw e;
  43753. }
  43754. // Propagate others as results
  43755. done(-1, e);
  43756. }
  43757. }
  43758. // Callback for when everything is done
  43759. function done(status, nativeStatusText, responses, headers) {
  43760. var isSuccess,
  43761. success,
  43762. error,
  43763. response,
  43764. modified,
  43765. statusText = nativeStatusText;
  43766. // Ignore repeat invocations
  43767. if (completed) {
  43768. return;
  43769. }
  43770. completed = true;
  43771. // Clear timeout if it exists
  43772. if (timeoutTimer) {
  43773. window.clearTimeout(timeoutTimer);
  43774. }
  43775. // Dereference transport for early garbage collection
  43776. // (no matter how long the jqXHR object will be used)
  43777. transport = undefined;
  43778. // Cache response headers
  43779. responseHeadersString = headers || "";
  43780. // Set readyState
  43781. jqXHR.readyState = status > 0 ? 4 : 0;
  43782. // Determine if successful
  43783. isSuccess = status >= 200 && status < 300 || status === 304;
  43784. // Get response data
  43785. if (responses) {
  43786. response = ajaxHandleResponses(s, jqXHR, responses);
  43787. }
  43788. // Convert no matter what (that way responseXXX fields are always set)
  43789. response = ajaxConvert(s, response, jqXHR, isSuccess);
  43790. // If successful, handle type chaining
  43791. if (isSuccess) {
  43792. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  43793. if (s.ifModified) {
  43794. modified = jqXHR.getResponseHeader("Last-Modified");
  43795. if (modified) {
  43796. jQuery.lastModified[cacheURL] = modified;
  43797. }
  43798. modified = jqXHR.getResponseHeader("etag");
  43799. if (modified) {
  43800. jQuery.etag[cacheURL] = modified;
  43801. }
  43802. }
  43803. // if no content
  43804. if (status === 204 || s.type === "HEAD") {
  43805. statusText = "nocontent";
  43806. // if not modified
  43807. } else if (status === 304) {
  43808. statusText = "notmodified";
  43809. // If we have data, let's convert it
  43810. } else {
  43811. statusText = response.state;
  43812. success = response.data;
  43813. error = response.error;
  43814. isSuccess = !error;
  43815. }
  43816. } else {
  43817. // Extract error from statusText and normalize for non-aborts
  43818. error = statusText;
  43819. if (status || !statusText) {
  43820. statusText = "error";
  43821. if (status < 0) {
  43822. status = 0;
  43823. }
  43824. }
  43825. }
  43826. // Set data for the fake xhr object
  43827. jqXHR.status = status;
  43828. jqXHR.statusText = (nativeStatusText || statusText) + "";
  43829. // Success/Error
  43830. if (isSuccess) {
  43831. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  43832. } else {
  43833. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  43834. }
  43835. // Status-dependent callbacks
  43836. jqXHR.statusCode(_statusCode);
  43837. _statusCode = undefined;
  43838. if (fireGlobals) {
  43839. globalEventContext.trigger(isSuccess ? "ajaxSuccess" : "ajaxError", [jqXHR, s, isSuccess ? success : error]);
  43840. }
  43841. // Complete
  43842. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  43843. if (fireGlobals) {
  43844. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  43845. // Handle the global AJAX counter
  43846. if (! --jQuery.active) {
  43847. jQuery.event.trigger("ajaxStop");
  43848. }
  43849. }
  43850. }
  43851. return jqXHR;
  43852. },
  43853. getJSON: function getJSON(url, data, callback) {
  43854. return jQuery.get(url, data, callback, "json");
  43855. },
  43856. getScript: function getScript(url, callback) {
  43857. return jQuery.get(url, undefined, callback, "script");
  43858. }
  43859. });
  43860. jQuery.each(["get", "post"], function (i, method) {
  43861. jQuery[method] = function (url, data, callback, type) {
  43862. // Shift arguments if data argument was omitted
  43863. if (isFunction(data)) {
  43864. type = type || callback;
  43865. callback = data;
  43866. data = undefined;
  43867. }
  43868. // The url can be an options object (which then must have .url)
  43869. return jQuery.ajax(jQuery.extend({
  43870. url: url,
  43871. type: method,
  43872. dataType: type,
  43873. data: data,
  43874. success: callback
  43875. }, jQuery.isPlainObject(url) && url));
  43876. };
  43877. });
  43878. jQuery._evalUrl = function (url) {
  43879. return jQuery.ajax({
  43880. url: url,
  43881. // Make this explicit, since user can override this through ajaxSetup (#11264)
  43882. type: "GET",
  43883. dataType: "script",
  43884. cache: true,
  43885. async: false,
  43886. global: false,
  43887. "throws": true
  43888. });
  43889. };
  43890. jQuery.fn.extend({
  43891. wrapAll: function wrapAll(html) {
  43892. var wrap;
  43893. if (this[0]) {
  43894. if (isFunction(html)) {
  43895. html = html.call(this[0]);
  43896. }
  43897. // The elements to wrap the target around
  43898. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  43899. if (this[0].parentNode) {
  43900. wrap.insertBefore(this[0]);
  43901. }
  43902. wrap.map(function () {
  43903. var elem = this;
  43904. while (elem.firstElementChild) {
  43905. elem = elem.firstElementChild;
  43906. }
  43907. return elem;
  43908. }).append(this);
  43909. }
  43910. return this;
  43911. },
  43912. wrapInner: function wrapInner(html) {
  43913. if (isFunction(html)) {
  43914. return this.each(function (i) {
  43915. jQuery(this).wrapInner(html.call(this, i));
  43916. });
  43917. }
  43918. return this.each(function () {
  43919. var self = jQuery(this),
  43920. contents = self.contents();
  43921. if (contents.length) {
  43922. contents.wrapAll(html);
  43923. } else {
  43924. self.append(html);
  43925. }
  43926. });
  43927. },
  43928. wrap: function wrap(html) {
  43929. var htmlIsFunction = isFunction(html);
  43930. return this.each(function (i) {
  43931. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i) : html);
  43932. });
  43933. },
  43934. unwrap: function unwrap(selector) {
  43935. this.parent(selector).not("body").each(function () {
  43936. jQuery(this).replaceWith(this.childNodes);
  43937. });
  43938. return this;
  43939. }
  43940. });
  43941. jQuery.expr.pseudos.hidden = function (elem) {
  43942. return !jQuery.expr.pseudos.visible(elem);
  43943. };
  43944. jQuery.expr.pseudos.visible = function (elem) {
  43945. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  43946. };
  43947. jQuery.ajaxSettings.xhr = function () {
  43948. try {
  43949. return new window.XMLHttpRequest();
  43950. } catch (e) {}
  43951. };
  43952. var xhrSuccessStatus = {
  43953. // File protocol always yields status code 0, assume 200
  43954. 0: 200,
  43955. // Support: IE <=9 only
  43956. // #1450: sometimes IE returns 1223 when it should be 204
  43957. 1223: 204
  43958. },
  43959. xhrSupported = jQuery.ajaxSettings.xhr();
  43960. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  43961. support.ajax = xhrSupported = !!xhrSupported;
  43962. jQuery.ajaxTransport(function (options) {
  43963. var _callback, errorCallback;
  43964. // Cross domain only allowed if supported through XMLHttpRequest
  43965. if (support.cors || xhrSupported && !options.crossDomain) {
  43966. return {
  43967. send: function send(headers, complete) {
  43968. var i,
  43969. xhr = options.xhr();
  43970. xhr.open(options.type, options.url, options.async, options.username, options.password);
  43971. // Apply custom fields if provided
  43972. if (options.xhrFields) {
  43973. for (i in options.xhrFields) {
  43974. xhr[i] = options.xhrFields[i];
  43975. }
  43976. }
  43977. // Override mime type if needed
  43978. if (options.mimeType && xhr.overrideMimeType) {
  43979. xhr.overrideMimeType(options.mimeType);
  43980. }
  43981. // X-Requested-With header
  43982. // For cross-domain requests, seeing as conditions for a preflight are
  43983. // akin to a jigsaw puzzle, we simply never set it to be sure.
  43984. // (it can always be set on a per-request basis or even using ajaxSetup)
  43985. // For same-domain requests, won't change header if already provided.
  43986. if (!options.crossDomain && !headers["X-Requested-With"]) {
  43987. headers["X-Requested-With"] = "XMLHttpRequest";
  43988. }
  43989. // Set headers
  43990. for (i in headers) {
  43991. xhr.setRequestHeader(i, headers[i]);
  43992. }
  43993. // Callback
  43994. _callback = function callback(type) {
  43995. return function () {
  43996. if (_callback) {
  43997. _callback = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  43998. if (type === "abort") {
  43999. xhr.abort();
  44000. } else if (type === "error") {
  44001. // Support: IE <=9 only
  44002. // On a manual native abort, IE9 throws
  44003. // errors on any property access that is not readyState
  44004. if (typeof xhr.status !== "number") {
  44005. complete(0, "error");
  44006. } else {
  44007. complete(
  44008. // File: protocol always yields status 0; see #8605, #14207
  44009. xhr.status, xhr.statusText);
  44010. }
  44011. } else {
  44012. complete(xhrSuccessStatus[xhr.status] || xhr.status, xhr.statusText,
  44013. // Support: IE <=9 only
  44014. // IE9 has no XHR2 but throws on binary (trac-11426)
  44015. // For XHR2 non-text, let the caller handle it (gh-2498)
  44016. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText }, xhr.getAllResponseHeaders());
  44017. }
  44018. }
  44019. };
  44020. };
  44021. // Listen to events
  44022. xhr.onload = _callback();
  44023. errorCallback = xhr.onerror = xhr.ontimeout = _callback("error");
  44024. // Support: IE 9 only
  44025. // Use onreadystatechange to replace onabort
  44026. // to handle uncaught aborts
  44027. if (xhr.onabort !== undefined) {
  44028. xhr.onabort = errorCallback;
  44029. } else {
  44030. xhr.onreadystatechange = function () {
  44031. // Check readyState before timeout as it changes
  44032. if (xhr.readyState === 4) {
  44033. // Allow onerror to be called first,
  44034. // but that will not handle a native abort
  44035. // Also, save errorCallback to a variable
  44036. // as xhr.onerror cannot be accessed
  44037. window.setTimeout(function () {
  44038. if (_callback) {
  44039. errorCallback();
  44040. }
  44041. });
  44042. }
  44043. };
  44044. }
  44045. // Create the abort callback
  44046. _callback = _callback("abort");
  44047. try {
  44048. // Do send the request (this may raise an exception)
  44049. xhr.send(options.hasContent && options.data || null);
  44050. } catch (e) {
  44051. // #14683: Only rethrow if this hasn't been notified as an error yet
  44052. if (_callback) {
  44053. throw e;
  44054. }
  44055. }
  44056. },
  44057. abort: function abort() {
  44058. if (_callback) {
  44059. _callback();
  44060. }
  44061. }
  44062. };
  44063. }
  44064. });
  44065. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  44066. jQuery.ajaxPrefilter(function (s) {
  44067. if (s.crossDomain) {
  44068. s.contents.script = false;
  44069. }
  44070. });
  44071. // Install script dataType
  44072. jQuery.ajaxSetup({
  44073. accepts: {
  44074. script: "text/javascript, application/javascript, " + "application/ecmascript, application/x-ecmascript"
  44075. },
  44076. contents: {
  44077. script: /\b(?:java|ecma)script\b/
  44078. },
  44079. converters: {
  44080. "text script": function textScript(text) {
  44081. jQuery.globalEval(text);
  44082. return text;
  44083. }
  44084. }
  44085. });
  44086. // Handle cache's special case and crossDomain
  44087. jQuery.ajaxPrefilter("script", function (s) {
  44088. if (s.cache === undefined) {
  44089. s.cache = false;
  44090. }
  44091. if (s.crossDomain) {
  44092. s.type = "GET";
  44093. }
  44094. });
  44095. // Bind script tag hack transport
  44096. jQuery.ajaxTransport("script", function (s) {
  44097. // This transport only deals with cross domain requests
  44098. if (s.crossDomain) {
  44099. var script, _callback2;
  44100. return {
  44101. send: function send(_, complete) {
  44102. script = jQuery("<script>").prop({
  44103. charset: s.scriptCharset,
  44104. src: s.url
  44105. }).on("load error", _callback2 = function callback(evt) {
  44106. script.remove();
  44107. _callback2 = null;
  44108. if (evt) {
  44109. complete(evt.type === "error" ? 404 : 200, evt.type);
  44110. }
  44111. });
  44112. // Use native DOM manipulation to avoid our domManip AJAX trickery
  44113. document.head.appendChild(script[0]);
  44114. },
  44115. abort: function abort() {
  44116. if (_callback2) {
  44117. _callback2();
  44118. }
  44119. }
  44120. };
  44121. }
  44122. });
  44123. var oldCallbacks = [],
  44124. rjsonp = /(=)\?(?=&|$)|\?\?/;
  44125. // Default jsonp settings
  44126. jQuery.ajaxSetup({
  44127. jsonp: "callback",
  44128. jsonpCallback: function jsonpCallback() {
  44129. var callback = oldCallbacks.pop() || jQuery.expando + "_" + nonce++;
  44130. this[callback] = true;
  44131. return callback;
  44132. }
  44133. });
  44134. // Detect, normalize options and install callbacks for jsonp requests
  44135. jQuery.ajaxPrefilter("json jsonp", function (s, originalSettings, jqXHR) {
  44136. var callbackName,
  44137. overwritten,
  44138. responseContainer,
  44139. 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");
  44140. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  44141. if (jsonProp || s.dataTypes[0] === "jsonp") {
  44142. // Get callback name, remembering preexisting value associated with it
  44143. callbackName = s.jsonpCallback = isFunction(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  44144. // Insert callback into url or form data
  44145. if (jsonProp) {
  44146. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  44147. } else if (s.jsonp !== false) {
  44148. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  44149. }
  44150. // Use data converter to retrieve json after script execution
  44151. s.converters["script json"] = function () {
  44152. if (!responseContainer) {
  44153. jQuery.error(callbackName + " was not called");
  44154. }
  44155. return responseContainer[0];
  44156. };
  44157. // Force json dataType
  44158. s.dataTypes[0] = "json";
  44159. // Install callback
  44160. overwritten = window[callbackName];
  44161. window[callbackName] = function () {
  44162. responseContainer = arguments;
  44163. };
  44164. // Clean-up function (fires after converters)
  44165. jqXHR.always(function () {
  44166. // If previous value didn't exist - remove it
  44167. if (overwritten === undefined) {
  44168. jQuery(window).removeProp(callbackName);
  44169. // Otherwise restore preexisting value
  44170. } else {
  44171. window[callbackName] = overwritten;
  44172. }
  44173. // Save back as free
  44174. if (s[callbackName]) {
  44175. // Make sure that re-using the options doesn't screw things around
  44176. s.jsonpCallback = originalSettings.jsonpCallback;
  44177. // Save the callback name for future use
  44178. oldCallbacks.push(callbackName);
  44179. }
  44180. // Call if it was a function and we have a response
  44181. if (responseContainer && isFunction(overwritten)) {
  44182. overwritten(responseContainer[0]);
  44183. }
  44184. responseContainer = overwritten = undefined;
  44185. });
  44186. // Delegate to script
  44187. return "script";
  44188. }
  44189. });
  44190. // Support: Safari 8 only
  44191. // In Safari 8 documents created via document.implementation.createHTMLDocument
  44192. // collapse sibling forms: the second one becomes a child of the first one.
  44193. // Because of that, this security measure has to be disabled in Safari 8.
  44194. // https://bugs.webkit.org/show_bug.cgi?id=137337
  44195. support.createHTMLDocument = function () {
  44196. var body = document.implementation.createHTMLDocument("").body;
  44197. body.innerHTML = "<form></form><form></form>";
  44198. return body.childNodes.length === 2;
  44199. }();
  44200. // Argument "data" should be string of html
  44201. // context (optional): If specified, the fragment will be created in this context,
  44202. // defaults to document
  44203. // keepScripts (optional): If true, will include scripts passed in the html string
  44204. jQuery.parseHTML = function (data, context, keepScripts) {
  44205. if (typeof data !== "string") {
  44206. return [];
  44207. }
  44208. if (typeof context === "boolean") {
  44209. keepScripts = context;
  44210. context = false;
  44211. }
  44212. var base, parsed, scripts;
  44213. if (!context) {
  44214. // Stop scripts or inline event handlers from being executed immediately
  44215. // by using document.implementation
  44216. if (support.createHTMLDocument) {
  44217. context = document.implementation.createHTMLDocument("");
  44218. // Set the base href for the created document
  44219. // so any parsed elements with URLs
  44220. // are based on the document's URL (gh-2965)
  44221. base = context.createElement("base");
  44222. base.href = document.location.href;
  44223. context.head.appendChild(base);
  44224. } else {
  44225. context = document;
  44226. }
  44227. }
  44228. parsed = rsingleTag.exec(data);
  44229. scripts = !keepScripts && [];
  44230. // Single tag
  44231. if (parsed) {
  44232. return [context.createElement(parsed[1])];
  44233. }
  44234. parsed = buildFragment([data], context, scripts);
  44235. if (scripts && scripts.length) {
  44236. jQuery(scripts).remove();
  44237. }
  44238. return jQuery.merge([], parsed.childNodes);
  44239. };
  44240. /**
  44241. * Load a url into a page
  44242. */
  44243. jQuery.fn.load = function (url, params, callback) {
  44244. var selector,
  44245. type,
  44246. response,
  44247. self = this,
  44248. off = url.indexOf(" ");
  44249. if (off > -1) {
  44250. selector = stripAndCollapse(url.slice(off));
  44251. url = url.slice(0, off);
  44252. }
  44253. // If it's a function
  44254. if (isFunction(params)) {
  44255. // We assume that it's the callback
  44256. callback = params;
  44257. params = undefined;
  44258. // Otherwise, build a param string
  44259. } else if (params && (typeof params === "undefined" ? "undefined" : _typeof(params)) === "object") {
  44260. type = "POST";
  44261. }
  44262. // If we have elements to modify, make the request
  44263. if (self.length > 0) {
  44264. jQuery.ajax({
  44265. url: url,
  44266. // If "type" variable is undefined, then "GET" method will be used.
  44267. // Make value of this field explicit since
  44268. // user can override it through ajaxSetup method
  44269. type: type || "GET",
  44270. dataType: "html",
  44271. data: params
  44272. }).done(function (responseText) {
  44273. // Save response for use in complete callback
  44274. response = arguments;
  44275. self.html(selector ?
  44276. // If a selector was specified, locate the right elements in a dummy div
  44277. // Exclude scripts to avoid IE 'Permission Denied' errors
  44278. jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) :
  44279. // Otherwise use the full result
  44280. responseText);
  44281. // If the request succeeds, this function gets "data", "status", "jqXHR"
  44282. // but they are ignored because response was set above.
  44283. // If it fails, this function gets "jqXHR", "status", "error"
  44284. }).always(callback && function (jqXHR, status) {
  44285. self.each(function () {
  44286. callback.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  44287. });
  44288. });
  44289. }
  44290. return this;
  44291. };
  44292. // Attach a bunch of functions for handling common AJAX events
  44293. jQuery.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function (i, type) {
  44294. jQuery.fn[type] = function (fn) {
  44295. return this.on(type, fn);
  44296. };
  44297. });
  44298. jQuery.expr.pseudos.animated = function (elem) {
  44299. return jQuery.grep(jQuery.timers, function (fn) {
  44300. return elem === fn.elem;
  44301. }).length;
  44302. };
  44303. jQuery.offset = {
  44304. setOffset: function setOffset(elem, options, i) {
  44305. var curPosition,
  44306. curLeft,
  44307. curCSSTop,
  44308. curTop,
  44309. curOffset,
  44310. curCSSLeft,
  44311. calculatePosition,
  44312. position = jQuery.css(elem, "position"),
  44313. curElem = jQuery(elem),
  44314. props = {};
  44315. // Set position first, in-case top/left are set even on static elem
  44316. if (position === "static") {
  44317. elem.style.position = "relative";
  44318. }
  44319. curOffset = curElem.offset();
  44320. curCSSTop = jQuery.css(elem, "top");
  44321. curCSSLeft = jQuery.css(elem, "left");
  44322. calculatePosition = (position === "absolute" || position === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  44323. // Need to be able to calculate position if either
  44324. // top or left is auto and position is either absolute or fixed
  44325. if (calculatePosition) {
  44326. curPosition = curElem.position();
  44327. curTop = curPosition.top;
  44328. curLeft = curPosition.left;
  44329. } else {
  44330. curTop = parseFloat(curCSSTop) || 0;
  44331. curLeft = parseFloat(curCSSLeft) || 0;
  44332. }
  44333. if (isFunction(options)) {
  44334. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  44335. options = options.call(elem, i, jQuery.extend({}, curOffset));
  44336. }
  44337. if (options.top != null) {
  44338. props.top = options.top - curOffset.top + curTop;
  44339. }
  44340. if (options.left != null) {
  44341. props.left = options.left - curOffset.left + curLeft;
  44342. }
  44343. if ("using" in options) {
  44344. options.using.call(elem, props);
  44345. } else {
  44346. curElem.css(props);
  44347. }
  44348. }
  44349. };
  44350. jQuery.fn.extend({
  44351. // offset() relates an element's border box to the document origin
  44352. offset: function offset(options) {
  44353. // Preserve chaining for setter
  44354. if (arguments.length) {
  44355. return options === undefined ? this : this.each(function (i) {
  44356. jQuery.offset.setOffset(this, options, i);
  44357. });
  44358. }
  44359. var rect,
  44360. win,
  44361. elem = this[0];
  44362. if (!elem) {
  44363. return;
  44364. }
  44365. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  44366. // Support: IE <=11 only
  44367. // Running getBoundingClientRect on a
  44368. // disconnected node in IE throws an error
  44369. if (!elem.getClientRects().length) {
  44370. return { top: 0, left: 0 };
  44371. }
  44372. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  44373. rect = elem.getBoundingClientRect();
  44374. win = elem.ownerDocument.defaultView;
  44375. return {
  44376. top: rect.top + win.pageYOffset,
  44377. left: rect.left + win.pageXOffset
  44378. };
  44379. },
  44380. // position() relates an element's margin box to its offset parent's padding box
  44381. // This corresponds to the behavior of CSS absolute positioning
  44382. position: function position() {
  44383. if (!this[0]) {
  44384. return;
  44385. }
  44386. var offsetParent,
  44387. offset,
  44388. doc,
  44389. elem = this[0],
  44390. parentOffset = { top: 0, left: 0 };
  44391. // position:fixed elements are offset from the viewport, which itself always has zero offset
  44392. if (jQuery.css(elem, "position") === "fixed") {
  44393. // Assume position:fixed implies availability of getBoundingClientRect
  44394. offset = elem.getBoundingClientRect();
  44395. } else {
  44396. offset = this.offset();
  44397. // Account for the *real* offset parent, which can be the document or its root element
  44398. // when a statically positioned element is identified
  44399. doc = elem.ownerDocument;
  44400. offsetParent = elem.offsetParent || doc.documentElement;
  44401. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  44402. offsetParent = offsetParent.parentNode;
  44403. }
  44404. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  44405. // Incorporate borders into its offset, since they are outside its content origin
  44406. parentOffset = jQuery(offsetParent).offset();
  44407. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  44408. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  44409. }
  44410. }
  44411. // Subtract parent offsets and element margins
  44412. return {
  44413. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  44414. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  44415. };
  44416. },
  44417. // This method will return documentElement in the following cases:
  44418. // 1) For the element inside the iframe without offsetParent, this method will return
  44419. // documentElement of the parent window
  44420. // 2) For the hidden or detached element
  44421. // 3) For body or html element, i.e. in case of the html node - it will return itself
  44422. //
  44423. // but those exceptions were never presented as a real life use-cases
  44424. // and might be considered as more preferable results.
  44425. //
  44426. // This logic, however, is not guaranteed and can change at any point in the future
  44427. offsetParent: function offsetParent() {
  44428. return this.map(function () {
  44429. var offsetParent = this.offsetParent;
  44430. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  44431. offsetParent = offsetParent.offsetParent;
  44432. }
  44433. return offsetParent || documentElement;
  44434. });
  44435. }
  44436. });
  44437. // Create scrollLeft and scrollTop methods
  44438. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function (method, prop) {
  44439. var top = "pageYOffset" === prop;
  44440. jQuery.fn[method] = function (val) {
  44441. return access(this, function (elem, method, val) {
  44442. // Coalesce documents and windows
  44443. var win;
  44444. if (isWindow(elem)) {
  44445. win = elem;
  44446. } else if (elem.nodeType === 9) {
  44447. win = elem.defaultView;
  44448. }
  44449. if (val === undefined) {
  44450. return win ? win[prop] : elem[method];
  44451. }
  44452. if (win) {
  44453. win.scrollTo(!top ? val : win.pageXOffset, top ? val : win.pageYOffset);
  44454. } else {
  44455. elem[method] = val;
  44456. }
  44457. }, method, val, arguments.length);
  44458. };
  44459. });
  44460. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  44461. // Add the top/left cssHooks using jQuery.fn.position
  44462. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  44463. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  44464. // getComputedStyle returns percent when specified for top/left/bottom/right;
  44465. // rather than make the css module depend on the offset module, just check for it here
  44466. jQuery.each(["top", "left"], function (i, prop) {
  44467. jQuery.cssHooks[prop] = addGetHookIf(support.pixelPosition, function (elem, computed) {
  44468. if (computed) {
  44469. computed = curCSS(elem, prop);
  44470. // If curCSS returns percentage, fallback to offset
  44471. return rnumnonpx.test(computed) ? jQuery(elem).position()[prop] + "px" : computed;
  44472. }
  44473. });
  44474. });
  44475. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  44476. jQuery.each({ Height: "height", Width: "width" }, function (name, type) {
  44477. jQuery.each({ padding: "inner" + name, content: type, "": "outer" + name }, function (defaultExtra, funcName) {
  44478. // Margin is only for outerHeight, outerWidth
  44479. jQuery.fn[funcName] = function (margin, value) {
  44480. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"),
  44481. extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  44482. return access(this, function (elem, type, value) {
  44483. var doc;
  44484. if (isWindow(elem)) {
  44485. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  44486. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  44487. }
  44488. // Get document width or height
  44489. if (elem.nodeType === 9) {
  44490. doc = elem.documentElement;
  44491. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  44492. // whichever is greatest
  44493. return Math.max(elem.body["scroll" + name], doc["scroll" + name], elem.body["offset" + name], doc["offset" + name], doc["client" + name]);
  44494. }
  44495. return value === undefined ?
  44496. // Get width or height on the element, requesting but not forcing parseFloat
  44497. jQuery.css(elem, type, extra) :
  44498. // Set width or height on the element
  44499. jQuery.style(elem, type, value, extra);
  44500. }, type, chainable ? margin : undefined, chainable);
  44501. };
  44502. });
  44503. });
  44504. 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) {
  44505. // Handle event binding
  44506. jQuery.fn[name] = function (data, fn) {
  44507. return arguments.length > 0 ? this.on(name, null, data, fn) : this.trigger(name);
  44508. };
  44509. });
  44510. jQuery.fn.extend({
  44511. hover: function hover(fnOver, fnOut) {
  44512. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  44513. }
  44514. });
  44515. jQuery.fn.extend({
  44516. bind: function bind(types, data, fn) {
  44517. return this.on(types, null, data, fn);
  44518. },
  44519. unbind: function unbind(types, fn) {
  44520. return this.off(types, null, fn);
  44521. },
  44522. delegate: function delegate(selector, types, data, fn) {
  44523. return this.on(types, selector, data, fn);
  44524. },
  44525. undelegate: function undelegate(selector, types, fn) {
  44526. // ( namespace ) or ( selector, types [, fn] )
  44527. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn);
  44528. }
  44529. });
  44530. // Bind a function to a context, optionally partially applying any
  44531. // arguments.
  44532. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  44533. // However, it is not slated for removal any time soon
  44534. jQuery.proxy = function (fn, context) {
  44535. var tmp, args, proxy;
  44536. if (typeof context === "string") {
  44537. tmp = fn[context];
  44538. context = fn;
  44539. fn = tmp;
  44540. }
  44541. // Quick check to determine if target is callable, in the spec
  44542. // this throws a TypeError, but we will just return undefined.
  44543. if (!isFunction(fn)) {
  44544. return undefined;
  44545. }
  44546. // Simulated bind
  44547. args = _slice.call(arguments, 2);
  44548. proxy = function proxy() {
  44549. return fn.apply(context || this, args.concat(_slice.call(arguments)));
  44550. };
  44551. // Set the guid of unique handler to the same of original handler, so it can be removed
  44552. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  44553. return proxy;
  44554. };
  44555. jQuery.holdReady = function (hold) {
  44556. if (hold) {
  44557. jQuery.readyWait++;
  44558. } else {
  44559. jQuery.ready(true);
  44560. }
  44561. };
  44562. jQuery.isArray = Array.isArray;
  44563. jQuery.parseJSON = JSON.parse;
  44564. jQuery.nodeName = nodeName;
  44565. jQuery.isFunction = isFunction;
  44566. jQuery.isWindow = isWindow;
  44567. jQuery.camelCase = camelCase;
  44568. jQuery.type = toType;
  44569. jQuery.now = Date.now;
  44570. jQuery.isNumeric = function (obj) {
  44571. // As of jQuery 3.0, isNumeric is limited to
  44572. // strings and numbers (primitives or objects)
  44573. // that can be coerced to finite numbers (gh-2662)
  44574. var type = jQuery.type(obj);
  44575. return (type === "number" || type === "string") &&
  44576. // parseFloat NaNs numeric-cast false positives ("")
  44577. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  44578. // subtraction forces infinities to NaN
  44579. !isNaN(obj - parseFloat(obj));
  44580. };
  44581. // Register as a named AMD module, since jQuery can be concatenated with other
  44582. // files that may use define, but not via a proper concatenation script that
  44583. // understands anonymous AMD modules. A named AMD is safest and most robust
  44584. // way to register. Lowercase jquery is used because AMD module names are
  44585. // derived from file names, and jQuery is normally delivered in a lowercase
  44586. // file name. Do this after creating the global so that if an AMD module wants
  44587. // to call noConflict to hide this version of jQuery, it will work.
  44588. // Note that for maximum portability, libraries that are not jQuery should
  44589. // declare themselves as anonymous modules, and avoid setting a global if an
  44590. // AMD loader is present. jQuery is a special case. For more information, see
  44591. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  44592. if (true) {
  44593. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  44594. return jQuery;
  44595. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  44596. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44597. }
  44598. var
  44599. // Map over jQuery in case of overwrite
  44600. _jQuery = window.jQuery,
  44601. // Map over the $ in case of overwrite
  44602. _$ = window.$;
  44603. jQuery.noConflict = function (deep) {
  44604. if (window.$ === jQuery) {
  44605. window.$ = _$;
  44606. }
  44607. if (deep && window.jQuery === jQuery) {
  44608. window.jQuery = _jQuery;
  44609. }
  44610. return jQuery;
  44611. };
  44612. // Expose jQuery and $ identifiers, even in AMD
  44613. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  44614. // and CommonJS for browser emulators (#13566)
  44615. if (!noGlobal) {
  44616. window.jQuery = window.$ = jQuery;
  44617. }
  44618. return jQuery;
  44619. });
  44620. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module)))
  44621. /***/ }),
  44622. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  44623. /*!********************************************************!*\
  44624. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  44625. \********************************************************/
  44626. /*! no static exports found */
  44627. /***/ (function(module, exports, __webpack_require__) {
  44628. "use strict";
  44629. Object.defineProperty(exports, "__esModule", {
  44630. value: true
  44631. });
  44632. var LanguageService = /** @class */function () {
  44633. function LanguageService(lsKey, defaultLang) {
  44634. if (defaultLang === void 0) {
  44635. defaultLang = 'pt';
  44636. }
  44637. this.lsKey = lsKey;
  44638. this.defaultLang = defaultLang;
  44639. this.listeners = [];
  44640. this.document = document;
  44641. this.setupListener();
  44642. }
  44643. LanguageService.prototype.setupListener = function () {
  44644. var _this = this;
  44645. if (this.document !== null) {
  44646. this.document.addEventListener("storage", function (event) {
  44647. var e = event;
  44648. if (e.key === _this.lsKey) {
  44649. _this.listeners.forEach(function (l) {
  44650. return l();
  44651. });
  44652. }
  44653. });
  44654. }
  44655. };
  44656. LanguageService.prototype.getLang = function () {
  44657. var lang = localStorage.getItem(this.lsKey);
  44658. if (lang === null || lang === undefined) {
  44659. console.warn("Internal Error: User language information has not been set. Returning default...");
  44660. return this.getDefaultLang();
  44661. }
  44662. return lang;
  44663. };
  44664. LanguageService.prototype.getDefaultLang = function () {
  44665. return this.defaultLang;
  44666. };
  44667. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  44668. this.listeners.push(listener);
  44669. };
  44670. return LanguageService;
  44671. }();
  44672. exports.LanguageService = LanguageService;
  44673. /***/ }),
  44674. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  44675. /*!************************************************************!*\
  44676. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  44677. \************************************************************/
  44678. /*! no static exports found */
  44679. /***/ (function(module, exports, __webpack_require__) {
  44680. "use strict";
  44681. Object.defineProperty(exports, "__esModule", {
  44682. value: true
  44683. });
  44684. var LanguageServiceNoLS = /** @class */function () {
  44685. function LanguageServiceNoLS(lang) {
  44686. this.lang = lang;
  44687. this.listeners = [];
  44688. }
  44689. LanguageServiceNoLS.prototype.setupListener = function () {};
  44690. LanguageServiceNoLS.prototype.notifyChange = function () {
  44691. this.listeners.forEach(function (l) {
  44692. return l();
  44693. });
  44694. };
  44695. LanguageServiceNoLS.prototype.setLang = function (lang) {
  44696. this.lang = lang;
  44697. this.notifyChange();
  44698. };
  44699. LanguageServiceNoLS.prototype.getLang = function () {
  44700. return this.lang;
  44701. };
  44702. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  44703. return this.lang;
  44704. };
  44705. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  44706. this.listeners.push(listener);
  44707. };
  44708. return LanguageServiceNoLS;
  44709. }();
  44710. exports.LanguageServiceNoLS = LanguageServiceNoLS;
  44711. /***/ }),
  44712. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  44713. /*!*********************************************************!*\
  44714. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  44715. \*********************************************************/
  44716. /*! no static exports found */
  44717. /***/ (function(module, exports, __webpack_require__) {
  44718. "use strict";
  44719. Object.defineProperty(exports, "__esModule", {
  44720. value: true
  44721. });
  44722. exports.LocalizedStrings = undefined;
  44723. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44724. var LocalizedStrings = /** @class */function () {
  44725. function LocalizedStrings(service, i18nData, listenToChange) {
  44726. if (listenToChange === void 0) {
  44727. listenToChange = false;
  44728. }
  44729. var _this = this;
  44730. this.service = service;
  44731. this.i18nData = i18nData;
  44732. this.listenToChange = listenToChange;
  44733. this.document = document;
  44734. if (this.listenToChange) {
  44735. service.registerLanguageChangeListener(function () {
  44736. _this.updateTagText();
  44737. });
  44738. }
  44739. }
  44740. LocalizedStrings.prototype.getString = function (id, type) {
  44741. var i18nObj = this.i18nData[this.service.getLang()];
  44742. if (!!!i18nObj) {
  44743. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  44744. i18nObj = this.i18nData[this.service.getDefaultLang()];
  44745. }
  44746. if (!!!i18nObj[type]) {
  44747. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  44748. } else if (!!!i18nObj[type][id]) {
  44749. return "{MISSING_I18N_IDENTIFIER}";
  44750. } else {
  44751. return i18nObj[type][id];
  44752. }
  44753. };
  44754. LocalizedStrings.prototype.getOR = function () {
  44755. return this.getUI('join_or');
  44756. };
  44757. LocalizedStrings.prototype.getError = function (id, context) {
  44758. if (context === void 0) {
  44759. context = [];
  44760. }
  44761. var text = this.getString(id, _StringTypes.StringTypes.ERROR);
  44762. return this.processString(text, context);
  44763. };
  44764. LocalizedStrings.prototype.getMessage = function (id, context) {
  44765. if (context === void 0) {
  44766. context = [];
  44767. }
  44768. var text = this.getString(id, _StringTypes.StringTypes.MESSAGE);
  44769. return this.processString(text, context);
  44770. };
  44771. LocalizedStrings.prototype.getUI = function (id, context) {
  44772. if (context === void 0) {
  44773. context = [];
  44774. }
  44775. var text = this.getString(id, _StringTypes.StringTypes.UI);
  44776. return this.processString(text, context);
  44777. };
  44778. LocalizedStrings.prototype.processString = function (text, context) {
  44779. for (var i = 0; i < context.length; i++) {
  44780. var v = context[i];
  44781. text = text.replace('\$' + i, v);
  44782. }
  44783. return text;
  44784. };
  44785. LocalizedStrings.prototype.updateTagText = function (func) {
  44786. var _this = this;
  44787. if (func === void 0) {
  44788. func = null;
  44789. }
  44790. if (this.document !== null) {
  44791. var list = this.document.querySelectorAll("data.i18n");
  44792. list.forEach(function (node) {
  44793. if (func === null) {
  44794. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  44795. } else {
  44796. node.innerHTML = func(node.getAttribute("value"));
  44797. }
  44798. });
  44799. }
  44800. };
  44801. LocalizedStrings.prototype.processTagTex = function (text) {
  44802. if (text === null) {
  44803. return "<Invalid i18n identifier>";
  44804. }
  44805. var opts = text.split(':');
  44806. var type = opts[0].toLowerCase();
  44807. var id = opts[1];
  44808. if (_StringTypes.StringTypes.ERROR === type) {
  44809. return this.getError(id);
  44810. } else if (_StringTypes.StringTypes.MESSAGE === type) {
  44811. return this.getMessage(id);
  44812. } else if (_StringTypes.StringTypes.UI === type) {
  44813. return this.getUI(id);
  44814. } else {
  44815. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  44816. return this.getString(id, type);
  44817. }
  44818. };
  44819. return LocalizedStrings;
  44820. }();
  44821. exports.LocalizedStrings = LocalizedStrings;
  44822. /***/ }),
  44823. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  44824. /*!****************************************************!*\
  44825. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  44826. \****************************************************/
  44827. /*! no static exports found */
  44828. /***/ (function(module, exports, __webpack_require__) {
  44829. "use strict";
  44830. Object.defineProperty(exports, "__esModule", {
  44831. value: true
  44832. });
  44833. var StringTypes = exports.StringTypes = undefined;
  44834. (function (StringTypes) {
  44835. StringTypes["ERROR"] = "error";
  44836. StringTypes["MESSAGE"] = "message";
  44837. StringTypes["UI"] = "ui";
  44838. })(StringTypes || (exports.StringTypes = StringTypes = {}));
  44839. /***/ }),
  44840. /***/ "./node_modules/line-i18n/dist/index.js":
  44841. /*!**********************************************!*\
  44842. !*** ./node_modules/line-i18n/dist/index.js ***!
  44843. \**********************************************/
  44844. /*! no static exports found */
  44845. /***/ (function(module, exports, __webpack_require__) {
  44846. "use strict";
  44847. Object.defineProperty(exports, "__esModule", {
  44848. value: true
  44849. });
  44850. var _LanguageService = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  44851. var _LocalizedStrings = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  44852. var _StringTypes = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  44853. var _LanguageServiceNoLS = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  44854. exports.default = {
  44855. LanguageService: _LanguageService.LanguageService,
  44856. LanguageServiceNoLS: _LanguageServiceNoLS.LanguageServiceNoLS,
  44857. LocalizedStrings: _LocalizedStrings.LocalizedStrings,
  44858. StringTypes: _StringTypes.StringTypes
  44859. };
  44860. /***/ }),
  44861. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  44862. /*!***************************************************!*\
  44863. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  44864. \***************************************************/
  44865. /*! no static exports found */
  44866. /***/ (function(module, exports, __webpack_require__) {
  44867. "use strict";
  44868. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/**
  44869. * DEVELOPED BY
  44870. * GIL LOPES BUENO
  44871. * gilbueno.mail@gmail.com
  44872. *
  44873. * WORKS WITH:
  44874. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  44875. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  44876. *
  44877. * FORK:
  44878. * https://github.com/melanke/Watch.JS
  44879. *
  44880. * LICENSE: MIT
  44881. */
  44882. 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; };
  44883. (function (factory) {
  44884. if (( false ? undefined : _typeof(exports)) === 'object') {
  44885. // Node. Does not work with strict CommonJS, but
  44886. // only CommonJS-like enviroments that support module.exports,
  44887. // like Node.
  44888. module.exports = factory();
  44889. } else if (true) {
  44890. // AMD. Register as an anonymous module.
  44891. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  44892. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  44893. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  44894. __WEBPACK_AMD_DEFINE_FACTORY__),
  44895. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  44896. } else {}
  44897. })(function () {
  44898. var WatchJS = {
  44899. noMore: false, // use WatchJS.suspend(obj) instead
  44900. useDirtyCheck: false, // use only dirty checking to track changes.
  44901. preserveExistingSetters: false
  44902. },
  44903. lengthsubjects = [];
  44904. var dirtyChecklist = [];
  44905. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  44906. var supportDefineProperty = false;
  44907. try {
  44908. supportDefineProperty = Object.defineProperty && Object.defineProperty({}, 'x', {});
  44909. } catch (ex) {/* not supported */}
  44910. var isFunction = function isFunction(functionToCheck) {
  44911. var getType = {};
  44912. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  44913. };
  44914. var isInt = function isInt(x) {
  44915. return x % 1 === 0;
  44916. };
  44917. var isArray = function isArray(obj) {
  44918. return Object.prototype.toString.call(obj) === '[object Array]';
  44919. };
  44920. var isObject = function isObject(obj) {
  44921. return {}.toString.apply(obj) === '[object Object]';
  44922. };
  44923. var getObjDiff = function getObjDiff(a, b) {
  44924. var aplus = [],
  44925. bplus = [];
  44926. if (!(typeof a == "string") && !(typeof b == "string")) {
  44927. if (isArray(a) && b) {
  44928. for (var i = 0; i < a.length; i++) {
  44929. if (b[i] === undefined) aplus.push(i);
  44930. }
  44931. } else {
  44932. for (var i in a) {
  44933. if (a.hasOwnProperty(i)) {
  44934. if (b && !b.hasOwnProperty(i)) {
  44935. aplus.push(i);
  44936. }
  44937. }
  44938. }
  44939. }
  44940. if (isArray(b) && a) {
  44941. for (var j = 0; j < b.length; j++) {
  44942. if (a[j] === undefined) bplus.push(j);
  44943. }
  44944. } else {
  44945. for (var j in b) {
  44946. if (b.hasOwnProperty(j)) {
  44947. if (a && !a.hasOwnProperty(j)) {
  44948. bplus.push(j);
  44949. }
  44950. }
  44951. }
  44952. }
  44953. }
  44954. return {
  44955. added: aplus,
  44956. removed: bplus
  44957. };
  44958. };
  44959. var clone = function clone(obj) {
  44960. if (null == obj || "object" != (typeof obj === 'undefined' ? 'undefined' : _typeof(obj))) {
  44961. return obj;
  44962. }
  44963. var copy = obj.constructor();
  44964. for (var attr in obj) {
  44965. copy[attr] = obj[attr];
  44966. }
  44967. return copy;
  44968. };
  44969. var getExistingSetter = function getExistingSetter(obj, propName) {
  44970. if (WatchJS.preserveExistingSetters) {
  44971. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  44972. return existing.set;
  44973. }
  44974. return undefined;
  44975. };
  44976. var defineGetAndSet = function defineGetAndSet(obj, propName, getter, setter) {
  44977. try {
  44978. var existingSetter = getExistingSetter(obj, propName);
  44979. Object.defineProperty(obj, propName, {
  44980. get: getter,
  44981. set: function set(value) {
  44982. setter.call(this, value, true); // coalesce changes
  44983. if (existingSetter) {
  44984. existingSetter(value);
  44985. }
  44986. },
  44987. enumerable: true,
  44988. configurable: true
  44989. });
  44990. } catch (e1) {
  44991. try {
  44992. Object.prototype.__defineGetter__.call(obj, propName, getter);
  44993. Object.prototype.__defineSetter__.call(obj, propName, function (value) {
  44994. setter.call(this, value, true); // coalesce changes
  44995. });
  44996. } catch (e2) {
  44997. observeDirtyChanges(obj, propName, setter);
  44998. //throw new Error("watchJS error: browser not supported :/")
  44999. }
  45000. }
  45001. };
  45002. var defineProp = function defineProp(obj, propName, value) {
  45003. try {
  45004. Object.defineProperty(obj, propName, {
  45005. enumerable: false,
  45006. configurable: true,
  45007. writable: false,
  45008. value: value
  45009. });
  45010. } catch (error) {
  45011. obj[propName] = value;
  45012. }
  45013. };
  45014. var observeDirtyChanges = function observeDirtyChanges(obj, propName, setter) {
  45015. dirtyChecklist[dirtyChecklist.length] = {
  45016. prop: propName,
  45017. object: obj,
  45018. orig: clone(obj[propName]),
  45019. callback: setter
  45020. };
  45021. };
  45022. var watch = function watch() {
  45023. if (isFunction(arguments[1])) {
  45024. watchAll.apply(this, arguments);
  45025. } else if (isArray(arguments[1])) {
  45026. watchMany.apply(this, arguments);
  45027. } else {
  45028. watchOne.apply(this, arguments);
  45029. }
  45030. };
  45031. var watchAll = function watchAll(obj, watcher, level, addNRemove) {
  45032. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45033. //accepts only objects and array (not string)
  45034. return;
  45035. }
  45036. if (isArray(obj)) {
  45037. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  45038. if (level === undefined || level > 0) {
  45039. for (var prop = 0; prop < obj.length; prop++) {
  45040. // watch objects in array
  45041. watchAll(obj[prop], watcher, level, addNRemove);
  45042. }
  45043. }
  45044. } else {
  45045. var prop,
  45046. props = [];
  45047. for (prop in obj) {
  45048. //for each attribute if obj is an object
  45049. if (prop == "$val" || !supportDefineProperty && prop === 'watchers') {
  45050. continue;
  45051. }
  45052. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  45053. props.push(prop); //put in the props
  45054. }
  45055. }
  45056. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  45057. }
  45058. if (addNRemove) {
  45059. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  45060. }
  45061. };
  45062. var watchMany = function watchMany(obj, props, watcher, level, addNRemove) {
  45063. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45064. //accepts only objects and array (not string)
  45065. return;
  45066. }
  45067. for (var i = 0; i < props.length; i++) {
  45068. //watch each property
  45069. var prop = props[i];
  45070. watchOne(obj, prop, watcher, level, addNRemove);
  45071. }
  45072. };
  45073. var watchOne = function watchOne(obj, prop, watcher, level, addNRemove) {
  45074. if (typeof obj == "string" || !(obj instanceof Object) && !isArray(obj)) {
  45075. //accepts only objects and array (not string)
  45076. return;
  45077. }
  45078. if (isFunction(obj[prop])) {
  45079. //dont watch if it is a function
  45080. return;
  45081. }
  45082. if (obj[prop] != null && (level === undefined || level > 0)) {
  45083. watchAll(obj[prop], watcher, level !== undefined ? level - 1 : level); //recursively watch all attributes of this
  45084. }
  45085. defineWatcher(obj, prop, watcher, level);
  45086. if (addNRemove && (level === undefined || level > 0)) {
  45087. pushToLengthSubjects(obj, prop, watcher, level);
  45088. }
  45089. };
  45090. var unwatch = function unwatch() {
  45091. if (isFunction(arguments[1])) {
  45092. unwatchAll.apply(this, arguments);
  45093. } else if (isArray(arguments[1])) {
  45094. unwatchMany.apply(this, arguments);
  45095. } else {
  45096. unwatchOne.apply(this, arguments);
  45097. }
  45098. };
  45099. var unwatchAll = function unwatchAll(obj, watcher) {
  45100. if (obj instanceof String || !(obj instanceof Object) && !isArray(obj)) {
  45101. //accepts only objects and array (not string)
  45102. return;
  45103. }
  45104. if (isArray(obj)) {
  45105. var props = ['__watchall__'];
  45106. for (var prop = 0; prop < obj.length; prop++) {
  45107. //for each item if obj is an array
  45108. props.push(prop); //put in the props
  45109. }
  45110. unwatchMany(obj, props, watcher); //watch all itens of the props
  45111. } else {
  45112. var unwatchPropsInObject = function unwatchPropsInObject(obj2) {
  45113. var props = [];
  45114. for (var prop2 in obj2) {
  45115. //for each attribute if obj is an object
  45116. if (obj2.hasOwnProperty(prop2)) {
  45117. if (obj2[prop2] instanceof Object) {
  45118. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  45119. } else {
  45120. props.push(prop2); //put in the props
  45121. }
  45122. }
  45123. }
  45124. unwatchMany(obj2, props, watcher); //unwatch all of the props
  45125. };
  45126. unwatchPropsInObject(obj);
  45127. }
  45128. };
  45129. var unwatchMany = function unwatchMany(obj, props, watcher) {
  45130. for (var prop2 in props) {
  45131. //watch each attribute of "props" if is an object
  45132. if (props.hasOwnProperty(prop2)) {
  45133. unwatchOne(obj, props[prop2], watcher);
  45134. }
  45135. }
  45136. };
  45137. var timeouts = [],
  45138. timerID = null;
  45139. function clearTimerID() {
  45140. timerID = null;
  45141. for (var i = 0; i < timeouts.length; i++) {
  45142. timeouts[i]();
  45143. }
  45144. timeouts.length = 0;
  45145. }
  45146. var getTimerID = function getTimerID() {
  45147. if (!timerID) {
  45148. timerID = setTimeout(clearTimerID);
  45149. }
  45150. return timerID;
  45151. };
  45152. var registerTimeout = function registerTimeout(fn) {
  45153. // register function to be called on timeout
  45154. if (timerID == null) getTimerID();
  45155. timeouts[timeouts.length] = fn;
  45156. };
  45157. // Track changes made to an array, object or an object's property
  45158. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  45159. // Syntax:
  45160. // trackChange(obj, callback, recursive, addNRemove)
  45161. // trackChange(obj, prop, callback, recursive, addNRemove)
  45162. var trackChange = function trackChange() {
  45163. var fn = isFunction(arguments[2]) ? trackProperty : trackObject;
  45164. fn.apply(this, arguments);
  45165. };
  45166. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  45167. var trackObject = function trackObject(obj, callback, recursive, addNRemove) {
  45168. var change = null,
  45169. lastTimerID = -1;
  45170. var isArr = isArray(obj);
  45171. var level,
  45172. fn = function fn(prop, action, newValue, oldValue) {
  45173. var timerID = getTimerID();
  45174. if (lastTimerID !== timerID) {
  45175. // check if timer has changed since last update
  45176. lastTimerID = timerID;
  45177. change = {
  45178. type: 'update'
  45179. };
  45180. change['value'] = obj;
  45181. change['splices'] = null;
  45182. registerTimeout(function () {
  45183. callback.call(this, change);
  45184. change = null;
  45185. });
  45186. }
  45187. // create splices for array changes
  45188. if (isArr && obj === this && change !== null) {
  45189. if (action === 'pop' || action === 'shift') {
  45190. newValue = [];
  45191. oldValue = [oldValue];
  45192. } else if (action === 'push' || action === 'unshift') {
  45193. newValue = [newValue];
  45194. oldValue = [];
  45195. } else if (action !== 'splice') {
  45196. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  45197. }
  45198. if (!change.splices) change.splices = [];
  45199. change.splices[change.splices.length] = {
  45200. index: prop,
  45201. deleteCount: oldValue ? oldValue.length : 0,
  45202. addedCount: newValue ? newValue.length : 0,
  45203. added: newValue,
  45204. deleted: oldValue
  45205. };
  45206. }
  45207. };
  45208. level = recursive == true ? undefined : 0;
  45209. watchAll(obj, fn, level, addNRemove);
  45210. };
  45211. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  45212. var trackProperty = function trackProperty(obj, prop, callback, recursive, addNRemove) {
  45213. if (obj && prop) {
  45214. watchOne(obj, prop, function (prop, action, newvalue, oldvalue) {
  45215. var change = {
  45216. type: 'update'
  45217. };
  45218. change['value'] = newvalue;
  45219. change['oldvalue'] = oldvalue;
  45220. if (recursive && isObject(newvalue) || isArray(newvalue)) {
  45221. trackObject(newvalue, callback, recursive, addNRemove);
  45222. }
  45223. callback.call(this, change);
  45224. }, 0);
  45225. if (recursive && isObject(obj[prop]) || isArray(obj[prop])) {
  45226. trackObject(obj[prop], callback, recursive, addNRemove);
  45227. }
  45228. }
  45229. };
  45230. var defineWatcher = function defineWatcher(obj, prop, watcher, level) {
  45231. var newWatcher = false;
  45232. var isArr = isArray(obj);
  45233. if (!obj.watchers) {
  45234. defineProp(obj, "watchers", {});
  45235. if (isArr) {
  45236. // watch array functions
  45237. watchFunctions(obj, function (index, action, newValue, oldValue) {
  45238. addPendingChange(obj, index, action, newValue, oldValue);
  45239. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  45240. var i,
  45241. n,
  45242. ln,
  45243. wAll,
  45244. watchList = obj.watchers[prop];
  45245. if (wAll = obj.watchers['__watchall__']) {
  45246. watchList = watchList ? watchList.concat(wAll) : wAll;
  45247. }
  45248. ln = watchList ? watchList.length : 0;
  45249. for (i = 0; i < ln; i++) {
  45250. if (action !== 'splice') {
  45251. watchAll(newValue, watchList[i], level === undefined ? level : level - 1);
  45252. } else {
  45253. // watch spliced values
  45254. for (n = 0; n < newValue.length; n++) {
  45255. watchAll(newValue[n], watchList[i], level === undefined ? level : level - 1);
  45256. }
  45257. }
  45258. }
  45259. }
  45260. });
  45261. }
  45262. }
  45263. if (!obj.watchers[prop]) {
  45264. obj.watchers[prop] = [];
  45265. if (!isArr) newWatcher = true;
  45266. }
  45267. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45268. if (obj.watchers[prop][i] === watcher) {
  45269. return;
  45270. }
  45271. }
  45272. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  45273. if (newWatcher) {
  45274. var val = obj[prop];
  45275. var getter = function getter() {
  45276. return val;
  45277. };
  45278. var setter = function setter(newval, delayWatcher) {
  45279. var oldval = val;
  45280. val = newval;
  45281. if (level !== 0 && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop])) && !obj[prop].watchers) {
  45282. // watch sub properties
  45283. var i,
  45284. ln = obj.watchers[prop].length;
  45285. for (i = 0; i < ln; i++) {
  45286. watchAll(obj[prop], obj.watchers[prop][i], level === undefined ? level : level - 1);
  45287. }
  45288. }
  45289. //watchFunctions(obj, prop);
  45290. if (isSuspended(obj, prop)) {
  45291. resume(obj, prop);
  45292. return;
  45293. }
  45294. if (!WatchJS.noMore) {
  45295. // this does not work with Object.observe
  45296. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  45297. if (oldval !== newval) {
  45298. if (!delayWatcher) {
  45299. callWatchers(obj, prop, "set", newval, oldval);
  45300. } else {
  45301. addPendingChange(obj, prop, "set", newval, oldval);
  45302. }
  45303. WatchJS.noMore = false;
  45304. }
  45305. }
  45306. };
  45307. if (WatchJS.useDirtyCheck) {
  45308. observeDirtyChanges(obj, prop, setter);
  45309. } else {
  45310. defineGetAndSet(obj, prop, getter, setter);
  45311. }
  45312. }
  45313. };
  45314. var callWatchers = function callWatchers(obj, prop, action, newval, oldval) {
  45315. if (prop !== undefined) {
  45316. var ln,
  45317. wl,
  45318. watchList = obj.watchers[prop];
  45319. if (wl = obj.watchers['__watchall__']) {
  45320. watchList = watchList ? watchList.concat(wl) : wl;
  45321. }
  45322. ln = watchList ? watchList.length : 0;
  45323. for (var wr = 0; wr < ln; wr++) {
  45324. watchList[wr].call(obj, prop, action, newval, oldval);
  45325. }
  45326. } else {
  45327. for (var prop in obj) {
  45328. //call all
  45329. if (obj.hasOwnProperty(prop)) {
  45330. callWatchers(obj, prop, action, newval, oldval);
  45331. }
  45332. }
  45333. }
  45334. };
  45335. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  45336. var defineArrayMethodWatcher = function defineArrayMethodWatcher(obj, original, methodName, callback) {
  45337. defineProp(obj, methodName, function () {
  45338. var index = 0;
  45339. var i, newValue, oldValue, response;
  45340. // get values before splicing array
  45341. if (methodName === 'splice') {
  45342. var start = arguments[0];
  45343. var end = start + arguments[1];
  45344. oldValue = obj.slice(start, end);
  45345. newValue = [];
  45346. for (i = 2; i < arguments.length; i++) {
  45347. newValue[i - 2] = arguments[i];
  45348. }
  45349. index = start;
  45350. } else {
  45351. newValue = arguments.length > 0 ? arguments[0] : undefined;
  45352. }
  45353. response = original.apply(obj, arguments);
  45354. if (methodName !== 'slice') {
  45355. if (methodName === 'pop') {
  45356. oldValue = response;
  45357. index = obj.length;
  45358. } else if (methodName === 'push') {
  45359. index = obj.length - 1;
  45360. } else if (methodName === 'shift') {
  45361. oldValue = response;
  45362. } else if (methodName !== 'unshift' && newValue === undefined) {
  45363. newValue = response;
  45364. }
  45365. callback.call(obj, index, methodName, newValue, oldValue);
  45366. }
  45367. return response;
  45368. });
  45369. };
  45370. var watchFunctions = function watchFunctions(obj, callback) {
  45371. if (!isFunction(callback) || !obj || obj instanceof String || !isArray(obj)) {
  45372. return;
  45373. }
  45374. for (var i = methodNames.length, methodName; i--;) {
  45375. methodName = methodNames[i];
  45376. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  45377. }
  45378. };
  45379. var unwatchOne = function unwatchOne(obj, prop, watcher) {
  45380. if (prop) {
  45381. if (obj.watchers && obj.watchers[prop]) {
  45382. if (watcher === undefined) {
  45383. delete obj.watchers[prop]; // remove all property watchers
  45384. } else {
  45385. for (var i = 0; i < obj.watchers[prop].length; i++) {
  45386. var w = obj.watchers[prop][i];
  45387. if (w == watcher) {
  45388. obj.watchers[prop].splice(i, 1);
  45389. }
  45390. }
  45391. }
  45392. }
  45393. } else {
  45394. delete obj.watchers;
  45395. }
  45396. removeFromLengthSubjects(obj, prop, watcher);
  45397. removeFromDirtyChecklist(obj, prop);
  45398. };
  45399. // suspend watchers until next update cycle
  45400. var suspend = function suspend(obj, prop) {
  45401. if (obj.watchers) {
  45402. var name = '__wjs_suspend__' + (prop !== undefined ? prop : '');
  45403. obj.watchers[name] = true;
  45404. }
  45405. };
  45406. var isSuspended = function isSuspended(obj, prop) {
  45407. return obj.watchers && (obj.watchers['__wjs_suspend__'] || obj.watchers['__wjs_suspend__' + prop]);
  45408. };
  45409. // resumes preivously suspended watchers
  45410. var resume = function resume(obj, prop) {
  45411. registerTimeout(function () {
  45412. delete obj.watchers['__wjs_suspend__'];
  45413. delete obj.watchers['__wjs_suspend__' + prop];
  45414. });
  45415. };
  45416. var pendingTimerID = null;
  45417. var addPendingChange = function addPendingChange(obj, prop, mode, newval, oldval) {
  45418. pendingChanges[pendingChanges.length] = {
  45419. obj: obj,
  45420. prop: prop,
  45421. mode: mode,
  45422. newval: newval,
  45423. oldval: oldval
  45424. };
  45425. if (pendingTimerID === null) {
  45426. pendingTimerID = setTimeout(applyPendingChanges);
  45427. }
  45428. };
  45429. var applyPendingChanges = function applyPendingChanges() {
  45430. // apply pending changes
  45431. var change = null;
  45432. pendingTimerID = null;
  45433. for (var i = 0; i < pendingChanges.length; i++) {
  45434. change = pendingChanges[i];
  45435. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  45436. }
  45437. if (change) {
  45438. pendingChanges = [];
  45439. change = null;
  45440. }
  45441. };
  45442. var loop = function loop() {
  45443. // check for new or deleted props
  45444. for (var i = 0; i < lengthsubjects.length; i++) {
  45445. var subj = lengthsubjects[i];
  45446. if (subj.prop === "$$watchlengthsubjectroot") {
  45447. var difference = getObjDiff(subj.obj, subj.actual);
  45448. if (difference.added.length || difference.removed.length) {
  45449. if (difference.added.length) {
  45450. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  45451. }
  45452. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  45453. }
  45454. subj.actual = clone(subj.obj);
  45455. } else {
  45456. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  45457. if (difference.added.length || difference.removed.length) {
  45458. if (difference.added.length) {
  45459. for (var j = 0; j < subj.obj.watchers[subj.prop].length; j++) {
  45460. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  45461. }
  45462. }
  45463. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  45464. }
  45465. subj.actual = clone(subj.obj[subj.prop]);
  45466. }
  45467. }
  45468. // start dirty check
  45469. var n, value;
  45470. if (dirtyChecklist.length > 0) {
  45471. for (var i = 0; i < dirtyChecklist.length; i++) {
  45472. n = dirtyChecklist[i];
  45473. value = n.object[n.prop];
  45474. if (!compareValues(n.orig, value)) {
  45475. n.orig = clone(value);
  45476. n.callback(value);
  45477. }
  45478. }
  45479. }
  45480. };
  45481. var compareValues = function compareValues(a, b) {
  45482. var i,
  45483. state = true;
  45484. if (a !== b) {
  45485. if (isObject(a)) {
  45486. for (i in a) {
  45487. if (!supportDefineProperty && i === 'watchers') continue;
  45488. if (a[i] !== b[i]) {
  45489. state = false;
  45490. break;
  45491. };
  45492. }
  45493. } else {
  45494. state = false;
  45495. }
  45496. }
  45497. return state;
  45498. };
  45499. var pushToLengthSubjects = function pushToLengthSubjects(obj, prop, watcher, level) {
  45500. var actual;
  45501. if (prop === "$$watchlengthsubjectroot") {
  45502. actual = clone(obj);
  45503. } else {
  45504. actual = clone(obj[prop]);
  45505. }
  45506. lengthsubjects.push({
  45507. obj: obj,
  45508. prop: prop,
  45509. actual: actual,
  45510. watcher: watcher,
  45511. level: level
  45512. });
  45513. };
  45514. var removeFromLengthSubjects = function removeFromLengthSubjects(obj, prop, watcher) {
  45515. for (var i = 0; i < lengthsubjects.length; i++) {
  45516. var subj = lengthsubjects[i];
  45517. if (subj.obj == obj) {
  45518. if (!prop || subj.prop == prop) {
  45519. if (!watcher || subj.watcher == watcher) {
  45520. // if we splice off one item at position i
  45521. // we need to decrement i as the array is one item shorter
  45522. // so when we increment i in the loop statement we
  45523. // will land at the correct index.
  45524. // if it's not decremented, you won't delete all length subjects
  45525. lengthsubjects.splice(i--, 1);
  45526. }
  45527. }
  45528. }
  45529. }
  45530. };
  45531. var removeFromDirtyChecklist = function removeFromDirtyChecklist(obj, prop) {
  45532. var notInUse;
  45533. for (var i = 0; i < dirtyChecklist.length; i++) {
  45534. var n = dirtyChecklist[i];
  45535. var watchers = n.object.watchers;
  45536. notInUse = n.object == obj && (!prop || n.prop == prop) && watchers && (!prop || !watchers[prop] || watchers[prop].length == 0);
  45537. if (notInUse) {
  45538. // we use the same syntax as in removeFromLengthSubjects
  45539. dirtyChecklist.splice(i--, 1);
  45540. }
  45541. }
  45542. };
  45543. setInterval(loop, 50);
  45544. WatchJS.watch = watch;
  45545. WatchJS.unwatch = unwatch;
  45546. WatchJS.callWatchers = callWatchers;
  45547. WatchJS.suspend = suspend; // suspend watchers
  45548. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  45549. return WatchJS;
  45550. });
  45551. /***/ }),
  45552. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  45553. /*!******************************************************!*\
  45554. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  45555. \******************************************************/
  45556. /*! no static exports found */
  45557. /***/ (function(module, exports, __webpack_require__) {
  45558. "use strict";
  45559. /***/ }),
  45560. /***/ "./node_modules/webpack/buildin/module.js":
  45561. /*!***********************************!*\
  45562. !*** (webpack)/buildin/module.js ***!
  45563. \***********************************/
  45564. /*! no static exports found */
  45565. /***/ (function(module, exports, __webpack_require__) {
  45566. "use strict";
  45567. module.exports = function (module) {
  45568. if (!module.webpackPolyfill) {
  45569. module.deprecate = function () {};
  45570. module.paths = [];
  45571. // module.parent = undefined by default
  45572. if (!module.children) module.children = [];
  45573. Object.defineProperty(module, "loaded", {
  45574. enumerable: true,
  45575. get: function get() {
  45576. return module.l;
  45577. }
  45578. });
  45579. Object.defineProperty(module, "id", {
  45580. enumerable: true,
  45581. get: function get() {
  45582. return module.i;
  45583. }
  45584. });
  45585. module.webpackPolyfill = 1;
  45586. }
  45587. return module;
  45588. };
  45589. /***/ })
  45590. /******/ });
  45591. });
  45592. //# sourceMappingURL=ivprog.bundle.js.map