ivprog.bundle.js 2.3 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else if(typeof exports === 'object')
  7. exports["ivprogCore"] = factory();
  8. else
  9. root["ivprogCore"] = factory();
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./js/main.js");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./.ima_version.json":
  99. /*!***************************!*\
  100. !*** ./.ima_version.json ***!
  101. \***************************/
  102. /*! exports provided: version, default */
  103. /***/ (function(module) {
  104. module.exports = {"version":"2019_03_14 15_44"};
  105. /***/ }),
  106. /***/ "./grammar/en/ivprog.g4":
  107. /*!******************************!*\
  108. !*** ./grammar/en/ivprog.g4 ***!
  109. \******************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports, __webpack_require__) {
  112. module.exports =
  113. /******/ (function(modules) { // webpackBootstrap
  114. /******/ // The module cache
  115. /******/ var installedModules = {};
  116. /******/
  117. /******/ // The require function
  118. /******/ function __webpack_require__(moduleId) {
  119. /******/
  120. /******/ // Check if module is in cache
  121. /******/ if(installedModules[moduleId]) {
  122. /******/ return installedModules[moduleId].exports;
  123. /******/ }
  124. /******/ // Create a new module (and put it into the cache)
  125. /******/ var module = installedModules[moduleId] = {
  126. /******/ i: moduleId,
  127. /******/ l: false,
  128. /******/ exports: {}
  129. /******/ };
  130. /******/
  131. /******/ // Execute the module function
  132. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  133. /******/
  134. /******/ // Flag the module as loaded
  135. /******/ module.l = true;
  136. /******/
  137. /******/ // Return the exports of the module
  138. /******/ return module.exports;
  139. /******/ }
  140. /******/
  141. /******/
  142. /******/ // expose the modules object (__webpack_modules__)
  143. /******/ __webpack_require__.m = modules;
  144. /******/
  145. /******/ // expose the module cache
  146. /******/ __webpack_require__.c = installedModules;
  147. /******/
  148. /******/ // identity function for calling harmony imports with the correct context
  149. /******/ __webpack_require__.i = function(value) { return value; };
  150. /******/
  151. /******/ // define getter function for harmony exports
  152. /******/ __webpack_require__.d = function(exports, name, getter) {
  153. /******/ if(!__webpack_require__.o(exports, name)) {
  154. /******/ Object.defineProperty(exports, name, {
  155. /******/ configurable: false,
  156. /******/ enumerable: true,
  157. /******/ get: getter
  158. /******/ });
  159. /******/ }
  160. /******/ };
  161. /******/
  162. /******/ // getDefaultExport function for compatibility with non-harmony modules
  163. /******/ __webpack_require__.n = function(module) {
  164. /******/ var getter = module && module.__esModule ?
  165. /******/ function getDefault() { return module['default']; } :
  166. /******/ function getModuleExports() { return module; };
  167. /******/ __webpack_require__.d(getter, 'a', getter);
  168. /******/ return getter;
  169. /******/ };
  170. /******/
  171. /******/ // Object.prototype.hasOwnProperty.call
  172. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  173. /******/
  174. /******/ // __webpack_public_path__
  175. /******/ __webpack_require__.p = "";
  176. /******/
  177. /******/ // Load entry module and return exports
  178. /******/ return __webpack_require__(__webpack_require__.s = 1);
  179. /******/ })
  180. /************************************************************************/
  181. /******/ ([
  182. /* 0 */
  183. /***/ (function(module, exports, __webpack_require__) {
  184. // Generated from /tmp/tmp-1782yRQvnNM5ZHBF/ivprog.g4 by ANTLR 4.7
  185. // jshint ignore: start
  186. var antlr4 = __webpack_require__(2);
  187. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  188. "\u0002/\u01d1\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  189. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  190. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  191. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  192. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  193. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  194. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  195. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  196. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  197. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  198. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  199. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  200. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  201. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003",
  202. "\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003\u0004\u0003",
  203. "\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003",
  204. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003",
  205. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0007\u0003",
  206. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  207. "\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  208. "\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  209. "\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b\u0003\u000b\u0003",
  210. "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003",
  211. "\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003",
  212. "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  213. "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  214. "\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u000f\u0003\u0010\u0003",
  215. "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003",
  216. "\u0011\u0003\u0011\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  217. "\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0014\u0003",
  218. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0015\u0003\u0015\u0003",
  219. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003",
  220. "\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0017\u0003",
  221. "\u0017\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  222. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  223. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  224. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  225. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  226. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0125\n&\u0003\'\u0003\'\u0003",
  227. "(\u0003(\u0003)\u0003)\u0007)\u012d\n)\f)\u000e)\u0130\u000b)\u0003",
  228. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0137\n+\r+\u000e+\u0138\u0003",
  229. "+\u0003+\u0003+\u0003+\u0005+\u013f\n+\u0003+\u0006+\u0142\n+\r+\u000e",
  230. "+\u0143\u0003+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d",
  231. "\n+\r+\u000e+\u014e\u0005+\u0151\n+\u0003,\u0006,\u0154\n,\r,\u000e",
  232. ",\u0155\u0003,\u0003,\u0006,\u015a\n,\r,\u000e,\u015b\u0003,\u0006,",
  233. "\u015f\n,\r,\u000e,\u0160\u0003,\u0003,\u0007,\u0165\n,\f,\u000e,\u0168",
  234. "\u000b,\u0003,\u0005,\u016b\n,\u0003-\u0003-\u0005-\u016f\n-\u0003-",
  235. "\u0006-\u0172\n-\r-\u000e-\u0173\u0003.\u0003.\u0007.\u0178\n.\f.\u000e",
  236. ".\u017b\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u0181\n/\u00030\u0003",
  237. "0\u00030\u00050\u0186\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  238. "2\u00032\u00033\u00063\u0191\n3\r3\u000e3\u0192\u00033\u00053\u0196",
  239. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01a0",
  240. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  241. "7\u00037\u00057\u01ad\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  242. "8\u00039\u00039\u00039\u00039\u00079\u01ba\n9\f9\u000e9\u01bd\u000b",
  243. "9\u00039\u00059\u01c0\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01c7",
  244. "\n9\f9\u000e9\u01ca\u000b9\u00039\u00039\u00059\u01ce\n9\u00039\u0003",
  245. "9\u0003\u01c8\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  246. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  247. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  248. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  249. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  250. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  251. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  252. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  253. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  254. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  255. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01e5\u0002\u0003\u0003",
  256. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  257. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  258. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  259. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  260. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  261. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  262. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  263. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  264. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  265. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  266. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  267. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  268. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  269. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  270. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  271. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  272. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  273. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  274. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  275. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  276. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  277. "s\u0003\u0002\u0002\u0002\u0005{\u0003\u0002\u0002\u0002\u0007\u0080",
  278. "\u0003\u0002\u0002\u0002\t\u0085\u0003\u0002\u0002\u0002\u000b\u008d",
  279. "\u0003\u0002\u0002\u0002\r\u0094\u0003\u0002\u0002\u0002\u000f\u009c",
  280. "\u0003\u0002\u0002\u0002\u0011\u00a6\u0003\u0002\u0002\u0002\u0013\u00ad",
  281. "\u0003\u0002\u0002\u0002\u0015\u00b2\u0003\u0002\u0002\u0002\u0017\u00bc",
  282. "\u0003\u0002\u0002\u0002\u0019\u00c2\u0003\u0002\u0002\u0002\u001b\u00cb",
  283. "\u0003\u0002\u0002\u0002\u001d\u00d2\u0003\u0002\u0002\u0002\u001f\u00d6",
  284. "\u0003\u0002\u0002\u0002!\u00dc\u0003\u0002\u0002\u0002#\u00df\u0003",
  285. "\u0002\u0002\u0002%\u00e5\u0003\u0002\u0002\u0002\'\u00e8\u0003\u0002",
  286. "\u0002\u0002)\u00ed\u0003\u0002\u0002\u0002+\u00f3\u0003\u0002\u0002",
  287. "\u0002-\u00f8\u0003\u0002\u0002\u0002/\u00fc\u0003\u0002\u0002\u0002",
  288. "1\u0100\u0003\u0002\u0002\u00023\u0103\u0003\u0002\u0002\u00025\u0105",
  289. "\u0003\u0002\u0002\u00027\u0107\u0003\u0002\u0002\u00029\u0109\u0003",
  290. "\u0002\u0002\u0002;\u010b\u0003\u0002\u0002\u0002=\u010d\u0003\u0002",
  291. "\u0002\u0002?\u010f\u0003\u0002\u0002\u0002A\u0111\u0003\u0002\u0002",
  292. "\u0002C\u0113\u0003\u0002\u0002\u0002E\u0115\u0003\u0002\u0002\u0002",
  293. "G\u0117\u0003\u0002\u0002\u0002I\u0119\u0003\u0002\u0002\u0002K\u0124",
  294. "\u0003\u0002\u0002\u0002M\u0126\u0003\u0002\u0002\u0002O\u0128\u0003",
  295. "\u0002\u0002\u0002Q\u012a\u0003\u0002\u0002\u0002S\u0131\u0003\u0002",
  296. "\u0002\u0002U\u0150\u0003\u0002\u0002\u0002W\u016a\u0003\u0002\u0002",
  297. "\u0002Y\u016c\u0003\u0002\u0002\u0002[\u0175\u0003\u0002\u0002\u0002",
  298. "]\u0180\u0003\u0002\u0002\u0002_\u0182\u0003\u0002\u0002\u0002a\u0189",
  299. "\u0003\u0002\u0002\u0002c\u018d\u0003\u0002\u0002\u0002e\u0195\u0003",
  300. "\u0002\u0002\u0002g\u0197\u0003\u0002\u0002\u0002i\u0199\u0003\u0002",
  301. "\u0002\u0002k\u019f\u0003\u0002\u0002\u0002m\u01ac\u0003\u0002\u0002",
  302. "\u0002o\u01ae\u0003\u0002\u0002\u0002q\u01cd\u0003\u0002\u0002\u0002",
  303. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  304. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  305. "\u0002z\u0004\u0003\u0002\u0002\u0002{|\u0007t\u0002\u0002|}\u0007g",
  306. "\u0002\u0002}~\u0007c\u0002\u0002~\u007f\u0007n\u0002\u0002\u007f\u0006",
  307. "\u0003\u0002\u0002\u0002\u0080\u0081\u0007x\u0002\u0002\u0081\u0082",
  308. "\u0007q\u0002\u0002\u0082\u0083\u0007k\u0002\u0002\u0083\u0084\u0007",
  309. "f\u0002\u0002\u0084\b\u0003\u0002\u0002\u0002\u0085\u0086\u0007d\u0002",
  310. "\u0002\u0086\u0087\u0007q\u0002\u0002\u0087\u0088\u0007q\u0002\u0002",
  311. "\u0088\u0089\u0007n\u0002\u0002\u0089\u008a\u0007g\u0002\u0002\u008a",
  312. "\u008b\u0007c\u0002\u0002\u008b\u008c\u0007p\u0002\u0002\u008c\n\u0003",
  313. "\u0002\u0002\u0002\u008d\u008e\u0007u\u0002\u0002\u008e\u008f\u0007",
  314. "v\u0002\u0002\u008f\u0090\u0007t\u0002\u0002\u0090\u0091\u0007k\u0002",
  315. "\u0002\u0091\u0092\u0007p\u0002\u0002\u0092\u0093\u0007i\u0002\u0002",
  316. "\u0093\f\u0003\u0002\u0002\u0002\u0094\u0095\u0007k\u0002\u0002\u0095",
  317. "\u0096\u0007p\u0002\u0002\u0096\u0097\u0007v\u0002\u0002\u0097\u0098",
  318. "\u0007g\u0002\u0002\u0098\u0099\u0007i\u0002\u0002\u0099\u009a\u0007",
  319. "g\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u000e\u0003\u0002",
  320. "\u0002\u0002\u009c\u009d\u0007e\u0002\u0002\u009d\u009e\u0007j\u0002",
  321. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  322. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  323. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  324. "\u0007t\u0002\u0002\u00a5\u0010\u0003\u0002\u0002\u0002\u00a6\u00a7",
  325. "\u0007u\u0002\u0002\u00a7\u00a8\u0007y\u0002\u0002\u00a8\u00a9\u0007",
  326. "k\u0002\u0002\u00a9\u00aa\u0007v\u0002\u0002\u00aa\u00ab\u0007e\u0002",
  327. "\u0002\u00ab\u00ac\u0007j\u0002\u0002\u00ac\u0012\u0003\u0002\u0002",
  328. "\u0002\u00ad\u00ae\u0007e\u0002\u0002\u00ae\u00af\u0007c\u0002\u0002",
  329. "\u00af\u00b0\u0007u\u0002\u0002\u00b0\u00b1\u0007g\u0002\u0002\u00b1",
  330. "\u0014\u0003\u0002\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3",
  331. "\u00b4\u0007v\u0002\u0002\u00b4\u00b5\u0007j\u0002\u0002\u00b5\u00b6",
  332. "\u0007g\u0002\u0002\u00b6\u00b7\u0007t\u0002\u0002\u00b7\u00b8\u0007",
  333. "y\u0002\u0002\u00b8\u00b9\u0007k\u0002\u0002\u00b9\u00ba\u0007u\u0002",
  334. "\u0002\u00ba\u00bb\u0007g\u0002\u0002\u00bb\u0016\u0003\u0002\u0002",
  335. "\u0002\u00bc\u00bd\u0007e\u0002\u0002\u00bd\u00be\u0007q\u0002\u0002",
  336. "\u00be\u00bf\u0007p\u0002\u0002\u00bf\u00c0\u0007u\u0002\u0002\u00c0",
  337. "\u00c1\u0007v\u0002\u0002\u00c1\u0018\u0003\u0002\u0002\u0002\u00c2",
  338. "\u00c3\u0007h\u0002\u0002\u00c3\u00c4\u0007w\u0002\u0002\u00c4\u00c5",
  339. "\u0007p\u0002\u0002\u00c5\u00c6\u0007e\u0002\u0002\u00c6\u00c7\u0007",
  340. "v\u0002\u0002\u00c7\u00c8\u0007k\u0002\u0002\u00c8\u00c9\u0007q\u0002",
  341. "\u0002\u00c9\u00ca\u0007p\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  342. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  343. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007w\u0002\u0002\u00cf",
  344. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u001c",
  345. "\u0003\u0002\u0002\u0002\u00d2\u00d3\u0007h\u0002\u0002\u00d3\u00d4",
  346. "\u0007q\u0002\u0002\u00d4\u00d5\u0007t\u0002\u0002\u00d5\u001e\u0003",
  347. "\u0002\u0002\u0002\u00d6\u00d7\u0007d\u0002\u0002\u00d7\u00d8\u0007",
  348. "t\u0002\u0002\u00d8\u00d9\u0007g\u0002\u0002\u00d9\u00da\u0007c\u0002",
  349. "\u0002\u00da\u00db\u0007m\u0002\u0002\u00db \u0003\u0002\u0002\u0002",
  350. "\u00dc\u00dd\u0007f\u0002\u0002\u00dd\u00de\u0007q\u0002\u0002\u00de",
  351. "\"\u0003\u0002\u0002\u0002\u00df\u00e0\u0007y\u0002\u0002\u00e0\u00e1",
  352. "\u0007j\u0002\u0002\u00e1\u00e2\u0007k\u0002\u0002\u00e2\u00e3\u0007",
  353. "n\u0002\u0002\u00e3\u00e4\u0007g\u0002\u0002\u00e4$\u0003\u0002\u0002",
  354. "\u0002\u00e5\u00e6\u0007k\u0002\u0002\u00e6\u00e7\u0007h\u0002\u0002",
  355. "\u00e7&\u0003\u0002\u0002\u0002\u00e8\u00e9\u0007g\u0002\u0002\u00e9",
  356. "\u00ea\u0007n\u0002\u0002\u00ea\u00eb\u0007u\u0002\u0002\u00eb\u00ec",
  357. "\u0007g\u0002\u0002\u00ec(\u0003\u0002\u0002\u0002\u00ed\u00ee\u0007",
  358. "h\u0002\u0002\u00ee\u00ef\u0007c\u0002\u0002\u00ef\u00f0\u0007n\u0002",
  359. "\u0002\u00f0\u00f1\u0007u\u0002\u0002\u00f1\u00f2\u0007g\u0002\u0002",
  360. "\u00f2*\u0003\u0002\u0002\u0002\u00f3\u00f4\u0007v\u0002\u0002\u00f4",
  361. "\u00f5\u0007t\u0002\u0002\u00f5\u00f6\u0007w\u0002\u0002\u00f6\u00f7",
  362. "\u0007g\u0002\u0002\u00f7,\u0003\u0002\u0002\u0002\u00f8\u00f9\u0007",
  363. "p\u0002\u0002\u00f9\u00fa\u0007q\u0002\u0002\u00fa\u00fb\u0007v\u0002",
  364. "\u0002\u00fb.\u0003\u0002\u0002\u0002\u00fc\u00fd\u0007C\u0002\u0002",
  365. "\u00fd\u00fe\u0007P\u0002\u0002\u00fe\u00ff\u0007F\u0002\u0002\u00ff",
  366. "0\u0003\u0002\u0002\u0002\u0100\u0101\u0007Q\u0002\u0002\u0101\u0102",
  367. "\u0007T\u0002\u0002\u01022\u0003\u0002\u0002\u0002\u0103\u0104\u0007",
  368. "*\u0002\u0002\u01044\u0003\u0002\u0002\u0002\u0105\u0106\u0007+\u0002",
  369. "\u0002\u01066\u0003\u0002\u0002\u0002\u0107\u0108\u0007]\u0002\u0002",
  370. "\u01088\u0003\u0002\u0002\u0002\u0109\u010a\u0007_\u0002\u0002\u010a",
  371. ":\u0003\u0002\u0002\u0002\u010b\u010c\u0007}\u0002\u0002\u010c<\u0003",
  372. "\u0002\u0002\u0002\u010d\u010e\u0007\u007f\u0002\u0002\u010e>\u0003",
  373. "\u0002\u0002\u0002\u010f\u0110\u0007.\u0002\u0002\u0110@\u0003\u0002",
  374. "\u0002\u0002\u0111\u0112\u0007?\u0002\u0002\u0112B\u0003\u0002\u0002",
  375. "\u0002\u0113\u0114\t\u0002\u0002\u0002\u0114D\u0003\u0002\u0002\u0002",
  376. "\u0115\u0116\t\u0003\u0002\u0002\u0116F\u0003\u0002\u0002\u0002\u0117",
  377. "\u0118\u0005/\u0018\u0002\u0118H\u0003\u0002\u0002\u0002\u0119\u011a",
  378. "\u00051\u0019\u0002\u011aJ\u0003\u0002\u0002\u0002\u011b\u011c\u0007",
  379. "@\u0002\u0002\u011c\u0125\u0007?\u0002\u0002\u011d\u011e\u0007?\u0002",
  380. "\u0002\u011e\u0125\u0007?\u0002\u0002\u011f\u0120\u0007>\u0002\u0002",
  381. "\u0120\u0125\u0007?\u0002\u0002\u0121\u0125\t\u0004\u0002\u0002\u0122",
  382. "\u0123\u0007#\u0002\u0002\u0123\u0125\u0007?\u0002\u0002\u0124\u011b",
  383. "\u0003\u0002\u0002\u0002\u0124\u011d\u0003\u0002\u0002\u0002\u0124\u011f",
  384. "\u0003\u0002\u0002\u0002\u0124\u0121\u0003\u0002\u0002\u0002\u0124\u0122",
  385. "\u0003\u0002\u0002\u0002\u0125L\u0003\u0002\u0002\u0002\u0126\u0127",
  386. "\u0007<\u0002\u0002\u0127N\u0003\u0002\u0002\u0002\u0128\u0129\u0005",
  387. "-\u0017\u0002\u0129P\u0003\u0002\u0002\u0002\u012a\u012e\t\u0005\u0002",
  388. "\u0002\u012b\u012d\t\u0006\u0002\u0002\u012c\u012b\u0003\u0002\u0002",
  389. "\u0002\u012d\u0130\u0003\u0002\u0002\u0002\u012e\u012c\u0003\u0002\u0002",
  390. "\u0002\u012e\u012f\u0003\u0002\u0002\u0002\u012fR\u0003\u0002\u0002",
  391. "\u0002\u0130\u012e\u0003\u0002\u0002\u0002\u0131\u0132\u0005Q)\u0002",
  392. "\u0132\u0133\u00070\u0002\u0002\u0133\u0134\u0005Q)\u0002\u0134T\u0003",
  393. "\u0002\u0002\u0002\u0135\u0137\t\u0007\u0002\u0002\u0136\u0135\u0003",
  394. "\u0002\u0002\u0002\u0137\u0138\u0003\u0002\u0002\u0002\u0138\u0136\u0003",
  395. "\u0002\u0002\u0002\u0138\u0139\u0003\u0002\u0002\u0002\u0139\u0151\u0003",
  396. "\u0002\u0002\u0002\u013a\u013b\u00072\u0002\u0002\u013b\u013f\u0007",
  397. "z\u0002\u0002\u013c\u013d\u00072\u0002\u0002\u013d\u013f\u0007Z\u0002",
  398. "\u0002\u013e\u013a\u0003\u0002\u0002\u0002\u013e\u013c\u0003\u0002\u0002",
  399. "\u0002\u013f\u0141\u0003\u0002\u0002\u0002\u0140\u0142\u0005g4\u0002",
  400. "\u0141\u0140\u0003\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002",
  401. "\u0143\u0141\u0003\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002",
  402. "\u0144\u0151\u0003\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002",
  403. "\u0146\u014a\u0007d\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148",
  404. "\u014a\u0007D\u0002\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149",
  405. "\u0147\u0003\u0002\u0002\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b",
  406. "\u014d\t\b\u0002\u0002\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e",
  407. "\u0003\u0002\u0002\u0002\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f",
  408. "\u0003\u0002\u0002\u0002\u014f\u0151\u0003\u0002\u0002\u0002\u0150\u0136",
  409. "\u0003\u0002\u0002\u0002\u0150\u013e\u0003\u0002\u0002\u0002\u0150\u0149",
  410. "\u0003\u0002\u0002\u0002\u0151V\u0003\u0002\u0002\u0002\u0152\u0154",
  411. "\t\u0007\u0002\u0002\u0153\u0152\u0003\u0002\u0002\u0002\u0154\u0155",
  412. "\u0003\u0002\u0002\u0002\u0155\u0153\u0003\u0002\u0002\u0002\u0155\u0156",
  413. "\u0003\u0002\u0002\u0002\u0156\u0157\u0003\u0002\u0002\u0002\u0157\u0159",
  414. "\u00070\u0002\u0002\u0158\u015a\t\u0007\u0002\u0002\u0159\u0158\u0003",
  415. "\u0002\u0002\u0002\u015a\u015b\u0003\u0002\u0002\u0002\u015b\u0159\u0003",
  416. "\u0002\u0002\u0002\u015b\u015c\u0003\u0002\u0002\u0002\u015c\u016b\u0003",
  417. "\u0002\u0002\u0002\u015d\u015f\t\u0007\u0002\u0002\u015e\u015d\u0003",
  418. "\u0002\u0002\u0002\u015f\u0160\u0003\u0002\u0002\u0002\u0160\u015e\u0003",
  419. "\u0002\u0002\u0002\u0160\u0161\u0003\u0002\u0002\u0002\u0161\u0162\u0003",
  420. "\u0002\u0002\u0002\u0162\u0166\u00070\u0002\u0002\u0163\u0165\t\u0007",
  421. "\u0002\u0002\u0164\u0163\u0003\u0002\u0002\u0002\u0165\u0168\u0003\u0002",
  422. "\u0002\u0002\u0166\u0164\u0003\u0002\u0002\u0002\u0166\u0167\u0003\u0002",
  423. "\u0002\u0002\u0167\u0169\u0003\u0002\u0002\u0002\u0168\u0166\u0003\u0002",
  424. "\u0002\u0002\u0169\u016b\u0005Y-\u0002\u016a\u0153\u0003\u0002\u0002",
  425. "\u0002\u016a\u015e\u0003\u0002\u0002\u0002\u016bX\u0003\u0002\u0002",
  426. "\u0002\u016c\u016e\t\t\u0002\u0002\u016d\u016f\t\u0002\u0002\u0002\u016e",
  427. "\u016d\u0003\u0002\u0002\u0002\u016e\u016f\u0003\u0002\u0002\u0002\u016f",
  428. "\u0171\u0003\u0002\u0002\u0002\u0170\u0172\t\u0007\u0002\u0002\u0171",
  429. "\u0170\u0003\u0002\u0002\u0002\u0172\u0173\u0003\u0002\u0002\u0002\u0173",
  430. "\u0171\u0003\u0002\u0002\u0002\u0173\u0174\u0003\u0002\u0002\u0002\u0174",
  431. "Z\u0003\u0002\u0002\u0002\u0175\u0179\u0007$\u0002\u0002\u0176\u0178",
  432. "\u0005]/\u0002\u0177\u0176\u0003\u0002\u0002\u0002\u0178\u017b\u0003",
  433. "\u0002\u0002\u0002\u0179\u0177\u0003\u0002\u0002\u0002\u0179\u017a\u0003",
  434. "\u0002\u0002\u0002\u017a\u017c\u0003\u0002\u0002\u0002\u017b\u0179\u0003",
  435. "\u0002\u0002\u0002\u017c\u017d\u0007$\u0002\u0002\u017d\\\u0003\u0002",
  436. "\u0002\u0002\u017e\u0181\n\n\u0002\u0002\u017f\u0181\u0005k6\u0002\u0180",
  437. "\u017e\u0003\u0002\u0002\u0002\u0180\u017f\u0003\u0002\u0002\u0002\u0181",
  438. "^\u0003\u0002\u0002\u0002\u0182\u0185\u0007)\u0002\u0002\u0183\u0186",
  439. "\u0005k6\u0002\u0184\u0186\n\u000b\u0002\u0002\u0185\u0183\u0003\u0002",
  440. "\u0002\u0002\u0185\u0184\u0003\u0002\u0002\u0002\u0186\u0187\u0003\u0002",
  441. "\u0002\u0002\u0187\u0188\u0007)\u0002\u0002\u0188`\u0003\u0002\u0002",
  442. "\u0002\u0189\u018a\t\f\u0002\u0002\u018a\u018b\u0003\u0002\u0002\u0002",
  443. "\u018b\u018c\b1\u0002\u0002\u018cb\u0003\u0002\u0002\u0002\u018d\u018e",
  444. "\u0007=\u0002\u0002\u018ed\u0003\u0002\u0002\u0002\u018f\u0191\t\r\u0002",
  445. "\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002\u0002",
  446. "\u0002\u0192\u0190\u0003\u0002\u0002\u0002\u0192\u0193\u0003\u0002\u0002",
  447. "\u0002\u0193\u0196\u0003\u0002\u0002\u0002\u0194\u0196\u0005c2\u0002",
  448. "\u0195\u0190\u0003\u0002\u0002\u0002\u0195\u0194\u0003\u0002\u0002\u0002",
  449. "\u0196f\u0003\u0002\u0002\u0002\u0197\u0198\t\u000e\u0002\u0002\u0198",
  450. "h\u0003\u0002\u0002\u0002\u0199\u019a\t\u000f\u0002\u0002\u019aj\u0003",
  451. "\u0002\u0002\u0002\u019b\u019c\u0007^\u0002\u0002\u019c\u01a0\t\u0010",
  452. "\u0002\u0002\u019d\u01a0\u0005o8\u0002\u019e\u01a0\u0005m7\u0002\u019f",
  453. "\u019b\u0003\u0002\u0002\u0002\u019f\u019d\u0003\u0002\u0002\u0002\u019f",
  454. "\u019e\u0003\u0002\u0002\u0002\u01a0l\u0003\u0002\u0002\u0002\u01a1",
  455. "\u01a2\u0007^\u0002\u0002\u01a2\u01a3\t\u0011\u0002\u0002\u01a3\u01a4",
  456. "\u0005i5\u0002\u01a4\u01a5\u0005i5\u0002\u01a5\u01ad\u0003\u0002\u0002",
  457. "\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01a8\u0005i5\u0002\u01a8",
  458. "\u01a9\u0005i5\u0002\u01a9\u01ad\u0003\u0002\u0002\u0002\u01aa\u01ab",
  459. "\u0007^\u0002\u0002\u01ab\u01ad\u0005i5\u0002\u01ac\u01a1\u0003\u0002",
  460. "\u0002\u0002\u01ac\u01a6\u0003\u0002\u0002\u0002\u01ac\u01aa\u0003\u0002",
  461. "\u0002\u0002\u01adn\u0003\u0002\u0002\u0002\u01ae\u01af\u0007^\u0002",
  462. "\u0002\u01af\u01b0\u0007w\u0002\u0002\u01b0\u01b1\u0005g4\u0002\u01b1",
  463. "\u01b2\u0005g4\u0002\u01b2\u01b3\u0005g4\u0002\u01b3\u01b4\u0005g4\u0002",
  464. "\u01b4p\u0003\u0002\u0002\u0002\u01b5\u01b6\u00071\u0002\u0002\u01b6",
  465. "\u01b7\u00071\u0002\u0002\u01b7\u01bb\u0003\u0002\u0002\u0002\u01b8",
  466. "\u01ba\n\r\u0002\u0002\u01b9\u01b8\u0003\u0002\u0002\u0002\u01ba\u01bd",
  467. "\u0003\u0002\u0002\u0002\u01bb\u01b9\u0003\u0002\u0002\u0002\u01bb\u01bc",
  468. "\u0003\u0002\u0002\u0002\u01bc\u01bf\u0003\u0002\u0002\u0002\u01bd\u01bb",
  469. "\u0003\u0002\u0002\u0002\u01be\u01c0\u0007\u000f\u0002\u0002\u01bf\u01be",
  470. "\u0003\u0002\u0002\u0002\u01bf\u01c0\u0003\u0002\u0002\u0002\u01c0\u01c1",
  471. "\u0003\u0002\u0002\u0002\u01c1\u01ce\u0007\f\u0002\u0002\u01c2\u01c3",
  472. "\u00071\u0002\u0002\u01c3\u01c4\u0007,\u0002\u0002\u01c4\u01c8\u0003",
  473. "\u0002\u0002\u0002\u01c5\u01c7\u000b\u0002\u0002\u0002\u01c6\u01c5\u0003",
  474. "\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c9\u0003",
  475. "\u0002\u0002\u0002\u01c8\u01c6\u0003\u0002\u0002\u0002\u01c9\u01cb\u0003",
  476. "\u0002\u0002\u0002\u01ca\u01c8\u0003\u0002\u0002\u0002\u01cb\u01cc\u0007",
  477. ",\u0002\u0002\u01cc\u01ce\u00071\u0002\u0002\u01cd\u01b5\u0003\u0002",
  478. "\u0002\u0002\u01cd\u01c2\u0003\u0002\u0002\u0002\u01ce\u01cf\u0003\u0002",
  479. "\u0002\u0002\u01cf\u01d0\b9\u0003\u0002\u01d0r\u0003\u0002\u0002\u0002",
  480. "\u001d\u0002\u0124\u012e\u0138\u013e\u0143\u0149\u014e\u0150\u0155\u015b",
  481. "\u0160\u0166\u016a\u016e\u0173\u0179\u0180\u0185\u0192\u0195\u019f\u01ac",
  482. "\u01bb\u01bf\u01c8\u01cd\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  483. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  484. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  485. function ivprog(input) {
  486. antlr4.Lexer.call(this, input);
  487. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  488. return this;
  489. }
  490. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  491. ivprog.prototype.constructor = ivprog;
  492. ivprog.EOF = antlr4.Token.EOF;
  493. ivprog.RK_PROGRAM = 1;
  494. ivprog.RK_REAL = 2;
  495. ivprog.RK_VOID = 3;
  496. ivprog.RK_BOOLEAN = 4;
  497. ivprog.RK_STRING = 5;
  498. ivprog.RK_INTEGER = 6;
  499. ivprog.RK_CHARACTER = 7;
  500. ivprog.RK_SWITCH = 8;
  501. ivprog.RK_CASE = 9;
  502. ivprog.RK_DEFAULT = 10;
  503. ivprog.RK_CONST = 11;
  504. ivprog.RK_FUNCTION = 12;
  505. ivprog.RK_RETURN = 13;
  506. ivprog.RK_FOR = 14;
  507. ivprog.RK_BREAK = 15;
  508. ivprog.RK_DO = 16;
  509. ivprog.RK_WHILE = 17;
  510. ivprog.RK_IF = 18;
  511. ivprog.RK_ELSE = 19;
  512. ivprog.RK_FALSE = 20;
  513. ivprog.RK_TRUE = 21;
  514. ivprog.OPEN_PARENTHESIS = 22;
  515. ivprog.CLOSE_PARENTHESIS = 23;
  516. ivprog.OPEN_BRACE = 24;
  517. ivprog.CLOSE_BRACE = 25;
  518. ivprog.OPEN_CURLY = 26;
  519. ivprog.CLOSE_CURLY = 27;
  520. ivprog.COMMA = 28;
  521. ivprog.EQUAL = 29;
  522. ivprog.SUM_OP = 30;
  523. ivprog.MULTI_OP = 31;
  524. ivprog.AND_OPERATOR = 32;
  525. ivprog.OR_OPERATOR = 33;
  526. ivprog.RELATIONAL_OPERATOR = 34;
  527. ivprog.COLON = 35;
  528. ivprog.NOT_OPERATOR = 36;
  529. ivprog.ID = 37;
  530. ivprog.LIB_ID = 38;
  531. ivprog.INTEGER = 39;
  532. ivprog.REAL = 40;
  533. ivprog.STRING = 41;
  534. ivprog.CHARACTER = 42;
  535. ivprog.WHITESPACE = 43;
  536. ivprog.EOS = 44;
  537. ivprog.COMMENTS = 45;
  538. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  539. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  540. ivprog.prototype.literalNames = [ null, "'program'", "'real'", "'void'",
  541. "'boolean'", "'string'", "'integer'",
  542. "'character'", "'switch'", "'case'", "'otherwise'",
  543. "'const'", "'function'", "'return'", "'for'",
  544. "'break'", "'do'", "'while'", "'if'",
  545. "'else'", "'false'", "'true'", "'('",
  546. "')'", "'['", "']'", "'{'", "'}'", "','",
  547. "'='", null, null, null, null, null, "':'" ];
  548. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  549. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  550. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  551. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  552. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  553. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  554. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  555. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  556. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  557. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  558. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  559. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  560. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  561. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  562. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  563. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  564. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  565. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  566. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  567. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  568. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  569. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  570. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  571. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  572. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  573. "STRING", "STRING_CHARACTER", "CHARACTER",
  574. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  575. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  576. "COMMENTS" ];
  577. ivprog.prototype.grammarFileName = "ivprog.g4";
  578. exports.ivprog = ivprog;
  579. /***/ }),
  580. /* 1 */
  581. /***/ (function(module, exports, __webpack_require__) {
  582. module.exports = {
  583. ivprog: __webpack_require__(0).ivprog
  584. };
  585. /***/ }),
  586. /* 2 */
  587. /***/ (function(module, exports) {
  588. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  589. /***/ })
  590. /******/ ]);
  591. /***/ }),
  592. /***/ "./grammar/en/langFunctions.js":
  593. /*!*************************************!*\
  594. !*** ./grammar/en/langFunctions.js ***!
  595. \*************************************/
  596. /*! exports provided: default */
  597. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  598. "use strict";
  599. __webpack_require__.r(__webpack_exports__);
  600. /* This is a dictionary of the language defined functions
  601. **/
  602. /* harmony default export */ __webpack_exports__["default"] = ({
  603. main_function: "start",
  604. $read: "read",
  605. $write: "write",
  606. $numElements: "total_of_elements",
  607. $matrixLines: "total_of_lines",
  608. $matrixColumns: "total_of_columns",
  609. $substring: "subcadeia",
  610. $length: "comprimento",
  611. $uppercase: "caixa_alta",
  612. $lowercase: "caixa_baixa",
  613. $charAt: "char_at",
  614. $isReal: "is_real",
  615. $isInt: "is_integer",
  616. $isBool: "is_logic",
  617. $castReal: "to_real",
  618. $castInt: "to_integer",
  619. $castBool: "to_logic",
  620. $castString: "to_string",
  621. $sin: "sin",
  622. $cos: "cos",
  623. $tan: "tan",
  624. $sqrt: "sqrt",
  625. $pow: "pow",
  626. $log: "log",
  627. $abs: "abs",
  628. $negate: "negate",
  629. $invert: "invert",
  630. $max: "maximum",
  631. $min: "minimum"
  632. });
  633. /***/ }),
  634. /***/ "./grammar/en/langLibs.js":
  635. /*!********************************!*\
  636. !*** ./grammar/en/langLibs.js ***!
  637. \********************************/
  638. /*! exports provided: default */
  639. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  640. "use strict";
  641. __webpack_require__.r(__webpack_exports__);
  642. /**
  643. * This is the dictionary of the language defined libraries
  644. */
  645. /* harmony default export */ __webpack_exports__["default"] = ({
  646. $mathLib: "Mathematic",
  647. $ioLib: "ES",
  648. $strLib: "Texto",
  649. $arrayLib: "Arranjo",
  650. $langLib: "Conversion"
  651. });
  652. /***/ }),
  653. /***/ "./grammar/es/ivprog.g4":
  654. /*!******************************!*\
  655. !*** ./grammar/es/ivprog.g4 ***!
  656. \******************************/
  657. /*! no static exports found */
  658. /***/ (function(module, exports, __webpack_require__) {
  659. module.exports =
  660. /******/ (function(modules) { // webpackBootstrap
  661. /******/ // The module cache
  662. /******/ var installedModules = {};
  663. /******/
  664. /******/ // The require function
  665. /******/ function __webpack_require__(moduleId) {
  666. /******/
  667. /******/ // Check if module is in cache
  668. /******/ if(installedModules[moduleId]) {
  669. /******/ return installedModules[moduleId].exports;
  670. /******/ }
  671. /******/ // Create a new module (and put it into the cache)
  672. /******/ var module = installedModules[moduleId] = {
  673. /******/ i: moduleId,
  674. /******/ l: false,
  675. /******/ exports: {}
  676. /******/ };
  677. /******/
  678. /******/ // Execute the module function
  679. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  680. /******/
  681. /******/ // Flag the module as loaded
  682. /******/ module.l = true;
  683. /******/
  684. /******/ // Return the exports of the module
  685. /******/ return module.exports;
  686. /******/ }
  687. /******/
  688. /******/
  689. /******/ // expose the modules object (__webpack_modules__)
  690. /******/ __webpack_require__.m = modules;
  691. /******/
  692. /******/ // expose the module cache
  693. /******/ __webpack_require__.c = installedModules;
  694. /******/
  695. /******/ // identity function for calling harmony imports with the correct context
  696. /******/ __webpack_require__.i = function(value) { return value; };
  697. /******/
  698. /******/ // define getter function for harmony exports
  699. /******/ __webpack_require__.d = function(exports, name, getter) {
  700. /******/ if(!__webpack_require__.o(exports, name)) {
  701. /******/ Object.defineProperty(exports, name, {
  702. /******/ configurable: false,
  703. /******/ enumerable: true,
  704. /******/ get: getter
  705. /******/ });
  706. /******/ }
  707. /******/ };
  708. /******/
  709. /******/ // getDefaultExport function for compatibility with non-harmony modules
  710. /******/ __webpack_require__.n = function(module) {
  711. /******/ var getter = module && module.__esModule ?
  712. /******/ function getDefault() { return module['default']; } :
  713. /******/ function getModuleExports() { return module; };
  714. /******/ __webpack_require__.d(getter, 'a', getter);
  715. /******/ return getter;
  716. /******/ };
  717. /******/
  718. /******/ // Object.prototype.hasOwnProperty.call
  719. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  720. /******/
  721. /******/ // __webpack_public_path__
  722. /******/ __webpack_require__.p = "";
  723. /******/
  724. /******/ // Load entry module and return exports
  725. /******/ return __webpack_require__(__webpack_require__.s = 1);
  726. /******/ })
  727. /************************************************************************/
  728. /******/ ([
  729. /* 0 */
  730. /***/ (function(module, exports, __webpack_require__) {
  731. // Generated from /tmp/tmp-17823CKm15QJnmLm/ivprog.g4 by ANTLR 4.7
  732. // jshint ignore: start
  733. var antlr4 = __webpack_require__(2);
  734. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  735. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  736. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  737. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  738. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  739. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  740. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  741. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  742. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  743. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  744. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  745. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  746. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  747. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  748. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  749. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  750. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  751. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  752. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  753. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  754. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  755. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  756. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  757. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  758. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  759. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  760. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  761. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  762. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  763. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  764. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  765. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  766. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  767. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  768. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  769. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  770. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  771. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  772. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  773. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  774. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  775. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  776. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  777. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  778. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  779. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  780. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  781. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  782. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  783. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  784. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  785. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  786. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  787. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  788. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  789. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  790. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  791. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  792. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  793. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  794. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  795. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  796. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  797. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  798. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  799. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  800. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  801. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  802. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  803. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  804. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  805. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  806. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  807. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  808. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  809. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  810. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  811. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  812. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  813. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  814. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  815. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  816. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  817. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  818. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  819. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  820. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  821. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  822. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  823. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  824. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  825. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  826. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  827. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  828. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  829. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  830. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  831. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  832. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  833. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  834. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  835. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  836. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  837. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  838. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  839. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  840. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  841. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  842. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  843. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  844. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  845. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  846. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  847. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  848. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  849. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  850. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  851. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  852. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  853. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  854. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  855. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  856. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  857. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  858. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  859. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  860. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  861. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  862. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  863. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  864. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  865. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  866. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  867. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  868. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  869. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  870. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  871. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  872. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  873. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  874. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  875. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  876. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  877. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  878. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  879. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  880. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  881. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  882. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  883. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  884. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  885. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  886. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  887. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  888. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  889. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  890. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  891. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  892. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  893. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  894. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  895. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  896. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  897. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  898. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  899. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  900. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  901. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  902. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  903. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  904. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  905. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  906. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  907. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  908. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  909. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  910. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  911. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  912. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  913. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  914. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  915. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  916. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  917. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  918. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  919. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  920. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  921. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  922. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  923. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  924. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  925. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  926. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  927. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  928. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  929. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  930. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  931. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  932. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  933. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  934. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  935. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  936. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  937. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  938. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  939. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  940. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  941. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  942. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  943. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  944. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  945. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  946. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  947. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  948. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  949. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  950. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  951. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  952. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  953. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  954. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  955. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  956. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  957. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  958. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  959. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  960. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  961. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  962. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  963. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  964. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  965. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  966. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  967. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  968. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  969. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  970. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  971. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  972. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  973. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  974. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  975. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  976. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  977. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  978. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  979. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  980. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  981. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  982. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  983. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  984. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  985. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  986. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  987. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  988. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  989. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  990. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  991. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  992. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  993. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  994. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  995. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  996. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  997. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  998. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  999. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1000. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1001. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1002. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1003. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1004. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1005. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1006. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1007. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1008. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1009. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1010. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1011. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1012. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1013. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1014. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1015. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1016. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1017. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1018. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1019. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1020. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1021. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1022. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1023. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1024. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1025. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1026. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1027. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1028. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1029. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1030. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1031. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1032. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1033. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1034. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1035. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1036. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1037. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1038. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1039. function ivprog(input) {
  1040. antlr4.Lexer.call(this, input);
  1041. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1042. return this;
  1043. }
  1044. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1045. ivprog.prototype.constructor = ivprog;
  1046. ivprog.EOF = antlr4.Token.EOF;
  1047. ivprog.RK_PROGRAM = 1;
  1048. ivprog.RK_REAL = 2;
  1049. ivprog.RK_VOID = 3;
  1050. ivprog.RK_BOOLEAN = 4;
  1051. ivprog.RK_STRING = 5;
  1052. ivprog.RK_INTEGER = 6;
  1053. ivprog.RK_CHARACTER = 7;
  1054. ivprog.RK_SWITCH = 8;
  1055. ivprog.RK_CASE = 9;
  1056. ivprog.RK_DEFAULT = 10;
  1057. ivprog.RK_CONST = 11;
  1058. ivprog.RK_FUNCTION = 12;
  1059. ivprog.RK_RETURN = 13;
  1060. ivprog.RK_FOR = 14;
  1061. ivprog.RK_BREAK = 15;
  1062. ivprog.RK_DO = 16;
  1063. ivprog.RK_WHILE = 17;
  1064. ivprog.RK_IF = 18;
  1065. ivprog.RK_ELSE = 19;
  1066. ivprog.RK_FALSE = 20;
  1067. ivprog.RK_TRUE = 21;
  1068. ivprog.OPEN_PARENTHESIS = 22;
  1069. ivprog.CLOSE_PARENTHESIS = 23;
  1070. ivprog.OPEN_BRACE = 24;
  1071. ivprog.CLOSE_BRACE = 25;
  1072. ivprog.OPEN_CURLY = 26;
  1073. ivprog.CLOSE_CURLY = 27;
  1074. ivprog.COMMA = 28;
  1075. ivprog.EQUAL = 29;
  1076. ivprog.SUM_OP = 30;
  1077. ivprog.MULTI_OP = 31;
  1078. ivprog.AND_OPERATOR = 32;
  1079. ivprog.OR_OPERATOR = 33;
  1080. ivprog.RELATIONAL_OPERATOR = 34;
  1081. ivprog.COLON = 35;
  1082. ivprog.NOT_OPERATOR = 36;
  1083. ivprog.ID = 37;
  1084. ivprog.LIB_ID = 38;
  1085. ivprog.INTEGER = 39;
  1086. ivprog.REAL = 40;
  1087. ivprog.STRING = 41;
  1088. ivprog.CHARACTER = 42;
  1089. ivprog.WHITESPACE = 43;
  1090. ivprog.EOS = 44;
  1091. ivprog.COMMENTS = 45;
  1092. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1093. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1094. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1095. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1096. "'escolha'", "'caso'", "'contrario'",
  1097. "'const'", "'funcao'", "'retorne'", "'para'",
  1098. "'pare'", "'faca'", "'enquanto'", "'se'",
  1099. "'senao'", "'falso'", "'verdadeiro'",
  1100. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1101. "','", "'='", null, null, null, null,
  1102. null, "':'" ];
  1103. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1104. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1105. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1106. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1107. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1108. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1109. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1110. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1111. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1112. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1113. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1114. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1115. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1116. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1117. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1118. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1119. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1120. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1121. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1122. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1123. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1124. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1125. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1126. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1127. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1128. "STRING", "STRING_CHARACTER", "CHARACTER",
  1129. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1130. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1131. "COMMENTS" ];
  1132. ivprog.prototype.grammarFileName = "ivprog.g4";
  1133. exports.ivprog = ivprog;
  1134. /***/ }),
  1135. /* 1 */
  1136. /***/ (function(module, exports, __webpack_require__) {
  1137. module.exports = {
  1138. ivprog: __webpack_require__(0).ivprog
  1139. };
  1140. /***/ }),
  1141. /* 2 */
  1142. /***/ (function(module, exports) {
  1143. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1144. /***/ })
  1145. /******/ ]);
  1146. /***/ }),
  1147. /***/ "./grammar/es/langFunctions.js":
  1148. /*!*************************************!*\
  1149. !*** ./grammar/es/langFunctions.js ***!
  1150. \*************************************/
  1151. /*! exports provided: default */
  1152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1153. "use strict";
  1154. __webpack_require__.r(__webpack_exports__);
  1155. /* This is a dictionary of the language defined functions
  1156. **/
  1157. /* harmony default export */ __webpack_exports__["default"] = ({
  1158. main_function: "inicio",
  1159. $read: "leia",
  1160. $write: "escreva",
  1161. $numElements: "total_of_elements",
  1162. $matrixLines: "total_of_lines",
  1163. $matrixColumns: "total_of_columns",
  1164. $substring: "subcadeia",
  1165. $length: "comprimento",
  1166. $uppercase: "caixa_alta",
  1167. $lowercase: "caixa_baixa",
  1168. $charAt: "char_at",
  1169. $isReal: "is_real",
  1170. $isInt: "is_integer",
  1171. $isBool: "is_logic",
  1172. $castReal: "to_real",
  1173. $castInt: "to_integer",
  1174. $castBool: "to_logic",
  1175. $castString: "to_string",
  1176. $sin: "sin",
  1177. $cos: "cos",
  1178. $tan: "tan",
  1179. $sqrt: "sqrt",
  1180. $pow: "pow",
  1181. $log: "log",
  1182. $abs: "abs",
  1183. $negate: "negate",
  1184. $invert: "invert",
  1185. $max: "maximum",
  1186. $min: "minimum"
  1187. });
  1188. /***/ }),
  1189. /***/ "./grammar/es/langLibs.js":
  1190. /*!********************************!*\
  1191. !*** ./grammar/es/langLibs.js ***!
  1192. \********************************/
  1193. /*! exports provided: default */
  1194. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1195. "use strict";
  1196. __webpack_require__.r(__webpack_exports__);
  1197. /**
  1198. * This is the dictionary of the language defined libraries
  1199. */
  1200. /* harmony default export */ __webpack_exports__["default"] = ({
  1201. $mathLib: "Mathematic",
  1202. $ioLib: "ES",
  1203. $strLib: "Texto",
  1204. $arrayLib: "Arranjo",
  1205. $langLib: "Conversion"
  1206. });
  1207. /***/ }),
  1208. /***/ "./grammar/index.js":
  1209. /*!**************************!*\
  1210. !*** ./grammar/index.js ***!
  1211. \**************************/
  1212. /*! exports provided: default */
  1213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1214. "use strict";
  1215. __webpack_require__.r(__webpack_exports__);
  1216. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pt/ivprog.g4 */ "./grammar/pt/ivprog.g4");
  1217. /* harmony import */ var _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__);
  1218. /* harmony import */ var _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt/langFunctions */ "./grammar/pt/langFunctions.js");
  1219. /* harmony import */ var _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./pt/langLibs */ "./grammar/pt/langLibs.js");
  1220. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./en/ivprog.g4 */ "./grammar/en/ivprog.g4");
  1221. /* harmony import */ var _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__);
  1222. /* harmony import */ var _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./en/langFunctions */ "./grammar/en/langFunctions.js");
  1223. /* harmony import */ var _en_langLibs__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./en/langLibs */ "./grammar/en/langLibs.js");
  1224. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./es/ivprog.g4 */ "./grammar/es/ivprog.g4");
  1225. /* harmony import */ var _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__);
  1226. /* harmony import */ var _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./es/langFunctions */ "./grammar/es/langFunctions.js");
  1227. /* harmony import */ var _es_langLibs__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./es/langLibs */ "./grammar/es/langLibs.js");
  1228. /* harmony default export */ __webpack_exports__["default"] = ({
  1229. pt: {
  1230. lexer: _pt_ivprog_g4__WEBPACK_IMPORTED_MODULE_0__["ivprog"],
  1231. langFuncs: _pt_langFunctions__WEBPACK_IMPORTED_MODULE_1__["default"],
  1232. langLibs: _pt_langLibs__WEBPACK_IMPORTED_MODULE_2__["default"]
  1233. },
  1234. en: {
  1235. lexer: _en_ivprog_g4__WEBPACK_IMPORTED_MODULE_3__["ivprog"],
  1236. langFuncs: _en_langFunctions__WEBPACK_IMPORTED_MODULE_4__["default"],
  1237. langLibs: _en_langLibs__WEBPACK_IMPORTED_MODULE_5__["default"]
  1238. },
  1239. es: {
  1240. lexer: _es_ivprog_g4__WEBPACK_IMPORTED_MODULE_6__["ivprog"],
  1241. langFuncs: _es_langFunctions__WEBPACK_IMPORTED_MODULE_7__["default"],
  1242. langLibs: _es_langLibs__WEBPACK_IMPORTED_MODULE_8__["default"]
  1243. }
  1244. });
  1245. /***/ }),
  1246. /***/ "./grammar/pt/ivprog.g4":
  1247. /*!******************************!*\
  1248. !*** ./grammar/pt/ivprog.g4 ***!
  1249. \******************************/
  1250. /*! no static exports found */
  1251. /***/ (function(module, exports, __webpack_require__) {
  1252. module.exports =
  1253. /******/ (function(modules) { // webpackBootstrap
  1254. /******/ // The module cache
  1255. /******/ var installedModules = {};
  1256. /******/
  1257. /******/ // The require function
  1258. /******/ function __webpack_require__(moduleId) {
  1259. /******/
  1260. /******/ // Check if module is in cache
  1261. /******/ if(installedModules[moduleId]) {
  1262. /******/ return installedModules[moduleId].exports;
  1263. /******/ }
  1264. /******/ // Create a new module (and put it into the cache)
  1265. /******/ var module = installedModules[moduleId] = {
  1266. /******/ i: moduleId,
  1267. /******/ l: false,
  1268. /******/ exports: {}
  1269. /******/ };
  1270. /******/
  1271. /******/ // Execute the module function
  1272. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  1273. /******/
  1274. /******/ // Flag the module as loaded
  1275. /******/ module.l = true;
  1276. /******/
  1277. /******/ // Return the exports of the module
  1278. /******/ return module.exports;
  1279. /******/ }
  1280. /******/
  1281. /******/
  1282. /******/ // expose the modules object (__webpack_modules__)
  1283. /******/ __webpack_require__.m = modules;
  1284. /******/
  1285. /******/ // expose the module cache
  1286. /******/ __webpack_require__.c = installedModules;
  1287. /******/
  1288. /******/ // identity function for calling harmony imports with the correct context
  1289. /******/ __webpack_require__.i = function(value) { return value; };
  1290. /******/
  1291. /******/ // define getter function for harmony exports
  1292. /******/ __webpack_require__.d = function(exports, name, getter) {
  1293. /******/ if(!__webpack_require__.o(exports, name)) {
  1294. /******/ Object.defineProperty(exports, name, {
  1295. /******/ configurable: false,
  1296. /******/ enumerable: true,
  1297. /******/ get: getter
  1298. /******/ });
  1299. /******/ }
  1300. /******/ };
  1301. /******/
  1302. /******/ // getDefaultExport function for compatibility with non-harmony modules
  1303. /******/ __webpack_require__.n = function(module) {
  1304. /******/ var getter = module && module.__esModule ?
  1305. /******/ function getDefault() { return module['default']; } :
  1306. /******/ function getModuleExports() { return module; };
  1307. /******/ __webpack_require__.d(getter, 'a', getter);
  1308. /******/ return getter;
  1309. /******/ };
  1310. /******/
  1311. /******/ // Object.prototype.hasOwnProperty.call
  1312. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  1313. /******/
  1314. /******/ // __webpack_public_path__
  1315. /******/ __webpack_require__.p = "";
  1316. /******/
  1317. /******/ // Load entry module and return exports
  1318. /******/ return __webpack_require__(__webpack_require__.s = 1);
  1319. /******/ })
  1320. /************************************************************************/
  1321. /******/ ([
  1322. /* 0 */
  1323. /***/ (function(module, exports, __webpack_require__) {
  1324. // Generated from /tmp/tmp-17826p8ez5mZyJT9/ivprog.g4 by ANTLR 4.7
  1325. // jshint ignore: start
  1326. var antlr4 = __webpack_require__(2);
  1327. var serializedATN = ["\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964",
  1328. "\u0002/\u01dc\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004",
  1329. "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t",
  1330. "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004",
  1331. "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010",
  1332. "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013",
  1333. "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017",
  1334. "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a",
  1335. "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e",
  1336. "\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004\"\t\"\u0004#",
  1337. "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004\'\t\'\u0004(\t(\u0004)\t)\u0004",
  1338. "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004",
  1339. "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004",
  1340. "8\t8\u00049\t9\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003",
  1341. "\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0002\u0003\u0003\u0003",
  1342. "\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0003\u0004\u0003\u0004\u0003",
  1343. "\u0004\u0003\u0004\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003",
  1344. "\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0005\u0003\u0006\u0003",
  1345. "\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003",
  1346. "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003",
  1347. "\u0007\u0003\u0007\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003\b\u0003",
  1348. "\b\u0003\b\u0003\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0003",
  1349. "\t\u0003\t\u0003\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0003\u000b",
  1350. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b",
  1351. "\u0003\u000b\u0003\u000b\u0003\u000b\u0003\f\u0003\f\u0003\f\u0003\f",
  1352. "\u0003\f\u0003\f\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003",
  1353. "\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003",
  1354. "\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0003",
  1355. "\u000f\u0003\u000f\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003",
  1356. "\u0010\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0003",
  1357. "\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003",
  1358. "\u0012\u0003\u0012\u0003\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003",
  1359. "\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003\u0014\u0003",
  1360. "\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003\u0015\u0003",
  1361. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003",
  1362. "\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0016\u0003\u0017\u0003",
  1363. "\u0017\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003\u0019\u0003",
  1364. "\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b\u0003",
  1365. "\u001c\u0003\u001c\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003",
  1366. "\u001f\u0003\u001f\u0003 \u0003 \u0003!\u0003!\u0003\"\u0003\"\u0003",
  1367. "#\u0003#\u0003$\u0003$\u0003%\u0003%\u0003&\u0003&\u0003&\u0003&\u0003",
  1368. "&\u0003&\u0003&\u0003&\u0003&\u0005&\u0130\n&\u0003\'\u0003\'\u0003",
  1369. "(\u0003(\u0003)\u0003)\u0007)\u0138\n)\f)\u000e)\u013b\u000b)\u0003",
  1370. "*\u0003*\u0003*\u0003*\u0003+\u0006+\u0142\n+\r+\u000e+\u0143\u0003",
  1371. "+\u0003+\u0003+\u0003+\u0005+\u014a\n+\u0003+\u0006+\u014d\n+\r+\u000e",
  1372. "+\u014e\u0003+\u0003+\u0003+\u0003+\u0005+\u0155\n+\u0003+\u0006+\u0158",
  1373. "\n+\r+\u000e+\u0159\u0005+\u015c\n+\u0003,\u0006,\u015f\n,\r,\u000e",
  1374. ",\u0160\u0003,\u0003,\u0006,\u0165\n,\r,\u000e,\u0166\u0003,\u0006,",
  1375. "\u016a\n,\r,\u000e,\u016b\u0003,\u0003,\u0007,\u0170\n,\f,\u000e,\u0173",
  1376. "\u000b,\u0003,\u0005,\u0176\n,\u0003-\u0003-\u0005-\u017a\n-\u0003-",
  1377. "\u0006-\u017d\n-\r-\u000e-\u017e\u0003.\u0003.\u0007.\u0183\n.\f.\u000e",
  1378. ".\u0186\u000b.\u0003.\u0003.\u0003/\u0003/\u0005/\u018c\n/\u00030\u0003",
  1379. "0\u00030\u00050\u0191\n0\u00030\u00030\u00031\u00031\u00031\u00031\u0003",
  1380. "2\u00032\u00033\u00063\u019c\n3\r3\u000e3\u019d\u00033\u00053\u01a1",
  1381. "\n3\u00034\u00034\u00035\u00035\u00036\u00036\u00036\u00036\u00056\u01ab",
  1382. "\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003",
  1383. "7\u00037\u00057\u01b8\n7\u00038\u00038\u00038\u00038\u00038\u00038\u0003",
  1384. "8\u00039\u00039\u00039\u00039\u00079\u01c5\n9\f9\u000e9\u01c8\u000b",
  1385. "9\u00039\u00059\u01cb\n9\u00039\u00039\u00039\u00039\u00039\u00079\u01d2",
  1386. "\n9\f9\u000e9\u01d5\u000b9\u00039\u00039\u00059\u01d9\n9\u00039\u0003",
  1387. "9\u0003\u01d3\u0002:\u0003\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b",
  1388. "\u0007\r\b\u000f\t\u0011\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b",
  1389. "\u000f\u001d\u0010\u001f\u0011!\u0012#\u0013%\u0014\'\u0015)\u0016+",
  1390. "\u0017-\u0002/\u00021\u00023\u00185\u00197\u001a9\u001b;\u001c=\u001d",
  1391. "?\u001eA\u001fC E!G\"I#K$M%O&Q\'S(U)W*Y\u0002[+]\u0002_,a-c\u0002e.",
  1392. "g\u0002i\u0002k\u0002m\u0002o\u0002q/\u0003\u0002\u0012\u0004\u0002",
  1393. "--//\u0005\u0002\'\',,11\u0004\u0002>>@@\u0005\u0002C\\aac|\u0006\u0002",
  1394. "2;C\\aac|\u0003\u00022;\u0003\u000223\u0004\u0002GGgg\u0006\u0002\f",
  1395. "\f\u000f\u000f$$^^\u0006\u0002\f\f\u000f\u000f))^^\u0004\u0002\u000b",
  1396. "\u000b\"\"\u0004\u0002\f\f\u000f\u000f\u0005\u00022;CHch\u0003\u0002",
  1397. "29\n\u0002$$))^^ddhhppttvv\u0003\u000225\u0002\u01f0\u0002\u0003\u0003",
  1398. "\u0002\u0002\u0002\u0002\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003",
  1399. "\u0002\u0002\u0002\u0002\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003",
  1400. "\u0002\u0002\u0002\u0002\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003",
  1401. "\u0002\u0002\u0002\u0002\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003",
  1402. "\u0002\u0002\u0002\u0002\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003",
  1403. "\u0002\u0002\u0002\u0002\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003",
  1404. "\u0002\u0002\u0002\u0002\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003",
  1405. "\u0002\u0002\u0002\u0002!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002",
  1406. "\u0002\u0002\u0002%\u0003\u0002\u0002\u0002\u0002\'\u0003\u0002\u0002",
  1407. "\u0002\u0002)\u0003\u0002\u0002\u0002\u0002+\u0003\u0002\u0002\u0002",
  1408. "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002",
  1409. "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003",
  1410. "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002",
  1411. "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002",
  1412. "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002",
  1413. "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002",
  1414. "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003",
  1415. "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002",
  1416. "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002[\u0003\u0002\u0002",
  1417. "\u0002\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002",
  1418. "\u0002e\u0003\u0002\u0002\u0002\u0002q\u0003\u0002\u0002\u0002\u0003",
  1419. "s\u0003\u0002\u0002\u0002\u0005|\u0003\u0002\u0002\u0002\u0007\u0081",
  1420. "\u0003\u0002\u0002\u0002\t\u0087\u0003\u0002\u0002\u0002\u000b\u008e",
  1421. "\u0003\u0002\u0002\u0002\r\u0095\u0003\u0002\u0002\u0002\u000f\u009d",
  1422. "\u0003\u0002\u0002\u0002\u0011\u00a7\u0003\u0002\u0002\u0002\u0013\u00af",
  1423. "\u0003\u0002\u0002\u0002\u0015\u00b4\u0003\u0002\u0002\u0002\u0017\u00be",
  1424. "\u0003\u0002\u0002\u0002\u0019\u00c4\u0003\u0002\u0002\u0002\u001b\u00cb",
  1425. "\u0003\u0002\u0002\u0002\u001d\u00d3\u0003\u0002\u0002\u0002\u001f\u00d8",
  1426. "\u0003\u0002\u0002\u0002!\u00dd\u0003\u0002\u0002\u0002#\u00e2\u0003",
  1427. "\u0002\u0002\u0002%\u00eb\u0003\u0002\u0002\u0002\'\u00ee\u0003\u0002",
  1428. "\u0002\u0002)\u00f4\u0003\u0002\u0002\u0002+\u00fa\u0003\u0002\u0002",
  1429. "\u0002-\u0105\u0003\u0002\u0002\u0002/\u0109\u0003\u0002\u0002\u0002",
  1430. "1\u010b\u0003\u0002\u0002\u00023\u010e\u0003\u0002\u0002\u00025\u0110",
  1431. "\u0003\u0002\u0002\u00027\u0112\u0003\u0002\u0002\u00029\u0114\u0003",
  1432. "\u0002\u0002\u0002;\u0116\u0003\u0002\u0002\u0002=\u0118\u0003\u0002",
  1433. "\u0002\u0002?\u011a\u0003\u0002\u0002\u0002A\u011c\u0003\u0002\u0002",
  1434. "\u0002C\u011e\u0003\u0002\u0002\u0002E\u0120\u0003\u0002\u0002\u0002",
  1435. "G\u0122\u0003\u0002\u0002\u0002I\u0124\u0003\u0002\u0002\u0002K\u012f",
  1436. "\u0003\u0002\u0002\u0002M\u0131\u0003\u0002\u0002\u0002O\u0133\u0003",
  1437. "\u0002\u0002\u0002Q\u0135\u0003\u0002\u0002\u0002S\u013c\u0003\u0002",
  1438. "\u0002\u0002U\u015b\u0003\u0002\u0002\u0002W\u0175\u0003\u0002\u0002",
  1439. "\u0002Y\u0177\u0003\u0002\u0002\u0002[\u0180\u0003\u0002\u0002\u0002",
  1440. "]\u018b\u0003\u0002\u0002\u0002_\u018d\u0003\u0002\u0002\u0002a\u0194",
  1441. "\u0003\u0002\u0002\u0002c\u0198\u0003\u0002\u0002\u0002e\u01a0\u0003",
  1442. "\u0002\u0002\u0002g\u01a2\u0003\u0002\u0002\u0002i\u01a4\u0003\u0002",
  1443. "\u0002\u0002k\u01aa\u0003\u0002\u0002\u0002m\u01b7\u0003\u0002\u0002",
  1444. "\u0002o\u01b9\u0003\u0002\u0002\u0002q\u01d8\u0003\u0002\u0002\u0002",
  1445. "st\u0007r\u0002\u0002tu\u0007t\u0002\u0002uv\u0007q\u0002\u0002vw\u0007",
  1446. "i\u0002\u0002wx\u0007t\u0002\u0002xy\u0007c\u0002\u0002yz\u0007o\u0002",
  1447. "\u0002z{\u0007c\u0002\u0002{\u0004\u0003\u0002\u0002\u0002|}\u0007t",
  1448. "\u0002\u0002}~\u0007g\u0002\u0002~\u007f\u0007c\u0002\u0002\u007f\u0080",
  1449. "\u0007n\u0002\u0002\u0080\u0006\u0003\u0002\u0002\u0002\u0081\u0082",
  1450. "\u0007x\u0002\u0002\u0082\u0083\u0007c\u0002\u0002\u0083\u0084\u0007",
  1451. "|\u0002\u0002\u0084\u0085\u0007k\u0002\u0002\u0085\u0086\u0007q\u0002",
  1452. "\u0002\u0086\b\u0003\u0002\u0002\u0002\u0087\u0088\u0007n\u0002\u0002",
  1453. "\u0088\u0089\u0007q\u0002\u0002\u0089\u008a\u0007i\u0002\u0002\u008a",
  1454. "\u008b\u0007k\u0002\u0002\u008b\u008c\u0007e\u0002\u0002\u008c\u008d",
  1455. "\u0007q\u0002\u0002\u008d\n\u0003\u0002\u0002\u0002\u008e\u008f\u0007",
  1456. "e\u0002\u0002\u008f\u0090\u0007c\u0002\u0002\u0090\u0091\u0007f\u0002",
  1457. "\u0002\u0091\u0092\u0007g\u0002\u0002\u0092\u0093\u0007k\u0002\u0002",
  1458. "\u0093\u0094\u0007c\u0002\u0002\u0094\f\u0003\u0002\u0002\u0002\u0095",
  1459. "\u0096\u0007k\u0002\u0002\u0096\u0097\u0007p\u0002\u0002\u0097\u0098",
  1460. "\u0007v\u0002\u0002\u0098\u0099\u0007g\u0002\u0002\u0099\u009a\u0007",
  1461. "k\u0002\u0002\u009a\u009b\u0007t\u0002\u0002\u009b\u009c\u0007q\u0002",
  1462. "\u0002\u009c\u000e\u0003\u0002\u0002\u0002\u009d\u009e\u0007e\u0002",
  1463. "\u0002\u009e\u009f\u0007c\u0002\u0002\u009f\u00a0\u0007t\u0002\u0002",
  1464. "\u00a0\u00a1\u0007c\u0002\u0002\u00a1\u00a2\u0007e\u0002\u0002\u00a2",
  1465. "\u00a3\u0007v\u0002\u0002\u00a3\u00a4\u0007g\u0002\u0002\u00a4\u00a5",
  1466. "\u0007t\u0002\u0002\u00a5\u00a6\u0007g\u0002\u0002\u00a6\u0010\u0003",
  1467. "\u0002\u0002\u0002\u00a7\u00a8\u0007g\u0002\u0002\u00a8\u00a9\u0007",
  1468. "u\u0002\u0002\u00a9\u00aa\u0007e\u0002\u0002\u00aa\u00ab\u0007q\u0002",
  1469. "\u0002\u00ab\u00ac\u0007n\u0002\u0002\u00ac\u00ad\u0007j\u0002\u0002",
  1470. "\u00ad\u00ae\u0007c\u0002\u0002\u00ae\u0012\u0003\u0002\u0002\u0002",
  1471. "\u00af\u00b0\u0007e\u0002\u0002\u00b0\u00b1\u0007c\u0002\u0002\u00b1",
  1472. "\u00b2\u0007u\u0002\u0002\u00b2\u00b3\u0007q\u0002\u0002\u00b3\u0014",
  1473. "\u0003\u0002\u0002\u0002\u00b4\u00b5\u0007e\u0002\u0002\u00b5\u00b6",
  1474. "\u0007q\u0002\u0002\u00b6\u00b7\u0007p\u0002\u0002\u00b7\u00b8\u0007",
  1475. "v\u0002\u0002\u00b8\u00b9\u0007t\u0002\u0002\u00b9\u00ba\u0007c\u0002",
  1476. "\u0002\u00ba\u00bb\u0007t\u0002\u0002\u00bb\u00bc\u0007k\u0002\u0002",
  1477. "\u00bc\u00bd\u0007q\u0002\u0002\u00bd\u0016\u0003\u0002\u0002\u0002",
  1478. "\u00be\u00bf\u0007e\u0002\u0002\u00bf\u00c0\u0007q\u0002\u0002\u00c0",
  1479. "\u00c1\u0007p\u0002\u0002\u00c1\u00c2\u0007u\u0002\u0002\u00c2\u00c3",
  1480. "\u0007v\u0002\u0002\u00c3\u0018\u0003\u0002\u0002\u0002\u00c4\u00c5",
  1481. "\u0007h\u0002\u0002\u00c5\u00c6\u0007w\u0002\u0002\u00c6\u00c7\u0007",
  1482. "p\u0002\u0002\u00c7\u00c8\u0007e\u0002\u0002\u00c8\u00c9\u0007c\u0002",
  1483. "\u0002\u00c9\u00ca\u0007q\u0002\u0002\u00ca\u001a\u0003\u0002\u0002",
  1484. "\u0002\u00cb\u00cc\u0007t\u0002\u0002\u00cc\u00cd\u0007g\u0002\u0002",
  1485. "\u00cd\u00ce\u0007v\u0002\u0002\u00ce\u00cf\u0007q\u0002\u0002\u00cf",
  1486. "\u00d0\u0007t\u0002\u0002\u00d0\u00d1\u0007p\u0002\u0002\u00d1\u00d2",
  1487. "\u0007g\u0002\u0002\u00d2\u001c\u0003\u0002\u0002\u0002\u00d3\u00d4",
  1488. "\u0007r\u0002\u0002\u00d4\u00d5\u0007c\u0002\u0002\u00d5\u00d6\u0007",
  1489. "t\u0002\u0002\u00d6\u00d7\u0007c\u0002\u0002\u00d7\u001e\u0003\u0002",
  1490. "\u0002\u0002\u00d8\u00d9\u0007r\u0002\u0002\u00d9\u00da\u0007c\u0002",
  1491. "\u0002\u00da\u00db\u0007t\u0002\u0002\u00db\u00dc\u0007g\u0002\u0002",
  1492. "\u00dc \u0003\u0002\u0002\u0002\u00dd\u00de\u0007h\u0002\u0002\u00de",
  1493. "\u00df\u0007c\u0002\u0002\u00df\u00e0\u0007e\u0002\u0002\u00e0\u00e1",
  1494. "\u0007c\u0002\u0002\u00e1\"\u0003\u0002\u0002\u0002\u00e2\u00e3\u0007",
  1495. "g\u0002\u0002\u00e3\u00e4\u0007p\u0002\u0002\u00e4\u00e5\u0007s\u0002",
  1496. "\u0002\u00e5\u00e6\u0007w\u0002\u0002\u00e6\u00e7\u0007c\u0002\u0002",
  1497. "\u00e7\u00e8\u0007p\u0002\u0002\u00e8\u00e9\u0007v\u0002\u0002\u00e9",
  1498. "\u00ea\u0007q\u0002\u0002\u00ea$\u0003\u0002\u0002\u0002\u00eb\u00ec",
  1499. "\u0007u\u0002\u0002\u00ec\u00ed\u0007g\u0002\u0002\u00ed&\u0003\u0002",
  1500. "\u0002\u0002\u00ee\u00ef\u0007u\u0002\u0002\u00ef\u00f0\u0007g\u0002",
  1501. "\u0002\u00f0\u00f1\u0007p\u0002\u0002\u00f1\u00f2\u0007c\u0002\u0002",
  1502. "\u00f2\u00f3\u0007q\u0002\u0002\u00f3(\u0003\u0002\u0002\u0002\u00f4",
  1503. "\u00f5\u0007h\u0002\u0002\u00f5\u00f6\u0007c\u0002\u0002\u00f6\u00f7",
  1504. "\u0007n\u0002\u0002\u00f7\u00f8\u0007u\u0002\u0002\u00f8\u00f9\u0007",
  1505. "q\u0002\u0002\u00f9*\u0003\u0002\u0002\u0002\u00fa\u00fb\u0007x\u0002",
  1506. "\u0002\u00fb\u00fc\u0007g\u0002\u0002\u00fc\u00fd\u0007t\u0002\u0002",
  1507. "\u00fd\u00fe\u0007f\u0002\u0002\u00fe\u00ff\u0007c\u0002\u0002\u00ff",
  1508. "\u0100\u0007f\u0002\u0002\u0100\u0101\u0007g\u0002\u0002\u0101\u0102",
  1509. "\u0007k\u0002\u0002\u0102\u0103\u0007t\u0002\u0002\u0103\u0104\u0007",
  1510. "q\u0002\u0002\u0104,\u0003\u0002\u0002\u0002\u0105\u0106\u0007p\u0002",
  1511. "\u0002\u0106\u0107\u0007c\u0002\u0002\u0107\u0108\u0007q\u0002\u0002",
  1512. "\u0108.\u0003\u0002\u0002\u0002\u0109\u010a\u0007G\u0002\u0002\u010a",
  1513. "0\u0003\u0002\u0002\u0002\u010b\u010c\u0007Q\u0002\u0002\u010c\u010d",
  1514. "\u0007W\u0002\u0002\u010d2\u0003\u0002\u0002\u0002\u010e\u010f\u0007",
  1515. "*\u0002\u0002\u010f4\u0003\u0002\u0002\u0002\u0110\u0111\u0007+\u0002",
  1516. "\u0002\u01116\u0003\u0002\u0002\u0002\u0112\u0113\u0007]\u0002\u0002",
  1517. "\u01138\u0003\u0002\u0002\u0002\u0114\u0115\u0007_\u0002\u0002\u0115",
  1518. ":\u0003\u0002\u0002\u0002\u0116\u0117\u0007}\u0002\u0002\u0117<\u0003",
  1519. "\u0002\u0002\u0002\u0118\u0119\u0007\u007f\u0002\u0002\u0119>\u0003",
  1520. "\u0002\u0002\u0002\u011a\u011b\u0007.\u0002\u0002\u011b@\u0003\u0002",
  1521. "\u0002\u0002\u011c\u011d\u0007?\u0002\u0002\u011dB\u0003\u0002\u0002",
  1522. "\u0002\u011e\u011f\t\u0002\u0002\u0002\u011fD\u0003\u0002\u0002\u0002",
  1523. "\u0120\u0121\t\u0003\u0002\u0002\u0121F\u0003\u0002\u0002\u0002\u0122",
  1524. "\u0123\u0005/\u0018\u0002\u0123H\u0003\u0002\u0002\u0002\u0124\u0125",
  1525. "\u00051\u0019\u0002\u0125J\u0003\u0002\u0002\u0002\u0126\u0127\u0007",
  1526. "@\u0002\u0002\u0127\u0130\u0007?\u0002\u0002\u0128\u0129\u0007?\u0002",
  1527. "\u0002\u0129\u0130\u0007?\u0002\u0002\u012a\u012b\u0007>\u0002\u0002",
  1528. "\u012b\u0130\u0007?\u0002\u0002\u012c\u0130\t\u0004\u0002\u0002\u012d",
  1529. "\u012e\u0007#\u0002\u0002\u012e\u0130\u0007?\u0002\u0002\u012f\u0126",
  1530. "\u0003\u0002\u0002\u0002\u012f\u0128\u0003\u0002\u0002\u0002\u012f\u012a",
  1531. "\u0003\u0002\u0002\u0002\u012f\u012c\u0003\u0002\u0002\u0002\u012f\u012d",
  1532. "\u0003\u0002\u0002\u0002\u0130L\u0003\u0002\u0002\u0002\u0131\u0132",
  1533. "\u0007<\u0002\u0002\u0132N\u0003\u0002\u0002\u0002\u0133\u0134\u0005",
  1534. "-\u0017\u0002\u0134P\u0003\u0002\u0002\u0002\u0135\u0139\t\u0005\u0002",
  1535. "\u0002\u0136\u0138\t\u0006\u0002\u0002\u0137\u0136\u0003\u0002\u0002",
  1536. "\u0002\u0138\u013b\u0003\u0002\u0002\u0002\u0139\u0137\u0003\u0002\u0002",
  1537. "\u0002\u0139\u013a\u0003\u0002\u0002\u0002\u013aR\u0003\u0002\u0002",
  1538. "\u0002\u013b\u0139\u0003\u0002\u0002\u0002\u013c\u013d\u0005Q)\u0002",
  1539. "\u013d\u013e\u00070\u0002\u0002\u013e\u013f\u0005Q)\u0002\u013fT\u0003",
  1540. "\u0002\u0002\u0002\u0140\u0142\t\u0007\u0002\u0002\u0141\u0140\u0003",
  1541. "\u0002\u0002\u0002\u0142\u0143\u0003\u0002\u0002\u0002\u0143\u0141\u0003",
  1542. "\u0002\u0002\u0002\u0143\u0144\u0003\u0002\u0002\u0002\u0144\u015c\u0003",
  1543. "\u0002\u0002\u0002\u0145\u0146\u00072\u0002\u0002\u0146\u014a\u0007",
  1544. "z\u0002\u0002\u0147\u0148\u00072\u0002\u0002\u0148\u014a\u0007Z\u0002",
  1545. "\u0002\u0149\u0145\u0003\u0002\u0002\u0002\u0149\u0147\u0003\u0002\u0002",
  1546. "\u0002\u014a\u014c\u0003\u0002\u0002\u0002\u014b\u014d\u0005g4\u0002",
  1547. "\u014c\u014b\u0003\u0002\u0002\u0002\u014d\u014e\u0003\u0002\u0002\u0002",
  1548. "\u014e\u014c\u0003\u0002\u0002\u0002\u014e\u014f\u0003\u0002\u0002\u0002",
  1549. "\u014f\u015c\u0003\u0002\u0002\u0002\u0150\u0151\u00072\u0002\u0002",
  1550. "\u0151\u0155\u0007d\u0002\u0002\u0152\u0153\u00072\u0002\u0002\u0153",
  1551. "\u0155\u0007D\u0002\u0002\u0154\u0150\u0003\u0002\u0002\u0002\u0154",
  1552. "\u0152\u0003\u0002\u0002\u0002\u0155\u0157\u0003\u0002\u0002\u0002\u0156",
  1553. "\u0158\t\b\u0002\u0002\u0157\u0156\u0003\u0002\u0002\u0002\u0158\u0159",
  1554. "\u0003\u0002\u0002\u0002\u0159\u0157\u0003\u0002\u0002\u0002\u0159\u015a",
  1555. "\u0003\u0002\u0002\u0002\u015a\u015c\u0003\u0002\u0002\u0002\u015b\u0141",
  1556. "\u0003\u0002\u0002\u0002\u015b\u0149\u0003\u0002\u0002\u0002\u015b\u0154",
  1557. "\u0003\u0002\u0002\u0002\u015cV\u0003\u0002\u0002\u0002\u015d\u015f",
  1558. "\t\u0007\u0002\u0002\u015e\u015d\u0003\u0002\u0002\u0002\u015f\u0160",
  1559. "\u0003\u0002\u0002\u0002\u0160\u015e\u0003\u0002\u0002\u0002\u0160\u0161",
  1560. "\u0003\u0002\u0002\u0002\u0161\u0162\u0003\u0002\u0002\u0002\u0162\u0164",
  1561. "\u00070\u0002\u0002\u0163\u0165\t\u0007\u0002\u0002\u0164\u0163\u0003",
  1562. "\u0002\u0002\u0002\u0165\u0166\u0003\u0002\u0002\u0002\u0166\u0164\u0003",
  1563. "\u0002\u0002\u0002\u0166\u0167\u0003\u0002\u0002\u0002\u0167\u0176\u0003",
  1564. "\u0002\u0002\u0002\u0168\u016a\t\u0007\u0002\u0002\u0169\u0168\u0003",
  1565. "\u0002\u0002\u0002\u016a\u016b\u0003\u0002\u0002\u0002\u016b\u0169\u0003",
  1566. "\u0002\u0002\u0002\u016b\u016c\u0003\u0002\u0002\u0002\u016c\u016d\u0003",
  1567. "\u0002\u0002\u0002\u016d\u0171\u00070\u0002\u0002\u016e\u0170\t\u0007",
  1568. "\u0002\u0002\u016f\u016e\u0003\u0002\u0002\u0002\u0170\u0173\u0003\u0002",
  1569. "\u0002\u0002\u0171\u016f\u0003\u0002\u0002\u0002\u0171\u0172\u0003\u0002",
  1570. "\u0002\u0002\u0172\u0174\u0003\u0002\u0002\u0002\u0173\u0171\u0003\u0002",
  1571. "\u0002\u0002\u0174\u0176\u0005Y-\u0002\u0175\u015e\u0003\u0002\u0002",
  1572. "\u0002\u0175\u0169\u0003\u0002\u0002\u0002\u0176X\u0003\u0002\u0002",
  1573. "\u0002\u0177\u0179\t\t\u0002\u0002\u0178\u017a\t\u0002\u0002\u0002\u0179",
  1574. "\u0178\u0003\u0002\u0002\u0002\u0179\u017a\u0003\u0002\u0002\u0002\u017a",
  1575. "\u017c\u0003\u0002\u0002\u0002\u017b\u017d\t\u0007\u0002\u0002\u017c",
  1576. "\u017b\u0003\u0002\u0002\u0002\u017d\u017e\u0003\u0002\u0002\u0002\u017e",
  1577. "\u017c\u0003\u0002\u0002\u0002\u017e\u017f\u0003\u0002\u0002\u0002\u017f",
  1578. "Z\u0003\u0002\u0002\u0002\u0180\u0184\u0007$\u0002\u0002\u0181\u0183",
  1579. "\u0005]/\u0002\u0182\u0181\u0003\u0002\u0002\u0002\u0183\u0186\u0003",
  1580. "\u0002\u0002\u0002\u0184\u0182\u0003\u0002\u0002\u0002\u0184\u0185\u0003",
  1581. "\u0002\u0002\u0002\u0185\u0187\u0003\u0002\u0002\u0002\u0186\u0184\u0003",
  1582. "\u0002\u0002\u0002\u0187\u0188\u0007$\u0002\u0002\u0188\\\u0003\u0002",
  1583. "\u0002\u0002\u0189\u018c\n\n\u0002\u0002\u018a\u018c\u0005k6\u0002\u018b",
  1584. "\u0189\u0003\u0002\u0002\u0002\u018b\u018a\u0003\u0002\u0002\u0002\u018c",
  1585. "^\u0003\u0002\u0002\u0002\u018d\u0190\u0007)\u0002\u0002\u018e\u0191",
  1586. "\u0005k6\u0002\u018f\u0191\n\u000b\u0002\u0002\u0190\u018e\u0003\u0002",
  1587. "\u0002\u0002\u0190\u018f\u0003\u0002\u0002\u0002\u0191\u0192\u0003\u0002",
  1588. "\u0002\u0002\u0192\u0193\u0007)\u0002\u0002\u0193`\u0003\u0002\u0002",
  1589. "\u0002\u0194\u0195\t\f\u0002\u0002\u0195\u0196\u0003\u0002\u0002\u0002",
  1590. "\u0196\u0197\b1\u0002\u0002\u0197b\u0003\u0002\u0002\u0002\u0198\u0199",
  1591. "\u0007=\u0002\u0002\u0199d\u0003\u0002\u0002\u0002\u019a\u019c\t\r\u0002",
  1592. "\u0002\u019b\u019a\u0003\u0002\u0002\u0002\u019c\u019d\u0003\u0002\u0002",
  1593. "\u0002\u019d\u019b\u0003\u0002\u0002\u0002\u019d\u019e\u0003\u0002\u0002",
  1594. "\u0002\u019e\u01a1\u0003\u0002\u0002\u0002\u019f\u01a1\u0005c2\u0002",
  1595. "\u01a0\u019b\u0003\u0002\u0002\u0002\u01a0\u019f\u0003\u0002\u0002\u0002",
  1596. "\u01a1f\u0003\u0002\u0002\u0002\u01a2\u01a3\t\u000e\u0002\u0002\u01a3",
  1597. "h\u0003\u0002\u0002\u0002\u01a4\u01a5\t\u000f\u0002\u0002\u01a5j\u0003",
  1598. "\u0002\u0002\u0002\u01a6\u01a7\u0007^\u0002\u0002\u01a7\u01ab\t\u0010",
  1599. "\u0002\u0002\u01a8\u01ab\u0005o8\u0002\u01a9\u01ab\u0005m7\u0002\u01aa",
  1600. "\u01a6\u0003\u0002\u0002\u0002\u01aa\u01a8\u0003\u0002\u0002\u0002\u01aa",
  1601. "\u01a9\u0003\u0002\u0002\u0002\u01abl\u0003\u0002\u0002\u0002\u01ac",
  1602. "\u01ad\u0007^\u0002\u0002\u01ad\u01ae\t\u0011\u0002\u0002\u01ae\u01af",
  1603. "\u0005i5\u0002\u01af\u01b0\u0005i5\u0002\u01b0\u01b8\u0003\u0002\u0002",
  1604. "\u0002\u01b1\u01b2\u0007^\u0002\u0002\u01b2\u01b3\u0005i5\u0002\u01b3",
  1605. "\u01b4\u0005i5\u0002\u01b4\u01b8\u0003\u0002\u0002\u0002\u01b5\u01b6",
  1606. "\u0007^\u0002\u0002\u01b6\u01b8\u0005i5\u0002\u01b7\u01ac\u0003\u0002",
  1607. "\u0002\u0002\u01b7\u01b1\u0003\u0002\u0002\u0002\u01b7\u01b5\u0003\u0002",
  1608. "\u0002\u0002\u01b8n\u0003\u0002\u0002\u0002\u01b9\u01ba\u0007^\u0002",
  1609. "\u0002\u01ba\u01bb\u0007w\u0002\u0002\u01bb\u01bc\u0005g4\u0002\u01bc",
  1610. "\u01bd\u0005g4\u0002\u01bd\u01be\u0005g4\u0002\u01be\u01bf\u0005g4\u0002",
  1611. "\u01bfp\u0003\u0002\u0002\u0002\u01c0\u01c1\u00071\u0002\u0002\u01c1",
  1612. "\u01c2\u00071\u0002\u0002\u01c2\u01c6\u0003\u0002\u0002\u0002\u01c3",
  1613. "\u01c5\n\r\u0002\u0002\u01c4\u01c3\u0003\u0002\u0002\u0002\u01c5\u01c8",
  1614. "\u0003\u0002\u0002\u0002\u01c6\u01c4\u0003\u0002\u0002\u0002\u01c6\u01c7",
  1615. "\u0003\u0002\u0002\u0002\u01c7\u01ca\u0003\u0002\u0002\u0002\u01c8\u01c6",
  1616. "\u0003\u0002\u0002\u0002\u01c9\u01cb\u0007\u000f\u0002\u0002\u01ca\u01c9",
  1617. "\u0003\u0002\u0002\u0002\u01ca\u01cb\u0003\u0002\u0002\u0002\u01cb\u01cc",
  1618. "\u0003\u0002\u0002\u0002\u01cc\u01d9\u0007\f\u0002\u0002\u01cd\u01ce",
  1619. "\u00071\u0002\u0002\u01ce\u01cf\u0007,\u0002\u0002\u01cf\u01d3\u0003",
  1620. "\u0002\u0002\u0002\u01d0\u01d2\u000b\u0002\u0002\u0002\u01d1\u01d0\u0003",
  1621. "\u0002\u0002\u0002\u01d2\u01d5\u0003\u0002\u0002\u0002\u01d3\u01d4\u0003",
  1622. "\u0002\u0002\u0002\u01d3\u01d1\u0003\u0002\u0002\u0002\u01d4\u01d6\u0003",
  1623. "\u0002\u0002\u0002\u01d5\u01d3\u0003\u0002\u0002\u0002\u01d6\u01d7\u0007",
  1624. ",\u0002\u0002\u01d7\u01d9\u00071\u0002\u0002\u01d8\u01c0\u0003\u0002",
  1625. "\u0002\u0002\u01d8\u01cd\u0003\u0002\u0002\u0002\u01d9\u01da\u0003\u0002",
  1626. "\u0002\u0002\u01da\u01db\b9\u0003\u0002\u01dbr\u0003\u0002\u0002\u0002",
  1627. "\u001d\u0002\u012f\u0139\u0143\u0149\u014e\u0154\u0159\u015b\u0160\u0166",
  1628. "\u016b\u0171\u0175\u0179\u017e\u0184\u018b\u0190\u019d\u01a0\u01aa\u01b7",
  1629. "\u01c6\u01ca\u01d3\u01d8\u0004\b\u0002\u0002\u0002\u0003\u0002"].join("");
  1630. var atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN);
  1631. var decisionsToDFA = atn.decisionToState.map( function(ds, index) { return new antlr4.dfa.DFA(ds, index); });
  1632. function ivprog(input) {
  1633. antlr4.Lexer.call(this, input);
  1634. this._interp = new antlr4.atn.LexerATNSimulator(this, atn, decisionsToDFA, new antlr4.PredictionContextCache());
  1635. return this;
  1636. }
  1637. ivprog.prototype = Object.create(antlr4.Lexer.prototype);
  1638. ivprog.prototype.constructor = ivprog;
  1639. ivprog.EOF = antlr4.Token.EOF;
  1640. ivprog.RK_PROGRAM = 1;
  1641. ivprog.RK_REAL = 2;
  1642. ivprog.RK_VOID = 3;
  1643. ivprog.RK_BOOLEAN = 4;
  1644. ivprog.RK_STRING = 5;
  1645. ivprog.RK_INTEGER = 6;
  1646. ivprog.RK_CHARACTER = 7;
  1647. ivprog.RK_SWITCH = 8;
  1648. ivprog.RK_CASE = 9;
  1649. ivprog.RK_DEFAULT = 10;
  1650. ivprog.RK_CONST = 11;
  1651. ivprog.RK_FUNCTION = 12;
  1652. ivprog.RK_RETURN = 13;
  1653. ivprog.RK_FOR = 14;
  1654. ivprog.RK_BREAK = 15;
  1655. ivprog.RK_DO = 16;
  1656. ivprog.RK_WHILE = 17;
  1657. ivprog.RK_IF = 18;
  1658. ivprog.RK_ELSE = 19;
  1659. ivprog.RK_FALSE = 20;
  1660. ivprog.RK_TRUE = 21;
  1661. ivprog.OPEN_PARENTHESIS = 22;
  1662. ivprog.CLOSE_PARENTHESIS = 23;
  1663. ivprog.OPEN_BRACE = 24;
  1664. ivprog.CLOSE_BRACE = 25;
  1665. ivprog.OPEN_CURLY = 26;
  1666. ivprog.CLOSE_CURLY = 27;
  1667. ivprog.COMMA = 28;
  1668. ivprog.EQUAL = 29;
  1669. ivprog.SUM_OP = 30;
  1670. ivprog.MULTI_OP = 31;
  1671. ivprog.AND_OPERATOR = 32;
  1672. ivprog.OR_OPERATOR = 33;
  1673. ivprog.RELATIONAL_OPERATOR = 34;
  1674. ivprog.COLON = 35;
  1675. ivprog.NOT_OPERATOR = 36;
  1676. ivprog.ID = 37;
  1677. ivprog.LIB_ID = 38;
  1678. ivprog.INTEGER = 39;
  1679. ivprog.REAL = 40;
  1680. ivprog.STRING = 41;
  1681. ivprog.CHARACTER = 42;
  1682. ivprog.WHITESPACE = 43;
  1683. ivprog.EOS = 44;
  1684. ivprog.COMMENTS = 45;
  1685. ivprog.prototype.channelNames = [ "DEFAULT_TOKEN_CHANNEL", "HIDDEN" ];
  1686. ivprog.prototype.modeNames = [ "DEFAULT_MODE" ];
  1687. ivprog.prototype.literalNames = [ null, "'programa'", "'real'", "'vazio'",
  1688. "'logico'", "'cadeia'", "'inteiro'", "'caractere'",
  1689. "'escolha'", "'caso'", "'contrario'",
  1690. "'const'", "'funcao'", "'retorne'", "'para'",
  1691. "'pare'", "'faca'", "'enquanto'", "'se'",
  1692. "'senao'", "'falso'", "'verdadeiro'",
  1693. "'('", "')'", "'['", "']'", "'{'", "'}'",
  1694. "','", "'='", null, null, null, null,
  1695. null, "':'" ];
  1696. ivprog.prototype.symbolicNames = [ null, "RK_PROGRAM", "RK_REAL", "RK_VOID",
  1697. "RK_BOOLEAN", "RK_STRING", "RK_INTEGER",
  1698. "RK_CHARACTER", "RK_SWITCH", "RK_CASE",
  1699. "RK_DEFAULT", "RK_CONST", "RK_FUNCTION",
  1700. "RK_RETURN", "RK_FOR", "RK_BREAK", "RK_DO",
  1701. "RK_WHILE", "RK_IF", "RK_ELSE", "RK_FALSE",
  1702. "RK_TRUE", "OPEN_PARENTHESIS", "CLOSE_PARENTHESIS",
  1703. "OPEN_BRACE", "CLOSE_BRACE", "OPEN_CURLY",
  1704. "CLOSE_CURLY", "COMMA", "EQUAL", "SUM_OP",
  1705. "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1706. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1707. "ID", "LIB_ID", "INTEGER", "REAL", "STRING",
  1708. "CHARACTER", "WHITESPACE", "EOS", "COMMENTS" ];
  1709. ivprog.prototype.ruleNames = [ "RK_PROGRAM", "RK_REAL", "RK_VOID", "RK_BOOLEAN",
  1710. "RK_STRING", "RK_INTEGER", "RK_CHARACTER",
  1711. "RK_SWITCH", "RK_CASE", "RK_DEFAULT", "RK_CONST",
  1712. "RK_FUNCTION", "RK_RETURN", "RK_FOR", "RK_BREAK",
  1713. "RK_DO", "RK_WHILE", "RK_IF", "RK_ELSE",
  1714. "RK_FALSE", "RK_TRUE", "RK_LOGICAL_NOT",
  1715. "RK_LOGICAL_AND", "RK_LOGICAL_OR", "OPEN_PARENTHESIS",
  1716. "CLOSE_PARENTHESIS", "OPEN_BRACE", "CLOSE_BRACE",
  1717. "OPEN_CURLY", "CLOSE_CURLY", "COMMA", "EQUAL",
  1718. "SUM_OP", "MULTI_OP", "AND_OPERATOR", "OR_OPERATOR",
  1719. "RELATIONAL_OPERATOR", "COLON", "NOT_OPERATOR",
  1720. "ID", "LIB_ID", "INTEGER", "REAL", "ExponentPart",
  1721. "STRING", "STRING_CHARACTER", "CHARACTER",
  1722. "WHITESPACE", "SEMICOLON", "EOS", "HEX_DIGIT",
  1723. "OCTAL_DIGIT", "ESC_SEQ", "ESC_OCTAL", "ESC_UNICODE",
  1724. "COMMENTS" ];
  1725. ivprog.prototype.grammarFileName = "ivprog.g4";
  1726. exports.ivprog = ivprog;
  1727. /***/ }),
  1728. /* 1 */
  1729. /***/ (function(module, exports, __webpack_require__) {
  1730. module.exports = {
  1731. ivprog: __webpack_require__(0).ivprog
  1732. };
  1733. /***/ }),
  1734. /* 2 */
  1735. /***/ (function(module, exports) {
  1736. module.exports = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  1737. /***/ })
  1738. /******/ ]);
  1739. /***/ }),
  1740. /***/ "./grammar/pt/langFunctions.js":
  1741. /*!*************************************!*\
  1742. !*** ./grammar/pt/langFunctions.js ***!
  1743. \*************************************/
  1744. /*! exports provided: default */
  1745. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1746. "use strict";
  1747. __webpack_require__.r(__webpack_exports__);
  1748. /* This is a dictionary of the language defined functions
  1749. **/
  1750. /* harmony default export */ __webpack_exports__["default"] = ({
  1751. main_function: "inicio",
  1752. $read: "leia",
  1753. $write: "escreva",
  1754. $numElements: "total_de_elementos",
  1755. $matrixLines: "total_de_linhas",
  1756. $matrixColumns: "total_de_colunas",
  1757. $substring: "subcadeia",
  1758. $length: "comprimento",
  1759. $uppercase: "caixa_alta",
  1760. $lowercase: "caixa_baixa",
  1761. $charAt: "char_at",
  1762. $isReal: "e_real",
  1763. $isInt: "e_inteiro",
  1764. $isBool: "e_logico",
  1765. $castReal: "como_real",
  1766. $castInt: "como_inteiro",
  1767. $castBool: "como_logico",
  1768. $castString: "como_cadeia",
  1769. $sin: "seno",
  1770. $cos: "cosseno",
  1771. $tan: "tangente",
  1772. $sqrt: "raiz_quadrada",
  1773. $pow: "potencia",
  1774. $log: "logaritmo",
  1775. $abs: "modulo",
  1776. $negate: "trocar_sinal",
  1777. $invert: "inverter_valor",
  1778. $max: "maximo",
  1779. $min: "minimo"
  1780. });
  1781. /***/ }),
  1782. /***/ "./grammar/pt/langLibs.js":
  1783. /*!********************************!*\
  1784. !*** ./grammar/pt/langLibs.js ***!
  1785. \********************************/
  1786. /*! exports provided: default */
  1787. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1788. "use strict";
  1789. __webpack_require__.r(__webpack_exports__);
  1790. /**
  1791. * This is the dictionary of the language defined libraries
  1792. */
  1793. /* harmony default export */ __webpack_exports__["default"] = ({
  1794. $mathLib: "Matematica",
  1795. $ioLib: "ES",
  1796. $strLib: "Texto",
  1797. $arrayLib: "Arranjo",
  1798. $langLib: "Conversao"
  1799. });
  1800. /***/ }),
  1801. /***/ "./i18n/en/error.json":
  1802. /*!****************************!*\
  1803. !*** ./i18n/en/error.json ***!
  1804. \****************************/
  1805. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1806. /***/ (function(module) {
  1807. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1808. /***/ }),
  1809. /***/ "./i18n/en/index.js":
  1810. /*!**************************!*\
  1811. !*** ./i18n/en/index.js ***!
  1812. \**************************/
  1813. /*! exports provided: default */
  1814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1815. "use strict";
  1816. __webpack_require__.r(__webpack_exports__);
  1817. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/en/error.json");
  1818. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/en/error.json", 1);
  1819. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/en/message.json");
  1820. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/en/message.json", 1);
  1821. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/en/ui.json");
  1822. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/en/ui.json", 1);
  1823. /* harmony default export */ __webpack_exports__["default"] = ({
  1824. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1825. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1826. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1827. });
  1828. /***/ }),
  1829. /***/ "./i18n/en/message.json":
  1830. /*!******************************!*\
  1831. !*** ./i18n/en/message.json ***!
  1832. \******************************/
  1833. /*! exports provided: test_case_success, test_case_duration, default */
  1834. /***/ (function(module) {
  1835. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1836. /***/ }),
  1837. /***/ "./i18n/en/ui.json":
  1838. /*!*************************!*\
  1839. !*** ./i18n/en/ui.json ***!
  1840. \*************************/
  1841. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1842. /***/ (function(module) {
  1843. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1844. /***/ }),
  1845. /***/ "./i18n/es/error.json":
  1846. /*!****************************!*\
  1847. !*** ./i18n/es/error.json ***!
  1848. \****************************/
  1849. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, default */
  1850. /***/ (function(module) {
  1851. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1"};
  1852. /***/ }),
  1853. /***/ "./i18n/es/index.js":
  1854. /*!**************************!*\
  1855. !*** ./i18n/es/index.js ***!
  1856. \**************************/
  1857. /*! exports provided: default */
  1858. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1859. "use strict";
  1860. __webpack_require__.r(__webpack_exports__);
  1861. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/es/error.json");
  1862. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/es/error.json", 1);
  1863. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/es/message.json");
  1864. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/es/message.json", 1);
  1865. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/es/ui.json");
  1866. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/es/ui.json", 1);
  1867. /* harmony default export */ __webpack_exports__["default"] = ({
  1868. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1869. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1870. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1871. });
  1872. /***/ }),
  1873. /***/ "./i18n/es/message.json":
  1874. /*!******************************!*\
  1875. !*** ./i18n/es/message.json ***!
  1876. \******************************/
  1877. /*! exports provided: test_case_success, test_case_duration, default */
  1878. /***/ (function(module) {
  1879. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1880. /***/ }),
  1881. /***/ "./i18n/es/ui.json":
  1882. /*!*************************!*\
  1883. !*** ./i18n/es/ui.json ***!
  1884. \*************************/
  1885. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_comment, text_attribution, text_if, text_else, text_break, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_receives, text_repeatNtimes, text_return, text_btn_return, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1886. /***/ (function(module) {
  1887. module.exports = {"function":"function","btn_clear":"Clear","btn_function":"Function","btn_arithmetic_plus":"Sum","btn_arithmetic_minus":"Minus","btn_arithmetic_multiplication":"Multiplication","btn_arithmetic_division":"Division","btn_arithmetic_module":"Module","btn_break":"Break","btn_case":"Case","start":"start","void":"void","integer":"integer","real":"real","program":"program","text":"string","text_start":"text","boolean":"boolean","true":"true","false":"false","variable":"Variable","command":"Command","new_parameter":"new_parameter","new_variable":"new_variable","new_global":"new_global","new_function":"new_function","vector":"vector","text_comment_start":"Initial comment of function...","text_comment_main":"This is the main function...","text_read_var":"Reading data","text_write_var":"Writing data","text_command_read":"read","text_command_write":"write","text_comment":"Comment","text_attribution":"Attribution","text_if":"if","text_else":"else","text_break":"break","text_for":"for","text_code_while":"while","text_code_do":"do","text_command_do":"do","text_code_switch":"switch","text_code_case":"case","text_logic_expression":"Logic Expression","text_arithmetic_expression":"Relational Expression","text_iftrue":"If true then","text_receives":"receives","text_repeatNtimes":"Repeat N times","text_return":"return","text_btn_return":"Return","text_whiletrue":"While true","text_dowhiletrue":"Do while true","text_switch":"Switch","text_functioncall":"Function call","text_value":"Value","text_operator":"Operator","text_parentheses":"Parentheses","text_change":"Change","text_teacher_algorithm":"Algorithm","text_teacher_algorithm_include":"Include the following algorithm in exercise","text_teacher_test_case":"Test cases","text_teacher_config":"Settings","text_teacher_data_types":"Data types","text_teacher_commands":"Commands","text_teacher_functions":"Functions","text_teacher_create_functions":"Create new functions","text_teacher_create_movement_functions":"Move functions","text_teacher_test_case_input":"Input","text_teacher_test_case_output":"Output","text_teacher_test_case_actions":"Actions","text_teacher_test_case_add":"Add test cases","text_header_ivprog_functions":"iVProg Functions","text_menu_functions_math":"Mathematic","text_menu_functions_text":"Text","text_menu_functions_arrangement":"Arrangement","text_menu_functions_conversion":"Conversion","text_none_variable":"There is no declared variable","text_none_variable_instruction":"Create a new variable to use it","text_ivprog_description":"Interactive Visual Programming on the Internet","tooltip_visual":"Visual programming","tooltip_textual":"Textual programming","tooltip_upload":"Upload code file","tooltip_download":"Download code file","tooltip_undo":"Undo","tooltip_redo":"Redo","tooltip_run":"Run program","tooltip_evaluate":"Evaluate program","tooltip_help":"Help","tooltip_add_global":"Add global variable","tooltip_minimize":"Hidde function elements","tooltip_console":"Open/Close console","var_menu_select_var":"Select a var","var_menu_select_all":"Select","var_menu_select_function":"Select a function","expression_menu_select":"Construct any logical condition","math":"Mathematic","text_t":"Text","inform_valid_name":"Inform a valid name!","inform_valid_content":"Enter some content!","inform_valid_expression":"Construct the logical condition!","inform_valid_name_duplicated":"This name is already in use by other function.","inform_valid_global_duplicated":"A global variable with this name already exists.","inform_valid_variable_duplicated":"A local variable with this name already exists.","arrangement":"Arrangement","conversion":"Conversion","$sin":"sin","$cos":"cos","$tan":"tan","$sqrt":"sqrt","$pow":"pow","$log":"log","$abs":"abs","$negate":"negate","$invert":"invert","$max":"maximum","$min":"minimum","$substring":"substring","$length":"length","$uppercase":"uppercase","$lowercase":"lowercase","$charAt":"char_at","$numElements":"total_of_elements","$matrixLines":"total_of_lines","$matrixColumns":"total_of_columns","$isReal":"is_real","$isInt":"is_integer","$isBool":"is_logic","$castReal":"to_real","$castInt":"to_integer","$castBool":"to_logic","$castString":"to_string","text_ivprog_version":"Version"};
  1888. /***/ }),
  1889. /***/ "./i18n/index.js":
  1890. /*!***********************!*\
  1891. !*** ./i18n/index.js ***!
  1892. \***********************/
  1893. /*! exports provided: default */
  1894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1895. "use strict";
  1896. __webpack_require__.r(__webpack_exports__);
  1897. /* harmony import */ var _en__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./en */ "./i18n/en/index.js");
  1898. /* harmony import */ var _pt__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./pt */ "./i18n/pt/index.js");
  1899. /* harmony import */ var _es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./es */ "./i18n/es/index.js");
  1900. /* harmony default export */ __webpack_exports__["default"] = ({
  1901. 'en': _en__WEBPACK_IMPORTED_MODULE_0__["default"],
  1902. 'pt': _pt__WEBPACK_IMPORTED_MODULE_1__["default"],
  1903. 'es': _es__WEBPACK_IMPORTED_MODULE_2__["default"]
  1904. });
  1905. /***/ }),
  1906. /***/ "./i18n/pt/error.json":
  1907. /*!****************************!*\
  1908. !*** ./i18n/pt/error.json ***!
  1909. \****************************/
  1910. /*! exports provided: token_missing_one, token_missing_two, eos_missing, invalid_type, invalid_array_dimension, invalid_array_size, extra_lines, invalid_main_return, invalid_var_declaration, invalid_break_command, invalid_terminal, const_not_init, id_missing, invalid_id_format, main_missing, invalid_global_var, not_implemented, function_missing, function_missing_full, invalid_parameters_size_full, invalid_parameters_size, invalid_ref_full, invalid_ref, invalid_parameter_type_full, invalid_parameter_type, unknown_command_full, unknown_command, loop_condition_type_full, loop_condition_type, endless_loop_full, endless_loop, for_condition_type_full, for_condition_type, if_condition_type_full, if_condition_type, invalid_return_type_full, invalid_return_type, invalid_void_return_full, invalid_void_return, unexpected_break_command_full, unexpected_break_command, invalid_dimension, void_in_expression_full, void_in_expression, invalid_array_access_full, invalid_array_access, invalid_matrix_access_full, invalid_matrix_access, matrix_column_outbounds_full, matrix_column_outbounds, matrix_line_outbounds_full, matrix_line_outbounds, vector_line_outbounds_full, vector_line_outbounds, vector_not_matrix_full, vector_not_matrix, invalid_infix_op_full, invalid_infix_op, invalid_unary_op_full, invalid_unary_op, unknown_op, duplicate_function, duplicate_variable, main_parameters, symbol_not_found_full, symbol_not_found, array_dimension_not_int_full, array_dimension_not_int, array_dimension_not_positive_full, array_dimension_not_positive, incompatible_types_full, incompatible_types, incompatible_types_array_full, incompatible_types_array, invalid_case_type_full, invalid_case_type, function_no_return, invalid_array_literal_type_full, invalid_array_literal_type, invalid_array_literal_line_full, invalid_array_literal_line, invalid_array_literal_column_full, invalid_array_literal_column, exceeded_input_request, test_case_few_reads, test_case_failed, test_case_failed_exception, invalid_type_conversion, default */
  1911. /***/ (function(module) {
  1912. module.exports = {"token_missing_one":"Erro de sintaxe: Espera-se $0, mas encontrou-se $1 na linha:$2, coluna:$3","token_missing_two":"Erro de sintaxe: Esperava-se $0 ou $1 mas encontrou-se $2 na liha:$3, coluna: $4","eos_missing":"Falta uma nova linha ou ; na linha: $0, coluna: $1","invalid_type":"$0 na linha: $1, coluna: $2 é um tipo inválido. Os tipos válidos são: $3","invalid_array_dimension":"A dimensão inválida na linha: $0, coluna: $1. Insira um $2 ou identificador válido do mesmo tipo.","invalid_array_size":"O tamnho do vetor/matriz excede o máximo de 2 na linha $0","extra_lines":"Nenhum texto é permitido após '}' em 'programa {...}'","invalid_main_return":"A função $0 deve retornar $1 na linha $2","invalid_var_declaration":"Erro na linha $0. Variáveis só podem ser declarados no corpo principal da função e de preferência nas primeiras linhas.","invalid_break_command":"Erro na linha $0. O comando $1 não pode ser usado fora de uma estrutura de repetição ou 'escolha...caso'","invalid_terminal":"Não é possível utilizar $0 na expressão da linha: $1, coluna: $2. Tente um valor númerico, variável ou chamada de função.","const_not_init":"Erro na linha: $0, coluna: $1. Uma variável declarada como const deve ser inicializada","id_missing":"Esperava-se um identificador, mas encontrou-se $0 na linha: $1, coluna: $2","invalid_id_format":"$0 na linha: $1, coluna: $2 não é um identificador válido. O símbolo '.' não é permitido neste contexto.","main_missing":"A função principal não foi encontrada","invalid_global_var":"Erro crítico: Chamada inválida da função initGlobal fora do contexto BASE","not_implemented":"Erro interno crítico: A função definida pelo sistema $0 não foi implementada.","function_missing":"A função $0 não foi encontrada","function_missing_full":"A função $0 na linha: $1, coluna: $2 não foi encontrada","invalid_parameters_size_full":"Erro na linha $0: a quantidade de parâmetros fornecidos à função $1 está incorreta. Esperava-se $2, encontrou-se $3.","invalid_parameters_size":"A quantidade de parâmetros fornecidos à função $0 está incorreta. Esperava-se $1, encontrou-se $2","invalid_ref_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_ref":"A expressão $0 fornecida como parâmetro para a função $1 não é válida para esta função. Use uma variável ou posição de vetor.","invalid_parameter_type_full":"A expressão $0 fornecida como parâmetro para a função $1 na linha $2 não é compatível com o tipo esperado.","invalid_parameter_type":"A expressão $0 fornecida como parâmetro para a função $1 não é compatível com o tipo esperado.","unknown_command_full":"Erro interno crítico: comando desconhecido encontrado na linha $0","unknown_command":"Erro interno crítico: comando desconhecido encontrado!","loop_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do laço de repetição deve ser do tipo lógico","loop_condition_type":"A condição $0 do laço de repetição deve ser do tipo lógico","endless_loop_full":"Possível laço infinito detectado no seu código. Verifique a linha $0","endless_loop":"Possível laço infinito detectado no seu código.","for_condition_type_full":"Erro na linha: $0, coluna $1: a condição de parada $2 do comando para(...) deve ser do tipo lógico","for_condition_type":"A condição de parada $0 do comando para(...) deve ser do tipo lógico","if_condition_type_full":"Erro na linha: $0, coluna $1: a condição $2 do comando se...senao deve ser do tipo lógico","if_condition_type":"A condição $0 do comando se...senao deve ser do tipo lógico","invalid_return_type_full":"Erro na linha $0: a expressão não produz um tipo compatível com a função $1. Tipo esperado: $2.","invalid_return_type":"A expressão não produz um tipo compatível com a função $0. Tipo esperado: $1.","invalid_void_return_full":"Erro na linha $0: a função $1 não pode retornar uma expressão vazia, use uma espressão do tipo $2","invalid_void_return":"A função $0 não pode retornar uma expressão vazia, use uma espressão do tipo $1","unexpected_break_command_full":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso na linha $0","unexpected_break_command":"Erro interno crítico: comando pare encontrado fora do contexto de um laço/escolha..caso","invalid_dimension":"As dimensões de um vetor/matriz devem ser do tipo inteiro","void_in_expression_full":"Erro na linha: $0, coluna: $1: a função $2 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","void_in_expression":"A função $0 não pode ser utilizada em uma expressão pois seu tipo de retorno é vazio","invalid_array_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a um vetor/matriz válido","invalid_array_access":"Identificador $0 não se refere a um vetor/matriz válido","invalid_matrix_access_full":"Identificador $0 na linha: $1, coluna: $2 não se refere a uma matriz válida","invalid_matrix_access":"Identificador $0 não se refere a uma matriz válida","matrix_column_outbounds_full":"Erro na linha $0: número de colunas $1 é inválido para a matriz $2 que possui $3 colunas","matrix_column_outbounds":"Número de colunas $0 é inválido para a matriz $1 que possui $2 colunas","matrix_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","matrix_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_line_outbounds_full":"Erro na linha $0: número de linhas $1 é inválido para a matriz $2 que possui $3 linhas","vector_line_outbounds":"Número de linhas $0 é inválido para a matriz $1 que possui $2 linhas","vector_not_matrix_full":"Erro na linha $0: $1 não é uma matriz","vector_not_matrix":"$1 não é uma matriz","invalid_infix_op_full":"Erro na linha $0: não é possível aplicar a operação $1 entre os tipos $2 e $3","invalid_infix_op":"Não é possível aplicar a operação $0 entre os tipos $1 e $2","invalid_unary_op_full":"Erro na linha $0: não é possível aplicar a operação $1 ao tipo $2","invalid_unary_op":"Não é possível aplicar a operação $0 ao tipo $1","unknown_op":"Erro interno crítico: Operação $0 desconhecida","duplicate_function":"A função $0 na linha: $1, coluna: $2 já foi definida anteriormente.","duplicate_variable":"A variável $0 na linha: $1, coluna: $2 já foi declarada anteriormente.","main_parameters":"A função inicio não pode ter parâmetros.","symbol_not_found_full":"A variável $0 na linha: $1, coluna: $2 não foi declarada","symbol_not_found":"A variável $0 não foi declarada","array_dimension_not_int_full":"As dimensões de um vetor/matriz na linha: $0 devem ser do tipo inteiro.","array_dimension_not_int":"As dimensões de um vetor/matriz devem ser do tipo inteiro.","array_dimension_not_positive_full":"As dimensões de um vetor/matriz na linha: $0 devem ser valores positivos.","array_dimension_not_positive":"As dimensões de um vetor/matriz devem ser valores positivos.","incompatible_types_full":"O tipo $0 não é compatível com o tipo resultante da expressão na linha $1","incompatible_types":"O tipo $0 não é compatível com o tipo resultante da expressão fornecida.","incompatible_types_array_full":"A expressão $0 é incompatível com o tipo $1 na linha: $2, coluna: $3.","incompatible_types_array":"A expressão $0 é incompatível com o tipo $1.","invalid_case_type_full":"O caso $0 na linha $1 é incompatível com o tipo $2.","invalid_case_type":"O caso $0 é incompatível com o tipo $1.","function_no_return":"A função $0 não possui um retorno acessível. Toda função deve ter ao menos um retorno no seu corpo principal.","invalid_array_literal_type_full":"Erro na linha $0: a expressão $1 não resulta em um tipo compatível.","invalid_array_literal_type":"A expressão $0 não resulta em um tipo compatível.","invalid_array_literal_line_full":"Erro na linha $0: esperava-se $1 linhas mas encontrou $2.","invalid_array_literal_line":"Esperava-se $0 linhas mas encontrou $1.","invalid_array_literal_column_full":"Erro na linha $0: esperava-se $1 colunas mas encontrou $2.","invalid_array_literal_column":"Esperava-se $0 colunas mas encontrou $1.","exceeded_input_request":"A quantidade de leituras requisitadas execedeu a quantidade de entradas disponíveis.","test_case_few_reads":"Caso de teste $0 falhou: ainda restam entradas!","test_case_failed":"Caso de teste $0 falhou: entradas:<$1>; saída esperada:<$2>; saída:<$3>","test_case_failed_exception":"Caso de teste $0 falhou: $1","invalid_type_conversion":"O valor $0 não pode ser convertido para o tipo $1"};
  1913. /***/ }),
  1914. /***/ "./i18n/pt/index.js":
  1915. /*!**************************!*\
  1916. !*** ./i18n/pt/index.js ***!
  1917. \**************************/
  1918. /*! exports provided: default */
  1919. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  1920. "use strict";
  1921. __webpack_require__.r(__webpack_exports__);
  1922. /* harmony import */ var _error_json__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./error.json */ "./i18n/pt/error.json");
  1923. var _error_json__WEBPACK_IMPORTED_MODULE_0___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./error.json */ "./i18n/pt/error.json", 1);
  1924. /* harmony import */ var _message_json__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./message.json */ "./i18n/pt/message.json");
  1925. var _message_json__WEBPACK_IMPORTED_MODULE_1___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./message.json */ "./i18n/pt/message.json", 1);
  1926. /* harmony import */ var _ui_json__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ui.json */ "./i18n/pt/ui.json");
  1927. var _ui_json__WEBPACK_IMPORTED_MODULE_2___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./ui.json */ "./i18n/pt/ui.json", 1);
  1928. /* harmony default export */ __webpack_exports__["default"] = ({
  1929. 'message': _message_json__WEBPACK_IMPORTED_MODULE_1__,
  1930. 'error': _error_json__WEBPACK_IMPORTED_MODULE_0__,
  1931. 'ui': _ui_json__WEBPACK_IMPORTED_MODULE_2__
  1932. });
  1933. /***/ }),
  1934. /***/ "./i18n/pt/message.json":
  1935. /*!******************************!*\
  1936. !*** ./i18n/pt/message.json ***!
  1937. \******************************/
  1938. /*! exports provided: test_case_success, test_case_duration, default */
  1939. /***/ (function(module) {
  1940. module.exports = {"test_case_success":"Caso de teste $0: OK","test_case_duration":"Levou $0ms"};
  1941. /***/ }),
  1942. /***/ "./i18n/pt/ui.json":
  1943. /*!*************************!*\
  1944. !*** ./i18n/pt/ui.json ***!
  1945. \*************************/
  1946. /*! exports provided: function, btn_clear, btn_function, btn_arithmetic_plus, btn_arithmetic_minus, btn_arithmetic_multiplication, btn_arithmetic_division, btn_arithmetic_module, btn_break, btn_case, start, void, integer, and, or, not, real, program, text, text_start, boolean, true, false, variable, command, new_parameter, new_variable, new_global, new_function, vector, text_comment_start, text_comment_main, text_read_var, text_write_var, text_command_read, text_command_write, text_return, text_btn_return, text_comment, join_or, matrix_string, vector_string, text_attribution, text_if, text_break, text_else, text_for, text_code_while, text_code_do, text_command_do, text_code_switch, text_code_case, text_logic_expression, text_arithmetic_expression, text_iftrue, text_repeatNtimes, text_receives, text_whiletrue, text_dowhiletrue, text_switch, text_functioncall, text_value, text_operator, text_parentheses, text_change, text_teacher_algorithm, text_teacher_algorithm_include, text_teacher_test_case, text_teacher_config, text_teacher_data_types, text_teacher_commands, text_teacher_functions, text_teacher_create_functions, text_teacher_create_movement_functions, text_teacher_test_case_input, text_teacher_test_case_output, text_teacher_test_case_actions, text_teacher_test_case_add, text_header_ivprog_functions, text_menu_functions_math, text_menu_functions_text, text_menu_functions_arrangement, text_menu_functions_conversion, text_none_variable, text_none_variable_instruction, text_ivprog_description, tooltip_visual, tooltip_textual, tooltip_upload, tooltip_download, tooltip_undo, tooltip_redo, tooltip_run, tooltip_evaluate, tooltip_help, tooltip_add_global, tooltip_minimize, tooltip_console, var_menu_select_var, var_menu_select_all, var_menu_select_function, expression_menu_select, math, text_t, inform_valid_name, inform_valid_content, inform_valid_expression, inform_valid_name_duplicated, inform_valid_global_duplicated, inform_valid_variable_duplicated, arrangement, conversion, $sin, $cos, $tan, $sqrt, $pow, $log, $abs, $negate, $invert, $max, $min, $substring, $length, $uppercase, $lowercase, $charAt, $numElements, $matrixLines, $matrixColumns, $isReal, $isInt, $isBool, $castReal, $castInt, $castBool, $castString, text_ivprog_version, default */
  1947. /***/ (function(module) {
  1948. module.exports = {"function":"funcao","btn_clear":"Limpar","btn_function":"Função","btn_arithmetic_plus":"Adição","btn_arithmetic_minus":"Subtração","btn_arithmetic_multiplication":"Multiplicação","btn_arithmetic_division":"Divisão","btn_arithmetic_module":"Módulo","btn_break":"Pare","btn_case":"Caso","start":"inicio","void":"vazio","integer":"inteiro","and":"E","or":"OU","not":"nao","real":"real","program":"programa","text":"cadeia","text_start":"texto","boolean":"logico","true":"verdadeiro","false":"falso","variable":"Variável","command":"Comando","new_parameter":"novo_parametro","new_variable":"nova_variavel","new_global":"nova_global","new_function":"nova_funcao","vector":"vetor","text_comment_start":"Comentário inicial da função...","text_comment_main":"Esta é a função principal...","text_read_var":"Leitura de dados","text_write_var":"Escrita de dados","text_command_read":"leia","text_command_write":"escreva","text_return":"retorne","text_btn_return":"Retorno","text_comment":"Comentário","join_or":"ou","matrix_string":"matriz de $0","vector_string":"vetor de $0","text_attribution":"Atribuição","text_if":"se","text_break":"pare","text_else":"senao","text_for":"para","text_code_while":"enquanto","text_code_do":"faca","text_command_do":"faça","text_code_switch":"escolha","text_code_case":"caso","text_logic_expression":"Expressão Lógica","text_arithmetic_expression":"Expressão Relacional","text_iftrue":"Se verdadeiro então","text_repeatNtimes":"Repita N vezes","text_receives":"recebe","text_whiletrue":"Enquanto verdadeiro","text_dowhiletrue":"Faça enquanto verdadeiro","text_switch":"Escolha","text_functioncall":"Chamada de função","text_value":"Valor","text_operator":"Operador","text_parentheses":"Parênteses","text_change":"Alterar","text_teacher_algorithm":"Algoritmo","text_teacher_algorithm_include":"Incluir o algoritmo abaixo no exercício","text_teacher_test_case":"Casos de teste","text_teacher_config":"Configurações","text_teacher_data_types":"Tipos de dados","text_teacher_commands":"Comandos","text_teacher_functions":"Funções","text_teacher_create_functions":"Criar novas funções","text_teacher_create_movement_functions":"Movimentar funções","text_teacher_test_case_input":"Entrada","text_teacher_test_case_output":"Saída","text_teacher_test_case_actions":"Ações","text_teacher_test_case_add":"Adicionar caso de teste","text_header_ivprog_functions":"Funções do iVProg","text_menu_functions_math":"Matemática","text_menu_functions_text":"Texto","text_menu_functions_arrangement":"Arranjo","text_menu_functions_conversion":"Conversão","text_none_variable":"Nenhuma variável declarada","text_none_variable_instruction":"Antes de utilizar uma variável, é necessário criá-la","text_ivprog_description":"Programação Visual interativa na Internet","tooltip_visual":"Programação visual","tooltip_textual":"Programação textual","tooltip_upload":"Upload de código fonte","tooltip_download":"Download do código fonte","tooltip_undo":"Desfazer","tooltip_redo":"Refazer","tooltip_run":"Executar o programa","tooltip_evaluate":"Avaliar o programa","tooltip_help":"Ajuda","tooltip_add_global":"Adicionar variável global","tooltip_minimize":"Ocultar os elementos da função","tooltip_console":"Abrir/fechar o terminal","var_menu_select_var":"Selecione uma variável","var_menu_select_all":"Selecione","var_menu_select_function":"Selecione uma função","expression_menu_select":"Construir uma expressão lógica","math":"Matematica","text_t":"Texto","inform_valid_name":"Informe um nome válido!","inform_valid_content":"Informe o conteúdo!","inform_valid_expression":"Construa uma expressão lógica!","inform_valid_name_duplicated":"Este nome já está em uso por outra função!","inform_valid_global_duplicated":"Já existe uma variável global com o nome informado.","inform_valid_variable_duplicated":"Já existe uma variável local com o nome informado.","arrangement":"Arranjo","conversion":"Conversao","$sin":"seno","$cos":"cosseno","$tan":"tangente","$sqrt":"raiz_quadrada","$pow":"potencia","$log":"logaritmo","$abs":"modulo","$negate":"trocar_sinal","$invert":"inverter_valor","$max":"maximo","$min":"minimo","$substring":"subcadeia","$length":"comprimento","$uppercase":"caixa_alta","$lowercase":"caixa_baixa","$charAt":"texto_na_posicao","$numElements":"total_de_elementos","$matrixLines":"total_de_linhas","$matrixColumns":"total_de_colunas","$isReal":"e_real","$isInt":"e_inteiro","$isBool":"e_logico","$castReal":"como_real","$castInt":"como_inteiro","$castBool":"como_logico","$castString":"como_cadeia","text_ivprog_version":"Versão"};
  1949. /***/ }),
  1950. /***/ "./js/Sortable.js":
  1951. /*!************************!*\
  1952. !*** ./js/Sortable.js ***!
  1953. \************************/
  1954. /*! no static exports found */
  1955. /***/ (function(module, exports, __webpack_require__) {
  1956. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1957. /**!
  1958. * Sortable
  1959. * @author RubaXa <trash@rubaxa.org>
  1960. * @license MIT
  1961. */
  1962. (function sortableModule(factory) {
  1963. "use strict";
  1964. if (true) {
  1965. !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  1966. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  1967. (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
  1968. __WEBPACK_AMD_DEFINE_FACTORY__),
  1969. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  1970. } else {}
  1971. })(function sortableFactory() {
  1972. "use strict";
  1973. if (typeof window == "undefined" || !window.document) {
  1974. return function sortableError() {
  1975. throw new Error("Sortable.js requires a window with a document");
  1976. };
  1977. }
  1978. var dragEl,
  1979. parentEl,
  1980. ghostEl,
  1981. cloneEl,
  1982. rootEl,
  1983. nextEl,
  1984. lastDownEl,
  1985. scrollEl,
  1986. scrollParentEl,
  1987. scrollCustomFn,
  1988. lastEl,
  1989. lastCSS,
  1990. lastParentCSS,
  1991. oldIndex,
  1992. newIndex,
  1993. activeGroup,
  1994. putSortable,
  1995. autoScroll = {},
  1996. tapEvt,
  1997. touchEvt,
  1998. moved,
  1999. /** @const */
  2000. R_SPACE = /\s+/g,
  2001. R_FLOAT = /left|right|inline/,
  2002. expando = 'Sortable' + new Date().getTime(),
  2003. win = window,
  2004. document = win.document,
  2005. parseInt = win.parseInt,
  2006. $ = win.jQuery || win.Zepto,
  2007. Polymer = win.Polymer,
  2008. captureMode = false,
  2009. supportDraggable = !!('draggable' in document.createElement('div')),
  2010. supportCssPointerEvents = function (el) {
  2011. // false when IE11
  2012. if (!!navigator.userAgent.match(/Trident.*rv[ :]?11\./)) {
  2013. return false;
  2014. }
  2015. el = document.createElement('x');
  2016. el.style.cssText = 'pointer-events:auto';
  2017. return el.style.pointerEvents === 'auto';
  2018. }(),
  2019. _silent = false,
  2020. abs = Math.abs,
  2021. min = Math.min,
  2022. savedInputChecked = [],
  2023. touchDragOverListeners = [],
  2024. _autoScroll = _throttle(function (
  2025. /**Event*/
  2026. evt,
  2027. /**Object*/
  2028. options,
  2029. /**HTMLElement*/
  2030. rootEl) {
  2031. // Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=505521
  2032. if (rootEl && options.scroll) {
  2033. var _this = rootEl[expando],
  2034. el,
  2035. rect,
  2036. sens = options.scrollSensitivity,
  2037. speed = options.scrollSpeed,
  2038. x = evt.clientX,
  2039. y = evt.clientY,
  2040. winWidth = window.innerWidth,
  2041. winHeight = window.innerHeight,
  2042. vx,
  2043. vy,
  2044. scrollOffsetX,
  2045. scrollOffsetY; // Delect scrollEl
  2046. if (scrollParentEl !== rootEl) {
  2047. scrollEl = options.scroll;
  2048. scrollParentEl = rootEl;
  2049. scrollCustomFn = options.scrollFn;
  2050. if (scrollEl === true) {
  2051. scrollEl = rootEl;
  2052. do {
  2053. if (scrollEl.offsetWidth < scrollEl.scrollWidth || scrollEl.offsetHeight < scrollEl.scrollHeight) {
  2054. break;
  2055. }
  2056. /* jshint boss:true */
  2057. } while (scrollEl = scrollEl.parentNode);
  2058. }
  2059. }
  2060. if (scrollEl) {
  2061. el = scrollEl;
  2062. rect = scrollEl.getBoundingClientRect();
  2063. vx = (abs(rect.right - x) <= sens) - (abs(rect.left - x) <= sens);
  2064. vy = (abs(rect.bottom - y) <= sens) - (abs(rect.top - y) <= sens);
  2065. }
  2066. if (!(vx || vy)) {
  2067. vx = (winWidth - x <= sens) - (x <= sens);
  2068. vy = (winHeight - y <= sens) - (y <= sens);
  2069. /* jshint expr:true */
  2070. (vx || vy) && (el = win);
  2071. }
  2072. if (autoScroll.vx !== vx || autoScroll.vy !== vy || autoScroll.el !== el) {
  2073. autoScroll.el = el;
  2074. autoScroll.vx = vx;
  2075. autoScroll.vy = vy;
  2076. clearInterval(autoScroll.pid);
  2077. if (el) {
  2078. autoScroll.pid = setInterval(function () {
  2079. scrollOffsetY = vy ? vy * speed : 0;
  2080. scrollOffsetX = vx ? vx * speed : 0;
  2081. if ('function' === typeof scrollCustomFn) {
  2082. return scrollCustomFn.call(_this, scrollOffsetX, scrollOffsetY, evt);
  2083. }
  2084. if (el === win) {
  2085. win.scrollTo(win.pageXOffset + scrollOffsetX, win.pageYOffset + scrollOffsetY);
  2086. } else {
  2087. el.scrollTop += scrollOffsetY;
  2088. el.scrollLeft += scrollOffsetX;
  2089. }
  2090. }, 24);
  2091. }
  2092. }
  2093. }
  2094. }, 30),
  2095. _prepareGroup = function _prepareGroup(options) {
  2096. function toFn(value, pull) {
  2097. if (value === void 0 || value === true) {
  2098. value = group.name;
  2099. }
  2100. if (typeof value === 'function') {
  2101. return value;
  2102. } else {
  2103. return function (to, from) {
  2104. var fromGroup = from.options.group.name;
  2105. return pull ? value : value && (value.join ? value.indexOf(fromGroup) > -1 : fromGroup == value);
  2106. };
  2107. }
  2108. }
  2109. var group = {};
  2110. var originalGroup = options.group;
  2111. if (!originalGroup || _typeof(originalGroup) != 'object') {
  2112. originalGroup = {
  2113. name: originalGroup
  2114. };
  2115. }
  2116. group.name = originalGroup.name;
  2117. group.checkPull = toFn(originalGroup.pull, true);
  2118. group.checkPut = toFn(originalGroup.put);
  2119. group.revertClone = originalGroup.revertClone;
  2120. options.group = group;
  2121. };
  2122. /**
  2123. * @class Sortable
  2124. * @param {HTMLElement} el
  2125. * @param {Object} [options]
  2126. */
  2127. function Sortable(el, options) {
  2128. if (!(el && el.nodeType && el.nodeType === 1)) {
  2129. throw 'Sortable: `el` must be HTMLElement, and not ' + {}.toString.call(el);
  2130. }
  2131. this.el = el; // root element
  2132. this.options = options = _extend({}, options); // Export instance
  2133. el[expando] = this; // Default options
  2134. var defaults = {
  2135. group: Math.random(),
  2136. sort: true,
  2137. disabled: false,
  2138. store: null,
  2139. handle: null,
  2140. scroll: true,
  2141. scrollSensitivity: 30,
  2142. scrollSpeed: 10,
  2143. draggable: /[uo]l/i.test(el.nodeName) ? 'li' : '>*',
  2144. ghostClass: 'sortable-ghost',
  2145. chosenClass: 'sortable-chosen',
  2146. dragClass: 'sortable-drag',
  2147. ignore: 'a, img',
  2148. filter: null,
  2149. preventOnFilter: true,
  2150. animation: 0,
  2151. setData: function setData(dataTransfer, dragEl) {
  2152. dataTransfer.setData('Text', dragEl.textContent);
  2153. },
  2154. dropBubble: false,
  2155. dragoverBubble: false,
  2156. dataIdAttr: 'data-id',
  2157. delay: 0,
  2158. forceFallback: false,
  2159. fallbackClass: 'sortable-fallback',
  2160. fallbackOnBody: false,
  2161. fallbackTolerance: 0,
  2162. fallbackOffset: {
  2163. x: 0,
  2164. y: 0
  2165. }
  2166. }; // Set default options
  2167. for (var name in defaults) {
  2168. !(name in options) && (options[name] = defaults[name]);
  2169. }
  2170. _prepareGroup(options); // Bind all private methods
  2171. for (var fn in this) {
  2172. if (fn.charAt(0) === '_' && typeof this[fn] === 'function') {
  2173. this[fn] = this[fn].bind(this);
  2174. }
  2175. } // Setup drag mode
  2176. this.nativeDraggable = options.forceFallback ? false : supportDraggable; // Bind events
  2177. _on(el, 'mousedown', this._onTapStart);
  2178. _on(el, 'touchstart', this._onTapStart);
  2179. _on(el, 'pointerdown', this._onTapStart);
  2180. if (this.nativeDraggable) {
  2181. _on(el, 'dragover', this);
  2182. _on(el, 'dragenter', this);
  2183. }
  2184. touchDragOverListeners.push(this._onDragOver); // Restore sorting
  2185. options.store && this.sort(options.store.get(this));
  2186. }
  2187. Sortable.prototype =
  2188. /** @lends Sortable.prototype */
  2189. {
  2190. constructor: Sortable,
  2191. _onTapStart: function _onTapStart(
  2192. /** Event|TouchEvent */
  2193. evt) {
  2194. var _this = this,
  2195. el = this.el,
  2196. options = this.options,
  2197. preventOnFilter = options.preventOnFilter,
  2198. type = evt.type,
  2199. touch = evt.touches && evt.touches[0],
  2200. target = (touch || evt).target,
  2201. originalTarget = evt.target.shadowRoot && evt.path && evt.path[0] || target,
  2202. filter = options.filter,
  2203. startIndex;
  2204. _saveInputCheckedState(el); // Don't trigger start event when an element is been dragged, otherwise the evt.oldindex always wrong when set option.group.
  2205. if (dragEl) {
  2206. return;
  2207. }
  2208. if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) {
  2209. return; // only left button or enabled
  2210. }
  2211. target = _closest(target, options.draggable, el);
  2212. if (!target) {
  2213. return;
  2214. }
  2215. if (lastDownEl === target) {
  2216. // Ignoring duplicate `down`
  2217. return;
  2218. } // Get the index of the dragged element within its parent
  2219. startIndex = _index(target, options.draggable); // Check filter
  2220. if (typeof filter === 'function') {
  2221. if (filter.call(this, evt, target, this)) {
  2222. _dispatchEvent(_this, originalTarget, 'filter', target, el, startIndex);
  2223. preventOnFilter && evt.preventDefault();
  2224. return; // cancel dnd
  2225. }
  2226. } else if (filter) {
  2227. filter = filter.split(',').some(function (criteria) {
  2228. criteria = _closest(originalTarget, criteria.trim(), el);
  2229. if (criteria) {
  2230. _dispatchEvent(_this, criteria, 'filter', target, el, startIndex);
  2231. return true;
  2232. }
  2233. });
  2234. if (filter) {
  2235. preventOnFilter && evt.preventDefault();
  2236. return; // cancel dnd
  2237. }
  2238. }
  2239. if (options.handle && !_closest(originalTarget, options.handle, el)) {
  2240. return;
  2241. } // Prepare `dragstart`
  2242. this._prepareDragStart(evt, touch, target, startIndex);
  2243. },
  2244. _prepareDragStart: function _prepareDragStart(
  2245. /** Event */
  2246. evt,
  2247. /** Touch */
  2248. touch,
  2249. /** HTMLElement */
  2250. target,
  2251. /** Number */
  2252. startIndex) {
  2253. var _this = this,
  2254. el = _this.el,
  2255. options = _this.options,
  2256. ownerDocument = el.ownerDocument,
  2257. dragStartFn;
  2258. if (target && !dragEl && target.parentNode === el) {
  2259. tapEvt = evt;
  2260. rootEl = el;
  2261. dragEl = target;
  2262. parentEl = dragEl.parentNode;
  2263. nextEl = dragEl.nextSibling;
  2264. lastDownEl = target;
  2265. activeGroup = options.group;
  2266. oldIndex = startIndex;
  2267. this._lastX = (touch || evt).clientX;
  2268. this._lastY = (touch || evt).clientY;
  2269. dragEl.style['will-change'] = 'transform';
  2270. dragStartFn = function dragStartFn() {
  2271. // Delayed drag has been triggered
  2272. // we can re-enable the events: touchmove/mousemove
  2273. _this._disableDelayedDrag(); // Make the element draggable
  2274. dragEl.draggable = _this.nativeDraggable; // Chosen item
  2275. _toggleClass(dragEl, options.chosenClass, true); // Bind the events: dragstart/dragend
  2276. _this._triggerDragStart(evt, touch); // Drag start event
  2277. _dispatchEvent(_this, rootEl, 'choose', dragEl, rootEl, oldIndex);
  2278. }; // Disable "draggable"
  2279. options.ignore.split(',').forEach(function (criteria) {
  2280. _find(dragEl, criteria.trim(), _disableDraggable);
  2281. });
  2282. _on(ownerDocument, 'mouseup', _this._onDrop);
  2283. _on(ownerDocument, 'touchend', _this._onDrop);
  2284. _on(ownerDocument, 'touchcancel', _this._onDrop);
  2285. _on(ownerDocument, 'pointercancel', _this._onDrop);
  2286. _on(ownerDocument, 'selectstart', _this);
  2287. if (options.delay) {
  2288. // If the user moves the pointer or let go the click or touch
  2289. // before the delay has been reached:
  2290. // disable the delayed drag
  2291. _on(ownerDocument, 'mouseup', _this._disableDelayedDrag);
  2292. _on(ownerDocument, 'touchend', _this._disableDelayedDrag);
  2293. _on(ownerDocument, 'touchcancel', _this._disableDelayedDrag);
  2294. _on(ownerDocument, 'mousemove', _this._disableDelayedDrag);
  2295. _on(ownerDocument, 'touchmove', _this._disableDelayedDrag);
  2296. _on(ownerDocument, 'pointermove', _this._disableDelayedDrag);
  2297. _this._dragStartTimer = setTimeout(dragStartFn, options.delay);
  2298. } else {
  2299. dragStartFn();
  2300. }
  2301. }
  2302. },
  2303. _disableDelayedDrag: function _disableDelayedDrag() {
  2304. var ownerDocument = this.el.ownerDocument;
  2305. clearTimeout(this._dragStartTimer);
  2306. _off(ownerDocument, 'mouseup', this._disableDelayedDrag);
  2307. _off(ownerDocument, 'touchend', this._disableDelayedDrag);
  2308. _off(ownerDocument, 'touchcancel', this._disableDelayedDrag);
  2309. _off(ownerDocument, 'mousemove', this._disableDelayedDrag);
  2310. _off(ownerDocument, 'touchmove', this._disableDelayedDrag);
  2311. _off(ownerDocument, 'pointermove', this._disableDelayedDrag);
  2312. },
  2313. _triggerDragStart: function _triggerDragStart(
  2314. /** Event */
  2315. evt,
  2316. /** Touch */
  2317. touch) {
  2318. touch = touch || (evt.pointerType == 'touch' ? evt : null);
  2319. if (touch) {
  2320. // Touch device support
  2321. tapEvt = {
  2322. target: dragEl,
  2323. clientX: touch.clientX,
  2324. clientY: touch.clientY
  2325. };
  2326. this._onDragStart(tapEvt, 'touch');
  2327. } else if (!this.nativeDraggable) {
  2328. this._onDragStart(tapEvt, true);
  2329. } else {
  2330. _on(dragEl, 'dragend', this);
  2331. _on(rootEl, 'dragstart', this._onDragStart);
  2332. }
  2333. try {
  2334. if (document.selection) {
  2335. // Timeout neccessary for IE9
  2336. setTimeout(function () {
  2337. document.selection.empty();
  2338. });
  2339. } else {
  2340. window.getSelection().removeAllRanges();
  2341. }
  2342. } catch (err) {}
  2343. },
  2344. _dragStarted: function _dragStarted() {
  2345. if (rootEl && dragEl) {
  2346. var options = this.options; // Apply effect
  2347. _toggleClass(dragEl, options.ghostClass, true);
  2348. _toggleClass(dragEl, options.dragClass, false);
  2349. Sortable.active = this; // Drag start event
  2350. _dispatchEvent(this, rootEl, 'start', dragEl, rootEl, oldIndex);
  2351. } else {
  2352. this._nulling();
  2353. }
  2354. },
  2355. _emulateDragOver: function _emulateDragOver() {
  2356. if (touchEvt) {
  2357. if (this._lastX === touchEvt.clientX && this._lastY === touchEvt.clientY) {
  2358. return;
  2359. }
  2360. this._lastX = touchEvt.clientX;
  2361. this._lastY = touchEvt.clientY;
  2362. if (!supportCssPointerEvents) {
  2363. _css(ghostEl, 'display', 'none');
  2364. }
  2365. var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY),
  2366. parent = target,
  2367. i = touchDragOverListeners.length;
  2368. if (parent) {
  2369. do {
  2370. if (parent[expando]) {
  2371. while (i--) {
  2372. touchDragOverListeners[i]({
  2373. clientX: touchEvt.clientX,
  2374. clientY: touchEvt.clientY,
  2375. target: target,
  2376. rootEl: parent
  2377. });
  2378. }
  2379. break;
  2380. }
  2381. target = parent; // store last element
  2382. }
  2383. /* jshint boss:true */
  2384. while (parent = parent.parentNode);
  2385. }
  2386. if (!supportCssPointerEvents) {
  2387. _css(ghostEl, 'display', '');
  2388. }
  2389. }
  2390. },
  2391. _onTouchMove: function _onTouchMove(
  2392. /**TouchEvent*/
  2393. evt) {
  2394. if (tapEvt) {
  2395. var options = this.options,
  2396. fallbackTolerance = options.fallbackTolerance,
  2397. fallbackOffset = options.fallbackOffset,
  2398. touch = evt.touches ? evt.touches[0] : evt,
  2399. dx = touch.clientX - tapEvt.clientX + fallbackOffset.x,
  2400. dy = touch.clientY - tapEvt.clientY + fallbackOffset.y,
  2401. translate3d = evt.touches ? 'translate3d(' + dx + 'px,' + dy + 'px,0)' : 'translate(' + dx + 'px,' + dy + 'px)'; // only set the status to dragging, when we are actually dragging
  2402. if (!Sortable.active) {
  2403. if (fallbackTolerance && min(abs(touch.clientX - this._lastX), abs(touch.clientY - this._lastY)) < fallbackTolerance) {
  2404. return;
  2405. }
  2406. this._dragStarted();
  2407. } // as well as creating the ghost element on the document body
  2408. this._appendGhost();
  2409. moved = true;
  2410. touchEvt = touch;
  2411. _css(ghostEl, 'webkitTransform', translate3d);
  2412. _css(ghostEl, 'mozTransform', translate3d);
  2413. _css(ghostEl, 'msTransform', translate3d);
  2414. _css(ghostEl, 'transform', translate3d);
  2415. evt.preventDefault();
  2416. }
  2417. },
  2418. _appendGhost: function _appendGhost() {
  2419. if (!ghostEl) {
  2420. var rect = dragEl.getBoundingClientRect(),
  2421. css = _css(dragEl),
  2422. options = this.options,
  2423. ghostRect;
  2424. ghostEl = dragEl.cloneNode(true);
  2425. _toggleClass(ghostEl, options.ghostClass, false);
  2426. _toggleClass(ghostEl, options.fallbackClass, true);
  2427. _toggleClass(ghostEl, options.dragClass, true);
  2428. _css(ghostEl, 'top', rect.top - parseInt(css.marginTop, 10));
  2429. _css(ghostEl, 'left', rect.left - parseInt(css.marginLeft, 10));
  2430. _css(ghostEl, 'width', rect.width);
  2431. _css(ghostEl, 'height', rect.height);
  2432. _css(ghostEl, 'opacity', '0.8');
  2433. _css(ghostEl, 'position', 'fixed');
  2434. _css(ghostEl, 'zIndex', '100000');
  2435. _css(ghostEl, 'pointerEvents', 'none');
  2436. options.fallbackOnBody && document.body.appendChild(ghostEl) || rootEl.appendChild(ghostEl); // Fixing dimensions.
  2437. ghostRect = ghostEl.getBoundingClientRect();
  2438. _css(ghostEl, 'width', rect.width * 2 - ghostRect.width);
  2439. _css(ghostEl, 'height', rect.height * 2 - ghostRect.height);
  2440. }
  2441. },
  2442. _onDragStart: function _onDragStart(
  2443. /**Event*/
  2444. evt,
  2445. /**boolean*/
  2446. useFallback) {
  2447. var dataTransfer = evt.dataTransfer,
  2448. options = this.options;
  2449. this._offUpEvents();
  2450. if (activeGroup.checkPull(this, this, dragEl, evt)) {
  2451. cloneEl = _clone(dragEl);
  2452. cloneEl.draggable = false;
  2453. cloneEl.style['will-change'] = '';
  2454. _css(cloneEl, 'display', 'none');
  2455. _toggleClass(cloneEl, this.options.chosenClass, false);
  2456. rootEl.insertBefore(cloneEl, dragEl);
  2457. _dispatchEvent(this, rootEl, 'clone', dragEl);
  2458. }
  2459. _toggleClass(dragEl, options.dragClass, true);
  2460. if (useFallback) {
  2461. if (useFallback === 'touch') {
  2462. // Bind touch events
  2463. _on(document, 'touchmove', this._onTouchMove);
  2464. _on(document, 'touchend', this._onDrop);
  2465. _on(document, 'touchcancel', this._onDrop);
  2466. _on(document, 'pointermove', this._onTouchMove);
  2467. _on(document, 'pointerup', this._onDrop);
  2468. } else {
  2469. // Old brwoser
  2470. _on(document, 'mousemove', this._onTouchMove);
  2471. _on(document, 'mouseup', this._onDrop);
  2472. }
  2473. this._loopId = setInterval(this._emulateDragOver, 50);
  2474. } else {
  2475. if (dataTransfer) {
  2476. dataTransfer.effectAllowed = 'move';
  2477. options.setData && options.setData.call(this, dataTransfer, dragEl);
  2478. }
  2479. _on(document, 'drop', this);
  2480. setTimeout(this._dragStarted, 0);
  2481. }
  2482. },
  2483. _onDragOver: function _onDragOver(
  2484. /**Event*/
  2485. evt) {
  2486. var el = this.el,
  2487. target,
  2488. dragRect,
  2489. targetRect,
  2490. revert,
  2491. options = this.options,
  2492. group = options.group,
  2493. activeSortable = Sortable.active,
  2494. isOwner = activeGroup === group,
  2495. isMovingBetweenSortable = false,
  2496. canSort = options.sort;
  2497. if (evt.preventDefault !== void 0) {
  2498. evt.preventDefault();
  2499. !options.dragoverBubble && evt.stopPropagation();
  2500. }
  2501. if (dragEl.animated) {
  2502. return;
  2503. }
  2504. moved = true;
  2505. if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = !rootEl.contains(dragEl)) // Reverting item into the original list
  2506. : putSortable === this || (activeSortable.lastPullMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt)) && (evt.rootEl === void 0 || evt.rootEl === this.el) // touch fallback
  2507. ) {
  2508. // Smart auto-scrolling
  2509. _autoScroll(evt, options, this.el);
  2510. if (_silent) {
  2511. return;
  2512. }
  2513. target = _closest(evt.target, options.draggable, el);
  2514. dragRect = dragEl.getBoundingClientRect();
  2515. if (putSortable !== this) {
  2516. putSortable = this;
  2517. isMovingBetweenSortable = true;
  2518. }
  2519. if (revert) {
  2520. _cloneHide(activeSortable, true);
  2521. parentEl = rootEl; // actualization
  2522. if (cloneEl || nextEl) {
  2523. rootEl.insertBefore(dragEl, cloneEl || nextEl);
  2524. } else if (!canSort) {
  2525. rootEl.appendChild(dragEl);
  2526. }
  2527. return;
  2528. }
  2529. if (el.children.length === 0 || el.children[0] === ghostEl || el === evt.target && _ghostIsLast(el, evt)) {
  2530. //assign target only if condition is true
  2531. if (el.children.length !== 0 && el.children[0] !== ghostEl && el === evt.target) {
  2532. target = el.lastElementChild;
  2533. }
  2534. if (target) {
  2535. if (target.animated) {
  2536. return;
  2537. }
  2538. targetRect = target.getBoundingClientRect();
  2539. }
  2540. _cloneHide(activeSortable, isOwner);
  2541. if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt) !== false) {
  2542. if (!dragEl.contains(el)) {
  2543. el.appendChild(dragEl);
  2544. parentEl = el; // actualization
  2545. }
  2546. this._animate(dragRect, dragEl);
  2547. target && this._animate(targetRect, target);
  2548. }
  2549. } else if (target && !target.animated && target !== dragEl && target.parentNode[expando] !== void 0) {
  2550. if (lastEl !== target) {
  2551. lastEl = target;
  2552. lastCSS = _css(target);
  2553. lastParentCSS = _css(target.parentNode);
  2554. }
  2555. targetRect = target.getBoundingClientRect();
  2556. var width = targetRect.right - targetRect.left,
  2557. height = targetRect.bottom - targetRect.top,
  2558. floating = R_FLOAT.test(lastCSS.cssFloat + lastCSS.display) || lastParentCSS.display == 'flex' && lastParentCSS['flex-direction'].indexOf('row') === 0,
  2559. isWide = target.offsetWidth > dragEl.offsetWidth,
  2560. isLong = target.offsetHeight > dragEl.offsetHeight,
  2561. halfway = (floating ? (evt.clientX - targetRect.left) / width : (evt.clientY - targetRect.top) / height) > 0.5,
  2562. nextSibling = target.nextElementSibling,
  2563. after = false;
  2564. if (floating) {
  2565. var elTop = dragEl.offsetTop,
  2566. tgTop = target.offsetTop;
  2567. if (elTop === tgTop) {
  2568. after = target.previousElementSibling === dragEl && !isWide || halfway && isWide;
  2569. } else if (target.previousElementSibling === dragEl || dragEl.previousElementSibling === target) {
  2570. after = (evt.clientY - targetRect.top) / height > 0.5;
  2571. } else {
  2572. after = tgTop > elTop;
  2573. }
  2574. } else if (!isMovingBetweenSortable) {
  2575. after = nextSibling !== dragEl && !isLong || halfway && isLong;
  2576. }
  2577. var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after);
  2578. if (moveVector !== false) {
  2579. if (moveVector === 1 || moveVector === -1) {
  2580. after = moveVector === 1;
  2581. }
  2582. _silent = true;
  2583. setTimeout(_unsilent, 30);
  2584. _cloneHide(activeSortable, isOwner);
  2585. if (!dragEl.contains(el)) {
  2586. if (after && !nextSibling) {
  2587. el.appendChild(dragEl);
  2588. } else {
  2589. target.parentNode.insertBefore(dragEl, after ? nextSibling : target);
  2590. }
  2591. }
  2592. parentEl = dragEl.parentNode; // actualization
  2593. this._animate(dragRect, dragEl);
  2594. this._animate(targetRect, target);
  2595. }
  2596. }
  2597. }
  2598. },
  2599. _animate: function _animate(prevRect, target) {
  2600. var ms = this.options.animation;
  2601. if (ms) {
  2602. var currentRect = target.getBoundingClientRect();
  2603. if (prevRect.nodeType === 1) {
  2604. prevRect = prevRect.getBoundingClientRect();
  2605. }
  2606. _css(target, 'transition', 'none');
  2607. _css(target, 'transform', 'translate3d(' + (prevRect.left - currentRect.left) + 'px,' + (prevRect.top - currentRect.top) + 'px,0)');
  2608. target.offsetWidth; // repaint
  2609. _css(target, 'transition', 'all ' + ms + 'ms');
  2610. _css(target, 'transform', 'translate3d(0,0,0)');
  2611. clearTimeout(target.animated);
  2612. target.animated = setTimeout(function () {
  2613. _css(target, 'transition', '');
  2614. _css(target, 'transform', '');
  2615. target.animated = false;
  2616. }, ms);
  2617. }
  2618. },
  2619. _offUpEvents: function _offUpEvents() {
  2620. var ownerDocument = this.el.ownerDocument;
  2621. _off(document, 'touchmove', this._onTouchMove);
  2622. _off(document, 'pointermove', this._onTouchMove);
  2623. _off(ownerDocument, 'mouseup', this._onDrop);
  2624. _off(ownerDocument, 'touchend', this._onDrop);
  2625. _off(ownerDocument, 'pointerup', this._onDrop);
  2626. _off(ownerDocument, 'touchcancel', this._onDrop);
  2627. _off(ownerDocument, 'pointercancel', this._onDrop);
  2628. _off(ownerDocument, 'selectstart', this);
  2629. },
  2630. _onDrop: function _onDrop(
  2631. /**Event*/
  2632. evt) {
  2633. var el = this.el,
  2634. options = this.options;
  2635. clearInterval(this._loopId);
  2636. clearInterval(autoScroll.pid);
  2637. clearTimeout(this._dragStartTimer); // Unbind events
  2638. _off(document, 'mousemove', this._onTouchMove);
  2639. if (this.nativeDraggable) {
  2640. _off(document, 'drop', this);
  2641. _off(el, 'dragstart', this._onDragStart);
  2642. }
  2643. this._offUpEvents();
  2644. if (evt) {
  2645. if (moved) {
  2646. evt.preventDefault();
  2647. !options.dropBubble && evt.stopPropagation();
  2648. }
  2649. ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl);
  2650. if (rootEl === parentEl || Sortable.active.lastPullMode !== 'clone') {
  2651. // Remove clone
  2652. cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl);
  2653. }
  2654. if (dragEl) {
  2655. if (this.nativeDraggable) {
  2656. _off(dragEl, 'dragend', this);
  2657. }
  2658. _disableDraggable(dragEl);
  2659. dragEl.style['will-change'] = ''; // Remove class's
  2660. _toggleClass(dragEl, this.options.ghostClass, false);
  2661. _toggleClass(dragEl, this.options.chosenClass, false); // Drag stop event
  2662. _dispatchEvent(this, rootEl, 'unchoose', dragEl, rootEl, oldIndex);
  2663. if (rootEl !== parentEl) {
  2664. newIndex = _index(dragEl, options.draggable);
  2665. if (newIndex >= 0) {
  2666. // Add event
  2667. _dispatchEvent(null, parentEl, 'add', dragEl, rootEl, oldIndex, newIndex); // Remove event
  2668. _dispatchEvent(this, rootEl, 'remove', dragEl, rootEl, oldIndex, newIndex); // drag from one list and drop into another
  2669. _dispatchEvent(null, parentEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2670. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2671. }
  2672. } else {
  2673. if (dragEl.nextSibling !== nextEl) {
  2674. // Get the index of the dragged element within its parent
  2675. newIndex = _index(dragEl, options.draggable);
  2676. if (newIndex >= 0) {
  2677. // drag & drop within the same list
  2678. _dispatchEvent(this, rootEl, 'update', dragEl, rootEl, oldIndex, newIndex);
  2679. _dispatchEvent(this, rootEl, 'sort', dragEl, rootEl, oldIndex, newIndex);
  2680. }
  2681. }
  2682. }
  2683. if (Sortable.active) {
  2684. /* jshint eqnull:true */
  2685. if (newIndex == null || newIndex === -1) {
  2686. newIndex = oldIndex;
  2687. }
  2688. _dispatchEvent(this, rootEl, 'end', dragEl, rootEl, oldIndex, newIndex); // Save sorting
  2689. this.save();
  2690. }
  2691. }
  2692. }
  2693. this._nulling();
  2694. },
  2695. _nulling: function _nulling() {
  2696. rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = scrollEl = scrollParentEl = tapEvt = touchEvt = moved = newIndex = lastEl = lastCSS = putSortable = activeGroup = Sortable.active = null;
  2697. savedInputChecked.forEach(function (el) {
  2698. el.checked = true;
  2699. });
  2700. savedInputChecked.length = 0;
  2701. },
  2702. handleEvent: function handleEvent(
  2703. /**Event*/
  2704. evt) {
  2705. switch (evt.type) {
  2706. case 'drop':
  2707. case 'dragend':
  2708. this._onDrop(evt);
  2709. break;
  2710. case 'dragover':
  2711. case 'dragenter':
  2712. if (dragEl) {
  2713. this._onDragOver(evt);
  2714. _globalDragOver(evt);
  2715. }
  2716. break;
  2717. case 'selectstart':
  2718. evt.preventDefault();
  2719. break;
  2720. }
  2721. },
  2722. /**
  2723. * Serializes the item into an array of string.
  2724. * @returns {String[]}
  2725. */
  2726. toArray: function toArray() {
  2727. var order = [],
  2728. el,
  2729. children = this.el.children,
  2730. i = 0,
  2731. n = children.length,
  2732. options = this.options;
  2733. for (; i < n; i++) {
  2734. el = children[i];
  2735. if (_closest(el, options.draggable, this.el)) {
  2736. order.push(el.getAttribute(options.dataIdAttr) || _generateId(el));
  2737. }
  2738. }
  2739. return order;
  2740. },
  2741. /**
  2742. * Sorts the elements according to the array.
  2743. * @param {String[]} order order of the items
  2744. */
  2745. sort: function sort(order) {
  2746. var items = {},
  2747. rootEl = this.el;
  2748. this.toArray().forEach(function (id, i) {
  2749. var el = rootEl.children[i];
  2750. if (_closest(el, this.options.draggable, rootEl)) {
  2751. items[id] = el;
  2752. }
  2753. }, this);
  2754. order.forEach(function (id) {
  2755. if (items[id]) {
  2756. rootEl.removeChild(items[id]);
  2757. rootEl.appendChild(items[id]);
  2758. }
  2759. });
  2760. },
  2761. /**
  2762. * Save the current sorting
  2763. */
  2764. save: function save() {
  2765. var store = this.options.store;
  2766. store && store.set(this);
  2767. },
  2768. /**
  2769. * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.
  2770. * @param {HTMLElement} el
  2771. * @param {String} [selector] default: `options.draggable`
  2772. * @returns {HTMLElement|null}
  2773. */
  2774. closest: function closest(el, selector) {
  2775. return _closest(el, selector || this.options.draggable, this.el);
  2776. },
  2777. /**
  2778. * Set/get option
  2779. * @param {string} name
  2780. * @param {*} [value]
  2781. * @returns {*}
  2782. */
  2783. option: function option(name, value) {
  2784. var options = this.options;
  2785. if (value === void 0) {
  2786. return options[name];
  2787. } else {
  2788. options[name] = value;
  2789. if (name === 'group') {
  2790. _prepareGroup(options);
  2791. }
  2792. }
  2793. },
  2794. /**
  2795. * Destroy
  2796. */
  2797. destroy: function destroy() {
  2798. var el = this.el;
  2799. el[expando] = null;
  2800. _off(el, 'mousedown', this._onTapStart);
  2801. _off(el, 'touchstart', this._onTapStart);
  2802. _off(el, 'pointerdown', this._onTapStart);
  2803. if (this.nativeDraggable) {
  2804. _off(el, 'dragover', this);
  2805. _off(el, 'dragenter', this);
  2806. } // Remove draggable attributes
  2807. Array.prototype.forEach.call(el.querySelectorAll('[draggable]'), function (el) {
  2808. el.removeAttribute('draggable');
  2809. });
  2810. touchDragOverListeners.splice(touchDragOverListeners.indexOf(this._onDragOver), 1);
  2811. this._onDrop();
  2812. this.el = el = null;
  2813. }
  2814. };
  2815. function _cloneHide(sortable, state) {
  2816. if (sortable.lastPullMode !== 'clone') {
  2817. state = true;
  2818. }
  2819. if (cloneEl && cloneEl.state !== state) {
  2820. _css(cloneEl, 'display', state ? 'none' : '');
  2821. if (!state) {
  2822. if (cloneEl.state) {
  2823. if (sortable.options.group.revertClone) {
  2824. rootEl.insertBefore(cloneEl, nextEl);
  2825. sortable._animate(dragEl, cloneEl);
  2826. } else {
  2827. rootEl.insertBefore(cloneEl, dragEl);
  2828. }
  2829. }
  2830. }
  2831. cloneEl.state = state;
  2832. }
  2833. }
  2834. function _closest(
  2835. /**HTMLElement*/
  2836. el,
  2837. /**String*/
  2838. selector,
  2839. /**HTMLElement*/
  2840. ctx) {
  2841. if (el) {
  2842. ctx = ctx || document;
  2843. do {
  2844. if (selector === '>*' && el.parentNode === ctx || _matches(el, selector)) {
  2845. return el;
  2846. }
  2847. /* jshint boss:true */
  2848. } while (el = _getParentOrHost(el));
  2849. }
  2850. return null;
  2851. }
  2852. function _getParentOrHost(el) {
  2853. var parent = el.host;
  2854. return parent && parent.nodeType ? parent : el.parentNode;
  2855. }
  2856. function _globalDragOver(
  2857. /**Event*/
  2858. evt) {
  2859. if (evt.dataTransfer) {
  2860. evt.dataTransfer.dropEffect = 'move';
  2861. }
  2862. evt.preventDefault();
  2863. }
  2864. function _on(el, event, fn) {
  2865. el.addEventListener(event, fn, captureMode);
  2866. }
  2867. function _off(el, event, fn) {
  2868. el.removeEventListener(event, fn, captureMode);
  2869. }
  2870. function _toggleClass(el, name, state) {
  2871. if (el) {
  2872. if (el.classList) {
  2873. el.classList[state ? 'add' : 'remove'](name);
  2874. } else {
  2875. var className = (' ' + el.className + ' ').replace(R_SPACE, ' ').replace(' ' + name + ' ', ' ');
  2876. el.className = (className + (state ? ' ' + name : '')).replace(R_SPACE, ' ');
  2877. }
  2878. }
  2879. }
  2880. function _css(el, prop, val) {
  2881. var style = el && el.style;
  2882. if (style) {
  2883. if (val === void 0) {
  2884. if (document.defaultView && document.defaultView.getComputedStyle) {
  2885. val = document.defaultView.getComputedStyle(el, '');
  2886. } else if (el.currentStyle) {
  2887. val = el.currentStyle;
  2888. }
  2889. return prop === void 0 ? val : val[prop];
  2890. } else {
  2891. if (!(prop in style)) {
  2892. prop = '-webkit-' + prop;
  2893. }
  2894. style[prop] = val + (typeof val === 'string' ? '' : 'px');
  2895. }
  2896. }
  2897. }
  2898. function _find(ctx, tagName, iterator) {
  2899. if (ctx) {
  2900. var list = ctx.getElementsByTagName(tagName),
  2901. i = 0,
  2902. n = list.length;
  2903. if (iterator) {
  2904. for (; i < n; i++) {
  2905. iterator(list[i], i);
  2906. }
  2907. }
  2908. return list;
  2909. }
  2910. return [];
  2911. }
  2912. function _dispatchEvent(sortable, rootEl, name, targetEl, fromEl, startIndex, newIndex) {
  2913. sortable = sortable || rootEl[expando];
  2914. var evt = document.createEvent('Event'),
  2915. options = sortable.options,
  2916. onName = 'on' + name.charAt(0).toUpperCase() + name.substr(1);
  2917. evt.initEvent(name, true, true);
  2918. evt.to = rootEl;
  2919. evt.from = fromEl || rootEl;
  2920. evt.item = targetEl || rootEl;
  2921. evt.clone = cloneEl;
  2922. evt.oldIndex = startIndex;
  2923. evt.newIndex = newIndex;
  2924. rootEl.dispatchEvent(evt);
  2925. if (options[onName]) {
  2926. options[onName].call(sortable, evt);
  2927. }
  2928. }
  2929. function _onMove(fromEl, toEl, dragEl, dragRect, targetEl, targetRect, originalEvt, willInsertAfter) {
  2930. var evt,
  2931. sortable = fromEl[expando],
  2932. onMoveFn = sortable.options.onMove,
  2933. retVal;
  2934. evt = document.createEvent('Event');
  2935. evt.initEvent('move', true, true);
  2936. evt.to = toEl;
  2937. evt.from = fromEl;
  2938. evt.dragged = dragEl;
  2939. evt.draggedRect = dragRect;
  2940. evt.related = targetEl || toEl;
  2941. evt.relatedRect = targetRect || toEl.getBoundingClientRect();
  2942. evt.willInsertAfter = willInsertAfter;
  2943. fromEl.dispatchEvent(evt);
  2944. if (onMoveFn) {
  2945. retVal = onMoveFn.call(sortable, evt, originalEvt);
  2946. }
  2947. return retVal;
  2948. }
  2949. function _disableDraggable(el) {
  2950. el.draggable = false;
  2951. }
  2952. function _unsilent() {
  2953. _silent = false;
  2954. }
  2955. /** @returns {HTMLElement|false} */
  2956. function _ghostIsLast(el, evt) {
  2957. var lastEl = el.lastElementChild,
  2958. rect = lastEl.getBoundingClientRect(); // 5 — min delta
  2959. // abs — нельзя добавлять, а то глюки при наведении сверху
  2960. return evt.clientY - (rect.top + rect.height) > 5 || evt.clientX - (rect.left + rect.width) > 5;
  2961. }
  2962. /**
  2963. * Generate id
  2964. * @param {HTMLElement} el
  2965. * @returns {String}
  2966. * @private
  2967. */
  2968. function _generateId(el) {
  2969. var str = el.tagName + el.className + el.src + el.href + el.textContent,
  2970. i = str.length,
  2971. sum = 0;
  2972. while (i--) {
  2973. sum += str.charCodeAt(i);
  2974. }
  2975. return sum.toString(36);
  2976. }
  2977. /**
  2978. * Returns the index of an element within its parent for a selected set of
  2979. * elements
  2980. * @param {HTMLElement} el
  2981. * @param {selector} selector
  2982. * @return {number}
  2983. */
  2984. function _index(el, selector) {
  2985. var index = 0;
  2986. if (!el || !el.parentNode) {
  2987. return -1;
  2988. }
  2989. while (el && (el = el.previousElementSibling)) {
  2990. if (el.nodeName.toUpperCase() !== 'TEMPLATE' && (selector === '>*' || _matches(el, selector))) {
  2991. index++;
  2992. }
  2993. }
  2994. return index;
  2995. }
  2996. function _matches(
  2997. /**HTMLElement*/
  2998. el,
  2999. /**String*/
  3000. selector) {
  3001. if (el) {
  3002. selector = selector.split('.');
  3003. var tag = selector.shift().toUpperCase(),
  3004. re = new RegExp('\\s(' + selector.join('|') + ')(?=\\s)', 'g');
  3005. return (tag === '' || el.nodeName.toUpperCase() == tag) && (!selector.length || ((' ' + el.className + ' ').match(re) || []).length == selector.length);
  3006. }
  3007. return false;
  3008. }
  3009. function _throttle(callback, ms) {
  3010. var args, _this;
  3011. return function () {
  3012. if (args === void 0) {
  3013. args = arguments;
  3014. _this = this;
  3015. setTimeout(function () {
  3016. if (args.length === 1) {
  3017. callback.call(_this, args[0]);
  3018. } else {
  3019. callback.apply(_this, args);
  3020. }
  3021. args = void 0;
  3022. }, ms);
  3023. }
  3024. };
  3025. }
  3026. function _extend(dst, src) {
  3027. if (dst && src) {
  3028. for (var key in src) {
  3029. if (src.hasOwnProperty(key)) {
  3030. dst[key] = src[key];
  3031. }
  3032. }
  3033. }
  3034. return dst;
  3035. }
  3036. function _clone(el) {
  3037. return $ ? $(el).clone(true)[0] : Polymer && Polymer.dom ? Polymer.dom(el).cloneNode(true) : el.cloneNode(true);
  3038. }
  3039. function _saveInputCheckedState(root) {
  3040. var inputs = root.getElementsByTagName('input');
  3041. var idx = inputs.length;
  3042. while (idx--) {
  3043. var el = inputs[idx];
  3044. el.checked && savedInputChecked.push(el);
  3045. }
  3046. } // Fixed #973:
  3047. _on(document, 'touchmove', function (evt) {
  3048. if (Sortable.active) {
  3049. evt.preventDefault();
  3050. }
  3051. });
  3052. try {
  3053. window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
  3054. get: function get() {
  3055. captureMode = {
  3056. capture: false,
  3057. passive: false
  3058. };
  3059. }
  3060. }));
  3061. } catch (err) {} // Export utils
  3062. Sortable.utils = {
  3063. on: _on,
  3064. off: _off,
  3065. css: _css,
  3066. find: _find,
  3067. is: function is(el, selector) {
  3068. return !!_closest(el, selector, el);
  3069. },
  3070. extend: _extend,
  3071. throttle: _throttle,
  3072. closest: _closest,
  3073. toggleClass: _toggleClass,
  3074. clone: _clone,
  3075. index: _index
  3076. };
  3077. /**
  3078. * Create sortable instance
  3079. * @param {HTMLElement} el
  3080. * @param {Object} [options]
  3081. */
  3082. Sortable.create = function (el, options) {
  3083. return new Sortable(el, options);
  3084. }; // Export
  3085. Sortable.version = '1.6.1';
  3086. return Sortable;
  3087. });
  3088. /***/ }),
  3089. /***/ "./js/assessment/ivprogAssessment.js":
  3090. /*!*******************************************!*\
  3091. !*** ./js/assessment/ivprogAssessment.js ***!
  3092. \*******************************************/
  3093. /*! exports provided: IVProgAssessment */
  3094. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3095. "use strict";
  3096. __webpack_require__.r(__webpack_exports__);
  3097. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgAssessment", function() { return IVProgAssessment; });
  3098. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  3099. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  3100. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  3101. /* harmony import */ var _util_inputTest__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../util/inputTest */ "./js/util/inputTest.js");
  3102. /* harmony import */ var _util_outputTest__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../util/outputTest */ "./js/util/outputTest.js");
  3103. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3104. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  3105. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_6__);
  3106. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  3107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3108. 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); } }
  3109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3110. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_5__["getInstance"]();
  3111. var IVProgAssessment =
  3112. /*#__PURE__*/
  3113. function () {
  3114. function IVProgAssessment(textCode, testCases, domConsole) {
  3115. _classCallCheck(this, IVProgAssessment);
  3116. this.textCode = textCode;
  3117. this.testCases = testCases;
  3118. this.domConsole = domConsole;
  3119. }
  3120. _createClass(IVProgAssessment, [{
  3121. key: "runTest",
  3122. value: function runTest() {
  3123. var _this = this;
  3124. try {
  3125. // try and show error messages through domconsole
  3126. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"].createParser(this.textCode);
  3127. var semantic = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_1__["SemanticAnalyser"](parser.parseTree());
  3128. var validTree = semantic.analyseTree(); // loop test cases and show messages through domconsole
  3129. var partialTests = this.testCases.map(function (t, name) {
  3130. return _this.partialEvaluateTestCase(new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_2__["IVProgProcessor"](validTree), t.input, t.output, name);
  3131. });
  3132. var testResult = partialTests.reduce(function (acc, curr) {
  3133. return acc.then(curr);
  3134. }, Promise.resolve(0));
  3135. return testResult.then(function (total) {
  3136. return Promise.resolve(total / _this.testCases.length);
  3137. }).catch(function (err) {
  3138. _this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3139. _this.domConsole.err(err.message);
  3140. return Promise.resolve(0);
  3141. });
  3142. } catch (error) {
  3143. this.domConsole.err("Erro durante a execução do programa"); // try and show error messages through domconsole
  3144. this.domConsole.err(error.message);
  3145. return Promise.resolve(0);
  3146. }
  3147. }
  3148. }, {
  3149. key: "evaluateTestCase",
  3150. value: function evaluateTestCase(prog, inputList, outputList, name, accumulator) {
  3151. var outerThis = this;
  3152. var input = new _util_inputTest__WEBPACK_IMPORTED_MODULE_3__["InputTest"](inputList);
  3153. var output = new _util_outputTest__WEBPACK_IMPORTED_MODULE_4__["OutputTest"]();
  3154. prog.registerInput(input);
  3155. prog.registerOutput(output);
  3156. var startTime = Date.now();
  3157. return prog.interpretAST().then(function (_) {
  3158. var millis = Date.now() - startTime;
  3159. if (input.inputList.length !== input.index) {
  3160. outerThis.showErrorMessage('test_case_few_reads', name + 1);
  3161. outerThis.showMessage('test_case_duration', millis);
  3162. return Promise.resolve(accumulator + 1 * (input.index / inputList.length));
  3163. } else if (output.list.length < outputList.length) {
  3164. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3165. outerThis.showMessage('test_case_duration', millis);
  3166. return Promise.resolve(accumulator + 1 * (output.list.length / outputList.length));
  3167. } else if (output.list.length > outputList.length) {
  3168. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3169. outerThis.showMessage('test_case_duration', millis);
  3170. return Promise.resolve(accumulator + 1 * (outputList.length / output.list.length));
  3171. } else {
  3172. var isOk = outerThis.checkOutput(output.list, outputList);
  3173. if (!isOk) {
  3174. outerThis.showErrorMessage('test_case_failed', name + 1, inputList.join(','), outputList.join(','), output.list.join(','));
  3175. outerThis.showMessage('test_case_duration', millis);
  3176. return Promise.resolve(accumulator);
  3177. } else {
  3178. outerThis.showMessage('test_case_success', name + 1);
  3179. outerThis.showMessage('test_case_duration', millis);
  3180. return Promise.resolve(accumulator + 1);
  3181. }
  3182. }
  3183. }).catch(function (error) {
  3184. outerThis.showErrorMessage('test_case_failed_exception', name + 1, error.message);
  3185. return Promise.resolve(accumulator);
  3186. });
  3187. }
  3188. }, {
  3189. key: "partialEvaluateTestCase",
  3190. value: function partialEvaluateTestCase(prog, inputList, outputList, name) {
  3191. return this.evaluateTestCase.bind(this, prog, inputList, outputList, name);
  3192. }
  3193. }, {
  3194. key: "checkOutput",
  3195. value: function checkOutput(aList, bList) {
  3196. for (var i = 0; i < aList.length; i++) {
  3197. var outValue = aList[i];
  3198. var castNumberA = parseFloat(outValue);
  3199. if (!Number.isNaN(castNumberA)) {
  3200. var castNumberB = parseFloat(bList[i]);
  3201. if (Number.isNaN(castNumberB)) {
  3202. return false;
  3203. }
  3204. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA);
  3205. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB);
  3206. var decimalPlaces = Math.min(castNumberB.dp(), _util_config__WEBPACK_IMPORTED_MODULE_7__["Config"].decimalPlaces);
  3207. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3208. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_FLOOR
  3209. });
  3210. castNumberA = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberA.toFixed(decimalPlaces));
  3211. castNumberB = new decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"](castNumberB.toFixed(decimalPlaces));
  3212. var aEqualsB = castNumberA.eq(castNumberB);
  3213. decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].set({
  3214. rounding: decimal_js__WEBPACK_IMPORTED_MODULE_6__["Decimal"].ROUND_HALF_UP
  3215. });
  3216. if (!aEqualsB) {
  3217. return false;
  3218. }
  3219. } else if (outValue != bList[i]) {
  3220. return false;
  3221. }
  3222. }
  3223. return true;
  3224. }
  3225. }, {
  3226. key: "showErrorMessage",
  3227. value: function showErrorMessage(errorID) {
  3228. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  3229. args[_key - 1] = arguments[_key];
  3230. }
  3231. this.domConsole.err(LocalizedStrings.getError(errorID, args));
  3232. }
  3233. }, {
  3234. key: "showMessage",
  3235. value: function showMessage(msgID) {
  3236. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  3237. args[_key2 - 1] = arguments[_key2];
  3238. }
  3239. this.domConsole.info(LocalizedStrings.getMessage(msgID, args));
  3240. }
  3241. }]);
  3242. return IVProgAssessment;
  3243. }();
  3244. /***/ }),
  3245. /***/ "./js/ast/commands/arrayAssign.js":
  3246. /*!****************************************!*\
  3247. !*** ./js/ast/commands/arrayAssign.js ***!
  3248. \****************************************/
  3249. /*! exports provided: ArrayIndexAssign */
  3250. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3251. "use strict";
  3252. __webpack_require__.r(__webpack_exports__);
  3253. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return ArrayIndexAssign; });
  3254. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3255. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3256. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3257. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3258. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3259. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3260. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3261. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3262. var ArrayIndexAssign =
  3263. /*#__PURE__*/
  3264. function (_Assign) {
  3265. _inherits(ArrayIndexAssign, _Assign);
  3266. function ArrayIndexAssign(id, lineExpression, columnExpression, expression) {
  3267. var _this;
  3268. _classCallCheck(this, ArrayIndexAssign);
  3269. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayIndexAssign).call(this, id, expression));
  3270. _this.line = lineExpression;
  3271. _this.column = columnExpression;
  3272. return _this;
  3273. }
  3274. return ArrayIndexAssign;
  3275. }(_assign__WEBPACK_IMPORTED_MODULE_0__["Assign"]);
  3276. /***/ }),
  3277. /***/ "./js/ast/commands/arrayDeclaration.js":
  3278. /*!*********************************************!*\
  3279. !*** ./js/ast/commands/arrayDeclaration.js ***!
  3280. \*********************************************/
  3281. /*! exports provided: ArrayDeclaration */
  3282. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3283. "use strict";
  3284. __webpack_require__.r(__webpack_exports__);
  3285. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return ArrayDeclaration; });
  3286. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3287. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3288. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3289. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3290. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3291. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3292. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3293. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3294. var ArrayDeclaration =
  3295. /*#__PURE__*/
  3296. function (_Declaration) {
  3297. _inherits(ArrayDeclaration, _Declaration);
  3298. function ArrayDeclaration(id, type, lines, columns, initial, isConst) {
  3299. var _this;
  3300. _classCallCheck(this, ArrayDeclaration);
  3301. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayDeclaration).call(this, id, type, initial, isConst));
  3302. _this.lines = lines;
  3303. _this.columns = columns;
  3304. return _this;
  3305. }
  3306. return ArrayDeclaration;
  3307. }(_declaration__WEBPACK_IMPORTED_MODULE_0__["Declaration"]);
  3308. /***/ }),
  3309. /***/ "./js/ast/commands/assign.js":
  3310. /*!***********************************!*\
  3311. !*** ./js/ast/commands/assign.js ***!
  3312. \***********************************/
  3313. /*! exports provided: Assign */
  3314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3315. "use strict";
  3316. __webpack_require__.r(__webpack_exports__);
  3317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return Assign; });
  3318. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3319. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3320. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3321. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3322. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3323. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3324. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3325. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3326. var Assign =
  3327. /*#__PURE__*/
  3328. function (_Command) {
  3329. _inherits(Assign, _Command);
  3330. function Assign(id, expression) {
  3331. var _this;
  3332. _classCallCheck(this, Assign);
  3333. _this = _possibleConstructorReturn(this, _getPrototypeOf(Assign).call(this));
  3334. _this.id = id;
  3335. _this.expression = expression;
  3336. return _this;
  3337. }
  3338. return Assign;
  3339. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3340. /***/ }),
  3341. /***/ "./js/ast/commands/break.js":
  3342. /*!**********************************!*\
  3343. !*** ./js/ast/commands/break.js ***!
  3344. \**********************************/
  3345. /*! exports provided: Break */
  3346. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3347. "use strict";
  3348. __webpack_require__.r(__webpack_exports__);
  3349. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  3350. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3351. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3352. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3353. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3354. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3355. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3356. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3357. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3358. var Break =
  3359. /*#__PURE__*/
  3360. function (_Command) {
  3361. _inherits(Break, _Command);
  3362. function Break() {
  3363. _classCallCheck(this, Break);
  3364. return _possibleConstructorReturn(this, _getPrototypeOf(Break).call(this));
  3365. }
  3366. return Break;
  3367. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3368. /***/ }),
  3369. /***/ "./js/ast/commands/case.js":
  3370. /*!*********************************!*\
  3371. !*** ./js/ast/commands/case.js ***!
  3372. \*********************************/
  3373. /*! exports provided: Case */
  3374. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3375. "use strict";
  3376. __webpack_require__.r(__webpack_exports__);
  3377. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return Case; });
  3378. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3379. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3380. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3381. 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); } }
  3382. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3383. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3384. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3385. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3386. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3387. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3388. var Case =
  3389. /*#__PURE__*/
  3390. function (_Command) {
  3391. _inherits(Case, _Command);
  3392. function Case(expression) {
  3393. var _this;
  3394. _classCallCheck(this, Case);
  3395. _this = _possibleConstructorReturn(this, _getPrototypeOf(Case).call(this));
  3396. _this.expression = expression;
  3397. _this.commands = [];
  3398. return _this;
  3399. }
  3400. _createClass(Case, [{
  3401. key: "setCommands",
  3402. value: function setCommands(commands) {
  3403. this.commands = commands;
  3404. }
  3405. }, {
  3406. key: "isDefault",
  3407. get: function get() {
  3408. return this.expression === null;
  3409. }
  3410. }]);
  3411. return Case;
  3412. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3413. /***/ }),
  3414. /***/ "./js/ast/commands/command.js":
  3415. /*!************************************!*\
  3416. !*** ./js/ast/commands/command.js ***!
  3417. \************************************/
  3418. /*! exports provided: Command */
  3419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3420. "use strict";
  3421. __webpack_require__.r(__webpack_exports__);
  3422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Command", function() { return Command; });
  3423. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3424. 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); } }
  3425. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3426. var Command =
  3427. /*#__PURE__*/
  3428. function () {
  3429. function Command() {
  3430. _classCallCheck(this, Command);
  3431. this._sourceInfo = null;
  3432. }
  3433. _createClass(Command, [{
  3434. key: "sourceInfo",
  3435. set: function set(sourceInfo) {
  3436. this._sourceInfo = sourceInfo;
  3437. },
  3438. get: function get() {
  3439. return this._sourceInfo;
  3440. }
  3441. }]);
  3442. return Command;
  3443. }();
  3444. /***/ }),
  3445. /***/ "./js/ast/commands/commandBlock.js":
  3446. /*!*****************************************!*\
  3447. !*** ./js/ast/commands/commandBlock.js ***!
  3448. \*****************************************/
  3449. /*! exports provided: CommandBlock */
  3450. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3451. "use strict";
  3452. __webpack_require__.r(__webpack_exports__);
  3453. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return CommandBlock; });
  3454. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3455. 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); } }
  3456. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3457. var CommandBlock =
  3458. /*#__PURE__*/
  3459. function () {
  3460. function CommandBlock(variables, commands) {
  3461. _classCallCheck(this, CommandBlock);
  3462. this.variables = variables;
  3463. this.commands = commands;
  3464. this._sourceInfo = null;
  3465. }
  3466. _createClass(CommandBlock, [{
  3467. key: "sourceInfo",
  3468. set: function set(sourceInfo) {
  3469. this._sourceInfo = sourceInfo;
  3470. },
  3471. get: function get() {
  3472. return this._sourceInfo;
  3473. }
  3474. }]);
  3475. return CommandBlock;
  3476. }();
  3477. /***/ }),
  3478. /***/ "./js/ast/commands/declaration.js":
  3479. /*!****************************************!*\
  3480. !*** ./js/ast/commands/declaration.js ***!
  3481. \****************************************/
  3482. /*! exports provided: Declaration */
  3483. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3484. "use strict";
  3485. __webpack_require__.r(__webpack_exports__);
  3486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return Declaration; });
  3487. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3488. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3489. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3490. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3491. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3492. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3493. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3494. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3495. var Declaration =
  3496. /*#__PURE__*/
  3497. function (_Command) {
  3498. _inherits(Declaration, _Command);
  3499. function Declaration(id, type, initial, isConst) {
  3500. var _this;
  3501. _classCallCheck(this, Declaration);
  3502. _this = _possibleConstructorReturn(this, _getPrototypeOf(Declaration).call(this));
  3503. _this.id = id;
  3504. _this.type = type;
  3505. _this.initial = initial;
  3506. _this.isConst = isConst;
  3507. return _this;
  3508. }
  3509. return Declaration;
  3510. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3511. /***/ }),
  3512. /***/ "./js/ast/commands/doWhile.js":
  3513. /*!************************************!*\
  3514. !*** ./js/ast/commands/doWhile.js ***!
  3515. \************************************/
  3516. /*! exports provided: DoWhile */
  3517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3518. "use strict";
  3519. __webpack_require__.r(__webpack_exports__);
  3520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return DoWhile; });
  3521. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3522. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3523. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3524. 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); } }
  3525. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3526. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3527. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3528. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3529. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3530. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3531. var DoWhile =
  3532. /*#__PURE__*/
  3533. function (_While) {
  3534. _inherits(DoWhile, _While);
  3535. function DoWhile(condition, commandBlock) {
  3536. _classCallCheck(this, DoWhile);
  3537. return _possibleConstructorReturn(this, _getPrototypeOf(DoWhile).call(this, condition, commandBlock));
  3538. }
  3539. _createClass(DoWhile, [{
  3540. key: "testFirst",
  3541. get: function get() {
  3542. return false;
  3543. }
  3544. }]);
  3545. return DoWhile;
  3546. }(_while__WEBPACK_IMPORTED_MODULE_0__["While"]);
  3547. /***/ }),
  3548. /***/ "./js/ast/commands/for.js":
  3549. /*!********************************!*\
  3550. !*** ./js/ast/commands/for.js ***!
  3551. \********************************/
  3552. /*! exports provided: For */
  3553. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3554. "use strict";
  3555. __webpack_require__.r(__webpack_exports__);
  3556. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "For", function() { return For; });
  3557. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3558. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3559. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3560. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3561. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3562. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3563. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3564. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3565. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3566. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3567. var For =
  3568. /*#__PURE__*/
  3569. function (_Command) {
  3570. _inherits(For, _Command);
  3571. function For(assignment, condition, increment, commandBlock) {
  3572. var _this;
  3573. _classCallCheck(this, For);
  3574. _this = _possibleConstructorReturn(this, _getPrototypeOf(For).call(this));
  3575. _this.assignment = assignment;
  3576. _this.condition = condition;
  3577. _this.increment = increment;
  3578. _this.commandBlock = commandBlock;
  3579. return _this;
  3580. }
  3581. _createClass(For, [{
  3582. key: "commands",
  3583. get: function get() {
  3584. return this.commandBlock.commands;
  3585. }
  3586. }]);
  3587. return For;
  3588. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3589. /***/ }),
  3590. /***/ "./js/ast/commands/formalParameter.js":
  3591. /*!********************************************!*\
  3592. !*** ./js/ast/commands/formalParameter.js ***!
  3593. \********************************************/
  3594. /*! exports provided: FormalParameter */
  3595. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3596. "use strict";
  3597. __webpack_require__.r(__webpack_exports__);
  3598. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return FormalParameter; });
  3599. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3600. 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); } }
  3601. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3602. var FormalParameter =
  3603. /*#__PURE__*/
  3604. function () {
  3605. function FormalParameter(type, id) {
  3606. var byRef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  3607. _classCallCheck(this, FormalParameter);
  3608. this.type = type;
  3609. this.id = id;
  3610. this.byRef = byRef;
  3611. this._sourceInfo = null;
  3612. }
  3613. _createClass(FormalParameter, [{
  3614. key: "sourceInfo",
  3615. set: function set(sourceInfo) {
  3616. this._sourceInfo = sourceInfo;
  3617. },
  3618. get: function get() {
  3619. return this._sourceInfo;
  3620. }
  3621. }]);
  3622. return FormalParameter;
  3623. }();
  3624. /***/ }),
  3625. /***/ "./js/ast/commands/function.js":
  3626. /*!*************************************!*\
  3627. !*** ./js/ast/commands/function.js ***!
  3628. \*************************************/
  3629. /*! exports provided: Function */
  3630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3631. "use strict";
  3632. __webpack_require__.r(__webpack_exports__);
  3633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  3634. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  3635. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3636. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3637. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3638. var Function =
  3639. /*#__PURE__*/
  3640. function () {
  3641. function Function(name, returnType, formalParameters, commandBlock) {
  3642. _classCallCheck(this, Function);
  3643. this.name = name;
  3644. this.returnType = returnType;
  3645. this.formalParameters = formalParameters;
  3646. this.commandBlock = commandBlock;
  3647. this._sourceInfo = null;
  3648. }
  3649. _createClass(Function, [{
  3650. key: "isMain",
  3651. get: function get() {
  3652. return this.name === null && this.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].VOID);
  3653. }
  3654. }, {
  3655. key: "commands",
  3656. get: function get() {
  3657. return this.commandBlock.commands;
  3658. }
  3659. }, {
  3660. key: "variablesDeclarations",
  3661. get: function get() {
  3662. return this.commandBlock.variables;
  3663. }
  3664. }, {
  3665. key: "sourceInfo",
  3666. set: function set(sourceInfo) {
  3667. this._sourceInfo = sourceInfo;
  3668. },
  3669. get: function get() {
  3670. return this._sourceInfo;
  3671. }
  3672. }]);
  3673. return Function;
  3674. }();
  3675. /***/ }),
  3676. /***/ "./js/ast/commands/ifThenElse.js":
  3677. /*!***************************************!*\
  3678. !*** ./js/ast/commands/ifThenElse.js ***!
  3679. \***************************************/
  3680. /*! exports provided: IfThenElse */
  3681. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3682. "use strict";
  3683. __webpack_require__.r(__webpack_exports__);
  3684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return IfThenElse; });
  3685. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3686. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3687. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3688. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3689. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3690. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3691. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3692. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3693. var IfThenElse =
  3694. /*#__PURE__*/
  3695. function (_Command) {
  3696. _inherits(IfThenElse, _Command);
  3697. function IfThenElse(condition, ifTrue, ifFalse) {
  3698. var _this;
  3699. _classCallCheck(this, IfThenElse);
  3700. _this = _possibleConstructorReturn(this, _getPrototypeOf(IfThenElse).call(this));
  3701. _this.condition = condition;
  3702. _this.ifTrue = ifTrue;
  3703. _this.ifFalse = ifFalse;
  3704. return _this;
  3705. }
  3706. return IfThenElse;
  3707. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3708. /***/ }),
  3709. /***/ "./js/ast/commands/index.js":
  3710. /*!**********************************!*\
  3711. !*** ./js/ast/commands/index.js ***!
  3712. \**********************************/
  3713. /*! exports provided: Break, Return, Assign, ArrayIndexAssign, Declaration, ArrayDeclaration, While, For, Function, IfThenElse, CommandBlock, DoWhile, Switch, Case, SysCall, FormalParameter, FunctionCall */
  3714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3715. "use strict";
  3716. __webpack_require__.r(__webpack_exports__);
  3717. /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./break */ "./js/ast/commands/break.js");
  3718. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return _break__WEBPACK_IMPORTED_MODULE_0__["Break"]; });
  3719. /* harmony import */ var _return__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./return */ "./js/ast/commands/return.js");
  3720. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return _return__WEBPACK_IMPORTED_MODULE_1__["Return"]; });
  3721. /* harmony import */ var _assign__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./assign */ "./js/ast/commands/assign.js");
  3722. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Assign", function() { return _assign__WEBPACK_IMPORTED_MODULE_2__["Assign"]; });
  3723. /* harmony import */ var _arrayAssign__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./arrayAssign */ "./js/ast/commands/arrayAssign.js");
  3724. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayIndexAssign", function() { return _arrayAssign__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]; });
  3725. /* harmony import */ var _declaration__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./declaration */ "./js/ast/commands/declaration.js");
  3726. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Declaration", function() { return _declaration__WEBPACK_IMPORTED_MODULE_4__["Declaration"]; });
  3727. /* harmony import */ var _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./arrayDeclaration */ "./js/ast/commands/arrayDeclaration.js");
  3728. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayDeclaration", function() { return _arrayDeclaration__WEBPACK_IMPORTED_MODULE_5__["ArrayDeclaration"]; });
  3729. /* harmony import */ var _while__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./while */ "./js/ast/commands/while.js");
  3730. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "While", function() { return _while__WEBPACK_IMPORTED_MODULE_6__["While"]; });
  3731. /* harmony import */ var _for__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./for */ "./js/ast/commands/for.js");
  3732. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "For", function() { return _for__WEBPACK_IMPORTED_MODULE_7__["For"]; });
  3733. /* harmony import */ var _function__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./function */ "./js/ast/commands/function.js");
  3734. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return _function__WEBPACK_IMPORTED_MODULE_8__["Function"]; });
  3735. /* harmony import */ var _ifThenElse__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./ifThenElse */ "./js/ast/commands/ifThenElse.js");
  3736. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IfThenElse", function() { return _ifThenElse__WEBPACK_IMPORTED_MODULE_9__["IfThenElse"]; });
  3737. /* harmony import */ var _commandBlock__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commandBlock */ "./js/ast/commands/commandBlock.js");
  3738. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "CommandBlock", function() { return _commandBlock__WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]; });
  3739. /* harmony import */ var _doWhile__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./doWhile */ "./js/ast/commands/doWhile.js");
  3740. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "DoWhile", function() { return _doWhile__WEBPACK_IMPORTED_MODULE_11__["DoWhile"]; });
  3741. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./switch */ "./js/ast/commands/switch.js");
  3742. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return _switch__WEBPACK_IMPORTED_MODULE_12__["Switch"]; });
  3743. /* harmony import */ var _case__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./case */ "./js/ast/commands/case.js");
  3744. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Case", function() { return _case__WEBPACK_IMPORTED_MODULE_13__["Case"]; });
  3745. /* harmony import */ var _sysCall__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./sysCall */ "./js/ast/commands/sysCall.js");
  3746. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return _sysCall__WEBPACK_IMPORTED_MODULE_14__["SysCall"]; });
  3747. /* harmony import */ var _formalParameter__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./formalParameter */ "./js/ast/commands/formalParameter.js");
  3748. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FormalParameter", function() { return _formalParameter__WEBPACK_IMPORTED_MODULE_15__["FormalParameter"]; });
  3749. /* harmony import */ var _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./../expressions/functionCall */ "./js/ast/expressions/functionCall.js");
  3750. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _expressions_functionCall__WEBPACK_IMPORTED_MODULE_16__["FunctionCall"]; });
  3751. //Proxy to expression since they do exatcly the same thing
  3752. /***/ }),
  3753. /***/ "./js/ast/commands/return.js":
  3754. /*!***********************************!*\
  3755. !*** ./js/ast/commands/return.js ***!
  3756. \***********************************/
  3757. /*! exports provided: Return */
  3758. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3759. "use strict";
  3760. __webpack_require__.r(__webpack_exports__);
  3761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  3762. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3763. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3764. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3765. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3766. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3767. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3768. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3769. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3770. var Return =
  3771. /*#__PURE__*/
  3772. function (_Command) {
  3773. _inherits(Return, _Command);
  3774. function Return(expression) {
  3775. var _this;
  3776. _classCallCheck(this, Return);
  3777. _this = _possibleConstructorReturn(this, _getPrototypeOf(Return).call(this));
  3778. _this.expression = expression;
  3779. return _this;
  3780. }
  3781. return Return;
  3782. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3783. /***/ }),
  3784. /***/ "./js/ast/commands/switch.js":
  3785. /*!***********************************!*\
  3786. !*** ./js/ast/commands/switch.js ***!
  3787. \***********************************/
  3788. /*! exports provided: Switch */
  3789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3790. "use strict";
  3791. __webpack_require__.r(__webpack_exports__);
  3792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  3793. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3794. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3795. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3796. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3797. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3798. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3799. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3800. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3801. var Switch =
  3802. /*#__PURE__*/
  3803. function (_Command) {
  3804. _inherits(Switch, _Command);
  3805. function Switch(expression, cases) {
  3806. var _this;
  3807. _classCallCheck(this, Switch);
  3808. _this = _possibleConstructorReturn(this, _getPrototypeOf(Switch).call(this));
  3809. _this.expression = expression;
  3810. _this.cases = cases;
  3811. return _this;
  3812. }
  3813. return Switch;
  3814. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3815. /***/ }),
  3816. /***/ "./js/ast/commands/sysCall.js":
  3817. /*!************************************!*\
  3818. !*** ./js/ast/commands/sysCall.js ***!
  3819. \************************************/
  3820. /*! exports provided: SysCall */
  3821. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3822. "use strict";
  3823. __webpack_require__.r(__webpack_exports__);
  3824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SysCall", function() { return SysCall; });
  3825. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3826. /**
  3827. * This class represents all the language defined functions.
  3828. * The language processor uses the id provided here to properly execute the desired function.
  3829. * The function is actually implemented inside the language processor.
  3830. * All the functions can be found at: js/processor/definedFunctions.js
  3831. */
  3832. var SysCall = function SysCall(langFunc) {
  3833. _classCallCheck(this, SysCall);
  3834. this.langFunc = langFunc;
  3835. };
  3836. /***/ }),
  3837. /***/ "./js/ast/commands/while.js":
  3838. /*!**********************************!*\
  3839. !*** ./js/ast/commands/while.js ***!
  3840. \**********************************/
  3841. /*! exports provided: While */
  3842. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3843. "use strict";
  3844. __webpack_require__.r(__webpack_exports__);
  3845. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "While", function() { return While; });
  3846. /* harmony import */ var _command__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./command */ "./js/ast/commands/command.js");
  3847. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3848. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3849. 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); } }
  3850. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  3851. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3852. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3853. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3854. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3855. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3856. var While =
  3857. /*#__PURE__*/
  3858. function (_Command) {
  3859. _inherits(While, _Command);
  3860. function While(expression, commandBlock) {
  3861. var _this;
  3862. _classCallCheck(this, While);
  3863. _this = _possibleConstructorReturn(this, _getPrototypeOf(While).call(this));
  3864. _this.expression = expression;
  3865. _this.commandBlock = commandBlock;
  3866. return _this;
  3867. }
  3868. _createClass(While, [{
  3869. key: "commands",
  3870. get: function get() {
  3871. return this.commandBlock.commands;
  3872. }
  3873. }, {
  3874. key: "testFirst",
  3875. get: function get() {
  3876. return true;
  3877. }
  3878. }]);
  3879. return While;
  3880. }(_command__WEBPACK_IMPORTED_MODULE_0__["Command"]);
  3881. /***/ }),
  3882. /***/ "./js/ast/error/syntaxError.js":
  3883. /*!*************************************!*\
  3884. !*** ./js/ast/error/syntaxError.js ***!
  3885. \*************************************/
  3886. /*! exports provided: SyntaxError */
  3887. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3888. "use strict";
  3889. __webpack_require__.r(__webpack_exports__);
  3890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxError", function() { return SyntaxError; });
  3891. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  3892. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3893. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3894. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3895. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3896. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  3897. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  3898. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  3899. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  3900. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3901. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3902. var SyntaxError =
  3903. /*#__PURE__*/
  3904. function (_Error) {
  3905. _inherits(SyntaxError, _Error);
  3906. function SyntaxError() {
  3907. var _getPrototypeOf2;
  3908. var _this;
  3909. _classCallCheck(this, SyntaxError);
  3910. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  3911. msg[_key] = arguments[_key];
  3912. }
  3913. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SyntaxError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  3914. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SyntaxError);
  3915. return _this;
  3916. }
  3917. return SyntaxError;
  3918. }(_wrapNativeSuper(Error));
  3919. /***/ }),
  3920. /***/ "./js/ast/error/syntaxErrorFactory.js":
  3921. /*!********************************************!*\
  3922. !*** ./js/ast/error/syntaxErrorFactory.js ***!
  3923. \********************************************/
  3924. /*! exports provided: SyntaxErrorFactory */
  3925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  3926. "use strict";
  3927. __webpack_require__.r(__webpack_exports__);
  3928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SyntaxErrorFactory", function() { return SyntaxErrorFactory; });
  3929. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  3930. /* harmony import */ var _syntaxError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./syntaxError */ "./js/ast/error/syntaxError.js");
  3931. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_0__["getInstance"]();
  3932. var SyntaxErrorFactory = Object.freeze({
  3933. extra_lines: function extra_lines() {
  3934. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("extra_lines"));
  3935. },
  3936. token_missing_one: function token_missing_one(expected, token) {
  3937. var context = [expected, token.text, token.line, token.column];
  3938. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("token_missing_one", context));
  3939. },
  3940. token_missing_list: function token_missing_list(expectedList, token) {
  3941. var line = expectedList.join(LocalizedStrings.getOR());
  3942. return SyntaxErrorFactory.token_missing_one(line, token);
  3943. },
  3944. id_missing: function id_missing(token) {
  3945. var context = [token.text, token.line, token.column];
  3946. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("id_missing", context));
  3947. },
  3948. eos_missing: function eos_missing(token) {
  3949. var context = [token.line, token.column];
  3950. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("eos_missing", context));
  3951. },
  3952. invalid_array_dimension: function invalid_array_dimension(typeName, token) {
  3953. var context = [token.line, token.column, typeName];
  3954. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_dimension", context));
  3955. },
  3956. invalid_array_size: function invalid_array_size(token) {
  3957. var context = [token.line];
  3958. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_array_size", context));
  3959. },
  3960. invalid_main_return: function invalid_main_return(name, typeName, token) {
  3961. var context = [name, typeName, token.line];
  3962. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_main_return", context));
  3963. },
  3964. invalid_var_declaration: function invalid_var_declaration(token) {
  3965. var context = [token.line];
  3966. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_var_declaration", context));
  3967. },
  3968. invalid_break_command: function invalid_break_command(cmdName, token) {
  3969. var context = [token.line, cmdName];
  3970. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_break_command", context));
  3971. },
  3972. invalid_terminal: function invalid_terminal(token) {
  3973. var context = [token.text, token.line, token.column];
  3974. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError('invalid_terminal', context));
  3975. },
  3976. invalid_type: function invalid_type(list, token) {
  3977. var line = list.join(LocalizedStrings.getOR());
  3978. var context = [token.text, token.line, token.column, line];
  3979. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_type", context));
  3980. },
  3981. const_not_init: function const_not_init(token) {
  3982. var context = [token.line, token.column];
  3983. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("const_not_init", context));
  3984. },
  3985. invalid_id_format: function invalid_id_format(token) {
  3986. var context = [token.text, token.line, token.column];
  3987. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("invalid_id_format", context));
  3988. },
  3989. duplicate_function: function duplicate_function(token) {
  3990. var context = [token.text, token.line, token.column];
  3991. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_function", context));
  3992. },
  3993. main_parameters: function main_parameters() {
  3994. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("main_parameters"));
  3995. },
  3996. duplicate_variable: function duplicate_variable(token) {
  3997. var context = [token.text, token.line, token.column];
  3998. return new _syntaxError__WEBPACK_IMPORTED_MODULE_1__["SyntaxError"](LocalizedStrings.getError("duplicate_variable", context));
  3999. }
  4000. });
  4001. /***/ }),
  4002. /***/ "./js/ast/expressions/arrayAccess.js":
  4003. /*!*******************************************!*\
  4004. !*** ./js/ast/expressions/arrayAccess.js ***!
  4005. \*******************************************/
  4006. /*! exports provided: ArrayAccess */
  4007. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4008. "use strict";
  4009. __webpack_require__.r(__webpack_exports__);
  4010. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return ArrayAccess; });
  4011. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4012. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4013. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4014. 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); } }
  4015. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4016. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4017. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4018. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4019. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4020. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4021. var ArrayAccess =
  4022. /*#__PURE__*/
  4023. function (_Expression) {
  4024. _inherits(ArrayAccess, _Expression);
  4025. function ArrayAccess(id, line, column) {
  4026. var _this;
  4027. _classCallCheck(this, ArrayAccess);
  4028. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayAccess).call(this));
  4029. _this.id = id;
  4030. _this.line = line;
  4031. _this.column = column;
  4032. return _this;
  4033. }
  4034. _createClass(ArrayAccess, [{
  4035. key: "toString",
  4036. value: function toString() {
  4037. var strLine = this.line.toString();
  4038. var strColumn = null;
  4039. if (this.column) {
  4040. strColumn = this.column.toString();
  4041. }
  4042. if (strColumn) {
  4043. return "".concat(this.id, "[").concat(strLine, "][").concat(strColumn, "]");
  4044. } else {
  4045. return "".concat(this.id, "[").concat(strLine, "]");
  4046. }
  4047. }
  4048. }]);
  4049. return ArrayAccess;
  4050. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4051. /***/ }),
  4052. /***/ "./js/ast/expressions/arrayLiteral.js":
  4053. /*!********************************************!*\
  4054. !*** ./js/ast/expressions/arrayLiteral.js ***!
  4055. \********************************************/
  4056. /*! exports provided: ArrayLiteral */
  4057. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4058. "use strict";
  4059. __webpack_require__.r(__webpack_exports__);
  4060. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return ArrayLiteral; });
  4061. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4062. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4063. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4064. 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); } }
  4065. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4066. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4067. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4068. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4069. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4070. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4071. var ArrayLiteral =
  4072. /*#__PURE__*/
  4073. function (_Literal) {
  4074. _inherits(ArrayLiteral, _Literal);
  4075. function ArrayLiteral(type, value) {
  4076. var _this;
  4077. _classCallCheck(this, ArrayLiteral);
  4078. _this = _possibleConstructorReturn(this, _getPrototypeOf(ArrayLiteral).call(this, type));
  4079. _this.value = value;
  4080. return _this;
  4081. }
  4082. _createClass(ArrayLiteral, [{
  4083. key: "validateType",
  4084. value: function validateType() {
  4085. // let valid = true;
  4086. // if(this.columns !== null) {
  4087. // const len = this.columns;
  4088. // const len2 = this.lines;
  4089. // for (let i = len - 1; i >= 0; i--) {
  4090. // for (let j = len2 - 1; j >= 0; j--) {
  4091. // if(this.value[i].value[j].type !== this.subtype) {
  4092. // valid = false;
  4093. // break;
  4094. // }
  4095. // }
  4096. // }
  4097. // } else {
  4098. // const len = this.lines;
  4099. // for (var i = len - 1; i >= 0; i--) {
  4100. // if(this.value[i].type !== this.subtype) {
  4101. // valid = false;
  4102. // break;
  4103. // }
  4104. // }
  4105. // }
  4106. return true; //valid;
  4107. }
  4108. }, {
  4109. key: "validateSize",
  4110. value: function validateSize() {
  4111. var valid = true;
  4112. if (this.columns !== null) {
  4113. var equalityTest = data.value.map(function (v) {
  4114. return v.length;
  4115. }).reduce(function (old, next) {
  4116. if (old === null) {
  4117. return next;
  4118. } else if (old === next) {
  4119. return old;
  4120. } else {
  4121. return -1;
  4122. }
  4123. }, null);
  4124. valid = equalityTest !== -1;
  4125. }
  4126. return valid;
  4127. }
  4128. }, {
  4129. key: "toString",
  4130. value: function toString() {
  4131. var strList = this.value.map(function (arrayLiteral) {
  4132. return arrayLiteral.toString();
  4133. });
  4134. return "{" + strList.join(',') + "}";
  4135. }
  4136. }, {
  4137. key: "subtype",
  4138. get: function get() {
  4139. var element = this.value[0];
  4140. if (element instanceof ArrayLiteral) {
  4141. return element.value[0].type;
  4142. } else {
  4143. return element.type;
  4144. }
  4145. }
  4146. }, {
  4147. key: "lines",
  4148. get: function get() {
  4149. return this.value.length;
  4150. }
  4151. }, {
  4152. key: "columns",
  4153. get: function get() {
  4154. var element = this.value[0];
  4155. if (!(element instanceof ArrayLiteral)) {
  4156. return null;
  4157. } else {
  4158. return element.value[0].length;
  4159. }
  4160. }
  4161. }, {
  4162. key: "isVector",
  4163. get: function get() {
  4164. return this.columns === null;
  4165. }
  4166. }, {
  4167. key: "isValid",
  4168. get: function get() {
  4169. return true; //this.validateType() && this.validateSize();
  4170. }
  4171. }]);
  4172. return ArrayLiteral;
  4173. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4174. /***/ }),
  4175. /***/ "./js/ast/expressions/boolLiteral.js":
  4176. /*!*******************************************!*\
  4177. !*** ./js/ast/expressions/boolLiteral.js ***!
  4178. \*******************************************/
  4179. /*! exports provided: BoolLiteral */
  4180. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4181. "use strict";
  4182. __webpack_require__.r(__webpack_exports__);
  4183. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return BoolLiteral; });
  4184. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4185. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4186. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4187. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4188. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4189. 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); } }
  4190. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4191. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4192. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4193. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4194. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4195. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4196. var BoolLiteral =
  4197. /*#__PURE__*/
  4198. function (_Literal) {
  4199. _inherits(BoolLiteral, _Literal);
  4200. function BoolLiteral(value) {
  4201. var _this;
  4202. _classCallCheck(this, BoolLiteral);
  4203. _this = _possibleConstructorReturn(this, _getPrototypeOf(BoolLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN));
  4204. _this.value = value;
  4205. return _this;
  4206. }
  4207. _createClass(BoolLiteral, [{
  4208. key: "toString",
  4209. value: function toString() {
  4210. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertBoolToString"])(this.value);
  4211. }
  4212. }]);
  4213. return BoolLiteral;
  4214. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4215. /***/ }),
  4216. /***/ "./js/ast/expressions/expression.js":
  4217. /*!******************************************!*\
  4218. !*** ./js/ast/expressions/expression.js ***!
  4219. \******************************************/
  4220. /*! exports provided: Expression */
  4221. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4222. "use strict";
  4223. __webpack_require__.r(__webpack_exports__);
  4224. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; });
  4225. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4226. 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); } }
  4227. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4228. var Expression =
  4229. /*#__PURE__*/
  4230. function () {
  4231. function Expression() {
  4232. _classCallCheck(this, Expression);
  4233. this._sourceInfo = null;
  4234. }
  4235. _createClass(Expression, [{
  4236. key: "sourceInfo",
  4237. set: function set(sourceInfo) {
  4238. this._sourceInfo = sourceInfo;
  4239. },
  4240. get: function get() {
  4241. return this._sourceInfo;
  4242. }
  4243. }]);
  4244. return Expression;
  4245. }();
  4246. /***/ }),
  4247. /***/ "./js/ast/expressions/functionCall.js":
  4248. /*!********************************************!*\
  4249. !*** ./js/ast/expressions/functionCall.js ***!
  4250. \********************************************/
  4251. /*! exports provided: FunctionCall */
  4252. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4253. "use strict";
  4254. __webpack_require__.r(__webpack_exports__);
  4255. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  4256. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4257. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4258. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4259. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4260. 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); } }
  4261. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4262. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4263. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4264. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4265. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4266. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4267. var FunctionCall =
  4268. /*#__PURE__*/
  4269. function (_Expression) {
  4270. _inherits(FunctionCall, _Expression);
  4271. function FunctionCall(id, actualParameters) {
  4272. var _this;
  4273. _classCallCheck(this, FunctionCall);
  4274. _this = _possibleConstructorReturn(this, _getPrototypeOf(FunctionCall).call(this));
  4275. _this.id = id;
  4276. _this.actualParameters = actualParameters;
  4277. return _this;
  4278. }
  4279. _createClass(FunctionCall, [{
  4280. key: "toString",
  4281. value: function toString() {
  4282. var name = null;
  4283. if (this.isMainCall) {
  4284. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName();
  4285. } else {
  4286. name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getLocalName(this.id);
  4287. }
  4288. var params = null;
  4289. if (this.actualParameters.length == 0) {
  4290. params = "()";
  4291. } else {
  4292. var strParams = this.actualParameters.map(function (v) {
  4293. return v.toString();
  4294. });
  4295. params = "(" + strParams.join(",") + ")";
  4296. }
  4297. return name + params;
  4298. }
  4299. }, {
  4300. key: "isMainCall",
  4301. get: function get() {
  4302. return this.id === null;
  4303. }
  4304. }, {
  4305. key: "parametersSize",
  4306. get: function get() {
  4307. return this.actualParameters.length;
  4308. }
  4309. }]);
  4310. return FunctionCall;
  4311. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4312. /***/ }),
  4313. /***/ "./js/ast/expressions/index.js":
  4314. /*!*************************************!*\
  4315. !*** ./js/ast/expressions/index.js ***!
  4316. \*************************************/
  4317. /*! exports provided: ArrayAccess, FunctionCall, IntLiteral, RealLiteral, BoolLiteral, StringLiteral, ArrayLiteral, VariableLiteral, InfixApp, UnaryApp */
  4318. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4319. "use strict";
  4320. __webpack_require__.r(__webpack_exports__);
  4321. /* harmony import */ var _arrayAccess__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./arrayAccess */ "./js/ast/expressions/arrayAccess.js");
  4322. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayAccess", function() { return _arrayAccess__WEBPACK_IMPORTED_MODULE_0__["ArrayAccess"]; });
  4323. /* harmony import */ var _functionCall__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./functionCall */ "./js/ast/expressions/functionCall.js");
  4324. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return _functionCall__WEBPACK_IMPORTED_MODULE_1__["FunctionCall"]; });
  4325. /* harmony import */ var _intLiteral__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./intLiteral */ "./js/ast/expressions/intLiteral.js");
  4326. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return _intLiteral__WEBPACK_IMPORTED_MODULE_2__["IntLiteral"]; });
  4327. /* harmony import */ var _realLiteral__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./realLiteral */ "./js/ast/expressions/realLiteral.js");
  4328. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return _realLiteral__WEBPACK_IMPORTED_MODULE_3__["RealLiteral"]; });
  4329. /* harmony import */ var _boolLiteral__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./boolLiteral */ "./js/ast/expressions/boolLiteral.js");
  4330. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BoolLiteral", function() { return _boolLiteral__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]; });
  4331. /* harmony import */ var _stringLiteral__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./stringLiteral */ "./js/ast/expressions/stringLiteral.js");
  4332. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return _stringLiteral__WEBPACK_IMPORTED_MODULE_5__["StringLiteral"]; });
  4333. /* harmony import */ var _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./arrayLiteral */ "./js/ast/expressions/arrayLiteral.js");
  4334. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArrayLiteral", function() { return _arrayLiteral__WEBPACK_IMPORTED_MODULE_6__["ArrayLiteral"]; });
  4335. /* harmony import */ var _variableLiteral__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variableLiteral */ "./js/ast/expressions/variableLiteral.js");
  4336. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return _variableLiteral__WEBPACK_IMPORTED_MODULE_7__["VariableLiteral"]; });
  4337. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4338. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return _infixApp__WEBPACK_IMPORTED_MODULE_8__["InfixApp"]; });
  4339. /* harmony import */ var _unaryApp__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./unaryApp */ "./js/ast/expressions/unaryApp.js");
  4340. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return _unaryApp__WEBPACK_IMPORTED_MODULE_9__["UnaryApp"]; });
  4341. /***/ }),
  4342. /***/ "./js/ast/expressions/infixApp.js":
  4343. /*!****************************************!*\
  4344. !*** ./js/ast/expressions/infixApp.js ***!
  4345. \****************************************/
  4346. /*! exports provided: InfixApp */
  4347. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4348. "use strict";
  4349. __webpack_require__.r(__webpack_exports__);
  4350. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InfixApp", function() { return InfixApp; });
  4351. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4352. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4353. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4354. 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); } }
  4355. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4356. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4357. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4358. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4359. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4360. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4361. var InfixApp =
  4362. /*#__PURE__*/
  4363. function (_Expression) {
  4364. _inherits(InfixApp, _Expression);
  4365. function InfixApp(op, left, right) {
  4366. var _this;
  4367. _classCallCheck(this, InfixApp);
  4368. _this = _possibleConstructorReturn(this, _getPrototypeOf(InfixApp).call(this));
  4369. _this.op = op;
  4370. _this.left = left;
  4371. _this.right = right;
  4372. return _this;
  4373. }
  4374. _createClass(InfixApp, [{
  4375. key: "toString",
  4376. value: function toString() {
  4377. var l = this.left.toString();
  4378. var op = this.op.value;
  4379. var r = this.right.toString();
  4380. return l + op + r;
  4381. }
  4382. }]);
  4383. return InfixApp;
  4384. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4385. /***/ }),
  4386. /***/ "./js/ast/expressions/intLiteral.js":
  4387. /*!******************************************!*\
  4388. !*** ./js/ast/expressions/intLiteral.js ***!
  4389. \******************************************/
  4390. /*! exports provided: IntLiteral */
  4391. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4392. "use strict";
  4393. __webpack_require__.r(__webpack_exports__);
  4394. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IntLiteral", function() { return IntLiteral; });
  4395. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4396. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4397. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4398. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4399. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4400. 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); } }
  4401. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4402. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4403. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4404. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4405. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4406. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4407. var IntLiteral =
  4408. /*#__PURE__*/
  4409. function (_Literal) {
  4410. _inherits(IntLiteral, _Literal);
  4411. function IntLiteral(value) {
  4412. var _this;
  4413. _classCallCheck(this, IntLiteral);
  4414. _this = _possibleConstructorReturn(this, _getPrototypeOf(IntLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER));
  4415. _this.value = value;
  4416. return _this;
  4417. }
  4418. _createClass(IntLiteral, [{
  4419. key: "toString",
  4420. value: function toString() {
  4421. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4422. }
  4423. }]);
  4424. return IntLiteral;
  4425. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4426. /***/ }),
  4427. /***/ "./js/ast/expressions/literal.js":
  4428. /*!***************************************!*\
  4429. !*** ./js/ast/expressions/literal.js ***!
  4430. \***************************************/
  4431. /*! exports provided: Literal */
  4432. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4433. "use strict";
  4434. __webpack_require__.r(__webpack_exports__);
  4435. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Literal", function() { return Literal; });
  4436. /* harmony import */ var _expression__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./expression */ "./js/ast/expressions/expression.js");
  4437. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4438. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4439. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4440. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4441. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4442. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4443. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4444. var Literal =
  4445. /*#__PURE__*/
  4446. function (_Expression) {
  4447. _inherits(Literal, _Expression);
  4448. function Literal(type) {
  4449. var _this;
  4450. _classCallCheck(this, Literal);
  4451. _this = _possibleConstructorReturn(this, _getPrototypeOf(Literal).call(this));
  4452. _this.type = type;
  4453. return _this;
  4454. }
  4455. return Literal;
  4456. }(_expression__WEBPACK_IMPORTED_MODULE_0__["Expression"]);
  4457. /***/ }),
  4458. /***/ "./js/ast/expressions/realLiteral.js":
  4459. /*!*******************************************!*\
  4460. !*** ./js/ast/expressions/realLiteral.js ***!
  4461. \*******************************************/
  4462. /*! exports provided: RealLiteral */
  4463. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4464. "use strict";
  4465. __webpack_require__.r(__webpack_exports__);
  4466. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RealLiteral", function() { return RealLiteral; });
  4467. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4468. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4469. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4470. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4471. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4472. 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); } }
  4473. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4474. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4475. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4476. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4478. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4479. var RealLiteral =
  4480. /*#__PURE__*/
  4481. function (_Literal) {
  4482. _inherits(RealLiteral, _Literal);
  4483. function RealLiteral(value) {
  4484. var _this;
  4485. _classCallCheck(this, RealLiteral);
  4486. _this = _possibleConstructorReturn(this, _getPrototypeOf(RealLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL));
  4487. _this.value = value;
  4488. return _this;
  4489. }
  4490. _createClass(RealLiteral, [{
  4491. key: "toString",
  4492. value: function toString() {
  4493. return Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(this.value, this.type);
  4494. }
  4495. }]);
  4496. return RealLiteral;
  4497. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4498. /***/ }),
  4499. /***/ "./js/ast/expressions/stringLiteral.js":
  4500. /*!*********************************************!*\
  4501. !*** ./js/ast/expressions/stringLiteral.js ***!
  4502. \*********************************************/
  4503. /*! exports provided: StringLiteral */
  4504. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4505. "use strict";
  4506. __webpack_require__.r(__webpack_exports__);
  4507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringLiteral", function() { return StringLiteral; });
  4508. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4509. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4510. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4511. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4512. 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); } }
  4513. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4514. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4515. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4516. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4517. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4518. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4519. var StringLiteral =
  4520. /*#__PURE__*/
  4521. function (_Literal) {
  4522. _inherits(StringLiteral, _Literal);
  4523. function StringLiteral(value) {
  4524. var _this;
  4525. _classCallCheck(this, StringLiteral);
  4526. _this = _possibleConstructorReturn(this, _getPrototypeOf(StringLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].STRING));
  4527. _this.value = value;
  4528. return _this;
  4529. }
  4530. _createClass(StringLiteral, [{
  4531. key: "toString",
  4532. value: function toString() {
  4533. return '"' + this.value + '"';
  4534. }
  4535. }]);
  4536. return StringLiteral;
  4537. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4538. /***/ }),
  4539. /***/ "./js/ast/expressions/unaryApp.js":
  4540. /*!****************************************!*\
  4541. !*** ./js/ast/expressions/unaryApp.js ***!
  4542. \****************************************/
  4543. /*! exports provided: UnaryApp */
  4544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4545. "use strict";
  4546. __webpack_require__.r(__webpack_exports__);
  4547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnaryApp", function() { return UnaryApp; });
  4548. /* harmony import */ var _infixApp__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./infixApp */ "./js/ast/expressions/infixApp.js");
  4549. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4550. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4551. 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); } }
  4552. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4553. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4554. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4555. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4556. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4557. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4558. var UnaryApp =
  4559. /*#__PURE__*/
  4560. function (_InfixApp) {
  4561. _inherits(UnaryApp, _InfixApp);
  4562. function UnaryApp(op, left) {
  4563. _classCallCheck(this, UnaryApp);
  4564. return _possibleConstructorReturn(this, _getPrototypeOf(UnaryApp).call(this, op, left, null));
  4565. }
  4566. _createClass(UnaryApp, [{
  4567. key: "toString",
  4568. value: function toString() {
  4569. var l = this.left.toString();
  4570. var op = this.op.value;
  4571. return op + l;
  4572. }
  4573. }]);
  4574. return UnaryApp;
  4575. }(_infixApp__WEBPACK_IMPORTED_MODULE_0__["InfixApp"]);
  4576. /***/ }),
  4577. /***/ "./js/ast/expressions/variableLiteral.js":
  4578. /*!***********************************************!*\
  4579. !*** ./js/ast/expressions/variableLiteral.js ***!
  4580. \***********************************************/
  4581. /*! exports provided: VariableLiteral */
  4582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4583. "use strict";
  4584. __webpack_require__.r(__webpack_exports__);
  4585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableLiteral", function() { return VariableLiteral; });
  4586. /* harmony import */ var _literal__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./literal */ "./js/ast/expressions/literal.js");
  4587. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  4588. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  4589. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4590. 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); } }
  4591. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4592. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  4593. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4594. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  4595. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  4596. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  4597. var VariableLiteral =
  4598. /*#__PURE__*/
  4599. function (_Literal) {
  4600. _inherits(VariableLiteral, _Literal);
  4601. function VariableLiteral(id) {
  4602. var _this;
  4603. _classCallCheck(this, VariableLiteral);
  4604. _this = _possibleConstructorReturn(this, _getPrototypeOf(VariableLiteral).call(this, _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].UNDEFINED));
  4605. _this.id = id;
  4606. return _this;
  4607. }
  4608. _createClass(VariableLiteral, [{
  4609. key: "toString",
  4610. value: function toString() {
  4611. return this.id;
  4612. }
  4613. }]);
  4614. return VariableLiteral;
  4615. }(_literal__WEBPACK_IMPORTED_MODULE_0__["Literal"]);
  4616. /***/ }),
  4617. /***/ "./js/ast/ivprogParser.js":
  4618. /*!********************************!*\
  4619. !*** ./js/ast/ivprogParser.js ***!
  4620. \********************************/
  4621. /*! exports provided: IVProgParser */
  4622. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  4623. "use strict";
  4624. __webpack_require__.r(__webpack_exports__);
  4625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgParser", function() { return IVProgParser; });
  4626. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! antlr4/index */ "./node_modules/antlr4/index.js");
  4627. /* harmony import */ var antlr4_index__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(antlr4_index__WEBPACK_IMPORTED_MODULE_0__);
  4628. /* harmony import */ var _expressions___WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./expressions/ */ "./js/ast/expressions/index.js");
  4629. /* harmony import */ var _commands___WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./commands/ */ "./js/ast/commands/index.js");
  4630. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  4631. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  4632. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  4633. /* harmony import */ var _sourceInfo__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./sourceInfo */ "./js/ast/sourceInfo.js");
  4634. /* harmony import */ var _operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./operators */ "./js/ast/operators.js");
  4635. /* harmony import */ var _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./error/syntaxErrorFactory */ "./js/ast/error/syntaxErrorFactory.js");
  4636. /* harmony import */ var _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../processor/definedFunctions */ "./js/processor/definedFunctions.js");
  4637. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  4638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4639. 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); } }
  4640. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  4641. var IVProgParser =
  4642. /*#__PURE__*/
  4643. function () {
  4644. _createClass(IVProgParser, null, [{
  4645. key: "createParser",
  4646. value: function createParser(input) {
  4647. var lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLexer();
  4648. return new IVProgParser(input, lexerClass);
  4649. } // <BEGIN scope consts>
  4650. }, {
  4651. key: "BASE",
  4652. get: function get() {
  4653. return 0;
  4654. }
  4655. }, {
  4656. key: "FUNCTION",
  4657. get: function get() {
  4658. return 1;
  4659. }
  4660. }, {
  4661. key: "COMMAND",
  4662. get: function get() {
  4663. return 2;
  4664. }
  4665. }, {
  4666. key: "BREAKABLE",
  4667. get: function get() {
  4668. return 4;
  4669. } // </ END scope consts>
  4670. }]);
  4671. function IVProgParser(input, lexerClass) {
  4672. _classCallCheck(this, IVProgParser);
  4673. this.lexerClass = lexerClass;
  4674. this.lexer = new lexerClass(new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["InputStream"](input));
  4675. this.tokenStream = new antlr4_index__WEBPACK_IMPORTED_MODULE_0__["CommonTokenStream"](this.lexer);
  4676. this.tokenStream.fill();
  4677. this.pos = 1;
  4678. this.variableTypes = [this.lexerClass.RK_INTEGER, this.lexerClass.RK_REAL, this.lexerClass.RK_BOOLEAN, this.lexerClass.RK_STRING];
  4679. this.functionTypes = this.variableTypes.concat(this.lexerClass.RK_VOID);
  4680. this.parsingArrayDimension = 0;
  4681. this.scope = [];
  4682. this.langFuncs = _services_languageService__WEBPACK_IMPORTED_MODULE_10__["LanguageService"].getCurrentLangFuncs();
  4683. this.definedFuncsNameList = [];
  4684. this.definedVariablesStack = [];
  4685. }
  4686. _createClass(IVProgParser, [{
  4687. key: "parseTree",
  4688. value: function parseTree() {
  4689. return this.parseProgram();
  4690. }
  4691. }, {
  4692. key: "getToken",
  4693. value: function getToken() {
  4694. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.pos;
  4695. // if(index === null)
  4696. // index = this.pos;
  4697. return this.tokenStream.LT(index);
  4698. }
  4699. }, {
  4700. key: "insideScope",
  4701. value: function insideScope(scope) {
  4702. if (this.scope.length <= 0) {
  4703. return IVProgParser.BASE === scope;
  4704. } else {
  4705. return this.scope[this.scope.length - 1] === scope;
  4706. }
  4707. }
  4708. }, {
  4709. key: "pushScope",
  4710. value: function pushScope(scope) {
  4711. this.scope.push(scope);
  4712. }
  4713. }, {
  4714. key: "pushVariableStack",
  4715. value: function pushVariableStack() {
  4716. this.definedVariablesStack.push([]);
  4717. }
  4718. }, {
  4719. key: "popScope",
  4720. value: function popScope() {
  4721. return this.scope.pop();
  4722. }
  4723. }, {
  4724. key: "popVariableStack",
  4725. value: function popVariableStack() {
  4726. return this.definedVariablesStack.pop();
  4727. }
  4728. }, {
  4729. key: "getCurrentVariableStack",
  4730. value: function getCurrentVariableStack() {
  4731. return this.definedVariablesStack[this.definedVariablesStack.length - 1];
  4732. }
  4733. }, {
  4734. key: "isEOF",
  4735. value: function isEOF() {
  4736. this.getToken(this.pos);
  4737. return this.tokenStream.fetchedEOF;
  4738. }
  4739. }, {
  4740. key: "parseProgram",
  4741. value: function parseProgram() {
  4742. var token = this.getToken();
  4743. var globalVars = [];
  4744. var functions = [];
  4745. if (this.lexerClass.RK_PROGRAM === token.type) {
  4746. this.pos++;
  4747. this.consumeNewLines();
  4748. this.checkOpenCurly();
  4749. this.pos++;
  4750. this.pushVariableStack();
  4751. while (true) {
  4752. this.consumeNewLines();
  4753. var _token = this.getToken();
  4754. if (_token.type === this.lexerClass.RK_CONST || this.isVariableType(_token)) {
  4755. globalVars = globalVars.concat(this.parseGlobalVariables());
  4756. } else if (_token.type === this.lexerClass.RK_FUNCTION) {
  4757. this.pushVariableStack();
  4758. functions = functions.concat(this.parseFunction());
  4759. this.popVariableStack();
  4760. } else {
  4761. break;
  4762. }
  4763. }
  4764. this.consumeNewLines();
  4765. this.checkCloseCurly();
  4766. this.pos++;
  4767. this.consumeNewLines();
  4768. if (!this.isEOF()) {
  4769. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].extra_lines();
  4770. }
  4771. this.popVariableStack();
  4772. return {
  4773. global: globalVars,
  4774. functions: functions
  4775. };
  4776. } else {
  4777. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_PROGRAM], token);
  4778. }
  4779. }
  4780. }, {
  4781. key: "checkOpenCurly",
  4782. value: function checkOpenCurly() {
  4783. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4784. var token = this.getToken();
  4785. if (this.lexerClass.OPEN_CURLY !== token.type) {
  4786. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('{', token);else return false;
  4787. }
  4788. return true;
  4789. }
  4790. }, {
  4791. key: "checkCloseCurly",
  4792. value: function checkCloseCurly() {
  4793. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4794. var token = this.getToken();
  4795. if (this.lexerClass.CLOSE_CURLY !== token.type) {
  4796. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('}', token);else return false;
  4797. }
  4798. return true;
  4799. }
  4800. /* It checks if the current token at position pos is a ']'.
  4801. * As a check function it doesn't increment pos.
  4802. *
  4803. * @params bool:attempt, indicates that the token is optional. Defaults: false
  4804. *
  4805. * @returns true if the attempt is true and current token is '[',
  4806. * false is attempt is true and current token is not '['
  4807. **/
  4808. }, {
  4809. key: "checkOpenBrace",
  4810. value: function checkOpenBrace() {
  4811. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4812. var token = this.getToken();
  4813. if (this.lexerClass.OPEN_BRACE !== token.type) {
  4814. if (!attempt) {
  4815. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('[', token);
  4816. } else {
  4817. return false;
  4818. }
  4819. }
  4820. return true;
  4821. }
  4822. }, {
  4823. key: "checkCloseBrace",
  4824. value: function checkCloseBrace() {
  4825. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4826. var token = this.getToken();
  4827. if (this.lexerClass.CLOSE_BRACE !== token.type) {
  4828. if (!attempt) {
  4829. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(']', token);
  4830. } else {
  4831. return false;
  4832. }
  4833. }
  4834. return true;
  4835. }
  4836. }, {
  4837. key: "checkOpenParenthesis",
  4838. value: function checkOpenParenthesis() {
  4839. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4840. var token = this.getToken();
  4841. if (this.lexerClass.OPEN_PARENTHESIS !== token.type) {
  4842. if (!attempt) {
  4843. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('(', token);
  4844. } else {
  4845. return false;
  4846. }
  4847. }
  4848. return true;
  4849. }
  4850. }, {
  4851. key: "checkCloseParenthesis",
  4852. value: function checkCloseParenthesis() {
  4853. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4854. var token = this.getToken();
  4855. if (this.lexerClass.CLOSE_PARENTHESIS !== token.type) {
  4856. if (!attempt) {
  4857. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(')', token);
  4858. } else {
  4859. return false;
  4860. }
  4861. }
  4862. return true;
  4863. }
  4864. }, {
  4865. key: "checkEOS",
  4866. value: function checkEOS() {
  4867. var attempt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  4868. var eosToken = this.getToken();
  4869. if (eosToken.type !== this.lexerClass.EOS) {
  4870. if (!attempt) throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].eos_missing(eosToken);else return false;
  4871. }
  4872. return true;
  4873. }
  4874. }, {
  4875. key: "checkFunctionDuplicate",
  4876. value: function checkFunctionDuplicate(functionID, funcIDToken) {
  4877. var id = functionID === null ? "$main" : functionID;
  4878. var index = this.definedFuncsNameList.indexOf(id);
  4879. if (index !== -1) {
  4880. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_function(funcIDToken);
  4881. }
  4882. this.definedFuncsNameList.push(id);
  4883. }
  4884. }, {
  4885. key: "checkVariableDuplicate",
  4886. value: function checkVariableDuplicate(variableID, variableIDToken) {
  4887. var index = this.getCurrentVariableStack().indexOf(variableID);
  4888. if (index !== -1) {
  4889. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].duplicate_variable(variableIDToken);
  4890. }
  4891. this.getCurrentVariableStack().push(variableID);
  4892. }
  4893. }, {
  4894. key: "consumeForSemiColon",
  4895. value: function consumeForSemiColon() {
  4896. var eosToken = this.getToken();
  4897. if (eosToken.type === this.lexerClass.EOS && eosToken.text.match(';')) {
  4898. this.pos++;
  4899. return;
  4900. }
  4901. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(';', eosToken);
  4902. }
  4903. }, {
  4904. key: "parseGlobalVariables",
  4905. value: function parseGlobalVariables() {
  4906. var decl = this.parseMaybeConst();
  4907. this.checkEOS();
  4908. this.pos++;
  4909. return decl;
  4910. }
  4911. /*
  4912. * Checks if the next token is PR_CONST. It's only available
  4913. * at global variables declaration level
  4914. * @returns Declararion(const, type, id, initVal?)
  4915. **/
  4916. }, {
  4917. key: "parseMaybeConst",
  4918. value: function parseMaybeConst() {
  4919. var constToken = this.getToken();
  4920. if (constToken.type === this.lexerClass.RK_CONST) {
  4921. this.pos++;
  4922. var typeString = this.parseType();
  4923. return this.parseDeclaration(typeString, true);
  4924. } else if (this.isVariableType(constToken)) {
  4925. var _typeString = this.parseType();
  4926. return this.parseDeclaration(_typeString);
  4927. } else {
  4928. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_CONST]].concat(this.getTypeArray()), constToken);
  4929. }
  4930. }
  4931. /*
  4932. * Parses a declarion of the form: type --- id --- (= --- EAnd)?
  4933. * @returns a list of Declararion(const, type, id, initVal?)
  4934. **/
  4935. }, {
  4936. key: "parseDeclaration",
  4937. value: function parseDeclaration(typeString) {
  4938. var isConst = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4939. var initial = null;
  4940. var dim1 = null;
  4941. var dim2 = null;
  4942. var idToken = this.getToken();
  4943. var idString = this.parseID();
  4944. this.checkVariableDuplicate(idString, idToken); // Check for array or vector
  4945. // ID[int/IDi][int/IDj]
  4946. if (this.checkOpenBrace(true)) {
  4947. this.pos++;
  4948. this.consumeNewLines();
  4949. dim1 = this.parseArrayDimension();
  4950. this.consumeNewLines();
  4951. this.checkCloseBrace();
  4952. this.pos++;
  4953. if (this.checkOpenBrace(true)) {
  4954. this.pos++;
  4955. this.consumeNewLines();
  4956. dim2 = this.parseArrayDimension();
  4957. this.consumeNewLines();
  4958. this.checkCloseBrace();
  4959. this.pos++;
  4960. }
  4961. }
  4962. var equalsToken = this.getToken();
  4963. if (isConst && equalsToken.type !== this.lexerClass.EQUAL) {
  4964. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].const_not_init(idToken);
  4965. }
  4966. if (equalsToken.type === this.lexerClass.EQUAL) {
  4967. this.pos++;
  4968. initial = this.parseExpressionOR();
  4969. }
  4970. var declaration = null;
  4971. var dimensions = 0;
  4972. if (dim1 !== null) {
  4973. dimensions++;
  4974. if (dim2 !== null) {
  4975. dimensions++;
  4976. }
  4977. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayDeclaration"](idString, new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions), dim1, dim2, initial, isConst);
  4978. } else {
  4979. declaration = new _commands___WEBPACK_IMPORTED_MODULE_2__["Declaration"](idString, typeString, initial, isConst);
  4980. }
  4981. declaration.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(idToken);
  4982. var commaToken = this.getToken();
  4983. if (commaToken.type === this.lexerClass.COMMA) {
  4984. this.pos++;
  4985. this.consumeNewLines();
  4986. return [declaration].concat(this.parseDeclaration(typeString, isConst));
  4987. } else {
  4988. return [declaration];
  4989. }
  4990. }
  4991. }, {
  4992. key: "consumeNewLines",
  4993. value: function consumeNewLines() {
  4994. var token = this.getToken();
  4995. while (token.type === this.lexerClass.EOS && token.text.match('[\r\n]+')) {
  4996. this.pos++;
  4997. token = this.getToken();
  4998. }
  4999. }
  5000. }, {
  5001. key: "isVariableType",
  5002. value: function isVariableType(token) {
  5003. return this.variableTypes.find(function (v) {
  5004. return v === token.type;
  5005. });
  5006. }
  5007. /*
  5008. * Reads the next token of the stream to check if it is a Integer or an ID.
  5009. * @returns Integer | ID
  5010. **/
  5011. }, {
  5012. key: "parseArrayDimension",
  5013. value: function parseArrayDimension() {
  5014. var dimToken = this.getToken();
  5015. if (dimToken.type === this.lexerClass.INTEGER) {
  5016. //parse as int literal
  5017. this.pos++;
  5018. return this.getIntLiteral(dimToken);
  5019. } else if (dimToken.type === this.lexerClass.ID) {
  5020. //parse as variable
  5021. this.pos++;
  5022. return this.parseVariable(dimToken);
  5023. } else {
  5024. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_array_dimension(this.lexer.literalNames[this.lexerClass.RK_INTEGER], dimToken);
  5025. }
  5026. }
  5027. /*
  5028. * Returns an object {type: 'int', value: value}.
  5029. * It checks for binary and hexadecimal integers.
  5030. * @returns object with fields type and value
  5031. **/
  5032. }, {
  5033. key: "getIntLiteral",
  5034. value: function getIntLiteral(token) {
  5035. var text = token.text;
  5036. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5037. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["IntLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(text));
  5038. exp.sourceInfo = sourceInfo;
  5039. return exp;
  5040. }
  5041. }, {
  5042. key: "getRealLiteral",
  5043. value: function getRealLiteral(token) {
  5044. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5045. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["RealLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(token.text));
  5046. exp.sourceInfo = sourceInfo;
  5047. return exp;
  5048. }
  5049. }, {
  5050. key: "getStringLiteral",
  5051. value: function getStringLiteral(token) {
  5052. var text = token.text;
  5053. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5054. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["StringLiteral"](Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toString"])(text));
  5055. exp.sourceInfo = sourceInfo;
  5056. return exp;
  5057. }
  5058. }, {
  5059. key: "getBoolLiteral",
  5060. value: function getBoolLiteral(token) {
  5061. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toBool"])(token.text);
  5062. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["BoolLiteral"](val);
  5063. exp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5064. ;
  5065. return exp;
  5066. }
  5067. }, {
  5068. key: "parseArrayLiteral",
  5069. value: function parseArrayLiteral() {
  5070. this.checkOpenCurly();
  5071. var beginArray = this.getToken();
  5072. if (this.parsingArrayDimension >= 2) {
  5073. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list("Array dimensions exceed maximum size of 2 at line ".concat(beginArray.line));
  5074. }
  5075. this.pos++;
  5076. this.parsingArrayDimension++;
  5077. this.consumeNewLines();
  5078. var data = this.parseExpressionList();
  5079. this.consumeNewLines();
  5080. this.checkCloseCurly();
  5081. var endArray = this.getToken();
  5082. this.pos++;
  5083. this.parsingArrayDimension--;
  5084. if (this.parsingArrayDimension === 0) {// if (!data.isValid) {
  5085. // // TODO: better error message
  5086. // console.log('invalid array');
  5087. // throw new Error(`Invalid array at line ${beginArray.line}`);
  5088. // }
  5089. }
  5090. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(beginArray, endArray);
  5091. var dataDim = 1;
  5092. if (data[0] instanceof _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"]) {
  5093. dataDim++;
  5094. }
  5095. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].UNDEFINED, dataDim);
  5096. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayLiteral"](type, data);
  5097. exp.sourceInfo = sourceInfo;
  5098. return exp;
  5099. }
  5100. /*
  5101. * Returns an object {type: 'variable', value: value}.
  5102. * @returns object with fields type and value
  5103. **/
  5104. }, {
  5105. key: "parseVariable",
  5106. value: function parseVariable(token) {
  5107. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5108. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](token.text);
  5109. exp.sourceInfo = sourceInfo;
  5110. return exp;
  5111. }
  5112. /*
  5113. * Returns an object representing a function. It has
  5114. * four attributes: returnType, id, formalParams and block.
  5115. * The block object has two attributes: declarations and commands
  5116. **/
  5117. }, {
  5118. key: "parseFunction",
  5119. value: function parseFunction() {
  5120. this.pushScope(IVProgParser.FUNCTION);
  5121. var formalParams = [];
  5122. var token = this.getToken();
  5123. if (token.type !== this.lexerClass.RK_FUNCTION) {
  5124. //throw SyntaxError.createError(this.lexer.literalNames[this.lexerClass.PR_FUNCAO], token);
  5125. return null;
  5126. }
  5127. this.pos++;
  5128. var funType = this.parseType();
  5129. var dimensions = 0;
  5130. if (this.checkOpenBrace(true)) {
  5131. this.pos++;
  5132. this.checkCloseBrace();
  5133. this.pos++;
  5134. dimensions++;
  5135. if (this.checkOpenBrace(true)) {
  5136. this.pos++;
  5137. this.checkCloseBrace();
  5138. this.pos++;
  5139. dimensions++;
  5140. }
  5141. }
  5142. var funcIDToken = this.getToken();
  5143. var functionID = this.parseID();
  5144. this.checkFunctionDuplicate(functionID, funcIDToken);
  5145. this.checkOpenParenthesis();
  5146. this.pos++;
  5147. this.consumeNewLines();
  5148. if (!this.checkCloseParenthesis(true)) {
  5149. formalParams = this.parseFormalParameters(); // formal parameters
  5150. this.consumeNewLines();
  5151. this.checkCloseParenthesis();
  5152. this.pos++;
  5153. } else {
  5154. this.pos++;
  5155. }
  5156. this.consumeNewLines();
  5157. var commandsBlock = this.parseCommandBlock();
  5158. var returnType = funType;
  5159. if (dimensions > 0) {
  5160. returnType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](funType, dimensions);
  5161. }
  5162. var func = new _commands___WEBPACK_IMPORTED_MODULE_2__["Function"](functionID, returnType, formalParams, commandsBlock);
  5163. if (functionID === null && !func.isMain) {
  5164. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_main_return(_processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName(), this.lexer.literalNames[this.lexerClass.RK_VOID], token.line);
  5165. } else if (func.isMain && formalParams.length !== 0) {
  5166. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].main_parameters();
  5167. }
  5168. this.popScope();
  5169. return func;
  5170. }
  5171. /*
  5172. * Parse the formal parameters of a function.
  5173. * @returns a list of objects with the following attributes: type, id and dimensions.
  5174. **/
  5175. }, {
  5176. key: "parseFormalParameters",
  5177. value: function parseFormalParameters() {
  5178. var list = [];
  5179. while (true) {
  5180. var dimensions = 0;
  5181. var typeString = this.parseType();
  5182. var idToken = this.getToken();
  5183. var idString = this.parseID();
  5184. this.checkVariableDuplicate(idString, idToken);
  5185. if (this.checkOpenBrace(true)) {
  5186. this.pos++;
  5187. dimensions++;
  5188. this.checkCloseBrace();
  5189. this.pos++;
  5190. if (this.checkOpenBrace(true)) {
  5191. this.pos++;
  5192. dimensions++;
  5193. this.checkCloseBrace();
  5194. this.pos++;
  5195. }
  5196. }
  5197. var type = null;
  5198. if (dimensions > 0) {
  5199. type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_5__["CompoundType"](typeString, dimensions);
  5200. } else {
  5201. type = typeString;
  5202. }
  5203. list.push(new _commands___WEBPACK_IMPORTED_MODULE_2__["FormalParameter"](type, idString));
  5204. var commaToken = this.getToken();
  5205. if (commaToken.type !== this.lexerClass.COMMA) break;
  5206. this.pos++;
  5207. this.consumeNewLines();
  5208. }
  5209. return list;
  5210. }
  5211. }, {
  5212. key: "parseID",
  5213. value: function parseID() {
  5214. var token = this.getToken();
  5215. if (token.type !== this.lexerClass.ID) {
  5216. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5217. }
  5218. this.pos++;
  5219. if (this.insideScope(IVProgParser.FUNCTION)) {
  5220. if (token.text === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5221. return null;
  5222. }
  5223. }
  5224. return token.text;
  5225. }
  5226. }, {
  5227. key: "parseMaybeLibID",
  5228. value: function parseMaybeLibID() {
  5229. var token = this.getToken();
  5230. if (token.type !== this.lexerClass.ID && token.type !== this.lexerClass.LIB_ID) {
  5231. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].id_missing(token);
  5232. }
  5233. this.pos++;
  5234. return token.text;
  5235. }
  5236. }, {
  5237. key: "parseType",
  5238. value: function parseType() {
  5239. var token = this.getToken();
  5240. if (token.type === this.lexerClass.ID && this.insideScope(IVProgParser.FUNCTION)) {
  5241. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5242. } else if (token.type === this.lexerClass.RK_VOID && this.insideScope(IVProgParser.FUNCTION)) {
  5243. this.pos++;
  5244. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].VOID;
  5245. } else if (this.isVariableType(token)) {
  5246. this.pos++;
  5247. switch (token.type) {
  5248. case this.lexerClass.RK_INTEGER:
  5249. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].INTEGER;
  5250. case this.lexerClass.RK_BOOLEAN:
  5251. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].BOOLEAN;
  5252. case this.lexerClass.RK_REAL:
  5253. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].REAL;
  5254. case this.lexerClass.RK_STRING:
  5255. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_4__["Types"].STRING;
  5256. default:
  5257. break;
  5258. }
  5259. }
  5260. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_type(this.getTypeArray(), token);
  5261. }
  5262. }, {
  5263. key: "parseCommandBlock",
  5264. value: function parseCommandBlock() {
  5265. var optionalCurly = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5266. var variablesDecl = [];
  5267. var commands = [];
  5268. var hasOpen = false;
  5269. if (this.checkOpenCurly(optionalCurly)) {
  5270. this.pos++;
  5271. hasOpen = true;
  5272. }
  5273. this.consumeNewLines();
  5274. while (true) {
  5275. var cmd = this.parseCommand();
  5276. if (cmd === null) break;
  5277. if (cmd !== -1) {
  5278. if (cmd instanceof Array) {
  5279. variablesDecl = variablesDecl.concat(cmd);
  5280. } else {
  5281. commands.push(cmd);
  5282. }
  5283. }
  5284. }
  5285. this.consumeNewLines();
  5286. if (hasOpen) {
  5287. this.checkCloseCurly();
  5288. this.pos++;
  5289. this.consumeNewLines();
  5290. }
  5291. return new _commands___WEBPACK_IMPORTED_MODULE_2__["CommandBlock"](variablesDecl, commands);
  5292. }
  5293. }, {
  5294. key: "parseCommand",
  5295. value: function parseCommand() {
  5296. var token = this.getToken();
  5297. if (this.isVariableType(token)) {
  5298. if (!this.insideScope(IVProgParser.FUNCTION)) {
  5299. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_var_declaration(token.line);
  5300. }
  5301. this.pushScope(IVProgParser.BASE);
  5302. var varType = this.parseType();
  5303. this.popScope();
  5304. var cmd = this.parseDeclaration(varType);
  5305. this.checkEOS();
  5306. this.pos++;
  5307. return cmd;
  5308. } else if (token.type === this.lexerClass.ID) {
  5309. return this.parseIDCommand();
  5310. } else if (token.type === this.lexerClass.LIB_ID) {
  5311. return this.parseIDCommand();
  5312. } else if (token.type === this.lexerClass.RK_RETURN) {
  5313. return this.parseReturn();
  5314. } else if (token.type === this.lexerClass.RK_WHILE) {
  5315. return this.parseWhile();
  5316. } else if (token.type === this.lexerClass.RK_FOR) {
  5317. return this.parseFor();
  5318. } else if (token.type === this.lexerClass.RK_BREAK) {
  5319. if (!this.insideScope(IVProgParser.BREAKABLE)) {
  5320. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_break_command(this.lexer.literalNames[this.lexerClass.RK_BREAK], token);
  5321. }
  5322. return this.parseBreak();
  5323. } else if (token.type === this.lexerClass.RK_SWITCH) {
  5324. return this.parseSwitchCase();
  5325. } else if (token.type === this.lexerClass.RK_DO) {
  5326. return this.parseDoWhile();
  5327. } else if (token.type === this.lexerClass.RK_IF) {
  5328. return this.parseIfThenElse();
  5329. } else if (this.checkEOS(true)) {
  5330. this.pos++;
  5331. return -1;
  5332. } else {
  5333. return null;
  5334. }
  5335. }
  5336. }, {
  5337. key: "parseSwitchCase",
  5338. value: function parseSwitchCase() {
  5339. this.pushScope(IVProgParser.BREAKABLE);
  5340. this.pos++;
  5341. this.checkOpenParenthesis();
  5342. this.pos++;
  5343. this.consumeNewLines();
  5344. var exp = this.parseExpressionOR();
  5345. this.consumeNewLines();
  5346. this.checkCloseParenthesis();
  5347. this.pos++;
  5348. this.consumeNewLines();
  5349. this.checkOpenCurly();
  5350. this.pos++;
  5351. this.consumeNewLines();
  5352. var casesList = this.parseCases();
  5353. this.consumeNewLines();
  5354. this.checkCloseCurly();
  5355. this.pos++;
  5356. this.consumeNewLines();
  5357. this.popScope();
  5358. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Switch"](exp, casesList);
  5359. }
  5360. }, {
  5361. key: "parseDoWhile",
  5362. value: function parseDoWhile() {
  5363. this.pos++;
  5364. this.consumeNewLines();
  5365. this.pushScope(IVProgParser.BREAKABLE);
  5366. var commandsBlock = this.parseCommandBlock();
  5367. this.consumeNewLines(); //Maybe not...
  5368. var whileToken = this.getToken();
  5369. if (whileToken.type !== this.lexerClass.RK_WHILE) {
  5370. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_WHILE], whileToken);
  5371. }
  5372. this.pos++;
  5373. this.checkOpenParenthesis();
  5374. this.pos++;
  5375. this.consumeNewLines();
  5376. var condition = this.parseExpressionOR();
  5377. this.consumeNewLines();
  5378. this.checkCloseParenthesis();
  5379. this.pos++;
  5380. this.checkEOS();
  5381. this.popScope();
  5382. return new _commands___WEBPACK_IMPORTED_MODULE_2__["DoWhile"](condition, commandsBlock);
  5383. }
  5384. }, {
  5385. key: "parseIfThenElse",
  5386. value: function parseIfThenElse() {
  5387. if (this.insideScope(IVProgParser.BREAKABLE)) {
  5388. this.pushScope(IVProgParser.BREAKABLE);
  5389. } else {
  5390. this.pushScope(IVProgParser.COMMAND);
  5391. }
  5392. var token = this.getToken();
  5393. this.pos++;
  5394. this.checkOpenParenthesis();
  5395. this.pos++;
  5396. this.consumeNewLines();
  5397. var logicalExpression = this.parseExpressionOR();
  5398. this.consumeNewLines();
  5399. this.checkCloseParenthesis();
  5400. this.pos++;
  5401. this.consumeNewLines();
  5402. var cmdBlocks = this.parseCommandBlock();
  5403. var maybeElse = this.getToken();
  5404. if (maybeElse.type === this.lexerClass.RK_ELSE) {
  5405. this.pos++;
  5406. this.consumeNewLines();
  5407. var maybeIf = this.getToken();
  5408. var elseBlock = null;
  5409. if (this.checkOpenCurly(true)) {
  5410. elseBlock = this.parseCommandBlock();
  5411. } else if (maybeIf.type === this.lexerClass.RK_IF) {
  5412. elseBlock = this.parseIfThenElse();
  5413. } else {
  5414. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list([this.lexer.literalNames[this.lexerClass.RK_IF], '{'], maybeIf);
  5415. }
  5416. this.popScope();
  5417. var _cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, elseBlock);
  5418. _cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5419. return _cmd;
  5420. }
  5421. this.popScope();
  5422. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["IfThenElse"](logicalExpression, cmdBlocks, null);
  5423. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5424. return cmd;
  5425. }
  5426. }, {
  5427. key: "parseFor",
  5428. value: function parseFor() {
  5429. this.pushScope(IVProgParser.BREAKABLE);
  5430. this.pos++;
  5431. this.checkOpenParenthesis();
  5432. this.pos++;
  5433. this.consumeNewLines();
  5434. var attribution = this.parseForAssign();
  5435. this.consumeNewLines();
  5436. var condition = this.parseExpressionOR();
  5437. this.consumeForSemiColon();
  5438. var increment = this.parseForAssign(true);
  5439. this.checkCloseParenthesis();
  5440. this.pos++;
  5441. this.consumeNewLines();
  5442. var commandsBlock = this.parseCommandBlock();
  5443. this.popScope();
  5444. return new _commands___WEBPACK_IMPORTED_MODULE_2__["For"](attribution, condition, increment, commandsBlock);
  5445. }
  5446. }, {
  5447. key: "parseWhile",
  5448. value: function parseWhile() {
  5449. this.pushScope(IVProgParser.BREAKABLE);
  5450. var token = this.getToken();
  5451. this.pos++;
  5452. this.checkOpenParenthesis();
  5453. this.pos++;
  5454. this.consumeNewLines();
  5455. var logicalExpression = this.parseExpressionOR();
  5456. this.consumeNewLines();
  5457. this.checkCloseParenthesis();
  5458. this.pos++;
  5459. this.consumeNewLines();
  5460. var cmdBlocks = this.parseCommandBlock();
  5461. this.popScope();
  5462. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["While"](logicalExpression, cmdBlocks);
  5463. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5464. return cmd;
  5465. }
  5466. }, {
  5467. key: "parseBreak",
  5468. value: function parseBreak() {
  5469. this.pos++;
  5470. this.checkEOS();
  5471. this.pos++;
  5472. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Break"]();
  5473. }
  5474. }, {
  5475. key: "parseReturn",
  5476. value: function parseReturn() {
  5477. this.pos++;
  5478. var exp = null;
  5479. if (!this.checkEOS(true)) {
  5480. exp = this.parseExpressionOR();
  5481. this.checkEOS();
  5482. }
  5483. this.pos++;
  5484. return new _commands___WEBPACK_IMPORTED_MODULE_2__["Return"](exp);
  5485. }
  5486. }, {
  5487. key: "parseIDCommand",
  5488. value: function parseIDCommand() {
  5489. var refToken = this.getToken();
  5490. var isID = refToken.type === this.lexerClass.ID;
  5491. var id = this.parseMaybeLibID();
  5492. if (this.checkOpenBrace(true)) {
  5493. this.pos++;
  5494. var lineExpression = null;
  5495. var columnExpression = null;
  5496. this.consumeNewLines();
  5497. lineExpression = this.parseExpression();
  5498. this.consumeNewLines();
  5499. this.checkCloseBrace();
  5500. this.pos++;
  5501. if (this.checkOpenBrace(true)) {
  5502. this.pos++;
  5503. this.consumeNewLines();
  5504. columnExpression = this.parseExpression();
  5505. this.consumeNewLines();
  5506. this.checkCloseBrace();
  5507. this.pos++;
  5508. }
  5509. var equalToken = this.getToken();
  5510. if (equalToken.type !== this.lexerClass.EQUAL) {
  5511. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equalToken);
  5512. }
  5513. this.pos++;
  5514. var exp = this.parseExpressionOR();
  5515. this.checkEOS();
  5516. this.pos++;
  5517. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["ArrayIndexAssign"](id, lineExpression, columnExpression, exp);
  5518. cmd.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalToken);
  5519. return cmd;
  5520. }
  5521. var equalOrParenthesis = this.getToken();
  5522. if (isID && equalOrParenthesis.type === this.lexerClass.EQUAL) {
  5523. this.pos++;
  5524. var _exp = this.parseExpressionOR();
  5525. this.checkEOS();
  5526. this.pos++;
  5527. var _cmd2 = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, _exp);
  5528. _cmd2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equalOrParenthesis);
  5529. return _cmd2;
  5530. } else if (equalOrParenthesis.type === this.lexerClass.OPEN_PARENTHESIS) {
  5531. var funcCall = this.parseFunctionCallCommand(id);
  5532. this.checkEOS();
  5533. this.pos++;
  5534. return funcCall;
  5535. } else if (isID) {
  5536. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_list(['=', '('], equalOrParenthesis);
  5537. } else {
  5538. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(refToken);
  5539. }
  5540. }
  5541. }, {
  5542. key: "parseForAssign",
  5543. value: function parseForAssign() {
  5544. var isLast = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  5545. if (!isLast) this.consumeNewLines();
  5546. if (this.checkEOS(true)) {
  5547. return null;
  5548. }
  5549. var id = this.parseID();
  5550. var equal = this.getToken();
  5551. if (equal.type !== this.lexerClass.EQUAL) {
  5552. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one('=', equal);
  5553. }
  5554. this.pos++;
  5555. var exp = this.parseExpressionOR();
  5556. if (!isLast) {
  5557. this.consumeForSemiColon();
  5558. }
  5559. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(equal);
  5560. var cmd = new _commands___WEBPACK_IMPORTED_MODULE_2__["Assign"](id, exp);
  5561. cmd.sourceInfo = sourceInfo;
  5562. return cmd;
  5563. }
  5564. }, {
  5565. key: "parseCases",
  5566. value: function parseCases() {
  5567. var token = this.getToken();
  5568. if (token.type !== this.lexerClass.RK_CASE) {
  5569. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(this.lexer.literalNames[this.lexerClass.RK_CASE], token);
  5570. }
  5571. this.pos++;
  5572. var nextToken = this.getToken();
  5573. if (nextToken.type === this.lexerClass.RK_DEFAULT) {
  5574. this.pos++;
  5575. var colonToken = this.getToken();
  5576. if (colonToken.type !== this.lexerClass.COLON) {
  5577. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', colonToken);
  5578. }
  5579. this.pos++;
  5580. this.consumeNewLines();
  5581. var block = this.parseCommandBlock(true);
  5582. var defaultCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](null);
  5583. defaultCase.setCommands(block.commands);
  5584. return [defaultCase];
  5585. } else {
  5586. var exp = this.parseExpressionOR();
  5587. var _colonToken = this.getToken();
  5588. if (_colonToken.type !== this.lexerClass.COLON) {
  5589. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].token_missing_one(':', _colonToken);
  5590. }
  5591. this.pos++;
  5592. this.consumeNewLines();
  5593. var _block = this.parseCommandBlock(true);
  5594. var aCase = new _commands___WEBPACK_IMPORTED_MODULE_2__["Case"](exp);
  5595. aCase.setCommands(_block.commands);
  5596. var caseToken = this.getToken();
  5597. if (caseToken.type === this.lexerClass.RK_CASE) {
  5598. return [aCase].concat(this.parseCases());
  5599. } else {
  5600. return [aCase];
  5601. }
  5602. }
  5603. }
  5604. /*
  5605. * Parses an Expression following the structure:
  5606. *
  5607. * EOR => EAnd ( 'or' EOR)? #expression and
  5608. *
  5609. * EOR => ENot ('and' EOR)? #expression or
  5610. *
  5611. * ENot => 'not'? ER #expression not
  5612. *
  5613. * ER => E ((>=, <=, ==, >, <) E)? #expression relational
  5614. *
  5615. * E => factor ((+, -) E)? #expression
  5616. *
  5617. * factor=> term ((*, /, %) factor)?
  5618. *
  5619. * term => literal || arrayAccess || FuncCall || ID || '('EAnd')'
  5620. **/
  5621. }, {
  5622. key: "parseExpressionOR",
  5623. value: function parseExpressionOR() {
  5624. var exp1 = this.parseExpressionAND();
  5625. while (this.getToken().type === this.lexerClass.OR_OPERATOR) {
  5626. var opToken = this.getToken();
  5627. this.pos++;
  5628. var or = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('or');
  5629. this.consumeNewLines();
  5630. var exp2 = this.parseExpressionAND();
  5631. var _finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](or, exp1, exp2);
  5632. _finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5633. exp1 = _finalExp;
  5634. }
  5635. return exp1;
  5636. }
  5637. }, {
  5638. key: "parseExpressionAND",
  5639. value: function parseExpressionAND() {
  5640. var exp1 = this.parseExpressionNot();
  5641. while (this.getToken().type === this.lexerClass.AND_OPERATOR) {
  5642. var opToken = this.getToken();
  5643. this.pos++;
  5644. var and = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('and');
  5645. this.consumeNewLines();
  5646. var exp2 = this.parseExpressionNot();
  5647. var _finalExp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](and, exp1, exp2);
  5648. _finalExp2.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5649. exp1 = _finalExp2;
  5650. }
  5651. return exp1;
  5652. }
  5653. }, {
  5654. key: "parseExpressionNot",
  5655. value: function parseExpressionNot() {
  5656. var maybeNotToken = this.getToken();
  5657. if (maybeNotToken.type === this.lexerClass.NOT_OPERATOR) {
  5658. var opToken = this.getToken();
  5659. this.pos++;
  5660. var not = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])('not');
  5661. var exp1 = this.parseExpressionRel();
  5662. finalExp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](not, exp1);
  5663. finalExp.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(opToken);
  5664. return finalExp;
  5665. } else {
  5666. return this.parseExpressionRel();
  5667. }
  5668. }
  5669. }, {
  5670. key: "parseExpressionRel",
  5671. value: function parseExpressionRel() {
  5672. var exp1 = this.parseExpression();
  5673. while (this.getToken().type === this.lexerClass.RELATIONAL_OPERATOR) {
  5674. var relToken = this.getToken();
  5675. this.pos++;
  5676. var rel = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(relToken.text);
  5677. var exp2 = this.parseExpression();
  5678. var _finalExp3 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](rel, exp1, exp2);
  5679. _finalExp3.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(relToken);
  5680. exp1 = _finalExp3;
  5681. }
  5682. return exp1;
  5683. }
  5684. }, {
  5685. key: "parseExpression",
  5686. value: function parseExpression() {
  5687. var factor = this.parseFactor();
  5688. while (this.getToken().type === this.lexerClass.SUM_OP) {
  5689. var sumOpToken = this.getToken();
  5690. this.pos++;
  5691. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(sumOpToken.text);
  5692. var factor2 = this.parseFactor();
  5693. var _finalExp4 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, factor, factor2);
  5694. _finalExp4.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(sumOpToken);
  5695. factor = _finalExp4;
  5696. }
  5697. return factor;
  5698. }
  5699. }, {
  5700. key: "parseFactor",
  5701. value: function parseFactor() {
  5702. var term = this.parseTerm();
  5703. while (this.getToken().type === this.lexerClass.MULTI_OP) {
  5704. var multOpToken = this.getToken();
  5705. this.pos++;
  5706. var op = Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(multOpToken.text);
  5707. var term2 = this.parseTerm();
  5708. var _finalExp5 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["InfixApp"](op, term, term2);
  5709. _finalExp5.sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(multOpToken);
  5710. term = _finalExp5;
  5711. }
  5712. return term;
  5713. }
  5714. }, {
  5715. key: "parseTerm",
  5716. value: function parseTerm() {
  5717. var token = this.getToken();
  5718. var sourceInfo = null;
  5719. switch (token.type) {
  5720. case this.lexerClass.SUM_OP:
  5721. this.pos++;
  5722. sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(token);
  5723. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["UnaryApp"](Object(_operators__WEBPACK_IMPORTED_MODULE_7__["convertFromString"])(token.text), this.parseTerm());
  5724. exp.sourceInfo = sourceInfo;
  5725. return exp;
  5726. case this.lexerClass.INTEGER:
  5727. this.pos++;
  5728. return this.getIntLiteral(token);
  5729. case this.lexerClass.REAL:
  5730. this.pos++;
  5731. return this.getRealLiteral(token);
  5732. case this.lexerClass.STRING:
  5733. this.pos++;
  5734. return this.getStringLiteral(token);
  5735. case this.lexerClass.RK_TRUE:
  5736. case this.lexerClass.RK_FALSE:
  5737. this.pos++;
  5738. return this.getBoolLiteral(token);
  5739. case this.lexerClass.OPEN_CURLY:
  5740. return this.parseArrayLiteral();
  5741. case this.lexerClass.ID:
  5742. case this.lexerClass.LIB_ID:
  5743. return this.parseIDTerm();
  5744. case this.lexerClass.OPEN_PARENTHESIS:
  5745. return this.parseParenthesisExp();
  5746. default:
  5747. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_terminal(token);
  5748. }
  5749. }
  5750. }, {
  5751. key: "parseIDTerm",
  5752. value: function parseIDTerm() {
  5753. var tokenA = this.getToken();
  5754. var id = this.parseMaybeLibID();
  5755. var isID = tokenA.type === this.lexerClass.ID;
  5756. if (isID && this.checkOpenBrace(true)) {
  5757. var tokenB = null;
  5758. this.pos++;
  5759. var firstIndex = this.parseExpression();
  5760. var secondIndex = null;
  5761. this.consumeNewLines();
  5762. this.checkCloseBrace();
  5763. tokenB = this.getToken();
  5764. this.pos++;
  5765. if (this.checkOpenBrace(true)) {
  5766. this.pos++;
  5767. secondIndex = this.parseExpression();
  5768. this.consumeNewLines();
  5769. this.checkCloseBrace();
  5770. tokenB = this.getToken();
  5771. this.pos++;
  5772. }
  5773. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5774. var exp = new _expressions___WEBPACK_IMPORTED_MODULE_1__["ArrayAccess"](id, firstIndex, secondIndex);
  5775. exp.sourceInfo = sourceInfo;
  5776. return exp;
  5777. } else if (this.checkOpenParenthesis(true)) {
  5778. return this.parseFunctionCallExpression(id);
  5779. } else if (isID) {
  5780. var _sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfo(tokenA);
  5781. var _exp2 = new _expressions___WEBPACK_IMPORTED_MODULE_1__["VariableLiteral"](id);
  5782. _exp2.sourceInfo = _sourceInfo;
  5783. return _exp2;
  5784. } else {
  5785. throw _error_syntaxErrorFactory__WEBPACK_IMPORTED_MODULE_8__["SyntaxErrorFactory"].invalid_id_format(tokenA);
  5786. }
  5787. }
  5788. }, {
  5789. key: "getFunctionName",
  5790. value: function getFunctionName(id) {
  5791. var name = _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getInternalName(id);
  5792. if (name === null) {
  5793. if (id === _processor_definedFunctions__WEBPACK_IMPORTED_MODULE_9__["LanguageDefinedFunction"].getMainFunctionName()) {
  5794. return null;
  5795. }
  5796. return id;
  5797. } else {
  5798. return name;
  5799. }
  5800. }
  5801. }, {
  5802. key: "parseFunctionCallExpression",
  5803. value: function parseFunctionCallExpression(id) {
  5804. var tokenA = this.getToken(this.pos - 1);
  5805. var actualParameters = this.parseActualParameters();
  5806. var tokenB = this.getToken(this.pos - 1);
  5807. var funcName = this.getFunctionName(id);
  5808. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5809. var cmd = new _expressions___WEBPACK_IMPORTED_MODULE_1__["FunctionCall"](funcName, actualParameters);
  5810. cmd.sourceInfo = sourceInfo;
  5811. return cmd;
  5812. }
  5813. }, {
  5814. key: "parseFunctionCallCommand",
  5815. value: function parseFunctionCallCommand(id) {
  5816. return this.parseFunctionCallExpression(id);
  5817. }
  5818. }, {
  5819. key: "parseParenthesisExp",
  5820. value: function parseParenthesisExp() {
  5821. this.checkOpenParenthesis();
  5822. var tokenA = this.getToken();
  5823. this.pos++;
  5824. this.consumeNewLines();
  5825. var exp = this.parseExpressionOR();
  5826. this.consumeNewLines();
  5827. this.checkCloseParenthesis();
  5828. var tokenB = this.getToken();
  5829. var sourceInfo = _sourceInfo__WEBPACK_IMPORTED_MODULE_6__["SourceInfo"].createSourceInfoFromList(tokenA, tokenB);
  5830. this.pos++;
  5831. exp.sourceInfo = sourceInfo;
  5832. return exp;
  5833. }
  5834. }, {
  5835. key: "parseActualParameters",
  5836. value: function parseActualParameters() {
  5837. this.checkOpenParenthesis();
  5838. this.pos++;
  5839. if (this.checkCloseParenthesis(true)) {
  5840. this.pos++;
  5841. return [];
  5842. }
  5843. this.consumeNewLines();
  5844. var list = this.parseExpressionList();
  5845. this.consumeNewLines();
  5846. this.checkCloseParenthesis();
  5847. this.pos++;
  5848. return list;
  5849. }
  5850. }, {
  5851. key: "parseExpressionList",
  5852. value: function parseExpressionList() {
  5853. var list = [];
  5854. while (true) {
  5855. var exp = this.parseExpressionOR();
  5856. list.push(exp);
  5857. var maybeToken = this.getToken();
  5858. if (maybeToken.type !== this.lexerClass.COMMA) {
  5859. break;
  5860. } else {
  5861. this.pos++;
  5862. this.consumeNewLines();
  5863. }
  5864. }
  5865. return list;
  5866. }
  5867. }, {
  5868. key: "getTypeArray",
  5869. value: function getTypeArray() {
  5870. var _this = this;
  5871. var types = this.insideScope(IVProgParser.FUNCTION) ? this.functionTypes : this.variableTypes;
  5872. return types.map(function (x) {
  5873. return _this.lexer.literalNames[x];
  5874. });
  5875. }
  5876. }]);
  5877. return IVProgParser;
  5878. }();
  5879. /***/ }),
  5880. /***/ "./js/ast/operators.js":
  5881. /*!*****************************!*\
  5882. !*** ./js/ast/operators.js ***!
  5883. \*****************************/
  5884. /*! exports provided: Operators, convertFromString */
  5885. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5886. "use strict";
  5887. __webpack_require__.r(__webpack_exports__);
  5888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Operators", function() { return Operators; });
  5889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertFromString", function() { return convertFromString; });
  5890. var Operators = Object.freeze({
  5891. ADD: {
  5892. ord: 0,
  5893. value: "+"
  5894. },
  5895. SUB: {
  5896. ord: 1,
  5897. value: "-"
  5898. },
  5899. MULT: {
  5900. ord: 2,
  5901. value: '*'
  5902. },
  5903. DIV: {
  5904. ord: 3,
  5905. value: '/'
  5906. },
  5907. MOD: {
  5908. ord: 4,
  5909. value: '%'
  5910. },
  5911. GT: {
  5912. ord: 5,
  5913. value: '>'
  5914. },
  5915. GE: {
  5916. ord: 6,
  5917. value: '>='
  5918. },
  5919. LT: {
  5920. ord: 7,
  5921. value: '<'
  5922. },
  5923. LE: {
  5924. ord: 8,
  5925. value: '<='
  5926. },
  5927. EQ: {
  5928. ord: 9,
  5929. value: '=='
  5930. },
  5931. NEQ: {
  5932. ord: 10,
  5933. value: '!='
  5934. },
  5935. AND: {
  5936. ord: 11,
  5937. value: 'and'
  5938. },
  5939. OR: {
  5940. ord: 12,
  5941. value: 'or'
  5942. },
  5943. NOT: {
  5944. ord: 13,
  5945. value: 'not'
  5946. }
  5947. });
  5948. function convertFromString(op) {
  5949. switch (op) {
  5950. case '+':
  5951. return Operators.ADD;
  5952. case '-':
  5953. return Operators.SUB;
  5954. case '*':
  5955. return Operators.MULT;
  5956. case '/':
  5957. return Operators.DIV;
  5958. case '%':
  5959. return Operators.MOD;
  5960. case '>':
  5961. return Operators.GT;
  5962. case '>=':
  5963. return Operators.GE;
  5964. case '<':
  5965. return Operators.LT;
  5966. case '<=':
  5967. return Operators.LE;
  5968. case '==':
  5969. return Operators.EQ;
  5970. case '!=':
  5971. return Operators.NEQ;
  5972. case 'and':
  5973. return Operators.AND;
  5974. case 'or':
  5975. return Operators.OR;
  5976. case 'not':
  5977. return Operators.NOT;
  5978. }
  5979. }
  5980. /***/ }),
  5981. /***/ "./js/ast/sourceInfo.js":
  5982. /*!******************************!*\
  5983. !*** ./js/ast/sourceInfo.js ***!
  5984. \******************************/
  5985. /*! exports provided: SourceInfo */
  5986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5987. "use strict";
  5988. __webpack_require__.r(__webpack_exports__);
  5989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SourceInfo", function() { return SourceInfo; });
  5990. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5991. 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); } }
  5992. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  5993. var SourceInfo =
  5994. /*#__PURE__*/
  5995. function () {
  5996. _createClass(SourceInfo, null, [{
  5997. key: "createSourceInfo",
  5998. value: function createSourceInfo(token) {
  5999. return new SourceInfo(token.line, token.column, token.text.length);
  6000. }
  6001. }, {
  6002. key: "createSourceInfoFromList",
  6003. value: function createSourceInfoFromList(tokenA, tokenB) {
  6004. var line = tokenA.line;
  6005. var column = tokenA.column; // copied from https://github.com/UNIVALI-LITE/Portugol-Studio/blob/master/core/src/main/java/br/univali/portugol/nucleo/analise/sintatica/Portugol.g
  6006. // No idea why...
  6007. var size = tokenB.tokenIndex + 1 - tokenA.tokenIndex;
  6008. return new SourceInfo(line, column, size);
  6009. }
  6010. }]);
  6011. function SourceInfo(line, column, size) {
  6012. _classCallCheck(this, SourceInfo);
  6013. this.line = line;
  6014. this.column = column;
  6015. this.size = size;
  6016. }
  6017. return SourceInfo;
  6018. }();
  6019. /***/ }),
  6020. /***/ "./js/io/domConsole.js":
  6021. /*!*****************************!*\
  6022. !*** ./js/io/domConsole.js ***!
  6023. \*****************************/
  6024. /*! exports provided: DOMConsole */
  6025. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6026. "use strict";
  6027. __webpack_require__.r(__webpack_exports__);
  6028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOMConsole", function() { return DOMConsole; });
  6029. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  6030. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  6031. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6032. 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); } }
  6033. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6034. var DOMConsole =
  6035. /*#__PURE__*/
  6036. function () {
  6037. _createClass(DOMConsole, null, [{
  6038. key: "USER",
  6039. get: function get() {
  6040. return 0;
  6041. }
  6042. }, {
  6043. key: "INFO",
  6044. get: function get() {
  6045. return 1;
  6046. }
  6047. }, {
  6048. key: "ERR",
  6049. get: function get() {
  6050. return 2;
  6051. }
  6052. }]);
  6053. function DOMConsole(elementID) {
  6054. _classCallCheck(this, DOMConsole);
  6055. this.input = null;
  6056. this.needInput = false;
  6057. this.termDiv = null;
  6058. this.anyKey = false;
  6059. this.parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elementID);
  6060. this.setup();
  6061. this.inputListeners = [];
  6062. }
  6063. _createClass(DOMConsole, [{
  6064. key: "setup",
  6065. value: function setup() {
  6066. this._setupDom();
  6067. this._setupEvents();
  6068. }
  6069. }, {
  6070. key: "_setupEvents",
  6071. value: function _setupEvents() {
  6072. var _this = this;
  6073. this.input.on("keydown", function (event) {
  6074. if (!_this.needInput) {
  6075. event.preventDefault();
  6076. return;
  6077. }
  6078. var keyCode = event.which;
  6079. if (keyCode === 13 || _this.anyKey) {
  6080. var text = _this.input.val();
  6081. text = text.replace('[\n\r]+', '');
  6082. _this.notifyListeners(text);
  6083. _this.write(text);
  6084. _this.input.val("");
  6085. }
  6086. });
  6087. }
  6088. }, {
  6089. key: "_setupDom",
  6090. value: function _setupDom() {
  6091. this.termDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6092. this.termDiv.addClass("ivprog-term-div");
  6093. this.input = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input text="type">');
  6094. this.input.addClass("ivprog-term-input");
  6095. this.termDiv.append(this.input);
  6096. this.parent.append(this.termDiv);
  6097. }
  6098. }, {
  6099. key: "notifyListeners",
  6100. value: function notifyListeners(text) {
  6101. this.inputListeners.forEach(function (resolve) {
  6102. return resolve(text);
  6103. });
  6104. this.inputListeners.splice(0, this.inputListeners.length);
  6105. this.hideInput();
  6106. this.anyKey = false;
  6107. }
  6108. }, {
  6109. key: "write",
  6110. value: function write(text) {
  6111. this._appendText(text, DOMConsole.USER);
  6112. }
  6113. }, {
  6114. key: "info",
  6115. value: function info(text) {
  6116. this._appendText(text, DOMConsole.INFO);
  6117. }
  6118. }, {
  6119. key: "err",
  6120. value: function err(text) {
  6121. this._appendText(text, DOMConsole.ERR);
  6122. }
  6123. }, {
  6124. key: "_appendText",
  6125. value: function _appendText(text, type) {
  6126. var divClass = this.getClassForType(type);
  6127. var textDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<div></div>");
  6128. textDiv.addClass(divClass);
  6129. textDiv.append(text);
  6130. textDiv.insertBefore(this.input);
  6131. this.scrollTerm();
  6132. }
  6133. }, {
  6134. key: "scrollTerm",
  6135. value: function scrollTerm() {
  6136. this.termDiv.animate({
  6137. scrollTop: this.termDiv.prop('scrollHeight')
  6138. }, 0);
  6139. }
  6140. }, {
  6141. key: "getClassForType",
  6142. value: function getClassForType(type) {
  6143. switch (type) {
  6144. case DOMConsole.USER:
  6145. return "ivprog-term-userText";
  6146. case DOMConsole.INFO:
  6147. return "ivprog-term-info";
  6148. case DOMConsole.ERR:
  6149. return "ivprog-term-error";
  6150. }
  6151. }
  6152. }, {
  6153. key: "dispose",
  6154. value: function dispose() {
  6155. this.parent.off();
  6156. this.input.off();
  6157. this.input = null;
  6158. this.parent.empty();
  6159. }
  6160. }, {
  6161. key: "showInput",
  6162. value: function showInput() {
  6163. this.needInput = true;
  6164. this.input.show();
  6165. this.input.focus();
  6166. }
  6167. }, {
  6168. key: "hideInput",
  6169. value: function hideInput() {
  6170. this.needInput = false;
  6171. this.input.hide();
  6172. }
  6173. }, {
  6174. key: "requestInput",
  6175. value: function requestInput(callback) {
  6176. var anyKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  6177. this.inputListeners.push(callback);
  6178. this.anyKey = anyKey;
  6179. this.showInput();
  6180. }
  6181. }, {
  6182. key: "sendOutput",
  6183. value: function sendOutput(text) {
  6184. var _this2 = this;
  6185. var output = "" + text;
  6186. output.split("\n").forEach(function (t) {
  6187. t = t.replace(/\t/g, '&#9;');
  6188. _this2.write(t);
  6189. });
  6190. }
  6191. }, {
  6192. key: "clear",
  6193. value: function clear() {
  6194. this.input.parent().children().not(this.input).remove();
  6195. this.input.val("");
  6196. }
  6197. }]);
  6198. return DOMConsole;
  6199. }();
  6200. /***/ }),
  6201. /***/ "./js/io/input.js":
  6202. /*!************************!*\
  6203. !*** ./js/io/input.js ***!
  6204. \************************/
  6205. /*! exports provided: Input */
  6206. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6207. "use strict";
  6208. __webpack_require__.r(__webpack_exports__);
  6209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; });
  6210. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6211. 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); } }
  6212. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6213. var Input =
  6214. /*#__PURE__*/
  6215. function () {
  6216. function Input() {
  6217. _classCallCheck(this, Input);
  6218. }
  6219. _createClass(Input, [{
  6220. key: "requestInput",
  6221. value: function requestInput(callback) {
  6222. throw new Error("Must be implemented");
  6223. }
  6224. }]);
  6225. return Input;
  6226. }();
  6227. /***/ }),
  6228. /***/ "./js/io/output.js":
  6229. /*!*************************!*\
  6230. !*** ./js/io/output.js ***!
  6231. \*************************/
  6232. /*! exports provided: Output */
  6233. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6234. "use strict";
  6235. __webpack_require__.r(__webpack_exports__);
  6236. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; });
  6237. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  6238. 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); } }
  6239. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  6240. var Output =
  6241. /*#__PURE__*/
  6242. function () {
  6243. function Output() {
  6244. _classCallCheck(this, Output);
  6245. }
  6246. _createClass(Output, [{
  6247. key: "sendOutput",
  6248. value: function sendOutput(text) {
  6249. throw new Error("Must be implemented");
  6250. }
  6251. }]);
  6252. return Output;
  6253. }();
  6254. /***/ }),
  6255. /***/ "./js/main.js":
  6256. /*!********************!*\
  6257. !*** ./js/main.js ***!
  6258. \********************/
  6259. /*! exports provided: runner, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeFunctionListener, removeGlobalListener, LocalizedStrings, i18n */
  6260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6261. "use strict";
  6262. __webpack_require__.r(__webpack_exports__);
  6263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  6264. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18n", function() { return i18n; });
  6265. /* harmony import */ var _runner__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runner */ "./js/runner.js");
  6266. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return _runner__WEBPACK_IMPORTED_MODULE_0__["runner"]; });
  6267. /* harmony import */ var _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualUI/functions */ "./js/visualUI/functions.js");
  6268. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["initVisualUI"]; });
  6269. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addFunctionChangeListener"]; });
  6270. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["addGlobalChangeListener"]; });
  6271. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeFunctionListener"]; });
  6272. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return _visualUI_functions__WEBPACK_IMPORTED_MODULE_1__["removeGlobalListener"]; });
  6273. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6274. /* harmony import */ var _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/i18nHelper */ "./js/services/i18nHelper.js");
  6275. var i18n = _services_i18nHelper__WEBPACK_IMPORTED_MODULE_3__["i18nHelper"].i18n;
  6276. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6277. /***/ }),
  6278. /***/ "./js/processor/compatibilityTable.js":
  6279. /*!********************************************!*\
  6280. !*** ./js/processor/compatibilityTable.js ***!
  6281. \********************************************/
  6282. /*! exports provided: resultTypeAfterInfixOp, resultTypeAfterUnaryOp */
  6283. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6284. "use strict";
  6285. __webpack_require__.r(__webpack_exports__);
  6286. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterInfixOp", function() { return resultTypeAfterInfixOp; });
  6287. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resultTypeAfterUnaryOp", function() { return resultTypeAfterUnaryOp; });
  6288. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  6289. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  6290. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  6291. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  6292. function buildInfixAddTable() {
  6293. var table = [[], [], [], []];
  6294. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6295. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6296. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6297. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6298. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6299. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6300. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6301. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6302. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6303. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING;
  6304. return table;
  6305. }
  6306. function buildInfixMultiDivSubTable() {
  6307. var table = [[], [], [], []];
  6308. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6309. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6310. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6311. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6312. return table;
  6313. }
  6314. function buildInfixEqualityInequalityTable() {
  6315. var table = [[], [], [], []];
  6316. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6317. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6318. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6319. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6320. return table;
  6321. }
  6322. function buildInfixRelationalTable() {
  6323. var table = [[], [], [], []];
  6324. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6325. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6326. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].STRING.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6327. return table;
  6328. }
  6329. function buildInfixAndOrTable() {
  6330. var table = [[], [], [], []];
  6331. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6332. return table;
  6333. }
  6334. function buildInfixModTable() {
  6335. var table = [[], [], [], []];
  6336. table[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord][_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6337. return table;
  6338. }
  6339. function buildUnarySumSubList() {
  6340. var list = [];
  6341. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6342. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL;
  6343. return list;
  6344. }
  6345. function buildUnaryNegList() {
  6346. var list = [];
  6347. list[_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN.ord] = _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6348. return list;
  6349. }
  6350. function buildInfixCompatibilityTable() {
  6351. var compatibilityMap = new WeakMap();
  6352. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildInfixAddTable());
  6353. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildInfixMultiDivSubTable());
  6354. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MULT, buildInfixMultiDivSubTable());
  6355. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].DIV, buildInfixMultiDivSubTable());
  6356. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].EQ, buildInfixEqualityInequalityTable());
  6357. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NEQ, buildInfixEqualityInequalityTable());
  6358. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GE, buildInfixRelationalTable());
  6359. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].GT, buildInfixRelationalTable());
  6360. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LE, buildInfixRelationalTable());
  6361. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].LT, buildInfixRelationalTable());
  6362. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].OR, buildInfixAndOrTable());
  6363. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].AND, buildInfixAndOrTable());
  6364. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD, buildInfixModTable());
  6365. return compatibilityMap;
  6366. }
  6367. function buildUnaryCompatibilityTable() {
  6368. var compatibilityMap = new WeakMap();
  6369. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].ADD, buildUnarySumSubList());
  6370. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].SUB, buildUnarySumSubList());
  6371. compatibilityMap.set(_ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].NOT, buildUnaryNegList());
  6372. return compatibilityMap;
  6373. }
  6374. var infixMap = buildInfixCompatibilityTable();
  6375. var unaryMap = buildUnaryCompatibilityTable();
  6376. function resultTypeAfterInfixOp(operator, leftExpressionType, rightExpressionType) {
  6377. try {
  6378. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"] && rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6379. var newMulti = [];
  6380. for (var i = 0; i < leftExpressionType.types.length; ++i) {
  6381. var typeA = leftExpressionType.types[i];
  6382. for (var j = 0; j < rightExpressionType.types.length; ++i) {
  6383. var typeB = rightExpressionType.types[j];
  6384. newMulti.push(resultTypeAfterInfixOp(operator, typeA, typeB));
  6385. }
  6386. }
  6387. newMulti = newMulti.filter(function (x) {
  6388. return !x.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED);
  6389. });
  6390. if (newMulti.length <= 0) {
  6391. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6392. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6393. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6394. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL]);
  6395. }
  6396. }
  6397. }
  6398. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6399. } else {
  6400. return new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"](newMulti);
  6401. }
  6402. } else if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6403. if (leftExpressionType.isCompatible(rightExpressionType)) {
  6404. return resultTypeAfterInfixOp(operator, rightExpressionType, rightExpressionType);
  6405. } else {
  6406. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6407. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6408. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6409. return rightExpressionType;
  6410. }
  6411. }
  6412. }
  6413. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6414. }
  6415. } else if (rightExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6416. if (rightExpressionType.isCompatible(leftExpressionType)) {
  6417. return resultTypeAfterInfixOp(operator, leftExpressionType, leftExpressionType);
  6418. } else {
  6419. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6420. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6421. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6422. return leftExpressionType;
  6423. }
  6424. }
  6425. }
  6426. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6427. }
  6428. }
  6429. var resultType = infixMap.get(operator)[leftExpressionType.ord][rightExpressionType.ord];
  6430. if (resultType === null || resultType === undefined) {
  6431. if (_util_config__WEBPACK_IMPORTED_MODULE_3__["Config"].enable_type_casting) {
  6432. if (leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || leftExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6433. if (rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER) || rightExpressionType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].REAL)) {
  6434. if (operator === _ast_operators__WEBPACK_IMPORTED_MODULE_1__["Operators"].MOD) {
  6435. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].INTEGER;
  6436. } else if (operator.ord >= 5 && operator.ord <= 10) {
  6437. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].BOOLEAN;
  6438. }
  6439. }
  6440. }
  6441. }
  6442. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6443. }
  6444. return resultType;
  6445. } catch (e) {
  6446. if (e instanceof TypeError) {
  6447. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6448. } else {
  6449. throw e;
  6450. }
  6451. }
  6452. }
  6453. function resultTypeAfterUnaryOp(operator, leftExpressionType) {
  6454. try {
  6455. if (leftExpressionType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]) {
  6456. return leftExpressionType;
  6457. }
  6458. return unaryMap.get(operator)[leftExpressionType.ord];
  6459. } catch (e) {
  6460. if (e instanceof TypeError) {
  6461. return _typeSystem_types__WEBPACK_IMPORTED_MODULE_0__["Types"].UNDEFINED;
  6462. } else {
  6463. throw e;
  6464. }
  6465. }
  6466. }
  6467. /***/ }),
  6468. /***/ "./js/processor/context.js":
  6469. /*!*********************************!*\
  6470. !*** ./js/processor/context.js ***!
  6471. \*********************************/
  6472. /*! exports provided: Context */
  6473. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6474. "use strict";
  6475. __webpack_require__.r(__webpack_exports__);
  6476. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Context", function() { return Context; });
  6477. var Context = Object.freeze({
  6478. BASE: Symbol('context:base'),
  6479. BREAKABLE: Symbol('context:breakable'),
  6480. FUNCTION: Symbol('context:function')
  6481. });
  6482. /***/ }),
  6483. /***/ "./js/processor/definedFunctions.js":
  6484. /*!******************************************!*\
  6485. !*** ./js/processor/definedFunctions.js ***!
  6486. \******************************************/
  6487. /*! exports provided: LanguageDefinedFunction */
  6488. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6489. "use strict";
  6490. __webpack_require__.r(__webpack_exports__);
  6491. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageDefinedFunction", function() { return LanguageDefinedFunction; });
  6492. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  6493. /* harmony import */ var _lib_io__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./lib/io */ "./js/processor/lib/io.js");
  6494. /* harmony import */ var _lib_strings__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./lib/strings */ "./js/processor/lib/strings.js");
  6495. /* harmony import */ var _lib_arrays__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./lib/arrays */ "./js/processor/lib/arrays.js");
  6496. /* harmony import */ var _lib_lang__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./lib/lang */ "./js/processor/lib/lang.js");
  6497. /* harmony import */ var _lib_math__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./lib/math */ "./js/processor/lib/math.js");
  6498. function valueToKey(value, object) {
  6499. for (var key in object) {
  6500. if (object.hasOwnProperty(key)) {
  6501. if (object[key] === value) {
  6502. return key;
  6503. }
  6504. }
  6505. }
  6506. return null;
  6507. }
  6508. function concatObjects() {
  6509. var result = {};
  6510. for (var i = 0; i < arguments.length; i++) {
  6511. var obj = i < 0 || arguments.length <= i ? undefined : arguments[i];
  6512. for (var key in obj) {
  6513. if (obj.hasOwnProperty(key)) {
  6514. result[key] = obj[key];
  6515. }
  6516. }
  6517. }
  6518. return result;
  6519. }
  6520. var libsObject = {
  6521. $mathLib: {
  6522. $sin: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSinFun"])(),
  6523. $cos: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createCosFun"])(),
  6524. $tan: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createTanFun"])(),
  6525. $sqrt: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createSqrtFun"])(),
  6526. $pow: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createPowFun"])(),
  6527. $log: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createLogFun"])(),
  6528. $abs: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createAbsFun"])(),
  6529. $negate: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createNegateFun"])(),
  6530. $invert: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createInvertFun"])(),
  6531. $max: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMaxFun"])(),
  6532. $min: Object(_lib_math__WEBPACK_IMPORTED_MODULE_5__["createMinFun"])()
  6533. },
  6534. $ioLib: {
  6535. $read: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createInputFun"])(),
  6536. $write: Object(_lib_io__WEBPACK_IMPORTED_MODULE_1__["createOutputFun"])()
  6537. },
  6538. $strLib: {
  6539. $substring: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createSubstringFun"])(),
  6540. $length: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLengthFun"])(),
  6541. $uppercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createUppercaseFun"])(),
  6542. $lowercase: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createLowercaseFun"])(),
  6543. $charAt: Object(_lib_strings__WEBPACK_IMPORTED_MODULE_2__["createrCharAtFun"])()
  6544. },
  6545. $arrayLib: {
  6546. $numElements: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createNumElementsFun"])(),
  6547. $matrixLines: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixLinesFun"])(),
  6548. $matrixColumns: Object(_lib_arrays__WEBPACK_IMPORTED_MODULE_3__["createMatrixColumnsFun"])()
  6549. },
  6550. $langLib: {
  6551. $isReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsRealFun"])(),
  6552. $isInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsIntFun"])(),
  6553. $isBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createIsBoolFun"])(),
  6554. $castReal: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastRealFun"])(),
  6555. $castInt: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastIntFun"])(),
  6556. $castBool: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastBoolFun"])(),
  6557. $castString: Object(_lib_lang__WEBPACK_IMPORTED_MODULE_4__["createCastStringFun"])()
  6558. }
  6559. };
  6560. var funcsObject = concatObjects(libsObject.$ioLib, libsObject.$langLib, libsObject.$strLib, libsObject.$arrayLib);
  6561. var LanguageDefinedFunction = Object.freeze({
  6562. getMainFunctionName: function getMainFunctionName() {
  6563. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs().main_function;
  6564. },
  6565. getInternalName: function getInternalName(localName) {
  6566. if (localName.indexOf(".") !== -1) {
  6567. var names = localName.split(".");
  6568. var lib = valueToKey(names[0], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs());
  6569. var internalName = valueToKey(names[1], _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6570. if (lib === null || internalName === null) {
  6571. return null;
  6572. }
  6573. return lib + "." + internalName;
  6574. }
  6575. var funcName = valueToKey(localName, _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs());
  6576. if (funcName !== null) {
  6577. if (funcsObject[funcName]) {
  6578. return funcName;
  6579. }
  6580. }
  6581. return null;
  6582. },
  6583. getFunction: function getFunction(internalName) {
  6584. if (internalName.indexOf(".") !== -1) {
  6585. var names = internalName.split(".");
  6586. var libName = names[0];
  6587. var funName = names[1];
  6588. return libsObject[libName][funName];
  6589. }
  6590. return funcsObject[internalName];
  6591. },
  6592. getLocalName: function getLocalName(internalName) {
  6593. if (internalName.indexOf(".") !== -1) {
  6594. var names = internalName.split(".");
  6595. var libName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangLibs()[names[0]];
  6596. var funName = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[names[1]];
  6597. return "".concat(libName, ".").concat(funName);
  6598. } else if (_services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName]) {
  6599. return _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLangFuncs()[internalName];
  6600. } else {
  6601. return internalName;
  6602. }
  6603. }
  6604. });
  6605. /***/ }),
  6606. /***/ "./js/processor/error/processorErrorFactory.js":
  6607. /*!*****************************************************!*\
  6608. !*** ./js/processor/error/processorErrorFactory.js ***!
  6609. \*****************************************************/
  6610. /*! exports provided: ProcessorErrorFactory */
  6611. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  6612. "use strict";
  6613. __webpack_require__.r(__webpack_exports__);
  6614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProcessorErrorFactory", function() { return ProcessorErrorFactory; });
  6615. /* harmony import */ var _runtimeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./runtimeError */ "./js/processor/error/runtimeError.js");
  6616. /* harmony import */ var _semanticError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./semanticError */ "./js/processor/error/semanticError.js");
  6617. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  6618. var LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_2__["getInstance"]();
  6619. var ProcessorErrorFactory = Object.freeze({
  6620. symbol_not_found_full: function symbol_not_found_full(id, sourceInfo) {
  6621. if (sourceInfo) {
  6622. var context = [id, sourceInfo.line, sourceInfo.column];
  6623. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found_full", context));
  6624. } else {
  6625. return ProcessorErrorFactory.symbol_not_found(id);
  6626. }
  6627. },
  6628. symbol_not_found: function symbol_not_found(id) {
  6629. var context = [id];
  6630. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("symbol_not_found", context));
  6631. },
  6632. function_missing_full: function function_missing_full(id, sourceInfo) {
  6633. if (sourceInfo) {
  6634. var context = [id, sourceInfo.line, sourceInfo.column];
  6635. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing_full", context));
  6636. } else {
  6637. return ProcessorErrorFactory.function_missing(id);
  6638. }
  6639. },
  6640. function_missing: function function_missing(id) {
  6641. var context = [id];
  6642. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_missing", context));
  6643. },
  6644. main_missing: function main_missing() {
  6645. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("main_missing"));
  6646. },
  6647. // TODO: better urgent error message
  6648. array_dimension_not_int_full: function array_dimension_not_int_full(sourceInfo) {
  6649. if (sourceInfo) {
  6650. var context = [sourceInfo.line];
  6651. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int_full", context));
  6652. } else {
  6653. return ProcessorErrorFactory.array_dimension_not_int();
  6654. }
  6655. },
  6656. array_dimension_not_int: function array_dimension_not_int() {
  6657. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_int"));
  6658. },
  6659. unknown_command_full: function unknown_command_full(sourceInfo) {
  6660. if (sourceInfo) {
  6661. var context = [sourceInfo.line];
  6662. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command_full", context));
  6663. } else {
  6664. return ProcessorErrorFactory.unknown_command();
  6665. }
  6666. },
  6667. unknown_command: function unknown_command() {
  6668. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unknown_command"));
  6669. },
  6670. incompatible_types_full: function incompatible_types_full(type, dim, sourceInfo) {
  6671. if (sourceInfo) {
  6672. var context = [LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6673. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_full", context));
  6674. } else {
  6675. return ProcessorErrorFactory.incompatible_types(type, dim);
  6676. }
  6677. },
  6678. incompatible_types: function incompatible_types(type, dim) {
  6679. var context = [LocalizedStrings.translateType(type, dim)];
  6680. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types", context));
  6681. },
  6682. incompatible_types_array_full: function incompatible_types_array_full(exp, type, dim, sourceInfo) {
  6683. if (sourceInfo) {
  6684. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6685. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array_full", context));
  6686. } else {
  6687. return ProcessorErrorFactory.incompatible_types_array(exp, type, dim);
  6688. }
  6689. },
  6690. incompatible_types_array: function incompatible_types_array(exp, type, dim) {
  6691. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6692. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("incompatible_types_array", context));
  6693. },
  6694. loop_condition_type_full: function loop_condition_type_full(exp, sourceInfo) {
  6695. if (sourceInfo) {
  6696. var context = [sourceInfo.line, sourceInfo.column, exp];
  6697. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type_full", context));
  6698. } else {
  6699. return ProcessorErrorFactory.loop_condition_type(exp);
  6700. }
  6701. },
  6702. loop_condition_type: function loop_condition_type(exp) {
  6703. var context = [exp];
  6704. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("loop_condition_type", context));
  6705. },
  6706. endless_loop_full: function endless_loop_full(sourceInfo) {
  6707. if (sourceInfo) {
  6708. var context = [sourceInfo.line];
  6709. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop_full", context));
  6710. } else {
  6711. return ProcessorErrorFactory.endless_loop();
  6712. }
  6713. },
  6714. endless_loop: function endless_loop() {
  6715. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("endless_loop"));
  6716. },
  6717. for_condition_type_full: function for_condition_type_full(exp, sourceInfo) {
  6718. if (sourceInfo) {
  6719. var context = [sourceInfo.line, sourceInfo.column, exp];
  6720. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type_full", context));
  6721. } else {
  6722. return ProcessorErrorFactory.for_condition_type(exp);
  6723. }
  6724. },
  6725. for_condition_type: function for_condition_type(exp) {
  6726. var context = [exp];
  6727. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("for_condition_type", context));
  6728. },
  6729. if_condition_type_full: function if_condition_type_full(exp, sourceInfo) {
  6730. if (sourceInfo) {
  6731. var context = [sourceInfo.line, sourceInfo.column, exp];
  6732. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type_full", context));
  6733. } else {
  6734. return ProcessorErrorFactory.if_condition_type(exp);
  6735. }
  6736. },
  6737. if_condition_type: function if_condition_type(exp) {
  6738. var context = [exp];
  6739. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("if_condition_type", context));
  6740. },
  6741. invalid_global_var: function invalid_global_var() {
  6742. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_global_var"));
  6743. },
  6744. not_implemented: function not_implemented(id) {
  6745. var context = [id];
  6746. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("not_implemented", context));
  6747. },
  6748. invalid_case_type_full: function invalid_case_type_full(exp, type, dim, sourceInfo) {
  6749. if (sourceInfo) {
  6750. var context = [exp, LocalizedStrings.translateType(type, dim), sourceInfo.line, sourceInfo.column];
  6751. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type_full", context));
  6752. } else {
  6753. return ProcessorErrorFactory.invalid_case_type(exp, type, dim);
  6754. }
  6755. },
  6756. invalid_case_type: function invalid_case_type(exp, type, dim) {
  6757. var context = [exp, LocalizedStrings.translateType(type, dim)];
  6758. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_case_type", context));
  6759. },
  6760. void_in_expression_full: function void_in_expression_full(id, sourceInfo) {
  6761. if (sourceInfo) {
  6762. var context = [sourceInfo.line, sourceInfo.column, id];
  6763. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression_full", context));
  6764. } else {
  6765. return ProcessorErrorFactory.void_in_expression(id);
  6766. }
  6767. },
  6768. void_in_expression: function void_in_expression(id) {
  6769. var context = [id];
  6770. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("void_in_expression", context));
  6771. },
  6772. invalid_array_access_full: function invalid_array_access_full(id, sourceInfo) {
  6773. if (sourceInfo) {
  6774. var context = [id, sourceInfo.line, sourceInfo.column];
  6775. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access_full", context));
  6776. } else {
  6777. return ProcessorErrorFactory.invalid_array_access(id);
  6778. }
  6779. },
  6780. invalid_array_access: function invalid_array_access(id) {
  6781. var context = [id];
  6782. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_array_access", context));
  6783. },
  6784. invalid_matrix_access_full: function invalid_matrix_access_full(id, sourceInfo) {
  6785. if (sourceInfo) {
  6786. var context = [id, sourceInfo.line, sourceInfo.column];
  6787. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access_full", context));
  6788. } else {
  6789. return ProcessorErrorFactory.invalid_matrix_access(id);
  6790. }
  6791. },
  6792. invalid_matrix_access: function invalid_matrix_access(id) {
  6793. var context = [id];
  6794. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_matrix_access", context));
  6795. },
  6796. matrix_column_outbounds_full: function matrix_column_outbounds_full(id, value, columns, sourceInfo) {
  6797. if (sourceInfo) {
  6798. var context = [sourceInfo.line, value, id, columns];
  6799. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds_full", context));
  6800. } else {
  6801. return ProcessorErrorFactory.matrix_column_outbounds(id, value, columns);
  6802. }
  6803. },
  6804. matrix_column_outbounds: function matrix_column_outbounds(id, value, columns) {
  6805. var context = [value, id, columns];
  6806. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_column_outbounds", context));
  6807. },
  6808. matrix_line_outbounds_full: function matrix_line_outbounds_full(id, value, lines, sourceInfo) {
  6809. if (sourceInfo) {
  6810. var context = [sourceInfo.line, value, id, lines];
  6811. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds_full", context));
  6812. } else {
  6813. return ProcessorErrorFactory.matrix_line_outbounds(id, value, lines);
  6814. }
  6815. },
  6816. matrix_line_outbounds: function matrix_line_outbounds(id, value, lines) {
  6817. var context = [value, id, lines];
  6818. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("matrix_line_outbounds", context));
  6819. },
  6820. vector_line_outbounds_full: function vector_line_outbounds_full(id, value, lines, sourceInfo) {
  6821. if (sourceInfo) {
  6822. var context = [sourceInfo.line, value, id, lines];
  6823. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds_full", context));
  6824. } else {
  6825. return ProcessorErrorFactory.vector_line_outbounds(id, value, lines);
  6826. }
  6827. },
  6828. vector_line_outbounds: function vector_line_outbounds(id, value, lines) {
  6829. var context = [value, id, lines];
  6830. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_line_outbounds", context));
  6831. },
  6832. vector_not_matrix_full: function vector_not_matrix_full(id, sourceInfo) {
  6833. if (sourceInfo) {
  6834. var context = [sourceInfo.line, id];
  6835. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix_full", context));
  6836. } else {
  6837. return ProcessorErrorFactory.vector_not_matrix(id);
  6838. }
  6839. },
  6840. vector_not_matrix: function vector_not_matrix(id) {
  6841. var context = [id];
  6842. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("vector_not_matrix", context));
  6843. },
  6844. function_no_return: function function_no_return(id) {
  6845. var context = [id];
  6846. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("function_no_return", context));
  6847. },
  6848. invalid_void_return_full: function invalid_void_return_full(id, type, dim, sourceInfo) {
  6849. if (sourceInfo) {
  6850. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6851. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6852. } else {
  6853. return ProcessorErrorFactory.invalid_void_return(id, type, dim);
  6854. }
  6855. },
  6856. invalid_void_return: function invalid_void_return(id, type, dim) {
  6857. var context = [id, LocalizedStrings.translateType(type, dim)];
  6858. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_void_return_full", context));
  6859. },
  6860. invalid_return_type_full: function invalid_return_type_full(id, type, dim, sourceInfo) {
  6861. if (sourceInfo) {
  6862. var context = [sourceInfo.line, id, LocalizedStrings.translateType(type, dim)];
  6863. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type_full", context));
  6864. } else {
  6865. return ProcessorErrorFactory.invalid_return_type(id, type, dim);
  6866. }
  6867. },
  6868. invalid_return_type: function invalid_return_type(id, type, dim) {
  6869. var context = [id, LocalizedStrings.translateType(type, dim)];
  6870. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_return_type", context));
  6871. },
  6872. invalid_parameters_size_full: function invalid_parameters_size_full(id, expected, actual, sourceInfo) {
  6873. if (sourceInfo) {
  6874. var context = [sourceInfo.line, id, expected, actual];
  6875. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size_full", context));
  6876. } else {
  6877. return ProcessorErrorFactory.invalid_parameters_size(id, expected, actual);
  6878. }
  6879. },
  6880. invalid_parameters_size: function invalid_parameters_size(id, expected, actual) {
  6881. var context = [id, expected, actual];
  6882. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameters_size", context));
  6883. },
  6884. invalid_parameter_type_full: function invalid_parameter_type_full(id, exp, sourceInfo) {
  6885. if (sourceInfo) {
  6886. var context = [exp, id, sourceInfo.line];
  6887. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6888. } else {
  6889. return ProcessorErrorFactory.invalid_parameter_type(id, exp);
  6890. }
  6891. },
  6892. invalid_parameter_type: function invalid_parameter_type(id, exp) {
  6893. var context = [exp, id];
  6894. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_parameter_type_full", context));
  6895. },
  6896. invalid_ref_full: function invalid_ref_full(id, exp, sourceInfo) {
  6897. if (sourceInfo) {
  6898. var context = [exp, id, sourceInfo.line];
  6899. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref_full", context));
  6900. } else {
  6901. return ProcessorErrorFactory.invalid_ref(id, exp);
  6902. }
  6903. },
  6904. invalid_ref: function invalid_ref(id, exp) {
  6905. var context = [exp, id];
  6906. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("invalid_ref", context));
  6907. },
  6908. unexpected_break_command_full: function unexpected_break_command_full(sourceInfo) {
  6909. if (sourceInfo) {
  6910. var context = [sourceInfo.line];
  6911. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command_full", context));
  6912. } else {
  6913. return ProcessorErrorFactory.unexpected_break_command();
  6914. }
  6915. },
  6916. unexpected_break_command: function unexpected_break_command() {
  6917. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("unexpected_break_command"));
  6918. },
  6919. invalid_array_literal_type_full: function invalid_array_literal_type_full(exp, sourceInfo) {
  6920. if (sourceInfo) {
  6921. var context = [sourceInfo.line, exp];
  6922. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type_full", context));
  6923. } else {
  6924. return ProcessorErrorFactory.invalid_array_literal_type(exp);
  6925. }
  6926. },
  6927. invalid_array_literal_type: function invalid_array_literal_type(exp) {
  6928. var context = [exp];
  6929. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_type", context));
  6930. },
  6931. invalid_array_literal_line_full: function invalid_array_literal_line_full(expected, actual, sourceInfo) {
  6932. if (sourceInfo) {
  6933. var context = [sourceInfo.line, expected, actual];
  6934. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line_full", context));
  6935. } else {
  6936. return ProcessorErrorFactory.invalid_array_literal_type(expected, actual);
  6937. }
  6938. },
  6939. invalid_array_literal_line: function invalid_array_literal_line(expected, actual) {
  6940. var context = [expected, actual];
  6941. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_line", context));
  6942. },
  6943. invalid_array_literal_column_full: function invalid_array_literal_column_full(expected, actual, sourceInfo) {
  6944. if (sourceInfo) {
  6945. var context = [sourceInfo.line, expected, actual];
  6946. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column_full", context));
  6947. } else {
  6948. return ProcessorErrorFactory.invalid_array_literal_column(expected, actual);
  6949. }
  6950. },
  6951. invalid_array_literal_column: function invalid_array_literal_column(expected, actual) {
  6952. var context = [expected, actual];
  6953. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_array_literal_column", context));
  6954. },
  6955. invalid_unary_op_full: function invalid_unary_op_full(opName, type, dim, sourceInfo) {
  6956. if (sourceInfo) {
  6957. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6958. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op_full", context));
  6959. } else {
  6960. return ProcessorErrorFactory.invalid_unary_op(opName, type, dim);
  6961. }
  6962. },
  6963. invalid_unary_op: function invalid_unary_op(opName, type, dim) {
  6964. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(type, dim)];
  6965. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_unary_op", context));
  6966. },
  6967. invalid_infix_op_full: function invalid_infix_op_full(opName, typeLeft, dimLeft, typeRight, dimRight, sourceInfo) {
  6968. if (sourceInfo) {
  6969. var context = [sourceInfo.line, LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6970. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op_full", context));
  6971. } else {
  6972. return ProcessorErrorFactory.invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight);
  6973. }
  6974. },
  6975. invalid_infix_op: function invalid_infix_op(opName, typeLeft, dimLeft, typeRight, dimRight) {
  6976. var context = [LocalizedStrings.translateOp(opName), LocalizedStrings.translateType(typeLeft, dimLeft), LocalizedStrings.translateType(typeRight, dimRight)];
  6977. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_infix_op", context));
  6978. },
  6979. array_dimension_not_positive_full: function array_dimension_not_positive_full(sourceInfo) {
  6980. if (sourceInfo) {
  6981. var context = [sourceInfo.line];
  6982. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive_full", context));
  6983. } else {
  6984. return ProcessorErrorFactory.array_dimension_not_positive();
  6985. }
  6986. },
  6987. array_dimension_not_positive: function array_dimension_not_positive() {
  6988. return new _semanticError__WEBPACK_IMPORTED_MODULE_1__["SemanticError"](LocalizedStrings.getError("array_dimension_not_positive"));
  6989. },
  6990. invalid_type_conversion: function invalid_type_conversion(value, type, dim) {
  6991. var context = [value, LocalizedStrings.translateType(type, dim)];
  6992. return new _runtimeError__WEBPACK_IMPORTED_MODULE_0__["RuntimeError"](LocalizedStrings.getError("invalid_type_conversion", context));
  6993. }
  6994. });
  6995. /***/ }),
  6996. /***/ "./js/processor/error/runtimeError.js":
  6997. /*!********************************************!*\
  6998. !*** ./js/processor/error/runtimeError.js ***!
  6999. \********************************************/
  7000. /*! exports provided: RuntimeError */
  7001. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7002. "use strict";
  7003. __webpack_require__.r(__webpack_exports__);
  7004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeError", function() { return RuntimeError; });
  7005. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7006. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7007. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7008. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7009. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7010. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7011. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7012. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7013. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7014. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7015. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7016. var RuntimeError =
  7017. /*#__PURE__*/
  7018. function (_Error) {
  7019. _inherits(RuntimeError, _Error);
  7020. function RuntimeError() {
  7021. var _getPrototypeOf2;
  7022. var _this;
  7023. _classCallCheck(this, RuntimeError);
  7024. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7025. msg[_key] = arguments[_key];
  7026. }
  7027. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(RuntimeError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7028. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), RuntimeError);
  7029. return _this;
  7030. }
  7031. return RuntimeError;
  7032. }(_wrapNativeSuper(Error));
  7033. /***/ }),
  7034. /***/ "./js/processor/error/semanticError.js":
  7035. /*!*********************************************!*\
  7036. !*** ./js/processor/error/semanticError.js ***!
  7037. \*********************************************/
  7038. /*! exports provided: SemanticError */
  7039. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7040. "use strict";
  7041. __webpack_require__.r(__webpack_exports__);
  7042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticError", function() { return SemanticError; });
  7043. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  7044. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7045. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  7046. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7047. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  7048. function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
  7049. function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
  7050. function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
  7051. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  7052. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  7053. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  7054. var SemanticError =
  7055. /*#__PURE__*/
  7056. function (_Error) {
  7057. _inherits(SemanticError, _Error);
  7058. function SemanticError() {
  7059. var _getPrototypeOf2;
  7060. var _this;
  7061. _classCallCheck(this, SemanticError);
  7062. for (var _len = arguments.length, msg = new Array(_len), _key = 0; _key < _len; _key++) {
  7063. msg[_key] = arguments[_key];
  7064. }
  7065. _this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(SemanticError)).call.apply(_getPrototypeOf2, [this].concat(msg)));
  7066. if (Error.captureStackTrace) Error.captureStackTrace(_assertThisInitialized(_this), SemanticError);
  7067. return _this;
  7068. }
  7069. return SemanticError;
  7070. }(_wrapNativeSuper(Error));
  7071. /***/ }),
  7072. /***/ "./js/processor/ivprogProcessor.js":
  7073. /*!*****************************************!*\
  7074. !*** ./js/processor/ivprogProcessor.js ***!
  7075. \*****************************************/
  7076. /*! exports provided: IVProgProcessor */
  7077. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7078. "use strict";
  7079. __webpack_require__.r(__webpack_exports__);
  7080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IVProgProcessor", function() { return IVProgProcessor; });
  7081. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./store/store */ "./js/processor/store/store.js");
  7082. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./store/storeObject */ "./js/processor/store/storeObject.js");
  7083. /* harmony import */ var _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./store/storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  7084. /* harmony import */ var _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./store/storeObjectRef */ "./js/processor/store/storeObjectRef.js");
  7085. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./modes */ "./js/processor/modes.js");
  7086. /* harmony import */ var _context__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./context */ "./js/processor/context.js");
  7087. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./../typeSystem/types */ "./js/typeSystem/types.js");
  7088. /* harmony import */ var _ast_operators__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./../ast/operators */ "./js/ast/operators.js");
  7089. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./definedFunctions */ "./js/processor/definedFunctions.js");
  7090. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./compatibilityTable */ "./js/processor/compatibilityTable.js");
  7091. /* harmony import */ var _ast_commands___WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/commands/ */ "./js/ast/commands/index.js");
  7092. /* harmony import */ var _ast_expressions___WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/expressions/ */ "./js/ast/expressions/index.js");
  7093. /* harmony import */ var _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./store/storeObjectArrayAddress */ "./js/processor/store/storeObjectArrayAddress.js");
  7094. /* harmony import */ var _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./store/storeObjectArrayAddressRef */ "./js/processor/store/storeObjectArrayAddressRef.js");
  7095. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  7096. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  7097. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  7098. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  7099. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_17__);
  7100. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  7101. /* harmony import */ var _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./error/runtimeError */ "./js/processor/error/runtimeError.js");
  7102. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7103. 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); } }
  7104. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  7105. var IVProgProcessor =
  7106. /*#__PURE__*/
  7107. function () {
  7108. _createClass(IVProgProcessor, null, [{
  7109. key: "LOOP_TIMEOUT",
  7110. get: function get() {
  7111. return _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].loopTimeout;
  7112. },
  7113. set: function set(ms) {
  7114. _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].setConfig({
  7115. loopTimeout: ms
  7116. });
  7117. }
  7118. }, {
  7119. key: "MAIN_INTERNAL_ID",
  7120. get: function get() {
  7121. return "$main";
  7122. }
  7123. }]);
  7124. function IVProgProcessor(ast) {
  7125. _classCallCheck(this, IVProgProcessor);
  7126. this.ast = ast;
  7127. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7128. this.stores = [this.globalStore];
  7129. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7130. this.input = null;
  7131. this.forceKill = false;
  7132. this.loopTimers = [];
  7133. this.output = null;
  7134. }
  7135. _createClass(IVProgProcessor, [{
  7136. key: "registerInput",
  7137. value: function registerInput(input) {
  7138. if (this.input !== null) this.input = null;
  7139. this.input = input;
  7140. }
  7141. }, {
  7142. key: "registerOutput",
  7143. value: function registerOutput(output) {
  7144. if (this.output !== null) this.output = null;
  7145. this.output = output;
  7146. }
  7147. }, {
  7148. key: "checkContext",
  7149. value: function checkContext(context) {
  7150. return this.context[this.context.length - 1] === context;
  7151. }
  7152. }, {
  7153. key: "ignoreSwitchCases",
  7154. value: function ignoreSwitchCases(store) {
  7155. if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7156. return true;
  7157. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7158. return true;
  7159. } else {
  7160. return false;
  7161. }
  7162. }
  7163. }, {
  7164. key: "prepareState",
  7165. value: function prepareState() {
  7166. if (this.stores !== null) {
  7167. for (var i = 0; i < this.stores.length; i++) {
  7168. delete this.stores[i];
  7169. }
  7170. this.stores = null;
  7171. }
  7172. if (this.globalStore !== null) this.globalStore = null;
  7173. this.globalStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"]("$global");
  7174. this.stores = [this.globalStore];
  7175. this.context = [_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE];
  7176. }
  7177. }, {
  7178. key: "interpretAST",
  7179. value: function interpretAST() {
  7180. var _this = this;
  7181. this.prepareState();
  7182. return this.initGlobal().then(function (_) {
  7183. var mainFunc = _this.findMainFunction();
  7184. if (mainFunc === null) {
  7185. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].main_missing();
  7186. }
  7187. return _this.runFunction(mainFunc, [], _this.globalStore);
  7188. });
  7189. }
  7190. }, {
  7191. key: "initGlobal",
  7192. value: function initGlobal() {
  7193. if (!this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BASE)) {
  7194. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_global_var();
  7195. }
  7196. return this.executeCommands(this.globalStore, this.ast.global);
  7197. }
  7198. }, {
  7199. key: "findMainFunction",
  7200. value: function findMainFunction() {
  7201. return this.ast.functions.find(function (v) {
  7202. return v.isMain;
  7203. });
  7204. }
  7205. }, {
  7206. key: "findFunction",
  7207. value: function findFunction(name) {
  7208. if (name.match(/^\$.+$/)) {
  7209. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getFunction(name);
  7210. if (!!!fun) {
  7211. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].not_implemented(name);
  7212. }
  7213. return fun;
  7214. } else {
  7215. var val = this.ast.functions.find(function (v) {
  7216. return v.name === name;
  7217. });
  7218. if (!!!val) {
  7219. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_missing(name);
  7220. }
  7221. return val;
  7222. }
  7223. }
  7224. }, {
  7225. key: "runFunction",
  7226. value: function runFunction(func, actualParameters, store) {
  7227. var _this2 = this;
  7228. var funcName = func.isMain ? IVProgProcessor.MAIN_INTERNAL_ID : func.name;
  7229. var funcStore = new _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"](funcName);
  7230. funcStore.extendStore(this.globalStore);
  7231. var returnStoreObject = null;
  7232. if (func.returnType instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7233. if (func.returnType.dimensions > 1) {
  7234. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, -1, [[]]);
  7235. } else {
  7236. returnStoreObject = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](func.returnType, -1, null, []);
  7237. }
  7238. } else {
  7239. returnStoreObject = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](func.returnType, null);
  7240. }
  7241. funcStore.insertStore('$', returnStoreObject);
  7242. var newFuncStore$ = this.associateParameters(func.formalParameters, actualParameters, store, funcStore);
  7243. var outerRef = this;
  7244. return newFuncStore$.then(function (sto) {
  7245. _this2.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].FUNCTION);
  7246. _this2.stores.push(sto);
  7247. return _this2.executeCommands(sto, func.variablesDeclarations).then(function (stoWithVars) {
  7248. return outerRef.executeCommands(stoWithVars, func.commands);
  7249. }).then(function (finalSto) {
  7250. outerRef.stores.pop();
  7251. outerRef.context.pop();
  7252. return finalSto;
  7253. });
  7254. });
  7255. }
  7256. }, {
  7257. key: "associateParameters",
  7258. value: function associateParameters(formalList, actualList, callerStore, calleeStore) {
  7259. var _this3 = this;
  7260. var funcName = calleeStore.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : calleeStore.name;
  7261. if (formalList.length != actualList.length) {
  7262. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameters_size(funcName, formalList.length, actualList.length);
  7263. }
  7264. var promises$ = actualList.map(function (actualParameter) {
  7265. return _this3.evaluateExpression(callerStore, actualParameter);
  7266. });
  7267. return Promise.all(promises$).then(function (values) {
  7268. for (var i = 0; i < values.length; i++) {
  7269. var stoObj = values[i];
  7270. var exp = actualList[i];
  7271. var shouldTypeCast = false;
  7272. var formalParameter = formalList[i];
  7273. if (!formalParameter.type.isCompatible(stoObj.type)) {
  7274. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && !formalParameter.byRef && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(formalParameter.type, stoObj.type)) {
  7275. shouldTypeCast = true;
  7276. } else {
  7277. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_parameter_type(funcName, exp.toString());
  7278. }
  7279. }
  7280. if (formalParameter.byRef && !stoObj.inStore) {
  7281. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_ref(funcName, exp.toString());
  7282. }
  7283. if (formalParameter.byRef) {
  7284. var ref = null;
  7285. if (stoObj instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7286. ref = new _store_storeObjectArrayAddressRef__WEBPACK_IMPORTED_MODULE_13__["StoreObjectArrayAddressRef"](stoObj);
  7287. } else {
  7288. ref = new _store_storeObjectRef__WEBPACK_IMPORTED_MODULE_3__["StoreObjectRef"](stoObj.id, callerStore);
  7289. }
  7290. calleeStore.insertStore(formalParameter.id, ref);
  7291. } else {
  7292. var realValue = _this3.parseStoreObjectValue(stoObj);
  7293. if (shouldTypeCast) {
  7294. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(formalParameter.type, realValue);
  7295. }
  7296. calleeStore.insertStore(formalParameter.id, realValue);
  7297. }
  7298. }
  7299. return calleeStore;
  7300. });
  7301. }
  7302. }, {
  7303. key: "executeCommands",
  7304. value: function executeCommands(store, cmds) {
  7305. // helper to partially apply a function, in this case executeCommand
  7306. var outerRef = this;
  7307. var partial = function partial(fun, cmd) {
  7308. return function (sto) {
  7309. return fun(sto, cmd);
  7310. };
  7311. };
  7312. return cmds.reduce(function (lastCommand, next) {
  7313. var nextCommand = partial(outerRef.executeCommand.bind(outerRef), next);
  7314. return lastCommand.then(nextCommand);
  7315. }, Promise.resolve(store));
  7316. }
  7317. }, {
  7318. key: "executeCommand",
  7319. value: function executeCommand(store, cmd) {
  7320. if (this.forceKill) {
  7321. return Promise.reject("FORCED_KILL!");
  7322. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].PAUSE) {
  7323. return Promise.resolve(this.executeCommand(store, cmd));
  7324. } else if (store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7325. return Promise.resolve(store);
  7326. } else if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE) && store.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7327. return Promise.resolve(store);
  7328. }
  7329. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Declaration"]) {
  7330. return this.executeDeclaration(store, cmd);
  7331. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayIndexAssign"]) {
  7332. return this.executeArrayIndexAssign(store, cmd);
  7333. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Assign"]) {
  7334. return this.executeAssign(store, cmd);
  7335. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Break"]) {
  7336. return this.executeBreak(store, cmd);
  7337. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Return"]) {
  7338. return this.executeReturn(store, cmd);
  7339. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7340. return this.executeIfThenElse(store, cmd);
  7341. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["DoWhile"]) {
  7342. return this.executeDoWhile(store, cmd);
  7343. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"]) {
  7344. return this.executeWhile(store, cmd);
  7345. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["For"]) {
  7346. return this.executeFor(store, cmd);
  7347. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["Switch"]) {
  7348. return this.executeSwitch(store, cmd);
  7349. } else if (cmd instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7350. return this.executeFunctionCall(store, cmd);
  7351. } else if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["SysCall"]) {
  7352. return this.executeSysCall(store, cmd);
  7353. } else {
  7354. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unknown_command(cmd.sourceInfo);
  7355. }
  7356. }
  7357. }, {
  7358. key: "executeSysCall",
  7359. value: function executeSysCall(store, cmd) {
  7360. var func = cmd.langFunc.bind(this);
  7361. return func(store, cmd);
  7362. }
  7363. }, {
  7364. key: "executeFunctionCall",
  7365. value: function executeFunctionCall(store, cmd) {
  7366. var func = null;
  7367. if (cmd.isMainCall) {
  7368. func = this.findMainFunction();
  7369. } else {
  7370. func = this.findFunction(cmd.id);
  7371. }
  7372. return this.runFunction(func, cmd.actualParameters, store).then(function (sto) {
  7373. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType) && sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7374. var funcName = func.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : func.name;
  7375. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].function_no_return(funcName));
  7376. } else {
  7377. return store;
  7378. }
  7379. });
  7380. }
  7381. }, {
  7382. key: "executeSwitch",
  7383. value: function executeSwitch(store, cmd) {
  7384. var _this4 = this;
  7385. this.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7386. var auxCaseFun = function auxCaseFun(promise, switchExp, aCase) {
  7387. return promise.then(function (result) {
  7388. var sto = result.sto;
  7389. if (_this4.ignoreSwitchCases(sto)) {
  7390. return Promise.resolve(result);
  7391. } else if (result.wasTrue || aCase.isDefault) {
  7392. var $newSto = _this4.executeCommands(result.sto, aCase.commands);
  7393. return $newSto.then(function (nSto) {
  7394. return Promise.resolve({
  7395. wasTrue: true,
  7396. sto: nSto
  7397. });
  7398. });
  7399. } else {
  7400. var $value = _this4.evaluateExpression(sto, new _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"](_ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ, switchExp, aCase.expression));
  7401. return $value.then(function (vl) {
  7402. if (vl.value) {
  7403. var _$newSto = _this4.executeCommands(result.sto, aCase.commands);
  7404. return _$newSto.then(function (nSto) {
  7405. return Promise.resolve({
  7406. wasTrue: true,
  7407. sto: nSto
  7408. });
  7409. });
  7410. } else {
  7411. return Promise.resolve({
  7412. wasTrue: false,
  7413. sto: sto
  7414. });
  7415. }
  7416. });
  7417. }
  7418. });
  7419. };
  7420. try {
  7421. var breakLoop = false;
  7422. var $result = Promise.resolve({
  7423. wasTrue: false,
  7424. sto: store
  7425. });
  7426. for (var index = 0; index < cmd.cases.length && !breakLoop; index++) {
  7427. var aCase = cmd.cases[index];
  7428. $result = auxCaseFun($result, cmd.expression, aCase);
  7429. $result.then(function (r) {
  7430. return breakLoop = _this4.ignoreSwitchCases(r.sto);
  7431. });
  7432. }
  7433. return $result.then(function (r) {
  7434. _this4.context.pop();
  7435. if (r.sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7436. r.sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7437. }
  7438. return r.sto;
  7439. });
  7440. } catch (error) {
  7441. return Promise.reject(error);
  7442. }
  7443. }
  7444. }, {
  7445. key: "executeFor",
  7446. value: function executeFor(store, cmd) {
  7447. try {
  7448. //BEGIN for -> while rewrite
  7449. var initCmd = cmd.assignment;
  7450. var condition = cmd.condition;
  7451. var increment = cmd.increment;
  7452. var whileBlock = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["CommandBlock"]([], cmd.commands.concat(increment));
  7453. var forAsWhile = new _ast_commands___WEBPACK_IMPORTED_MODULE_10__["While"](condition, whileBlock);
  7454. forAsWhile.sourceInfo = cmd.sourceInfo; //END for -> while rewrite
  7455. var newCmdList = [initCmd, forAsWhile];
  7456. return this.executeCommands(store, newCmdList);
  7457. } catch (error) {
  7458. return Promise.reject(error);
  7459. }
  7460. }
  7461. }, {
  7462. key: "executeDoWhile",
  7463. value: function executeDoWhile(store, cmd) {
  7464. var outerRef = this;
  7465. try {
  7466. outerRef.loopTimers.push(Date.now());
  7467. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7468. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7469. return $newStore.then(function (sto) {
  7470. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7471. outerRef.context.pop();
  7472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7473. outerRef.loopTimers.pop();
  7474. return sto;
  7475. }
  7476. var $value = outerRef.evaluateExpression(sto, cmd.expression);
  7477. return $value.then(function (vl) {
  7478. if (!vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7479. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.sourceInfo));
  7480. }
  7481. if (vl.value) {
  7482. outerRef.context.pop();
  7483. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7484. var time = outerRef.loopTimers[i];
  7485. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7486. outerRef.forceKill = true;
  7487. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7488. }
  7489. }
  7490. return outerRef.executeCommand(sto, cmd);
  7491. } else {
  7492. outerRef.context.pop();
  7493. outerRef.loopTimers.pop();
  7494. return sto;
  7495. }
  7496. });
  7497. });
  7498. } catch (error) {
  7499. return Promise.reject(error);
  7500. }
  7501. }
  7502. }, {
  7503. key: "executeWhile",
  7504. value: function executeWhile(store, cmd) {
  7505. var outerRef = this;
  7506. try {
  7507. outerRef.loopTimers.push(Date.now());
  7508. outerRef.context.push(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE);
  7509. var $value = outerRef.evaluateExpression(store, cmd.expression);
  7510. return $value.then(function (vl) {
  7511. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7512. if (vl.value) {
  7513. var $newStore = outerRef.executeCommands(store, cmd.commands);
  7514. return $newStore.then(function (sto) {
  7515. outerRef.context.pop();
  7516. if (sto.mode === _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK) {
  7517. outerRef.loopTimers.pop();
  7518. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RUN;
  7519. return sto;
  7520. }
  7521. for (var i = 0; i < outerRef.loopTimers.length; i++) {
  7522. var time = outerRef.loopTimers[i];
  7523. if (Date.now() - time >= IVProgProcessor.LOOP_TIMEOUT) {
  7524. outerRef.forceKill = true;
  7525. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].endless_loop_full(cmd.sourceInfo));
  7526. }
  7527. }
  7528. return outerRef.executeCommand(sto, cmd);
  7529. });
  7530. } else {
  7531. outerRef.context.pop();
  7532. outerRef.loopTimers.pop();
  7533. return store;
  7534. }
  7535. } else {
  7536. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo));
  7537. }
  7538. });
  7539. } catch (error) {
  7540. return Promise.reject(error);
  7541. }
  7542. }
  7543. }, {
  7544. key: "executeIfThenElse",
  7545. value: function executeIfThenElse(store, cmd) {
  7546. var _this5 = this;
  7547. try {
  7548. var $value = this.evaluateExpression(store, cmd.condition);
  7549. return $value.then(function (vl) {
  7550. if (vl.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN)) {
  7551. if (vl.value) {
  7552. return _this5.executeCommands(store, cmd.ifTrue.commands);
  7553. } else if (cmd.ifFalse !== null) {
  7554. if (cmd.ifFalse instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["IfThenElse"]) {
  7555. return _this5.executeCommand(store, cmd.ifFalse);
  7556. } else {
  7557. return _this5.executeCommands(store, cmd.ifFalse.commands);
  7558. }
  7559. } else {
  7560. return Promise.resolve(store);
  7561. }
  7562. } else {
  7563. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo));
  7564. }
  7565. });
  7566. } catch (error) {
  7567. return Promise.reject(error);
  7568. }
  7569. }
  7570. }, {
  7571. key: "executeReturn",
  7572. value: function executeReturn(store, cmd) {
  7573. var _this6 = this;
  7574. try {
  7575. var funcType = store.applyStore('$').type;
  7576. var $value = this.evaluateExpression(store, cmd.expression);
  7577. var funcName = store.name === IVProgProcessor.MAIN_INTERNAL_ID ? _definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName() : store.name;
  7578. return $value.then(function (vl) {
  7579. if (vl === null && funcType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID)) {
  7580. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7581. return Promise.resolve(store);
  7582. }
  7583. if (vl === null || !funcType.isCompatible(vl.type)) {
  7584. var stringInfo = funcType.stringInfo();
  7585. var info = stringInfo[0];
  7586. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_return_type_full(funcName, info.type, info.dim, cmd.sourceInfo));
  7587. } else {
  7588. var realValue = _this6.parseStoreObjectValue(vl);
  7589. store.updateStore('$', realValue);
  7590. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  7591. return Promise.resolve(store);
  7592. }
  7593. });
  7594. } catch (error) {
  7595. return Promise.reject(error);
  7596. }
  7597. }
  7598. }, {
  7599. key: "executeBreak",
  7600. value: function executeBreak(store, cmd) {
  7601. if (this.checkContext(_context__WEBPACK_IMPORTED_MODULE_5__["Context"].BREAKABLE)) {
  7602. store.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].BREAK;
  7603. return Promise.resolve(store);
  7604. } else {
  7605. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].unexpected_break_command_full(cmd.sourceInfo));
  7606. }
  7607. }
  7608. }, {
  7609. key: "executeAssign",
  7610. value: function executeAssign(store, cmd) {
  7611. var _this7 = this;
  7612. try {
  7613. var inStore = store.applyStore(cmd.id);
  7614. var $value = this.evaluateExpression(store, cmd.expression);
  7615. return $value.then(function (vl) {
  7616. var realValue = _this7.parseStoreObjectValue(vl);
  7617. if (!inStore.type.isCompatible(realValue.type)) {
  7618. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(inStore.type, vl.type)) {
  7619. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(inStore.type, realValue);
  7620. } else {
  7621. var stringInfo = inStore.type.stringInfo();
  7622. var info = stringInfo[0];
  7623. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7624. }
  7625. }
  7626. store.updateStore(cmd.id, realValue);
  7627. return store;
  7628. });
  7629. } catch (error) {
  7630. return Promise.reject(error);
  7631. }
  7632. }
  7633. }, {
  7634. key: "executeArrayIndexAssign",
  7635. value: function executeArrayIndexAssign(store, cmd) {
  7636. var _this8 = this;
  7637. var mustBeArray = store.applyStore(cmd.id);
  7638. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7639. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo));
  7640. }
  7641. var line$ = this.evaluateExpression(store, cmd.line);
  7642. var column$ = this.evaluateExpression(store, cmd.column);
  7643. var value$ = this.evaluateExpression(store, cmd.expression);
  7644. return Promise.all([line$, column$, value$]).then(function (results) {
  7645. var lineSO = results[0];
  7646. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7647. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7648. }
  7649. var line = lineSO.number;
  7650. var columnSO = results[1];
  7651. var column = null;
  7652. if (columnSO !== null) {
  7653. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7654. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7655. }
  7656. column = columnSO.number;
  7657. }
  7658. var value = _this8.parseStoreObjectValue(results[2]);
  7659. if (line >= mustBeArray.lines) {
  7660. if (mustBeArray.isVector) {
  7661. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7662. } else {
  7663. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(cmd.id, line, mustBeArray.lines, cmd.sourceInfo));
  7664. }
  7665. } else if (line < 0) {
  7666. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7667. }
  7668. if (column !== null && mustBeArray.columns === null) {
  7669. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(cmd.id, cmd.sourceInfo));
  7670. }
  7671. if (column !== null) {
  7672. if (column >= mustBeArray.columns) {
  7673. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(cmd.id, column, mustBeArray.columns, cmd.sourceInfo));
  7674. } else if (column < 0) {
  7675. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7676. }
  7677. }
  7678. var newArray = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), mustBeArray);
  7679. if (column !== null) {
  7680. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7681. var type = mustBeArray.type.innerType;
  7682. var stringInfo = type.stringInfo();
  7683. var info = stringInfo[0];
  7684. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7685. }
  7686. newArray.value[line].value[column] = value;
  7687. store.updateStore(cmd.id, newArray);
  7688. } else {
  7689. if (mustBeArray.columns !== null && value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"] || !newArray.type.canAccept(value.type)) {
  7690. var _type = mustBeArray.type;
  7691. var _stringInfo = _type.stringInfo();
  7692. var _info = _stringInfo[0];
  7693. var exp = cmd.expression.toString();
  7694. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_array_full(exp, _info.type, _info.dim - 1, cmd.sourceInfo));
  7695. }
  7696. newArray.value[line] = value;
  7697. store.updateStore(cmd.id, newArray);
  7698. }
  7699. return store;
  7700. });
  7701. }
  7702. }, {
  7703. key: "executeDeclaration",
  7704. value: function executeDeclaration(store, cmd) {
  7705. try {
  7706. var $value = this.evaluateExpression(store, cmd.initial);
  7707. if (cmd instanceof _ast_commands___WEBPACK_IMPORTED_MODULE_10__["ArrayDeclaration"]) {
  7708. var $lines = this.evaluateExpression(store, cmd.lines);
  7709. var $columns = cmd.columns === null ? null : this.evaluateExpression(store, cmd.columns);
  7710. return Promise.all([$lines, $columns, $value]).then(function (values) {
  7711. var lineSO = values[0];
  7712. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7713. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7714. }
  7715. var line = lineSO.number;
  7716. if (line < 0) {
  7717. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7718. }
  7719. var columnSO = values[1];
  7720. var column = null;
  7721. if (columnSO !== null) {
  7722. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7723. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo));
  7724. }
  7725. column = columnSO.number;
  7726. if (column < 0) {
  7727. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(cmd.sourceInfo);
  7728. }
  7729. }
  7730. var value = values[2];
  7731. var temp = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, null);
  7732. store.insertStore(cmd.id, temp);
  7733. var realValue = value;
  7734. if (value !== null) {
  7735. if (value instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7736. if (value.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7737. realValue = Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null), value.refValue);
  7738. } else {
  7739. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), value.refValue);
  7740. }
  7741. }
  7742. } else {
  7743. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](cmd.type, line, column, []);
  7744. if (column !== null) {
  7745. for (var i = 0; i < line; i++) {
  7746. realValue.value.push(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](cmd.type.innerType, 1), column, null, []));
  7747. }
  7748. }
  7749. }
  7750. realValue.readOnly = cmd.isConst;
  7751. store.updateStore(cmd.id, realValue);
  7752. return store;
  7753. });
  7754. } else {
  7755. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, null);
  7756. store.insertStore(cmd.id, temp);
  7757. return $value.then(function (vl) {
  7758. var realValue = vl;
  7759. if (vl !== null) {
  7760. if (!vl.type.isCompatible(cmd.type)) {
  7761. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(cmd.type, vl.type)) {
  7762. realValue = _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].doImplicitCasting(cmd.type, realValue);
  7763. } else {
  7764. var stringInfo = typeInfo.type.stringInfo();
  7765. var info = stringInfo[0];
  7766. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, cmd.sourceInfo));
  7767. }
  7768. }
  7769. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  7770. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  7771. return Promise.reject(new Error("!!!Critical Error: Compatibility check failed, a Type accepts a CompoundType"));
  7772. } else {
  7773. realValue = Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), vl.refValue);
  7774. }
  7775. }
  7776. } else {
  7777. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](cmd.type, 0);
  7778. }
  7779. realValue.readOnly = cmd.isConst;
  7780. store.updateStore(cmd.id, realValue);
  7781. return store;
  7782. });
  7783. }
  7784. } catch (e) {
  7785. return Promise.reject(e);
  7786. }
  7787. }
  7788. }, {
  7789. key: "evaluateExpression",
  7790. value: function evaluateExpression(store, exp) {
  7791. if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["UnaryApp"]) {
  7792. return this.evaluateUnaryApp(store, exp);
  7793. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["InfixApp"]) {
  7794. return this.evaluateInfixApp(store, exp);
  7795. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayAccess"]) {
  7796. return this.evaluateArrayAccess(store, exp);
  7797. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["VariableLiteral"]) {
  7798. return this.evaluateVariableLiteral(store, exp);
  7799. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["IntLiteral"]) {
  7800. return this.evaluateLiteral(store, exp);
  7801. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["RealLiteral"]) {
  7802. return this.evaluateLiteral(store, exp);
  7803. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["BoolLiteral"]) {
  7804. return this.evaluateLiteral(store, exp);
  7805. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["StringLiteral"]) {
  7806. return this.evaluateLiteral(store, exp);
  7807. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["ArrayLiteral"]) {
  7808. return this.evaluateArrayLiteral(store, exp);
  7809. } else if (exp instanceof _ast_expressions___WEBPACK_IMPORTED_MODULE_11__["FunctionCall"]) {
  7810. return this.evaluateFunctionCall(store, exp);
  7811. }
  7812. return Promise.resolve(null);
  7813. }
  7814. }, {
  7815. key: "evaluateFunctionCall",
  7816. value: function evaluateFunctionCall(store, exp) {
  7817. if (exp.isMainCall) {
  7818. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_8__["LanguageDefinedFunction"].getMainFunctionName(), exp.sourceInfo));
  7819. }
  7820. var func = this.findFunction(exp.id);
  7821. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].VOID.isCompatible(func.returnType)) {
  7822. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].void_in_expression_full(exp.id, exp.sourceInfo));
  7823. }
  7824. var $newStore = this.runFunction(func, exp.actualParameters, store);
  7825. return $newStore.then(function (sto) {
  7826. if (sto.mode !== _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN) {
  7827. return Promise.reject(new Error("The function that was called did not had a return command: " + exp.id));
  7828. }
  7829. var val = sto.applyStore('$');
  7830. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7831. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null, null), val));
  7832. } else {
  7833. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7834. }
  7835. });
  7836. }
  7837. }, {
  7838. key: "evaluateArrayLiteral",
  7839. value: function evaluateArrayLiteral(store, exp) {
  7840. var errorHelperFunction = function errorHelperFunction(validationResult, exp) {
  7841. var errorCode = validationResult[0];
  7842. switch (errorCode) {
  7843. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_COLUMN_NUMBER:
  7844. {
  7845. var columnValue = validationResult[1];
  7846. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_column_full(arr.columns, columnValue, exp.sourceInfo));
  7847. }
  7848. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_LINE_NUMBER:
  7849. {
  7850. var lineValue = validationResult[1];
  7851. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_line_full(arr.lines, lineValue, exp.sourceInfo));
  7852. }
  7853. case _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"].WRONG_TYPE:
  7854. {
  7855. var line = null;
  7856. var strExp = null;
  7857. if (validationResult.length > 2) {
  7858. line = validationResult[1];
  7859. var column = validationResult[2];
  7860. strExp = exp.value[line].value[column].toString();
  7861. } else {
  7862. line = validationResult[1];
  7863. strExp = exp.value[line].toString();
  7864. }
  7865. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_literal_type_full(strExp, exp.sourceInfo));
  7866. }
  7867. }
  7868. };
  7869. if (!exp.isVector) {
  7870. var $matrix = this.evaluateMatrix(store, exp.value);
  7871. return $matrix.then(function (list) {
  7872. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type.innerType, 2);
  7873. var arr = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, list[0].lines, list);
  7874. var checkResult = arr.isValid;
  7875. if (checkResult.length == 0) return Promise.resolve(arr);else {
  7876. return errorHelperFunction(checkResult, exp);
  7877. }
  7878. });
  7879. } else {
  7880. return this.evaluateVector(store, exp.value).then(function (list) {
  7881. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7882. var stoArray = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7883. var checkResult = stoArray.isValid;
  7884. if (checkResult.length == 0) return Promise.resolve(stoArray);else {
  7885. return errorHelperFunction(checkResult, exp);
  7886. }
  7887. });
  7888. }
  7889. }
  7890. }, {
  7891. key: "evaluateVector",
  7892. value: function evaluateVector(store, exps) {
  7893. var _this9 = this;
  7894. return Promise.all(exps.map(function (exp) {
  7895. return _this9.evaluateExpression(store, exp);
  7896. }));
  7897. }
  7898. }, {
  7899. key: "evaluateMatrix",
  7900. value: function evaluateMatrix(store, exps) {
  7901. var _this10 = this;
  7902. return Promise.all(exps.map(function (vector) {
  7903. var $vector = _this10.evaluateVector(store, vector.value);
  7904. return $vector.then(function (list) {
  7905. var type = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"](list[0].type, 1);
  7906. return new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](type, list.length, null, list);
  7907. });
  7908. }));
  7909. }
  7910. }, {
  7911. key: "evaluateLiteral",
  7912. value: function evaluateLiteral(_, exp) {
  7913. return Promise.resolve(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](exp.type, exp.value));
  7914. }
  7915. }, {
  7916. key: "evaluateVariableLiteral",
  7917. value: function evaluateVariableLiteral(store, exp) {
  7918. try {
  7919. var val = store.applyStore(exp.id);
  7920. if (val instanceof _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"]) {
  7921. return Promise.resolve(Object.assign(new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](null, null, null, null), val));
  7922. } else {
  7923. return Promise.resolve(Object.assign(new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](null, null), val));
  7924. }
  7925. } catch (error) {
  7926. return Promise.reject(error);
  7927. }
  7928. }
  7929. }, {
  7930. key: "evaluateArrayAccess",
  7931. value: function evaluateArrayAccess(store, exp) {
  7932. var mustBeArray = store.applyStore(exp.id);
  7933. if (!(mustBeArray.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"])) {
  7934. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_array_access_full(exp.id, exp.sourceInfo));
  7935. }
  7936. var $line = this.evaluateExpression(store, exp.line);
  7937. var $column = this.evaluateExpression(store, exp.column);
  7938. return Promise.all([$line, $column]).then(function (values) {
  7939. var lineSO = values[0];
  7940. var columnSO = values[1];
  7941. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(lineSO.type)) {
  7942. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7943. }
  7944. var line = lineSO.number;
  7945. var column = null;
  7946. if (columnSO !== null) {
  7947. if (!_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(columnSO.type)) {
  7948. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_int_full(exp.sourceInfo));
  7949. }
  7950. column = columnSO.number;
  7951. }
  7952. if (line >= mustBeArray.lines) {
  7953. if (mustBeArray.isVector) {
  7954. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7955. } else {
  7956. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_line_outbounds_full(exp.id, line, mustBeArray.lines, exp.sourceInfo));
  7957. }
  7958. } else if (line < 0) {
  7959. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7960. }
  7961. if (column !== null && mustBeArray.columns === null) {
  7962. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].vector_not_matrix_full(exp.id, exp.sourceInfo));
  7963. }
  7964. if (column !== null) {
  7965. if (column >= mustBeArray.columns) {
  7966. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].matrix_column_outbounds_full(exp.id, column, mustBeArray.columns, exp.sourceInfo));
  7967. } else if (column < 0) {
  7968. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].array_dimension_not_positive_full(exp.sourceInfo);
  7969. }
  7970. }
  7971. return Promise.resolve(new _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"](mustBeArray.id, line, column, store));
  7972. });
  7973. }
  7974. }, {
  7975. key: "evaluateUnaryApp",
  7976. value: function evaluateUnaryApp(store, unaryApp) {
  7977. var $left = this.evaluateExpression(store, unaryApp.left);
  7978. return $left.then(function (left) {
  7979. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterUnaryOp"])(unaryApp.op, left.type);
  7980. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  7981. var stringInfo = left.type.stringInfo();
  7982. var info = stringInfo[0];
  7983. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_unary_op_full(unaryApp.op, info.type, info.dim, unaryApp.sourceInfo));
  7984. }
  7985. switch (unaryApp.op.ord) {
  7986. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  7987. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value);
  7988. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  7989. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.negated());
  7990. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NOT.ord:
  7991. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, !left.value);
  7992. default:
  7993. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid UnaryApp ' + unaryApp.op));
  7994. }
  7995. });
  7996. }
  7997. }, {
  7998. key: "evaluateInfixApp",
  7999. value: function evaluateInfixApp(store, infixApp) {
  8000. var $left = this.evaluateExpression(store, infixApp.left);
  8001. var $right = this.evaluateExpression(store, infixApp.right);
  8002. return Promise.all([$left, $right]).then(function (values) {
  8003. var shouldImplicitCast = false;
  8004. var left = values[0];
  8005. var right = values[1];
  8006. var resultType = Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_9__["resultTypeAfterInfixOp"])(infixApp.op, left.type, right.type);
  8007. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].UNDEFINED.isCompatible(resultType)) {
  8008. if (_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].enable_type_casting && _store_store__WEBPACK_IMPORTED_MODULE_0__["Store"].canImplicitTypeCast(left.type, right.type)) {
  8009. shouldImplicitCast = true;
  8010. } else {
  8011. var stringInfoLeft = left.type.stringInfo();
  8012. var infoLeft = stringInfoLeft[0];
  8013. var stringInfoRight = right.type.stringInfo();
  8014. var infoRight = stringInfoRight[0];
  8015. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_18__["ProcessorErrorFactory"].invalid_infix_op_full(infixApp.op, infoLeft.type, infoLeft.dim, infoRight.type, infoRight.dim, infixApp.sourceInfo));
  8016. }
  8017. }
  8018. var result = null;
  8019. switch (infixApp.op.ord) {
  8020. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].ADD.ord:
  8021. {
  8022. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8023. var rightStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(right.value, right.type);
  8024. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value + rightStr);
  8025. } else if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(right.type)) {
  8026. var leftStr = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_15__["convertToString"])(left.value, left.type);
  8027. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, leftStr + right.value);
  8028. } else {
  8029. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.plus(right.value));
  8030. }
  8031. }
  8032. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].SUB.ord:
  8033. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value.minus(right.value));
  8034. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MULT.ord:
  8035. {
  8036. result = left.value.times(right.value);
  8037. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8038. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8039. }
  8040. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8041. }
  8042. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].DIV.ord:
  8043. {
  8044. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(resultType)) result = left.value.divToInt(right.value);else result = left.value.div(right.value);
  8045. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8046. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8047. }
  8048. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8049. }
  8050. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].MOD.ord:
  8051. {
  8052. var leftValue = left.value;
  8053. var rightValue = right.value;
  8054. if (shouldImplicitCast) {
  8055. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER;
  8056. leftValue = leftValue.trunc();
  8057. rightValue = rightValue.trunc();
  8058. }
  8059. result = leftValue.modulo(rightValue);
  8060. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces) {
  8061. result = new decimal_js__WEBPACK_IMPORTED_MODULE_17___default.a(result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_16__["Config"].decimalPlaces));
  8062. }
  8063. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8064. }
  8065. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GT.ord:
  8066. {
  8067. var _leftValue = left.value;
  8068. var _rightValue = right.value;
  8069. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8070. result = left.value.length > right.value.length;
  8071. } else {
  8072. if (shouldImplicitCast) {
  8073. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8074. _leftValue = _leftValue.trunc();
  8075. _rightValue = _rightValue.trunc();
  8076. }
  8077. result = _leftValue.gt(_rightValue);
  8078. }
  8079. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8080. }
  8081. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].GE.ord:
  8082. {
  8083. var _leftValue2 = left.value;
  8084. var _rightValue2 = right.value;
  8085. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8086. result = left.value.length >= right.value.length;
  8087. } else {
  8088. if (shouldImplicitCast) {
  8089. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8090. _leftValue2 = _leftValue2.trunc();
  8091. _rightValue2 = _rightValue2.trunc();
  8092. }
  8093. result = _leftValue2.gte(_rightValue2);
  8094. }
  8095. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8096. }
  8097. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LT.ord:
  8098. {
  8099. var _leftValue3 = left.value;
  8100. var _rightValue3 = right.value;
  8101. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8102. result = left.value.length < right.value.length;
  8103. } else {
  8104. if (shouldImplicitCast) {
  8105. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8106. _leftValue3 = _leftValue3.trunc();
  8107. _rightValue3 = _rightValue3.trunc();
  8108. }
  8109. result = _leftValue3.lt(_rightValue3);
  8110. }
  8111. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8112. }
  8113. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].LE.ord:
  8114. {
  8115. var _leftValue4 = left.value;
  8116. var _rightValue4 = right.value;
  8117. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].STRING.isCompatible(left.type)) {
  8118. result = left.value.length <= right.value.length;
  8119. } else {
  8120. if (shouldImplicitCast) {
  8121. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8122. _leftValue4 = _leftValue4.trunc();
  8123. _rightValue4 = _rightValue4.trunc();
  8124. }
  8125. result = _leftValue4.lte(_rightValue4);
  8126. }
  8127. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8128. }
  8129. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].EQ.ord:
  8130. {
  8131. var _leftValue5 = left.value;
  8132. var _rightValue5 = right.value;
  8133. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8134. if (shouldImplicitCast) {
  8135. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8136. _leftValue5 = _leftValue5.trunc();
  8137. _rightValue5 = _rightValue5.trunc();
  8138. }
  8139. result = _leftValue5.eq(_rightValue5);
  8140. } else {
  8141. result = left.value === right.value;
  8142. }
  8143. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8144. }
  8145. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].NEQ.ord:
  8146. {
  8147. var _leftValue6 = left.value;
  8148. var _rightValue6 = right.value;
  8149. if (_typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].INTEGER.isCompatible(left.type) || _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].REAL.isCompatible(left.type)) {
  8150. if (shouldImplicitCast) {
  8151. resultType = _typeSystem_types__WEBPACK_IMPORTED_MODULE_6__["Types"].BOOLEAN;
  8152. _leftValue6 = _leftValue6.trunc();
  8153. _rightValue6 = _rightValue6.trunc();
  8154. }
  8155. result = !_leftValue6.eq(_rightValue6);
  8156. } else {
  8157. result = left.value !== right.value;
  8158. }
  8159. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, result);
  8160. }
  8161. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].AND.ord:
  8162. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value && right.value);
  8163. case _ast_operators__WEBPACK_IMPORTED_MODULE_7__["Operators"].OR.ord:
  8164. return new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](resultType, left.value || right.value);
  8165. default:
  8166. return Promise.reject(new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]('!!!Critical Invalid InfixApp ' + infixApp.op));
  8167. }
  8168. });
  8169. }
  8170. }, {
  8171. key: "parseStoreObjectValue",
  8172. value: function parseStoreObjectValue(vl) {
  8173. var realValue = vl;
  8174. if (vl instanceof _store_storeObjectArrayAddress__WEBPACK_IMPORTED_MODULE_12__["StoreObjectArrayAddress"]) {
  8175. if (vl.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_14__["CompoundType"]) {
  8176. switch (vl.type.dimensions) {
  8177. case 1:
  8178. {
  8179. realValue = new _store_storeObjectArray__WEBPACK_IMPORTED_MODULE_2__["StoreObjectArray"](vl.type, vl.value);
  8180. break;
  8181. }
  8182. default:
  8183. {
  8184. throw new _error_runtimeError__WEBPACK_IMPORTED_MODULE_19__["RuntimeError"]("Three dimensional array address...");
  8185. }
  8186. }
  8187. } else {
  8188. realValue = new _store_storeObject__WEBPACK_IMPORTED_MODULE_1__["StoreObject"](vl.type, vl.value);
  8189. }
  8190. }
  8191. return realValue;
  8192. }
  8193. }]);
  8194. return IVProgProcessor;
  8195. }();
  8196. /***/ }),
  8197. /***/ "./js/processor/lib/arrays.js":
  8198. /*!************************************!*\
  8199. !*** ./js/processor/lib/arrays.js ***!
  8200. \************************************/
  8201. /*! exports provided: createNumElementsFun, createMatrixLinesFun, createMatrixColumnsFun */
  8202. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8203. "use strict";
  8204. __webpack_require__.r(__webpack_exports__);
  8205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNumElementsFun", function() { return createNumElementsFun; });
  8206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixLinesFun", function() { return createMatrixLinesFun; });
  8207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMatrixColumnsFun", function() { return createMatrixColumnsFun; });
  8208. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8209. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8210. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8211. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8212. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8213. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8214. /**
  8215. * num_elements
  8216. * matrix_lines
  8217. * matrix_columns
  8218. */
  8219. function createNumElementsFun() {
  8220. var numElementsFun = function numElementsFun(sto, _) {
  8221. var vector = sto.applyStore("vector");
  8222. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(vector.lines));
  8223. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8224. return Promise.resolve(sto.updateStore("$", temp));
  8225. };
  8226. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](numElementsFun)]);
  8227. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$numElements', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 1), 'vector', false)], block);
  8228. return func;
  8229. }
  8230. function createMatrixLinesFun() {
  8231. var matrixLinesFun = function matrixLinesFun(sto, _) {
  8232. var matrix = sto.applyStore("matrix");
  8233. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.lines));
  8234. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8235. return Promise.resolve(sto.updateStore("$", temp));
  8236. };
  8237. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixLinesFun)]);
  8238. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixLines', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8239. return func;
  8240. }
  8241. function createMatrixColumnsFun() {
  8242. var matrixColumnsFun = function matrixColumnsFun(sto, _) {
  8243. var matrix = sto.applyStore("matrix");
  8244. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(matrix.columns));
  8245. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_5__["Modes"].RETURN;
  8246. return Promise.resolve(sto.updateStore("$", temp));
  8247. };
  8248. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](matrixColumnsFun)]);
  8249. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$matrixColumns', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_4__["CompoundType"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 2), 'matrix', false)], block);
  8250. return func;
  8251. }
  8252. /***/ }),
  8253. /***/ "./js/processor/lib/io.js":
  8254. /*!********************************!*\
  8255. !*** ./js/processor/lib/io.js ***!
  8256. \********************************/
  8257. /*! exports provided: createOutputFun, createInputFun */
  8258. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8259. "use strict";
  8260. __webpack_require__.r(__webpack_exports__);
  8261. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOutputFun", function() { return createOutputFun; });
  8262. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInputFun", function() { return createInputFun; });
  8263. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../store/storeObject */ "./js/processor/store/storeObject.js");
  8264. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8265. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8266. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8267. function createOutputFun() {
  8268. var writeFunction = function writeFunction(store, _) {
  8269. var val = store.applyStore('p1');
  8270. this.output.sendOutput(Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["convertToString"])(val.value, val.type));
  8271. return Promise.resolve(store);
  8272. };
  8273. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](writeFunction)]);
  8274. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$write', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', false)], block);
  8275. return func;
  8276. }
  8277. function createInputFun() {
  8278. var readFunction = function readFunction(store, _) {
  8279. var _this = this;
  8280. var request = new Promise(function (resolve, _) {
  8281. _this.input.requestInput(resolve);
  8282. });
  8283. return request.then(function (text) {
  8284. var typeToConvert = store.applyStore('p1').type;
  8285. var stoObj = null;
  8286. if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER)) {
  8287. var val = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toInt"])(text);
  8288. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].INTEGER, val.trunc());
  8289. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL)) {
  8290. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toReal"])(text));
  8291. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN)) {
  8292. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].BOOLEAN, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toBool"])(text));
  8293. } else if (typeToConvert.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING)) {
  8294. stoObj = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].STRING, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_2__["toString"])(text));
  8295. }
  8296. _this.loopTimers.splice(0, _this.loopTimers.length);
  8297. store.updateStore('p1', stoObj);
  8298. return Promise.resolve(store);
  8299. });
  8300. };
  8301. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](readFunction)]);
  8302. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$read', _typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].VOID, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_3__["Types"].ALL, 'p1', true)], block);
  8303. return func;
  8304. }
  8305. /***/ }),
  8306. /***/ "./js/processor/lib/lang.js":
  8307. /*!**********************************!*\
  8308. !*** ./js/processor/lib/lang.js ***!
  8309. \**********************************/
  8310. /*! exports provided: createIsRealFun, createIsIntFun, createIsBoolFun, createCastRealFun, createCastIntFun, createCastBoolFun, createCastStringFun */
  8311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8312. "use strict";
  8313. __webpack_require__.r(__webpack_exports__);
  8314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsRealFun", function() { return createIsRealFun; });
  8315. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsIntFun", function() { return createIsIntFun; });
  8316. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createIsBoolFun", function() { return createIsBoolFun; });
  8317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastRealFun", function() { return createCastRealFun; });
  8318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastIntFun", function() { return createCastIntFun; });
  8319. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastBoolFun", function() { return createCastBoolFun; });
  8320. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCastStringFun", function() { return createCastStringFun; });
  8321. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8322. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8323. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8324. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8325. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  8326. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8327. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8328. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8329. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8330. /**
  8331. *
  8332. * is_real
  8333. * is_int
  8334. * is_bool
  8335. * cast_real
  8336. * cast_int
  8337. * cast_bool
  8338. * cast_string
  8339. */
  8340. function createIsRealFun() {
  8341. var isRealFun = function isRealFun(sto, _) {
  8342. var str = sto.applyStore("str");
  8343. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8344. var result = false;
  8345. try {
  8346. var val = parser.parseTerm();
  8347. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8348. result = true;
  8349. }
  8350. } catch (error) {}
  8351. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8352. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8353. return Promise.resolve(sto.updateStore("$", temp));
  8354. };
  8355. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isRealFun)]);
  8356. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8357. return func;
  8358. }
  8359. function createIsIntFun() {
  8360. var isIntFun = function isIntFun(sto, _) {
  8361. var str = sto.applyStore("str");
  8362. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8363. var result = false;
  8364. try {
  8365. var val = parser.parseTerm();
  8366. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8367. result = true;
  8368. }
  8369. } catch (error) {}
  8370. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8371. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8372. return Promise.resolve(sto.updateStore("$", temp));
  8373. };
  8374. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isIntFun)]);
  8375. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8376. return func;
  8377. }
  8378. function createIsBoolFun() {
  8379. var isBoolFun = function isBoolFun(sto, _) {
  8380. var str = sto.applyStore("str");
  8381. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(str.value);
  8382. var result = false;
  8383. try {
  8384. var val = parser.parseTerm();
  8385. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8386. result = true;
  8387. }
  8388. } catch (error) {}
  8389. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, result);
  8390. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8391. return Promise.resolve(sto.updateStore("$", temp));
  8392. };
  8393. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](isBoolFun)]);
  8394. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$isBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8395. return func;
  8396. }
  8397. function createCastRealFun() {
  8398. var castRealFun = function castRealFun(sto, _) {
  8399. var val = sto.applyStore("val");
  8400. var value = val.value;
  8401. switch (val.type.ord) {
  8402. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.ord:
  8403. {
  8404. value = value.toNumber();
  8405. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(value));
  8406. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8407. return Promise.resolve(sto.updateStore("$", temp));
  8408. }
  8409. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8410. {
  8411. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8412. try {
  8413. var result = parser.parseTerm();
  8414. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["RealLiteral"]) {
  8415. var _temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result.value);
  8416. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8417. return Promise.resolve(sto.updateStore("$", _temp));
  8418. }
  8419. } catch (error) {}
  8420. }
  8421. }
  8422. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.stringInfo();
  8423. var typeInfo = typeStringInfoArray[0];
  8424. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8425. };
  8426. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castRealFun)]);
  8427. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castReal', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8428. return func;
  8429. }
  8430. function createCastIntFun() {
  8431. var castIntFun = function castIntFun(sto, _) {
  8432. var val = sto.applyStore("val");
  8433. var value = val.value;
  8434. switch (val.type.ord) {
  8435. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL.ord:
  8436. {
  8437. value = value.toNumber();
  8438. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Math.floor(value));
  8439. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8440. return Promise.resolve(sto.updateStore("$", temp));
  8441. }
  8442. case _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING.ord:
  8443. {
  8444. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8445. try {
  8446. var result = parser.parseTerm();
  8447. if (result instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["IntLiteral"]) {
  8448. var _temp2 = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, result.value);
  8449. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8450. return Promise.resolve(sto.updateStore("$", _temp2));
  8451. }
  8452. } catch (error) {}
  8453. }
  8454. }
  8455. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER.stringInfo();
  8456. var typeInfo = typeStringInfoArray[0];
  8457. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8458. };
  8459. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castIntFun)]);
  8460. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castInt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_7__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING]), 'val', false)], block);
  8461. return func;
  8462. }
  8463. function createCastBoolFun() {
  8464. var castBoolFun = function castBoolFun(sto, _) {
  8465. var str = sto.applyStore("str");
  8466. var value = str.value;
  8467. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_4__["IVProgParser"].createParser(value);
  8468. try {
  8469. var val = parser.parseTerm();
  8470. if (val instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_5__["BoolLiteral"]) {
  8471. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, val.value);
  8472. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8473. return Promise.resolve(sto.updateStore("$", temp));
  8474. }
  8475. } catch (error) {}
  8476. var typeStringInfoArray = _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN.stringInfo();
  8477. var typeInfo = typeStringInfoArray[0];
  8478. return Promise.reject(_error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_8__["ProcessorErrorFactory"].invalid_type_conversion(value, typeInfo.type, typeInfo.dim));
  8479. };
  8480. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castBoolFun)]);
  8481. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castBool', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].BOOLEAN, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8482. return func;
  8483. }
  8484. function createCastStringFun() {
  8485. var castStringFun = function castStringFun(store, _) {
  8486. var val = store.applyStore('str');
  8487. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["convertToString"])(val);
  8488. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8489. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_6__["Modes"].RETURN;
  8490. return Promise.resolve(sto.updateStore("$", temp));
  8491. };
  8492. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](castStringFun)]);
  8493. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$castString', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].ALL, 'str', false)], block);
  8494. return func;
  8495. }
  8496. /***/ }),
  8497. /***/ "./js/processor/lib/math.js":
  8498. /*!**********************************!*\
  8499. !*** ./js/processor/lib/math.js ***!
  8500. \**********************************/
  8501. /*! exports provided: createSinFun, createCosFun, createTanFun, createSqrtFun, createPowFun, createLogFun, createAbsFun, createNegateFun, createInvertFun, createMaxFun, createMinFun */
  8502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8503. "use strict";
  8504. __webpack_require__.r(__webpack_exports__);
  8505. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSinFun", function() { return createSinFun; });
  8506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createCosFun", function() { return createCosFun; });
  8507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createTanFun", function() { return createTanFun; });
  8508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSqrtFun", function() { return createSqrtFun; });
  8509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPowFun", function() { return createPowFun; });
  8510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLogFun", function() { return createLogFun; });
  8511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAbsFun", function() { return createAbsFun; });
  8512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createNegateFun", function() { return createNegateFun; });
  8513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInvertFun", function() { return createInvertFun; });
  8514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMaxFun", function() { return createMaxFun; });
  8515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createMinFun", function() { return createMinFun; });
  8516. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8517. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8518. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8519. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8520. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  8521. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_4__);
  8522. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8523. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8524. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8525. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8526. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  8527. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  8528. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  8529. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  8530. /**
  8531. * sin
  8532. * cos
  8533. * tan
  8534. * sqrt
  8535. * pow
  8536. * log
  8537. * abs
  8538. * negate
  8539. * invert
  8540. * max
  8541. * min
  8542. */
  8543. function convertToRadians(degrees) {
  8544. return degrees.times(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].acos(-1)).div(180);
  8545. }
  8546. function createSinFun() {
  8547. var sinFun = function sinFun(sto, _) {
  8548. var x = sto.applyStore('x');
  8549. var angle = x.value.mod(360);
  8550. var result = null;
  8551. if (angle.eq(90)) {
  8552. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](1);
  8553. } else if (angle.eq(180)) {
  8554. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8555. } else if (angle.eq(270)) {
  8556. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8557. } else {
  8558. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].sin(convertToRadians(angle));
  8559. }
  8560. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8561. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8562. }
  8563. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8564. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8565. return Promise.resolve(sto.updateStore('$', temp));
  8566. };
  8567. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sinFun)]);
  8568. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sin', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8569. return func;
  8570. }
  8571. function createCosFun() {
  8572. var cosFun = function cosFun(sto, _) {
  8573. var x = sto.applyStore('x');
  8574. var angle = x.value.mod(360);
  8575. var result = null;
  8576. if (angle.eq(90)) {
  8577. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8578. } else if (angle.eq(180)) {
  8579. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](-1);
  8580. } else if (angle.eq(270)) {
  8581. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](0);
  8582. }
  8583. result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].cos(convertToRadians(angle));
  8584. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8585. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8586. }
  8587. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8588. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8589. return Promise.resolve(sto.updateStore('$', temp));
  8590. };
  8591. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](cosFun)]);
  8592. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$cos', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8593. return func;
  8594. }
  8595. function createTanFun() {
  8596. var tanFun = function tanFun(sto, _) {
  8597. var x = sto.applyStore('x');
  8598. var angle = x.value.mod(360);
  8599. if (angle.eq(90) || angle.eq(270)) {
  8600. return Promise.reject("Tangent of " + x.value.toNumber() + "° is undefined.");
  8601. }
  8602. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].tan(convertToRadians(angle));
  8603. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8604. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8605. }
  8606. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8607. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8608. return Promise.resolve(sto.updateStore('$', temp));
  8609. };
  8610. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](tanFun)]);
  8611. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$tan', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8612. return func;
  8613. }
  8614. function createSqrtFun() {
  8615. var sqrtFun = function sqrtFun(sto, _) {
  8616. var x = sto.applyStore('x');
  8617. var result = x.value.sqrt();
  8618. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8619. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8620. }
  8621. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8622. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8623. return Promise.resolve(sto.updateStore('$', temp));
  8624. };
  8625. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](sqrtFun)]);
  8626. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$sqrt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8627. return func;
  8628. }
  8629. function createPowFun() {
  8630. var powFun = function powFun(sto, _) {
  8631. var x = sto.applyStore('x');
  8632. var y = sto.applyStore('y');
  8633. var result = x.value.pow(y.value);
  8634. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8635. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8636. }
  8637. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8638. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8639. return Promise.resolve(sto.updateStore('$', temp));
  8640. };
  8641. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](powFun)]);
  8642. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$pow', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'y', false)], block);
  8643. return func;
  8644. }
  8645. function createLogFun() {
  8646. var logFun = function logFun(sto, _) {
  8647. var x = sto.applyStore('x');
  8648. if (x.value.isNegative()) {
  8649. return Promise.reject("the value passed to log function cannot be negative");
  8650. }
  8651. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].log10(x.value);
  8652. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8653. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8654. }
  8655. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8656. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8657. return Promise.resolve(sto.updateStore('$', temp));
  8658. };
  8659. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](logFun)]);
  8660. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$log', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8661. return func;
  8662. }
  8663. function createAbsFun() {
  8664. var absFun = function absFun(sto, _) {
  8665. var x = sto.applyStore('x');
  8666. var result = x.value.abs();
  8667. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8668. sto.updateStore('$', temp);
  8669. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8670. return Promise.resolve(sto);
  8671. };
  8672. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](absFun)]);
  8673. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$abs', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8674. return func;
  8675. }
  8676. function createNegateFun() {
  8677. var negateFun = function negateFun(sto, _) {
  8678. var x = sto.applyStore('x');
  8679. var result = x.value.negated();
  8680. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type, result);
  8681. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8682. return Promise.resolve(sto.updateStore('$', temp));
  8683. };
  8684. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](negateFun)]);
  8685. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$negate', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8686. return func;
  8687. }
  8688. function createInvertFun() {
  8689. var invertFun = function invertFun(sto, _) {
  8690. var x = sto.applyStore('x');
  8691. var result = Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toReal"])(1).dividedBy(x.value);
  8692. if (result.dp() > _util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces) {
  8693. result = new decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"](result.toFixed(_util_config__WEBPACK_IMPORTED_MODULE_8__["Config"].decimalPlaces));
  8694. }
  8695. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, result);
  8696. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8697. return Promise.resolve(sto.updateStore('$', temp));
  8698. };
  8699. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](invertFun)]);
  8700. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$invert', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 'x', false)], block);
  8701. return func;
  8702. }
  8703. function createMaxFun() {
  8704. var maxFun = function maxFun(sto, _) {
  8705. var x = sto.applyStore('x');
  8706. var numbers = x.value.map(function (stoObj) {
  8707. return stoObj.value;
  8708. });
  8709. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].max.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8710. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8711. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8712. return Promise.resolve(sto.updateStore('$', temp));
  8713. };
  8714. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8715. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](maxFun)]);
  8716. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$max', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8717. return func;
  8718. }
  8719. function createMinFun() {
  8720. var minFun = function minFun(sto, _) {
  8721. var x = sto.applyStore('x');
  8722. var numbers = x.value.map(function (stoObj) {
  8723. return stoObj.value;
  8724. });
  8725. var result = decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"].min.apply(decimal_js__WEBPACK_IMPORTED_MODULE_4__["Decimal"], _toConsumableArray(numbers));
  8726. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](x.type.innerType, result);
  8727. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_7__["Modes"].RETURN;
  8728. return Promise.resolve(sto.updateStore('$', temp));
  8729. };
  8730. var paramType = new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_6__["CompoundType"](new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), 1);
  8731. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](minFun)]);
  8732. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$min', new _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_5__["MultiType"]([_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].REAL]), [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](paramType, 'x', false)], block);
  8733. return func;
  8734. }
  8735. /***/ }),
  8736. /***/ "./js/processor/lib/strings.js":
  8737. /*!*************************************!*\
  8738. !*** ./js/processor/lib/strings.js ***!
  8739. \*************************************/
  8740. /*! exports provided: createSubstringFun, createLengthFun, createUppercaseFun, createLowercaseFun, createrCharAtFun */
  8741. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8742. "use strict";
  8743. __webpack_require__.r(__webpack_exports__);
  8744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createSubstringFun", function() { return createSubstringFun; });
  8745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLengthFun", function() { return createLengthFun; });
  8746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUppercaseFun", function() { return createUppercaseFun; });
  8747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLowercaseFun", function() { return createLowercaseFun; });
  8748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createrCharAtFun", function() { return createrCharAtFun; });
  8749. /* harmony import */ var _store_storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../store/storeObject */ "./js/processor/store/storeObject.js");
  8750. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../ast/commands */ "./js/ast/commands/index.js");
  8751. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  8752. /* harmony import */ var _typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../../typeSystem/parsers */ "./js/typeSystem/parsers.js");
  8753. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../modes */ "./js/processor/modes.js");
  8754. /*
  8755. * substring
  8756. * length
  8757. * uppercase
  8758. * lowercase
  8759. * charAt
  8760. **/
  8761. function createSubstringFun() {
  8762. var substringFun = function substringFun(sto, _) {
  8763. var str = sto.applyStore("str");
  8764. var start = sto.applyStore("start");
  8765. var end = sto.applyStore("end");
  8766. var result = str.value.substring(start.value, end.value);
  8767. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, result);
  8768. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8769. return Promise.resolve(sto.updateStore("$", temp));
  8770. };
  8771. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](substringFun)]);
  8772. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$substring', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'start', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'end', false)], block);
  8773. return func;
  8774. }
  8775. function createLengthFun() {
  8776. var lengthFun = function lengthFun(sto, _) {
  8777. var str = sto.applyStore("str");
  8778. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, Object(_typeSystem_parsers__WEBPACK_IMPORTED_MODULE_3__["toInt"])(str.value.length));
  8779. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8780. return Promise.resolve(sto.updateStore("$", temp));
  8781. };
  8782. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lengthFun)]);
  8783. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$length', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8784. return func;
  8785. }
  8786. function createUppercaseFun() {
  8787. var uppercaseFun = function uppercaseFun(sto, _) {
  8788. var str = sto.applyStore("str");
  8789. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toUpperCase());
  8790. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8791. return Promise.resolve(sto.updateStore("$", temp));
  8792. };
  8793. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](uppercaseFun)]);
  8794. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$uppercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8795. return func;
  8796. }
  8797. function createLowercaseFun() {
  8798. var lowercaseFun = function lowercaseFun(sto, _) {
  8799. var str = sto.applyStore("str");
  8800. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.toLowerCase());
  8801. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8802. return Promise.resolve(sto.updateStore("$", temp));
  8803. };
  8804. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](lowercaseFun)]);
  8805. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$lowercase', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false)], block);
  8806. return func;
  8807. }
  8808. function createrCharAtFun() {
  8809. var charAtFun = function charAtFun(sto, _) {
  8810. var str = sto.applyStore("str");
  8811. var idx = sto.applyStore("index");
  8812. if (idx.value.toNumber() < 0 || idx.value.toNumber() >= str.value.length) {
  8813. return Promise.reject(new Error("invalid string position"));
  8814. }
  8815. var temp = new _store_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, str.value.charAt(idx.value.toNumber()));
  8816. sto.mode = _modes__WEBPACK_IMPORTED_MODULE_4__["Modes"].RETURN;
  8817. return Promise.resolve(sto.updateStore("$", temp));
  8818. };
  8819. var block = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["CommandBlock"]([], [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["SysCall"](charAtFun)]);
  8820. var func = new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["Function"]('$charAt', _typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, [new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].STRING, 'str', false), new _ast_commands__WEBPACK_IMPORTED_MODULE_1__["FormalParameter"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_2__["Types"].INTEGER, 'index', false)], block);
  8821. return func;
  8822. }
  8823. /***/ }),
  8824. /***/ "./js/processor/modes.js":
  8825. /*!*******************************!*\
  8826. !*** ./js/processor/modes.js ***!
  8827. \*******************************/
  8828. /*! exports provided: Modes */
  8829. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8830. "use strict";
  8831. __webpack_require__.r(__webpack_exports__);
  8832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Modes", function() { return Modes; });
  8833. var Modes = Object.freeze({
  8834. RETURN: Symbol('mode:return'),
  8835. BREAK: Symbol('mode:break'),
  8836. PAUSE: Symbol('mode:pause'),
  8837. RUN: Symbol('mode:run')
  8838. });
  8839. /***/ }),
  8840. /***/ "./js/processor/semantic/semanticAnalyser.js":
  8841. /*!***************************************************!*\
  8842. !*** ./js/processor/semantic/semanticAnalyser.js ***!
  8843. \***************************************************/
  8844. /*! exports provided: SemanticAnalyser */
  8845. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8846. "use strict";
  8847. __webpack_require__.r(__webpack_exports__);
  8848. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SemanticAnalyser", function() { return SemanticAnalyser; });
  8849. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  8850. /* harmony import */ var _definedFunctions__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../definedFunctions */ "./js/processor/definedFunctions.js");
  8851. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../services/languageService */ "./js/services/languageService.js");
  8852. /* harmony import */ var _ast_commands__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../ast/commands */ "./js/ast/commands/index.js");
  8853. /* harmony import */ var _ast_expressions__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../ast/expressions */ "./js/ast/expressions/index.js");
  8854. /* harmony import */ var _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../ast/expressions/literal */ "./js/ast/expressions/literal.js");
  8855. /* harmony import */ var _compatibilityTable__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../compatibilityTable */ "./js/processor/compatibilityTable.js");
  8856. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../typeSystem/types */ "./js/typeSystem/types.js");
  8857. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  8858. /* harmony import */ var _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../typeSystem/multiType */ "./js/typeSystem/multiType.js");
  8859. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../../util/config */ "./js/util/config.js");
  8860. /* harmony import */ var _store_store__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../store/store */ "./js/processor/store/store.js");
  8861. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8862. 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); } }
  8863. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  8864. var SemanticAnalyser =
  8865. /*#__PURE__*/
  8866. function () {
  8867. function SemanticAnalyser(ast) {
  8868. _classCallCheck(this, SemanticAnalyser);
  8869. this.ast = ast;
  8870. this.lexerClass = _services_languageService__WEBPACK_IMPORTED_MODULE_2__["LanguageService"].getCurrentLexer();
  8871. var lexer = new this.lexerClass(null);
  8872. this.literalNames = lexer.literalNames;
  8873. this.symbolMap = null;
  8874. this.currentFunction = null;
  8875. }
  8876. _createClass(SemanticAnalyser, [{
  8877. key: "pushMap",
  8878. value: function pushMap() {
  8879. if (this.symbolMap === null) {
  8880. this.symbolMap = {
  8881. map: {},
  8882. next: null
  8883. };
  8884. } else {
  8885. var n = {
  8886. map: {},
  8887. next: this.symbolMap
  8888. };
  8889. this.symbolMap = n;
  8890. }
  8891. }
  8892. }, {
  8893. key: "popMap",
  8894. value: function popMap() {
  8895. if (this.symbolMap !== null) {
  8896. this.symbolMap = this.symbolMap.next;
  8897. }
  8898. }
  8899. }, {
  8900. key: "insertSymbol",
  8901. value: function insertSymbol(id, typeInfo) {
  8902. this.symbolMap.map[id] = typeInfo;
  8903. }
  8904. }, {
  8905. key: "findSymbol",
  8906. value: function findSymbol(id, symMap) {
  8907. if (!symMap.map[id]) {
  8908. if (symMap.next) {
  8909. return this.findSymbol(id, symMap.next);
  8910. }
  8911. return null;
  8912. } else {
  8913. return symMap.map[id];
  8914. }
  8915. }
  8916. }, {
  8917. key: "getMainFunction",
  8918. value: function getMainFunction() {
  8919. return this.ast.functions.find(function (v) {
  8920. return v.isMain;
  8921. });
  8922. }
  8923. }, {
  8924. key: "findFunction",
  8925. value: function findFunction(name) {
  8926. if (name.match(/^\$.+$/)) {
  8927. var fun = _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getFunction(name);
  8928. if (!!!fun) {
  8929. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].not_implemented(name);
  8930. }
  8931. return fun;
  8932. } else {
  8933. var val = this.ast.functions.find(function (v) {
  8934. return v.name === name;
  8935. });
  8936. if (!!!val) {
  8937. return null;
  8938. }
  8939. return val;
  8940. }
  8941. }
  8942. }, {
  8943. key: "analyseTree",
  8944. value: function analyseTree() {
  8945. var globalVars = this.ast.global;
  8946. this.pushMap();
  8947. this.assertDeclarations(globalVars);
  8948. var functions = this.ast.functions;
  8949. var mainFunc = functions.filter(function (f) {
  8950. return f.name === null;
  8951. });
  8952. if (mainFunc.length <= 0) {
  8953. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].main_missing();
  8954. }
  8955. for (var i = 0; i < functions.length; i++) {
  8956. var fun = functions[i];
  8957. this.assertFunction(fun);
  8958. }
  8959. return this.ast;
  8960. }
  8961. }, {
  8962. key: "assertDeclarations",
  8963. value: function assertDeclarations(list) {
  8964. for (var i = 0; i < list.length; i++) {
  8965. this.assertDeclaration(list[i]);
  8966. }
  8967. }
  8968. }, {
  8969. key: "assertDeclaration",
  8970. value: function assertDeclaration(declaration) {
  8971. if (declaration instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayDeclaration"]) {
  8972. if (declaration.initial === null) {
  8973. var lineType = this.evaluateExpressionType(declaration.lines);
  8974. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8975. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8976. }
  8977. if (declaration.columns !== null) {
  8978. var columnType = this.evaluateExpressionType(declaration.columns);
  8979. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  8980. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(declaration.sourceInfo);
  8981. }
  8982. }
  8983. this.insertSymbol(declaration.id, {
  8984. id: declaration.id,
  8985. lines: declaration.lines,
  8986. columns: declaration.columns,
  8987. type: declaration.type
  8988. });
  8989. return;
  8990. }
  8991. this.evaluateArrayLiteral(declaration.id, declaration.lines, declaration.columns, declaration.type, declaration.initial);
  8992. this.insertSymbol(declaration.id, {
  8993. id: declaration.id,
  8994. lines: declaration.lines,
  8995. columns: declaration.columns,
  8996. type: declaration.type
  8997. });
  8998. } else {
  8999. if (declaration.initial === null) {
  9000. this.insertSymbol(declaration.id, {
  9001. id: declaration.id,
  9002. type: declaration.type
  9003. });
  9004. return;
  9005. }
  9006. var resultType = this.evaluateExpressionType(declaration.initial);
  9007. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9008. if (!resultType.isCompatible(declaration.type)) {
  9009. var stringInfo = declaration.type.stringInfo();
  9010. var info = stringInfo[0];
  9011. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(info.type, info.dim, declaration.sourceInfo);
  9012. }
  9013. this.insertSymbol(declaration.id, {
  9014. id: declaration.id,
  9015. type: declaration.type
  9016. });
  9017. } else if (!declaration.type.isCompatible(resultType) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !declaration.type.isCompatible(resultType) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(declaration.type, resultType)) {
  9018. var _stringInfo = declaration.type.stringInfo();
  9019. var _info = _stringInfo[0];
  9020. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info.type, _info.dim, declaration.sourceInfo);
  9021. } else {
  9022. this.insertSymbol(declaration.id, {
  9023. id: declaration.id,
  9024. type: declaration.type
  9025. });
  9026. }
  9027. }
  9028. }
  9029. }, {
  9030. key: "evaluateExpressionType",
  9031. value: function evaluateExpressionType(expression) {
  9032. if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["UnaryApp"]) {
  9033. var op = expression.op;
  9034. var resultType = this.evaluateExpressionType(expression.left);
  9035. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterUnaryOp"])(op, resultType);
  9036. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["InfixApp"]) {
  9037. var _op = expression.op;
  9038. var resultTypeLeft = this.evaluateExpressionType(expression.left);
  9039. var resultTypeRight = this.evaluateExpressionType(expression.right);
  9040. return Object(_compatibilityTable__WEBPACK_IMPORTED_MODULE_6__["resultTypeAfterInfixOp"])(_op, resultTypeLeft, resultTypeRight);
  9041. } else if (expression instanceof _ast_expressions_literal__WEBPACK_IMPORTED_MODULE_5__["Literal"]) {
  9042. return this.evaluateLiteralType(expression);
  9043. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9044. if (expression.isMainCall) {
  9045. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(_definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName(), expression.sourceInfo);
  9046. }
  9047. var fun = this.findFunction(expression.id);
  9048. if (fun === null) {
  9049. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(expression.id, expression.sourceInfo);
  9050. }
  9051. if (fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9052. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].void_in_expression_full(expression.id, expression.sourceInfo);
  9053. }
  9054. this.assertParameters(fun, expression.actualParameters);
  9055. return fun.returnType;
  9056. } else if (expression instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"]) {
  9057. var arrayTypeInfo = this.findSymbol(expression.id, this.symbolMap);
  9058. if (arrayTypeInfo === null) {
  9059. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(expression.id, expression.sourceInfo);
  9060. }
  9061. if (!(arrayTypeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9062. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(expression.id, expression.sourceInfo);
  9063. }
  9064. var lineType = this.evaluateExpressionType(expression.line);
  9065. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9066. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9067. }
  9068. if (expression.column !== null) {
  9069. if (arrayTypeInfo.columns === null) {
  9070. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(expression.id, expression.sourceInfo);
  9071. }
  9072. var columnType = this.evaluateExpressionType(expression.column);
  9073. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9074. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(expression.sourceInfo);
  9075. }
  9076. }
  9077. var arrType = arrayTypeInfo.type;
  9078. if (expression.column !== null) {
  9079. // indexing matrix
  9080. return arrType.innerType;
  9081. } else {
  9082. if (arrayTypeInfo.columns === null) {
  9083. return arrType.innerType;
  9084. }
  9085. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](arrType.innerType, 1);
  9086. }
  9087. }
  9088. }
  9089. }, {
  9090. key: "evaluateLiteralType",
  9091. value: function evaluateLiteralType(literal) {
  9092. if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["IntLiteral"]) {
  9093. return literal.type;
  9094. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["RealLiteral"]) {
  9095. return literal.type;
  9096. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["StringLiteral"]) {
  9097. return literal.type;
  9098. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["BoolLiteral"]) {
  9099. return literal.type;
  9100. } else if (literal instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"]) {
  9101. var typeInfo = this.findSymbol(literal.id, this.symbolMap);
  9102. if (typeInfo === null) {
  9103. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(literal.id, literal.sourceInfo);
  9104. }
  9105. if (typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9106. return typeInfo.type;
  9107. }
  9108. return typeInfo.type;
  9109. } else {
  9110. console.warn("Evaluating type only for an array literal...");
  9111. var last = null;
  9112. if (literal.value.length === 1) {
  9113. last = this.evaluateExpressionType(literal.value[0]);
  9114. } else {
  9115. for (var i = 0; i < literal.value.length; i++) {
  9116. var e = this.evaluateExpressionType(literal.value[i]);
  9117. if (last === null) {
  9118. last = e;
  9119. } else if (!last.isCompatible(e)) {
  9120. var strInfo = last.stringInfo();
  9121. var info = strInfo[0];
  9122. var strExp = literal.toString();
  9123. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_array_full(strExp, info.type, info.dim, literal.sourceInfo);
  9124. }
  9125. }
  9126. }
  9127. if (last instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9128. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last.innerType, last.dimensions + 1);
  9129. }
  9130. return new _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"](last, 1);
  9131. }
  9132. }
  9133. }, {
  9134. key: "evaluateArrayLiteral",
  9135. value: function evaluateArrayLiteral(id, lines, columns, type, literal) {
  9136. /* if (literal instanceof ArrayLiteral) {
  9137. const dimType = this.evaluateExpressionType(lines);
  9138. if (!dimType.isCompatible(Types.INTEGER)) {
  9139. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9140. }
  9141. if ((lines instanceof IntLiteral)) {
  9142. if (!lines.value.eq(literal.value.length)) {
  9143. if(type.dimensions > 1) {
  9144. throw ProcessorErrorFactory.matrix_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9145. } else {
  9146. throw ProcessorErrorFactory.vector_line_outbounds_full(id, literal.value.length, lines.value.toNumber(), literal.sourceInfo)
  9147. }
  9148. } else if (lines.value.isNeg()) {
  9149. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9150. }
  9151. }
  9152. if (columns === null) {
  9153. // it's a vector...
  9154. literal.value.reduce((last, next) => {
  9155. const eType = this.evaluateExpressionType(next);
  9156. if (!last.canAccept(eType)) {
  9157. const strInfo = last.stringInfo();
  9158. const info = strInfo[0];
  9159. const strExp = literal.toString();
  9160. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9161. }
  9162. return last;
  9163. }, type);
  9164. return true;
  9165. } else {
  9166. const dimType = this.evaluateExpressionType(columns);
  9167. if (!dimType.isCompatible(Types.INTEGER)) {
  9168. throw ProcessorErrorFactory.array_dimension_not_int_full(literal.sourceInfo);
  9169. }
  9170. if ((columns instanceof IntLiteral)) {
  9171. const columnValue = literal.value[0].value.length;
  9172. if (!columns.value.eq(columnValue)) {
  9173. if(type.dimensions > 1) {
  9174. throw ProcessorErrorFactory.matrix_column_outbounds_full(id, literal.value.length, columns.value.toNumber(), literal.sourceInfo)
  9175. } else {
  9176. throw ProcessorErrorFactory.invalid_matrix_access_full(id, literal.sourceInfo);
  9177. }
  9178. } else if (columns.value.isNeg()) {
  9179. throw ProcessorErrorFactory.array_dimension_not_positive_full(literal.sourceInfo);
  9180. }
  9181. for (let i = 0; i < columns; i++) {
  9182. const anotherArray = literal.value[i];
  9183. this.evaluateArrayLiteral(id, columns, null, type, anotherArray)
  9184. }
  9185. }
  9186. }
  9187. } else {
  9188. const resultType = this.evaluateExpressionType(literal);
  9189. if (!(resultType instanceof CompoundType)) {
  9190. const strInfo = type.stringInfo();
  9191. const info = strInfo[0];
  9192. const strExp = literal.toString();
  9193. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9194. }
  9195. if (!type.isCompatible(resultType)) {
  9196. const strInfo = type.stringInfo();
  9197. const info = strInfo[0];
  9198. const strExp = literal.toString();
  9199. throw ProcessorErrorFactory.incompatible_types_array_full(strExp,info.type, info.dim, literal.sourceInfo);
  9200. }
  9201. return true;
  9202. } */
  9203. return true;
  9204. }
  9205. }, {
  9206. key: "assertFunction",
  9207. value: function assertFunction(fun) {
  9208. var _this = this;
  9209. this.pushMap();
  9210. this.currentFunction = fun;
  9211. fun.formalParameters.forEach(function (formalParam) {
  9212. if (formalParam.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"]) {
  9213. if (formalParam.type.dimensions > 1) {
  9214. _this.insertSymbol(formalParam.id, {
  9215. id: formalParam.id,
  9216. lines: -1,
  9217. columns: -1,
  9218. type: formalParam.type
  9219. });
  9220. } else {
  9221. _this.insertSymbol(formalParam.id, {
  9222. id: formalParam.id,
  9223. lines: -1,
  9224. columns: null,
  9225. type: formalParam.type
  9226. });
  9227. }
  9228. } else {
  9229. _this.insertSymbol(formalParam.id, {
  9230. id: formalParam.id,
  9231. type: formalParam.type
  9232. });
  9233. }
  9234. });
  9235. this.assertDeclarations(fun.variablesDeclarations);
  9236. var optional = fun.returnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID);
  9237. var valid = this.assertReturn(fun, optional);
  9238. if (!valid) {
  9239. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_no_return(fun.name);
  9240. }
  9241. this.popMap();
  9242. }
  9243. }, {
  9244. key: "assertReturn",
  9245. value: function assertReturn(fun, optional) {
  9246. var _this2 = this;
  9247. return fun.commands.reduce(function (last, next) {
  9248. return _this2.checkCommand(fun.returnType, next, optional) || last;
  9249. }, optional);
  9250. }
  9251. }, {
  9252. key: "checkCommand",
  9253. value: function checkCommand(type, cmd, optional) {
  9254. if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["While"]) {
  9255. var resultType = this.evaluateExpressionType(cmd.expression);
  9256. if (!resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9257. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].loop_condition_type_full(cmd.expression.toString(), cmd.sourceInfo);
  9258. }
  9259. this.checkCommands(type, cmd.commands, optional);
  9260. return false;
  9261. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["For"]) {
  9262. this.checkCommand(type, cmd.assignment, optional);
  9263. var _resultType = this.evaluateExpressionType(cmd.condition);
  9264. if (!_resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9265. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].for_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9266. }
  9267. this.checkCommand(type, cmd.increment, optional);
  9268. this.checkCommands(type, cmd.commands, optional);
  9269. return false;
  9270. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Switch"]) {
  9271. var sType = this.evaluateExpressionType(cmd.expression);
  9272. var result = optional;
  9273. var hasDefault = false;
  9274. for (var i = 0; i < cmd.cases.length; i++) {
  9275. var aCase = cmd.cases[i];
  9276. if (aCase.expression !== null) {
  9277. var caseType = this.evaluateExpressionType(aCase.expression);
  9278. if (!sType.isCompatible(caseType)) {
  9279. var strInfo = sType.stringInfo();
  9280. var info = strInfo[0];
  9281. var strExp = aCase.expression.toString();
  9282. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_case_type_full(strExp, info.type, info.dim, aCase.sourceInfo);
  9283. }
  9284. } else {
  9285. hasDefault = true;
  9286. }
  9287. result = result && this.checkCommands(type, aCase.commands, result);
  9288. }
  9289. return result && hasDefault;
  9290. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["ArrayIndexAssign"]) {
  9291. var typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9292. if (typeInfo === null) {
  9293. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9294. }
  9295. if (!(typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9296. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_array_access_full(cmd.id, cmd.sourceInfo);
  9297. }
  9298. var exp = cmd.expression;
  9299. var lineExp = cmd.line;
  9300. var lineType = this.evaluateExpressionType(lineExp);
  9301. if (!lineType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9302. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9303. }
  9304. var columnExp = cmd.column;
  9305. if (typeInfo.columns === null && columnExp !== null) {
  9306. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_matrix_access_full(cmd.id, cmd.sourceInfo);
  9307. } else if (columnExp !== null) {
  9308. var columnType = this.evaluateExpressionType(columnExp);
  9309. if (!columnType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER)) {
  9310. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].array_dimension_not_int_full(cmd.sourceInfo);
  9311. }
  9312. } // exp can be a arrayLiteral, a single value exp or an array access
  9313. if (exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9314. this.evaluateArrayLiteral(cmd.id, typeInfo.lines, columnExp ? typeInfo.columns : null, typeInfo.type, exp);
  9315. } else {// cannot properly evaluate since type system is poorly constructed
  9316. }
  9317. return optional;
  9318. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Assign"]) {
  9319. var _typeInfo = this.findSymbol(cmd.id, this.symbolMap);
  9320. if (_typeInfo === null) {
  9321. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].symbol_not_found_full(cmd.id, cmd.sourceInfo);
  9322. }
  9323. var _exp = cmd.expression;
  9324. if (_exp instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayLiteral"]) {
  9325. if (!(_typeInfo.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_8__["CompoundType"])) {
  9326. var stringInfo = _typeInfo.type.stringInfo();
  9327. var _info2 = stringInfo[0];
  9328. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info2.type, _info2.dim, cmd.sourceInfo);
  9329. }
  9330. this.evaluateArrayLiteral(cmd.id, _typeInfo.lines, _typeInfo.columns, _typeInfo.type, _exp);
  9331. } else {
  9332. var _resultType2 = this.evaluateExpressionType(_exp);
  9333. if (!_resultType2.isCompatible(_typeInfo.type) && !_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting || !_resultType2.isCompatible(_typeInfo.type) && _util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(_typeInfo.type, _resultType2)) {
  9334. var _stringInfo2 = _typeInfo.type.stringInfo();
  9335. var _info3 = _stringInfo2[0];
  9336. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].incompatible_types_full(_info3.type, _info3.dim, cmd.sourceInfo);
  9337. }
  9338. }
  9339. return optional;
  9340. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Break"]) {
  9341. return optional;
  9342. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9343. var _resultType3 = this.evaluateExpressionType(cmd.condition);
  9344. if (!_resultType3.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].BOOLEAN)) {
  9345. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].if_condition_type_full(cmd.condition.toString(), cmd.sourceInfo);
  9346. }
  9347. if (cmd.ifFalse instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["IfThenElse"]) {
  9348. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommand(type, cmd.ifFalse, optional);
  9349. } else {
  9350. return this.checkCommands(type, cmd.ifTrue.commands, optional) && this.checkCommands(type, cmd.ifFalse.commands, optional);
  9351. }
  9352. } else if (cmd instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["FunctionCall"]) {
  9353. var fun = null;
  9354. if (cmd.isMainCall) {
  9355. fun = this.getMainFunction();
  9356. } else {
  9357. fun = this.findFunction(cmd.id);
  9358. }
  9359. if (fun === null) {
  9360. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].function_missing_full(cmd.id, cmd.sourceInfo);
  9361. }
  9362. this.assertParameters(fun, cmd.actualParameters);
  9363. return optional;
  9364. } else if (cmd instanceof _ast_commands__WEBPACK_IMPORTED_MODULE_3__["Return"]) {
  9365. var funcName = this.currentFunction.isMain ? _definedFunctions__WEBPACK_IMPORTED_MODULE_1__["LanguageDefinedFunction"].getMainFunctionName() : this.currentFunction.name;
  9366. if (cmd.expression === null && !type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].VOID)) {
  9367. var _stringInfo3 = type.stringInfo();
  9368. var _info4 = _stringInfo3[0];
  9369. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_void_return_full(funcName, _info4.type, _info4.dim, cmd.sourceInfo);
  9370. } else if (cmd.expression !== null) {
  9371. var _resultType4 = this.evaluateExpressionType(cmd.expression);
  9372. if (!type.isCompatible(_resultType4)) {
  9373. var _stringInfo4 = type.stringInfo();
  9374. var _info5 = _stringInfo4[0];
  9375. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_return_type_full(funcName, _info5.type, _info5.dim, cmd.sourceInfo);
  9376. } else {
  9377. return true;
  9378. }
  9379. } else {
  9380. return true;
  9381. }
  9382. }
  9383. }
  9384. }, {
  9385. key: "checkCommands",
  9386. value: function checkCommands(type, cmds, optional) {
  9387. var _this3 = this;
  9388. return cmds.reduce(function (last, next) {
  9389. return _this3.checkCommand(type, next, optional) || last;
  9390. }, optional);
  9391. }
  9392. }, {
  9393. key: "assertParameters",
  9394. value: function assertParameters(fun, actualParametersList) {
  9395. if (fun.formalParameters.length !== actualParametersList.length) {
  9396. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameters_size_full(fun.name, actualParametersList.length, fun.formalParameters.length, null);
  9397. }
  9398. for (var i = 0; i < actualParametersList.length; i++) {
  9399. var param = actualParametersList[i];
  9400. var formalParam = fun.formalParameters[i];
  9401. var id = formalParam.id;
  9402. if (formalParam.byRef) {
  9403. if (!(param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["VariableLiteral"] || param instanceof _ast_expressions__WEBPACK_IMPORTED_MODULE_4__["ArrayAccess"])) {
  9404. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9405. }
  9406. }
  9407. var resultType = this.evaluateExpressionType(param);
  9408. if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"] && formalParam.type instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9409. var shared = 0;
  9410. for (var j = 0; j < resultType.types.length; j++) {
  9411. var element = resultType.types[j];
  9412. if (formalParam.type.types.indexOf(element) !== -1) {
  9413. shared++;
  9414. }
  9415. }
  9416. if (shared <= 0) {
  9417. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9418. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9419. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9420. continue;
  9421. }
  9422. }
  9423. }
  9424. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9425. }
  9426. } else if (resultType instanceof _typeSystem_multiType__WEBPACK_IMPORTED_MODULE_9__["MultiType"]) {
  9427. if (!resultType.isCompatible(formalParam.type)) {
  9428. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9429. if (resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || resultType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9430. if (formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].INTEGER) || formalParam.type.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_7__["Types"].REAL)) {
  9431. continue;
  9432. }
  9433. }
  9434. }
  9435. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9436. }
  9437. } else if (!formalParam.type.isCompatible(resultType)) {
  9438. if (_util_config__WEBPACK_IMPORTED_MODULE_10__["Config"].enable_type_casting && !formalParam.byRef) {
  9439. if (_store_store__WEBPACK_IMPORTED_MODULE_11__["Store"].canImplicitTypeCast(formalParam.type, resultType)) {
  9440. continue;
  9441. }
  9442. }
  9443. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_0__["ProcessorErrorFactory"].invalid_parameter_type_full(id, param.toString(), param.sourceInfo);
  9444. }
  9445. }
  9446. }
  9447. }]);
  9448. return SemanticAnalyser;
  9449. }();
  9450. /***/ }),
  9451. /***/ "./js/processor/store/store.js":
  9452. /*!*************************************!*\
  9453. !*** ./js/processor/store/store.js ***!
  9454. \*************************************/
  9455. /*! exports provided: Store */
  9456. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9457. "use strict";
  9458. __webpack_require__.r(__webpack_exports__);
  9459. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Store", function() { return Store; });
  9460. /* harmony import */ var _modes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../modes */ "./js/processor/modes.js");
  9461. /* harmony import */ var _typeSystem_types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./../../typeSystem/types */ "./js/typeSystem/types.js");
  9462. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9463. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9464. 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); } }
  9465. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9466. var Store =
  9467. /*#__PURE__*/
  9468. function () {
  9469. _createClass(Store, null, [{
  9470. key: "canImplicitTypeCast",
  9471. value: function canImplicitTypeCast(castType, sourceType) {
  9472. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9473. if (sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) || sourceType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL)) {
  9474. return true;
  9475. }
  9476. }
  9477. return false;
  9478. }
  9479. }, {
  9480. key: "doImplicitCasting",
  9481. value: function doImplicitCasting(castType, stoObj) {
  9482. if (!Store.canImplicitTypeCast(castType, stoObj.type)) {
  9483. throw new Error("!!!Critical error: attempted to type cast invalid types");
  9484. }
  9485. if (castType.isCompatible(_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER)) {
  9486. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, stoObj.value.trunc());
  9487. } else {
  9488. return new _storeObject__WEBPACK_IMPORTED_MODULE_2__["StoreObject"](_typeSystem_types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, stoObj.value);
  9489. }
  9490. }
  9491. }]);
  9492. function Store(name) {
  9493. _classCallCheck(this, Store);
  9494. this.name = name;
  9495. this.store = {};
  9496. this.nextStore = null;
  9497. this.mode = _modes__WEBPACK_IMPORTED_MODULE_0__["Modes"].RUN;
  9498. }
  9499. _createClass(Store, [{
  9500. key: "extendStore",
  9501. value: function extendStore(nextStore) {
  9502. this.nextStore = nextStore;
  9503. }
  9504. }, {
  9505. key: "applyStore",
  9506. value: function applyStore(id) {
  9507. if (!this.store[id]) {
  9508. if (this.nextStore !== null) {
  9509. return this.nextStore.applyStore(id);
  9510. } else {
  9511. throw new Error("Variable ".concat(id, " not found."));
  9512. }
  9513. }
  9514. var val = this.store[id];
  9515. if (val.isRef) {
  9516. return val.getRefObj();
  9517. }
  9518. return this.store[id];
  9519. }
  9520. }, {
  9521. key: "updateStore",
  9522. value: function updateStore(id, stoObj) {
  9523. if (!this.store[id]) {
  9524. if (this.nextStore !== null) {
  9525. this.nextStore.updateStore(id, stoObj);
  9526. return this;
  9527. } else {
  9528. // TODO: better error message
  9529. throw new Error("Variable ".concat(id, " not found."));
  9530. }
  9531. } else {
  9532. var oldObj = this.store[id];
  9533. if (oldObj.readOnly) {
  9534. // TODO: better error message
  9535. throw new Error("Cannot change value of a read only variable: " + id);
  9536. }
  9537. if (oldObj.isRef) {
  9538. oldObj.updateRef(stoObj);
  9539. return this;
  9540. } else if (oldObj.isCompatible(stoObj)) {
  9541. stoObj.setID(id);
  9542. this.store[id] = Object.freeze(stoObj);
  9543. return this;
  9544. } else {
  9545. var oldType = oldObj.type;
  9546. var stoType = stoObj.type; // TODO: better error message
  9547. throw new Error("".concat(oldType, " is not compatible with type ").concat(stoType, " given"));
  9548. }
  9549. }
  9550. } //In case of future use of ref, it needs to have a special function to update the storeRefObject
  9551. // and no the StoreObject refferenced by it
  9552. // updateStoreRef(id, stoObjAddress) {...}
  9553. }, {
  9554. key: "insertStore",
  9555. value: function insertStore(id, stoObj) {
  9556. if (this.store[id]) {
  9557. // TODO: better error message
  9558. throw new Error("".concat(id, " is already defined"));
  9559. }
  9560. stoObj.setID(id);
  9561. this.store[id] = Object.freeze(stoObj);
  9562. return this;
  9563. }
  9564. }]);
  9565. return Store;
  9566. }();
  9567. /***/ }),
  9568. /***/ "./js/processor/store/storeObject.js":
  9569. /*!*******************************************!*\
  9570. !*** ./js/processor/store/storeObject.js ***!
  9571. \*******************************************/
  9572. /*! exports provided: StoreObject */
  9573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9574. "use strict";
  9575. __webpack_require__.r(__webpack_exports__);
  9576. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObject", function() { return StoreObject; });
  9577. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9578. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_0__);
  9579. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9580. 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); } }
  9581. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9582. var StoreObject =
  9583. /*#__PURE__*/
  9584. function () {
  9585. function StoreObject(type, value) {
  9586. var readOnly = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9587. _classCallCheck(this, StoreObject);
  9588. this._type = type;
  9589. this._value = value;
  9590. this._readOnly = readOnly;
  9591. this._id = null;
  9592. }
  9593. _createClass(StoreObject, [{
  9594. key: "setID",
  9595. value: function setID(id) {
  9596. this._id = id;
  9597. }
  9598. }, {
  9599. key: "isCompatible",
  9600. value: function isCompatible(another) {
  9601. if (another instanceof StoreObject) {
  9602. return this.type.isCompatible(another.type);
  9603. }
  9604. return false;
  9605. }
  9606. }, {
  9607. key: "id",
  9608. get: function get() {
  9609. return this._id;
  9610. }
  9611. }, {
  9612. key: "inStore",
  9613. get: function get() {
  9614. return this.id !== null;
  9615. }
  9616. }, {
  9617. key: "type",
  9618. get: function get() {
  9619. return this._type;
  9620. }
  9621. }, {
  9622. key: "value",
  9623. get: function get() {
  9624. return this._value;
  9625. }
  9626. }, {
  9627. key: "number",
  9628. get: function get() {
  9629. if (this._value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_0___default.a) {
  9630. return this._value.toNumber();
  9631. } else {
  9632. return null;
  9633. }
  9634. }
  9635. }, {
  9636. key: "readOnly",
  9637. get: function get() {
  9638. return this._readOnly;
  9639. },
  9640. set: function set(value) {
  9641. this._readOnly = value;
  9642. }
  9643. }]);
  9644. return StoreObject;
  9645. }();
  9646. /***/ }),
  9647. /***/ "./js/processor/store/storeObjectArray.js":
  9648. /*!************************************************!*\
  9649. !*** ./js/processor/store/storeObjectArray.js ***!
  9650. \************************************************/
  9651. /*! exports provided: StoreObjectArray */
  9652. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9653. "use strict";
  9654. __webpack_require__.r(__webpack_exports__);
  9655. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArray", function() { return StoreObjectArray; });
  9656. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9657. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9658. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9659. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9660. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9661. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  9662. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  9663. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9664. 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); } }
  9665. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9666. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9667. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9668. var StoreObjectArray =
  9669. /*#__PURE__*/
  9670. function (_StoreObject) {
  9671. _inherits(StoreObjectArray, _StoreObject);
  9672. _createClass(StoreObjectArray, null, [{
  9673. key: "WRONG_LINE_NUMBER",
  9674. get: function get() {
  9675. return 1;
  9676. }
  9677. }, {
  9678. key: "WRONG_TYPE",
  9679. get: function get() {
  9680. return 2;
  9681. }
  9682. }, {
  9683. key: "WRONG_COLUMN_NUMBER",
  9684. get: function get() {
  9685. return 3;
  9686. }
  9687. }]);
  9688. function StoreObjectArray(type, lines, columns) {
  9689. var _this;
  9690. var value = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9691. var readOnly = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9692. _classCallCheck(this, StoreObjectArray);
  9693. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArray).call(this, type, value, readOnly));
  9694. _this._lines = lines;
  9695. _this._columns = columns;
  9696. return _this;
  9697. }
  9698. _createClass(StoreObjectArray, [{
  9699. key: "isCompatible",
  9700. value: function isCompatible(another) {
  9701. if (another instanceof _storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]) {
  9702. if (this.lines === -1 && another.lines > 0 || this.lines === another.lines) {
  9703. if (this.columns === -1 && another.columns > 0 || this.columns === another.columns) {
  9704. return _get(_getPrototypeOf(StoreObjectArray.prototype), "isCompatible", this).call(this, another);
  9705. }
  9706. }
  9707. }
  9708. return false;
  9709. }
  9710. }, {
  9711. key: "lines",
  9712. get: function get() {
  9713. return this._lines;
  9714. }
  9715. }, {
  9716. key: "columns",
  9717. get: function get() {
  9718. return this._columns;
  9719. }
  9720. }, {
  9721. key: "isVector",
  9722. get: function get() {
  9723. return this.type.dimensions === 1;
  9724. }
  9725. }, {
  9726. key: "isValid",
  9727. get: function get() {
  9728. var _this2 = this;
  9729. if (this.value !== null) {
  9730. if (this.isVector) {
  9731. if (this.value.length !== this.lines) {
  9732. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9733. ;
  9734. }
  9735. var mustBeNull = this.value.find(function (v) {
  9736. return !_this2.type.canAccept(v.type);
  9737. });
  9738. if (!!mustBeNull) {
  9739. return [StoreObjectArray.WRONG_TYPE, this.value.indexOf(mustBeNull)];
  9740. ;
  9741. }
  9742. }
  9743. return [];
  9744. } else {
  9745. if (this.lines !== this.value.length) {
  9746. return [StoreObjectArray.WRONG_LINE_NUMBER, this.value.length];
  9747. }
  9748. for (var i = 0; i < this.lines; i++) {
  9749. for (var j = 0; j < this.columns; j++) {
  9750. var arr = this.value[i];
  9751. if (arr.length !== this.columns) {
  9752. return [StoreObjectArray.WRONG_COLUMN_NUMBER, arr.length];
  9753. }
  9754. var _mustBeNull = arr.find(function (v) {
  9755. return !_this2.type.canAccept(v.type);
  9756. });
  9757. if (!!_mustBeNull) {
  9758. return [StoreObjectArray.WRONG_TYPE, i, arr.indexOf(_mustBeNull)];
  9759. }
  9760. }
  9761. }
  9762. return [];
  9763. }
  9764. }
  9765. }]);
  9766. return StoreObjectArray;
  9767. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9768. /***/ }),
  9769. /***/ "./js/processor/store/storeObjectArrayAddress.js":
  9770. /*!*******************************************************!*\
  9771. !*** ./js/processor/store/storeObjectArrayAddress.js ***!
  9772. \*******************************************************/
  9773. /*! exports provided: StoreObjectArrayAddress */
  9774. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9775. "use strict";
  9776. __webpack_require__.r(__webpack_exports__);
  9777. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddress", function() { return StoreObjectArrayAddress; });
  9778. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9779. /* harmony import */ var _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./storeObjectArray */ "./js/processor/store/storeObjectArray.js");
  9780. /* harmony import */ var _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../typeSystem/compoundType */ "./js/typeSystem/compoundType.js");
  9781. /* harmony import */ var _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../error/processorErrorFactory */ "./js/processor/error/processorErrorFactory.js");
  9782. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9783. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9784. 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); } }
  9785. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9786. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9787. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9788. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9789. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9790. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9791. var StoreObjectArrayAddress =
  9792. /*#__PURE__*/
  9793. function (_StoreObject) {
  9794. _inherits(StoreObjectArrayAddress, _StoreObject);
  9795. function StoreObjectArrayAddress(refID, line, column, store) {
  9796. var _this;
  9797. _classCallCheck(this, StoreObjectArrayAddress);
  9798. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddress).call(this, null, null, false));
  9799. _this.refID = refID;
  9800. _this.store = store;
  9801. _this.line = line;
  9802. _this.column = column;
  9803. return _this;
  9804. }
  9805. _createClass(StoreObjectArrayAddress, [{
  9806. key: "getArrayObject",
  9807. value: function getArrayObject() {
  9808. return this.store.applyStore(this.refID);
  9809. }
  9810. }, {
  9811. key: "updateArrayObject",
  9812. value: function updateArrayObject(stoObj) {
  9813. var anArray = this.getArrayObject();
  9814. var newArray = Object.assign(new _storeObjectArray__WEBPACK_IMPORTED_MODULE_1__["StoreObjectArray"](null, null, null), anArray);
  9815. if (!stoObj.type.isCompatible(this.type)) {
  9816. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9817. } else if (this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"] && this.type.canAccept(stoObj.type)) {
  9818. throw new Error("Invalid operation: cannot assign the value given to ".concat(this.refID));
  9819. }
  9820. if (this.column !== null) {
  9821. newArray.value[this.line].value[this.column] = stoObj;
  9822. return newArray;
  9823. } else {
  9824. newArray.value[this.line] = stoObj;
  9825. return newArray;
  9826. }
  9827. }
  9828. }, {
  9829. key: "isCompatible",
  9830. value: function isCompatible(another) {
  9831. if (this.type.isCompatible(another.type)) {
  9832. if (another.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"]) {
  9833. return this.lines === another.lines && this.columns === another.columns;
  9834. } else {
  9835. this.refValue.isCompatible(another);
  9836. }
  9837. }
  9838. }
  9839. }, {
  9840. key: "isRef",
  9841. get: function get() {
  9842. return false;
  9843. }
  9844. }, {
  9845. key: "inStore",
  9846. get: function get() {
  9847. return true;
  9848. }
  9849. }, {
  9850. key: "refValue",
  9851. get: function get() {
  9852. var refLine = this.store.applyStore(this.refID).value[this.line];
  9853. if (!refLine) {
  9854. if (this.getArrayObject().isVector) {
  9855. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9856. } else {
  9857. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_line_outbounds(this.refID, this.line, this.getArrayObject().lines);
  9858. }
  9859. }
  9860. if (this.column !== null) {
  9861. var refColumn = refLine.value[this.column];
  9862. if (!refColumn) {
  9863. if (this.getArrayObject().isVector) {
  9864. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].vector_not_matrix(this.refID);
  9865. } else {
  9866. throw _error_processorErrorFactory__WEBPACK_IMPORTED_MODULE_3__["ProcessorErrorFactory"].matrix_column_outbounds(this.refID, this.column, this.getArrayObject().columns);
  9867. }
  9868. }
  9869. return refColumn;
  9870. }
  9871. return refLine;
  9872. }
  9873. }, {
  9874. key: "value",
  9875. get: function get() {
  9876. return this.refValue.value;
  9877. }
  9878. }, {
  9879. key: "type",
  9880. get: function get() {
  9881. return this.refValue.type;
  9882. }
  9883. }, {
  9884. key: "lines",
  9885. get: function get() {
  9886. if (!(this.type instanceof _typeSystem_compoundType__WEBPACK_IMPORTED_MODULE_2__["CompoundType"])) {
  9887. return null;
  9888. }
  9889. return this.refValue.value.length;
  9890. }
  9891. }, {
  9892. key: "columns",
  9893. get: function get() {
  9894. switch (this.type.dimensions) {
  9895. case 2:
  9896. return this.refValue.value[0].value.length;
  9897. default:
  9898. return null;
  9899. }
  9900. }
  9901. }]);
  9902. return StoreObjectArrayAddress;
  9903. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9904. /***/ }),
  9905. /***/ "./js/processor/store/storeObjectArrayAddressRef.js":
  9906. /*!**********************************************************!*\
  9907. !*** ./js/processor/store/storeObjectArrayAddressRef.js ***!
  9908. \**********************************************************/
  9909. /*! exports provided: StoreObjectArrayAddressRef */
  9910. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9911. "use strict";
  9912. __webpack_require__.r(__webpack_exports__);
  9913. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectArrayAddressRef", function() { return StoreObjectArrayAddressRef; });
  9914. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9915. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9916. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9917. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9918. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9919. 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); } }
  9920. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9921. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9922. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9923. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  9924. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  9925. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  9926. var StoreObjectArrayAddressRef =
  9927. /*#__PURE__*/
  9928. function (_StoreObject) {
  9929. _inherits(StoreObjectArrayAddressRef, _StoreObject);
  9930. function StoreObjectArrayAddressRef(address) {
  9931. var _this;
  9932. _classCallCheck(this, StoreObjectArrayAddressRef);
  9933. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectArrayAddressRef).call(this, null, null, false));
  9934. _this.address = address;
  9935. return _this;
  9936. }
  9937. _createClass(StoreObjectArrayAddressRef, [{
  9938. key: "getRefObj",
  9939. value: function getRefObj() {
  9940. return this.address.refValue;
  9941. }
  9942. }, {
  9943. key: "updateRef",
  9944. value: function updateRef(stoObj) {
  9945. var newArray = this.address.updateArrayObject(stoObj);
  9946. this.address.store.updateStore(this.address.refID, newArray);
  9947. }
  9948. }, {
  9949. key: "isCompatible",
  9950. value: function isCompatible(another) {
  9951. return this.address.isCompatible(another);
  9952. }
  9953. }, {
  9954. key: "isRef",
  9955. get: function get() {
  9956. return true;
  9957. }
  9958. }, {
  9959. key: "type",
  9960. get: function get() {
  9961. return this.address.type;
  9962. }
  9963. }, {
  9964. key: "value",
  9965. get: function get() {
  9966. return this.address.value;
  9967. }
  9968. }, {
  9969. key: "number",
  9970. get: function get() {
  9971. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  9972. return this.value.toNumber();
  9973. } else {
  9974. return null;
  9975. }
  9976. }
  9977. }]);
  9978. return StoreObjectArrayAddressRef;
  9979. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  9980. /***/ }),
  9981. /***/ "./js/processor/store/storeObjectRef.js":
  9982. /*!**********************************************!*\
  9983. !*** ./js/processor/store/storeObjectRef.js ***!
  9984. \**********************************************/
  9985. /*! exports provided: StoreObjectRef */
  9986. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  9987. "use strict";
  9988. __webpack_require__.r(__webpack_exports__);
  9989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StoreObjectRef", function() { return StoreObjectRef; });
  9990. /* harmony import */ var _storeObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./storeObject */ "./js/processor/store/storeObject.js");
  9991. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  9992. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_1__);
  9993. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  9994. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9995. 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); } }
  9996. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  9997. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  9998. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9999. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  10000. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  10001. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  10002. var StoreObjectRef =
  10003. /*#__PURE__*/
  10004. function (_StoreObject) {
  10005. _inherits(StoreObjectRef, _StoreObject);
  10006. function StoreObjectRef(refID, store) {
  10007. var _this;
  10008. _classCallCheck(this, StoreObjectRef);
  10009. _this = _possibleConstructorReturn(this, _getPrototypeOf(StoreObjectRef).call(this, null, null, false));
  10010. _this.refID = refID;
  10011. _this.store = store;
  10012. return _this;
  10013. }
  10014. _createClass(StoreObjectRef, [{
  10015. key: "getRefObj",
  10016. value: function getRefObj() {
  10017. return this.store.applyStore(this.refID);
  10018. }
  10019. }, {
  10020. key: "updateRef",
  10021. value: function updateRef(stoObj) {
  10022. this.store.updateStore(this.refID, stoObj);
  10023. }
  10024. }, {
  10025. key: "isCompatible",
  10026. value: function isCompatible(another) {
  10027. return this.store.applyStore(this.refID).isCompatible(another);
  10028. }
  10029. }, {
  10030. key: "isRef",
  10031. get: function get() {
  10032. return true;
  10033. }
  10034. }, {
  10035. key: "type",
  10036. get: function get() {
  10037. return this.store.applyStore(this.refID).type;
  10038. }
  10039. }, {
  10040. key: "value",
  10041. get: function get() {
  10042. return this.store.applyStore(this.refID).value;
  10043. }
  10044. }, {
  10045. key: "number",
  10046. get: function get() {
  10047. if (this.value instanceof decimal_js__WEBPACK_IMPORTED_MODULE_1___default.a) {
  10048. return this.value.toNumber();
  10049. } else {
  10050. return null;
  10051. }
  10052. }
  10053. }]);
  10054. return StoreObjectRef;
  10055. }(_storeObject__WEBPACK_IMPORTED_MODULE_0__["StoreObject"]);
  10056. /***/ }),
  10057. /***/ "./js/runner.js":
  10058. /*!**********************!*\
  10059. !*** ./js/runner.js ***!
  10060. \**********************/
  10061. /*! exports provided: runner */
  10062. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10063. "use strict";
  10064. __webpack_require__.r(__webpack_exports__);
  10065. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "runner", function() { return runner; });
  10066. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./ast/ivprogParser */ "./js/ast/ivprogParser.js");
  10067. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  10068. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./io/domConsole */ "./js/io/domConsole.js");
  10069. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./services/languageService */ "./js/services/languageService.js");
  10070. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  10071. function runner() {
  10072. var ivprogLexer = _services_languageService__WEBPACK_IMPORTED_MODULE_3__["LanguageService"].getCurrentLexer(); // const lexer = new ivprogLexer(new InputStream(input));
  10073. // const stream = new CommonTokenStream(lexer);
  10074. // stream.fill();
  10075. // let i = 1;
  10076. // let token = null;
  10077. // while ((token = stream.LT(i)).type !== ivprogLexer.EOF && token.type !== ivprogLexer.WHITESPACE) {
  10078. // console.log(`${token.type}-${token.text}`);
  10079. // console.log('\n')
  10080. // i++;
  10081. // }
  10082. // const anaSin = new IVProgParser(input, ivprogLexer);
  10083. var editor = new JsonEditor('#json-renderer', {});
  10084. var domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_2__["DOMConsole"]("#console"); // proc.interpretAST().then( sto => {
  10085. // console.log(sto.applyStore('a'));
  10086. // }).catch(e => console.log(e));
  10087. try {
  10088. $('#btn').click(function () {
  10089. var input = $('#input').val();
  10090. var analiser = new _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_0__["IVProgParser"](input, ivprogLexer);
  10091. try {
  10092. var data = analiser.parseTree();
  10093. var semAna = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_4__["SemanticAnalyser"](data);
  10094. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_1__["IVProgProcessor"](semAna.analyseTree());
  10095. proc.registerInput(domConsole);
  10096. domConsole.clear();
  10097. proc.registerOutput(domConsole);
  10098. proc.interpretAST().then(function (sto) {
  10099. return editor.load(sto.store);
  10100. }).catch(function (e) {
  10101. alert(e);
  10102. console.log(e);
  10103. });
  10104. } catch (error) {
  10105. alert(error);
  10106. console.log(error);
  10107. }
  10108. });
  10109. } catch (a) {
  10110. console.log(a);
  10111. }
  10112. }
  10113. /***/ }),
  10114. /***/ "./js/semantic/semantic.min.js":
  10115. /*!*************************************!*\
  10116. !*** ./js/semantic/semantic.min.js ***!
  10117. \*************************************/
  10118. /*! no static exports found */
  10119. /***/ (function(module, exports) {
  10120. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  10121. /*
  10122. * # Semantic UI - 2.3.3
  10123. * https://github.com/Semantic-Org/Semantic-UI
  10124. * http://www.semantic-ui.com/
  10125. *
  10126. * Copyright 2014 Contributors
  10127. * Released under the MIT license
  10128. * http://opensource.org/licenses/MIT
  10129. *
  10130. */
  10131. !function (e, t, n, i) {
  10132. e.site = e.fn.site = function (o) {
  10133. var a,
  10134. r,
  10135. s = new Date().getTime(),
  10136. l = [],
  10137. c = arguments[0],
  10138. u = "string" == typeof c,
  10139. d = [].slice.call(arguments, 1),
  10140. f = e.isPlainObject(o) ? e.extend(!0, {}, e.site.settings, o) : e.extend({}, e.site.settings),
  10141. m = f.namespace,
  10142. g = f.error,
  10143. p = "module-" + m,
  10144. h = e(n),
  10145. v = this,
  10146. b = h.data(p);
  10147. return a = {
  10148. initialize: function initialize() {
  10149. a.instantiate();
  10150. },
  10151. instantiate: function instantiate() {
  10152. a.verbose("Storing instance of site", a), b = a, h.data(p, a);
  10153. },
  10154. normalize: function normalize() {
  10155. a.fix.console(), a.fix.requestAnimationFrame();
  10156. },
  10157. fix: {
  10158. console: function (_console) {
  10159. function console() {
  10160. return _console.apply(this, arguments);
  10161. }
  10162. console.toString = function () {
  10163. return _console.toString();
  10164. };
  10165. return console;
  10166. }(function () {
  10167. 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 () {});
  10168. }),
  10169. consoleClear: function consoleClear() {
  10170. a.debug("Disabling programmatic console clearing"), t.console.clear = function () {};
  10171. },
  10172. requestAnimationFrame: function requestAnimationFrame() {
  10173. 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) {
  10174. setTimeout(e, 0);
  10175. });
  10176. }
  10177. },
  10178. moduleExists: function moduleExists(t) {
  10179. return e.fn[t] !== i && e.fn[t].settings !== i;
  10180. },
  10181. enabled: {
  10182. modules: function modules(t) {
  10183. var n = [];
  10184. return t = t || f.modules, e.each(t, function (e, t) {
  10185. a.moduleExists(t) && n.push(t);
  10186. }), n;
  10187. }
  10188. },
  10189. disabled: {
  10190. modules: function modules(t) {
  10191. var n = [];
  10192. return t = t || f.modules, e.each(t, function (e, t) {
  10193. a.moduleExists(t) || n.push(t);
  10194. }), n;
  10195. }
  10196. },
  10197. change: {
  10198. setting: function setting(t, n, o, r) {
  10199. o = "string" == typeof o ? "all" === o ? f.modules : [o] : o || f.modules, r = r === i || r, e.each(o, function (i, o) {
  10200. var s,
  10201. l = !a.moduleExists(o) || e.fn[o].settings.namespace || !1;
  10202. 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)));
  10203. });
  10204. },
  10205. settings: function settings(t, n, o) {
  10206. n = "string" == typeof n ? [n] : n || f.modules, o = o === i || o, e.each(n, function (n, i) {
  10207. var r;
  10208. 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)));
  10209. });
  10210. }
  10211. },
  10212. enable: {
  10213. console: function console() {
  10214. a.console(!0);
  10215. },
  10216. debug: function debug(e, t) {
  10217. e = e || f.modules, a.debug("Enabling debug for modules", e), a.change.setting("debug", !0, e, t);
  10218. },
  10219. verbose: function verbose(e, t) {
  10220. e = e || f.modules, a.debug("Enabling verbose debug for modules", e), a.change.setting("verbose", !0, e, t);
  10221. }
  10222. },
  10223. disable: {
  10224. console: function console() {
  10225. a.console(!1);
  10226. },
  10227. debug: function debug(e, t) {
  10228. e = e || f.modules, a.debug("Disabling debug for modules", e), a.change.setting("debug", !1, e, t);
  10229. },
  10230. verbose: function verbose(e, t) {
  10231. e = e || f.modules, a.debug("Disabling verbose debug for modules", e), a.change.setting("verbose", !1, e, t);
  10232. }
  10233. },
  10234. console: function console(e) {
  10235. if (e) {
  10236. if (b.cache.console === i) return void a.error(g.console);
  10237. a.debug("Restoring console function"), t.console = b.cache.console;
  10238. } else a.debug("Disabling console function"), b.cache.console = t.console, t.console = {
  10239. clear: function clear() {},
  10240. error: function error() {},
  10241. group: function group() {},
  10242. groupCollapsed: function groupCollapsed() {},
  10243. groupEnd: function groupEnd() {},
  10244. info: function info() {},
  10245. log: function log() {},
  10246. markTimeline: function markTimeline() {},
  10247. warn: function warn() {}
  10248. };
  10249. },
  10250. destroy: function destroy() {
  10251. a.verbose("Destroying previous site for", h), h.removeData(p);
  10252. },
  10253. cache: {},
  10254. setting: function setting(t, n) {
  10255. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  10256. if (n === i) return f[t];
  10257. f[t] = n;
  10258. }
  10259. },
  10260. internal: function internal(t, n) {
  10261. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  10262. if (n === i) return a[t];
  10263. a[t] = n;
  10264. }
  10265. },
  10266. debug: function debug() {
  10267. f.debug && (f.performance ? a.performance.log(arguments) : (a.debug = Function.prototype.bind.call(console.info, console, f.name + ":"), a.debug.apply(console, arguments)));
  10268. },
  10269. verbose: function verbose() {
  10270. 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)));
  10271. },
  10272. error: function error() {
  10273. a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments);
  10274. },
  10275. performance: {
  10276. log: function log(e) {
  10277. var t, n;
  10278. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10279. Element: v,
  10280. Name: e[0],
  10281. Arguments: [].slice.call(e, 1) || "",
  10282. "Execution Time": n
  10283. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  10284. },
  10285. display: function display() {
  10286. var t = f.name + ":",
  10287. n = 0;
  10288. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  10289. n += t["Execution Time"];
  10290. }), 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) {
  10291. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10292. }), console.groupEnd()), l = [];
  10293. }
  10294. },
  10295. invoke: function invoke(t, n, o) {
  10296. var s,
  10297. l,
  10298. c,
  10299. u = b;
  10300. 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) {
  10301. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10302. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  10303. if (u[r] !== i) return l = u[r], !1;
  10304. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  10305. u = u[o];
  10306. }
  10307. })), 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;
  10308. }
  10309. }, u ? (b === i && a.initialize(), a.invoke(c)) : (b !== i && a.destroy(), a.initialize()), r !== i ? r : this;
  10310. }, e.site.settings = {
  10311. name: "Site",
  10312. namespace: "site",
  10313. error: {
  10314. console: "Console cannot be restored, most likely it was overwritten outside of module",
  10315. method: "The method you called is not defined."
  10316. },
  10317. debug: !1,
  10318. verbose: !1,
  10319. performance: !0,
  10320. modules: ["accordion", "api", "checkbox", "dimmer", "dropdown", "embed", "form", "modal", "nag", "popup", "rating", "shape", "sidebar", "state", "sticky", "tab", "transition", "visit", "visibility"],
  10321. siteNamespace: "site",
  10322. namespaceStub: {
  10323. cache: {},
  10324. config: {},
  10325. sections: {},
  10326. section: {},
  10327. utilities: {}
  10328. }
  10329. }, e.extend(e.expr[":"], {
  10330. data: e.expr.createPseudo ? e.expr.createPseudo(function (t) {
  10331. return function (n) {
  10332. return !!e.data(n, t);
  10333. };
  10334. }) : function (t, n, i) {
  10335. return !!e.data(t, i[3]);
  10336. }
  10337. });
  10338. }(jQuery, window, document), function (e, t, n, i) {
  10339. "use strict";
  10340. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.form = function (t) {
  10341. var o,
  10342. a = e(this),
  10343. r = a.selector || "",
  10344. s = new Date().getTime(),
  10345. l = [],
  10346. c = arguments[0],
  10347. u = arguments[1],
  10348. d = "string" == typeof c,
  10349. f = [].slice.call(arguments, 1);
  10350. return a.each(function () {
  10351. var m,
  10352. g,
  10353. p,
  10354. h,
  10355. v,
  10356. b,
  10357. y,
  10358. x,
  10359. C,
  10360. w,
  10361. S,
  10362. k,
  10363. T,
  10364. A,
  10365. R,
  10366. P,
  10367. E = e(this),
  10368. F = this,
  10369. O = [],
  10370. D = !1;
  10371. (P = {
  10372. initialize: function initialize() {
  10373. 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());
  10374. },
  10375. instantiate: function instantiate() {
  10376. P.verbose("Storing instance of module", P), R = P, E.data(T, P);
  10377. },
  10378. destroy: function destroy() {
  10379. P.verbose("Destroying previous module", R), P.removeEvents(), E.removeData(T);
  10380. },
  10381. refresh: function refresh() {
  10382. 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);
  10383. },
  10384. submit: function submit() {
  10385. P.verbose("Submitting form", E), E.submit();
  10386. },
  10387. attachEvents: function attachEvents(t, n) {
  10388. n = n || "submit", e(t).on("click" + A, function (e) {
  10389. P[n](), e.preventDefault();
  10390. });
  10391. },
  10392. bindEvents: function bindEvents() {
  10393. 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 () {
  10394. var t = e(this),
  10395. n = t.prop("type"),
  10396. i = P.get.changeEvent(n, t);
  10397. e(this).on(i + A, P.event.field.change);
  10398. });
  10399. },
  10400. clear: function clear() {
  10401. m.each(function () {
  10402. var t = e(this),
  10403. n = t.parent(),
  10404. i = t.closest(g),
  10405. o = i.find(x.prompt),
  10406. a = t.data(y.defaultValue) || "",
  10407. r = n.is(x.uiCheckbox),
  10408. s = n.is(x.uiDropdown);
  10409. 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(""));
  10410. });
  10411. },
  10412. reset: function reset() {
  10413. m.each(function () {
  10414. var t = e(this),
  10415. n = t.parent(),
  10416. o = t.closest(g),
  10417. a = o.find(x.prompt),
  10418. r = t.data(y.defaultValue),
  10419. s = n.is(x.uiCheckbox),
  10420. l = n.is(x.uiDropdown),
  10421. c = o.hasClass(C.error);
  10422. 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)));
  10423. });
  10424. },
  10425. determine: {
  10426. isValid: function isValid() {
  10427. var t = !0;
  10428. return e.each(b, function (e, n) {
  10429. P.validate.field(n, e, !0) || (t = !1);
  10430. }), t;
  10431. }
  10432. },
  10433. is: {
  10434. bracketedRule: function bracketedRule(e) {
  10435. return e.type && e.type.match(v.regExp.bracket);
  10436. },
  10437. shorthandFields: function shorthandFields(e) {
  10438. var t = e[Object.keys(e)[0]];
  10439. return P.is.shorthandRules(t);
  10440. },
  10441. shorthandRules: function shorthandRules(t) {
  10442. return "string" == typeof t || e.isArray(t);
  10443. },
  10444. empty: function empty(e) {
  10445. return !e || 0 === e.length || (e.is('input[type="checkbox"]') ? !e.is(":checked") : P.is.blank(e));
  10446. },
  10447. blank: function blank(t) {
  10448. return "" === e.trim(t.val());
  10449. },
  10450. valid: function valid(t) {
  10451. var n = !0;
  10452. 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) {
  10453. P.is.valid(e) || (n = !1);
  10454. }), n);
  10455. }
  10456. },
  10457. removeEvents: function removeEvents() {
  10458. E.off(A), m.off(A), h.off(A), m.off(A);
  10459. },
  10460. event: {
  10461. field: {
  10462. keydown: function keydown(t) {
  10463. var n = e(this),
  10464. i = t.which,
  10465. o = n.is(x.input),
  10466. a = n.is(x.checkbox),
  10467. r = n.closest(x.uiDropdown).length > 0,
  10468. s = 13;
  10469. 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);
  10470. },
  10471. keyup: function keyup() {
  10472. D = !1;
  10473. },
  10474. blur: function blur(t) {
  10475. var n = e(this),
  10476. i = n.closest(g),
  10477. o = P.get.validation(n);
  10478. i.hasClass(C.error) ? (P.debug("Revalidating field", n, o), o && P.validate.field(o)) : "blur" == v.on && o && P.validate.field(o);
  10479. },
  10480. change: function change(t) {
  10481. var n = e(this),
  10482. i = n.closest(g),
  10483. o = P.get.validation(n);
  10484. o && ("change" == v.on || i.hasClass(C.error) && v.revalidate) && (clearTimeout(P.timer), P.timer = setTimeout(function () {
  10485. P.debug("Revalidating field", n, P.get.validation(n)), P.validate.field(o);
  10486. }, v.delay));
  10487. }
  10488. }
  10489. },
  10490. get: {
  10491. ancillaryValue: function ancillaryValue(e) {
  10492. return !(!e.type || !e.value && !P.is.bracketedRule(e)) && (e.value !== i ? e.value : e.type.match(v.regExp.bracket)[1] + "");
  10493. },
  10494. ruleName: function ruleName(e) {
  10495. return P.is.bracketedRule(e) ? e.type.replace(e.type.match(v.regExp.bracket)[0], "") : e.type;
  10496. },
  10497. changeEvent: function changeEvent(e, t) {
  10498. return "checkbox" == e || "radio" == e || "hidden" == e || t.is("select") ? "change" : P.get.inputEvent();
  10499. },
  10500. inputEvent: function inputEvent() {
  10501. return n.createElement("input").oninput !== i ? "input" : n.createElement("input").onpropertychange !== i ? "propertychange" : "keyup";
  10502. },
  10503. fieldsFromShorthand: function fieldsFromShorthand(t) {
  10504. var n = {};
  10505. return e.each(t, function (t, i) {
  10506. "string" == typeof i && (i = [i]), n[t] = {
  10507. rules: []
  10508. }, e.each(i, function (e, i) {
  10509. n[t].rules.push({
  10510. type: i
  10511. });
  10512. });
  10513. }), n;
  10514. },
  10515. prompt: function prompt(t, n) {
  10516. var i,
  10517. o,
  10518. a = P.get.ruleName(t),
  10519. r = P.get.ancillaryValue(t),
  10520. s = P.get.field(n.identifier),
  10521. l = s.val(),
  10522. c = e.isFunction(t.prompt) ? t.prompt(l) : t.prompt || v.prompt[a] || v.text.unspecifiedRule,
  10523. u = -1 !== c.search("{value}"),
  10524. d = -1 !== c.search("{name}");
  10525. 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;
  10526. },
  10527. settings: function settings() {
  10528. if (e.isPlainObject(t)) {
  10529. var n = Object.keys(t);
  10530. 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));
  10531. } else v = e.fn.form.settings, b = e.fn.form.settings.defaults, P.verbose("Using default form validation", b, v);
  10532. 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();
  10533. },
  10534. field: function field(t) {
  10535. 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/>");
  10536. },
  10537. fields: function fields(t) {
  10538. var n = e();
  10539. return e.each(t, function (e, t) {
  10540. n = n.add(P.get.field(t));
  10541. }), n;
  10542. },
  10543. validation: function validation(t) {
  10544. var n, i;
  10545. return !!b && (e.each(b, function (e, o) {
  10546. i = o.identifier || e, P.get.field(i)[0] == t[0] && (o.identifier = i, n = o);
  10547. }), n || !1);
  10548. },
  10549. value: function value(e) {
  10550. var t = [];
  10551. return t.push(e), P.get.values.call(F, t)[e];
  10552. },
  10553. values: function values(t) {
  10554. var n = {};
  10555. return (e.isArray(t) ? P.get.fields(t) : m).each(function (t, o) {
  10556. var a = e(o),
  10557. r = (a.prop("type"), a.prop("name")),
  10558. s = a.val(),
  10559. l = a.is(x.checkbox),
  10560. c = a.is(x.radio),
  10561. u = -1 !== r.indexOf("[]"),
  10562. d = !!l && a.is(":checked");
  10563. 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);
  10564. }), n;
  10565. }
  10566. },
  10567. has: {
  10568. field: function field(e) {
  10569. 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;
  10570. }
  10571. },
  10572. escape: {
  10573. string: function string(e) {
  10574. return (e = String(e)).replace(w.escape, "\\$&");
  10575. }
  10576. },
  10577. add: {
  10578. rule: function rule(e, t) {
  10579. P.add.field(e, t);
  10580. },
  10581. field: function field(t, n) {
  10582. var i = {};
  10583. P.is.shorthandRules(n) ? (n = e.isArray(n) ? n : [n], i[t] = {
  10584. rules: []
  10585. }, e.each(n, function (e, n) {
  10586. i[t].rules.push({
  10587. type: n
  10588. });
  10589. })) : i[t] = n, b = e.extend({}, b, i), P.debug("Adding rules", i, b);
  10590. },
  10591. fields: function fields(t) {
  10592. var n;
  10593. n = t && P.is.shorthandFields(t) ? P.get.fieldsFromShorthand(t) : t, b = e.extend({}, b, n);
  10594. },
  10595. prompt: function prompt(t, n) {
  10596. var o = P.get.field(t).closest(g),
  10597. a = o.children(x.prompt),
  10598. r = 0 !== a.length;
  10599. 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)));
  10600. },
  10601. errors: function errors(e) {
  10602. P.debug("Adding form error messages", e), P.set.error(), p.html(v.templates.error(e));
  10603. }
  10604. },
  10605. remove: {
  10606. rule: function rule(t, n) {
  10607. var o = e.isArray(n) ? n : [n];
  10608. if (n == i) return P.debug("Removed all rules"), void (b[t].rules = []);
  10609. b[t] != i && e.isArray(b[t].rules) && e.each(b[t].rules, function (e, n) {
  10610. -1 !== o.indexOf(n.type) && (P.debug("Removed rule", n.type), b[t].rules.splice(e, 1));
  10611. });
  10612. },
  10613. field: function field(t) {
  10614. var n = e.isArray(t) ? t : [t];
  10615. e.each(n, function (e, t) {
  10616. P.remove.rule(t);
  10617. });
  10618. },
  10619. rules: function rules(t, n) {
  10620. e.isArray(t) ? e.each(fields, function (e, t) {
  10621. P.remove.rule(t, n);
  10622. }) : P.remove.rule(t, n);
  10623. },
  10624. fields: function fields(e) {
  10625. P.remove.field(e);
  10626. },
  10627. prompt: function prompt(t) {
  10628. var n = P.get.field(t).closest(g),
  10629. o = n.children(x.prompt);
  10630. 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 () {
  10631. o.remove();
  10632. }) : o.fadeOut(v.duration, function () {
  10633. o.remove();
  10634. }));
  10635. }
  10636. },
  10637. set: {
  10638. success: function success() {
  10639. E.removeClass(C.error).addClass(C.success);
  10640. },
  10641. defaults: function defaults() {
  10642. m.each(function () {
  10643. var t = e(this),
  10644. n = t.filter(x.checkbox).length > 0 ? t.is(":checked") : t.val();
  10645. t.data(y.defaultValue, n);
  10646. });
  10647. },
  10648. error: function error() {
  10649. E.removeClass(C.success).addClass(C.error);
  10650. },
  10651. value: function value(e, t) {
  10652. var n = {};
  10653. return n[e] = t, P.set.values.call(F, n);
  10654. },
  10655. values: function values(t) {
  10656. e.isEmptyObject(t) || e.each(t, function (t, n) {
  10657. var i,
  10658. o = P.get.field(t),
  10659. a = o.parent(),
  10660. r = e.isArray(n),
  10661. s = a.is(x.uiCheckbox),
  10662. l = a.is(x.uiDropdown),
  10663. c = o.is(x.radio) && s;
  10664. o.length > 0 && (r && s ? (P.verbose("Selecting multiple", n, o), a.checkbox("uncheck"), e.each(n, function (e, t) {
  10665. i = o.filter('[value="' + t + '"]'), a = i.parent(), i.length > 0 && a.checkbox("check");
  10666. })) : 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)));
  10667. });
  10668. }
  10669. },
  10670. validate: {
  10671. form: function form(e, t) {
  10672. var n = P.get.values();
  10673. if (D) return !1;
  10674. if (O = [], P.determine.isValid()) {
  10675. if (P.debug("Form has no validation errors, submitting"), P.set.success(), !0 !== t) return v.onSuccess.call(F, e, n);
  10676. } 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);
  10677. },
  10678. field: function field(t, n, o) {
  10679. o = o === i || o, "string" == typeof t && (P.verbose("Validating field", t), n = t, t = b[t]);
  10680. var a = t.identifier || n,
  10681. r = P.get.field(a),
  10682. s = !!t.depends && P.get.field(t.depends),
  10683. l = !0,
  10684. c = [];
  10685. 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) {
  10686. 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);
  10687. }), 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);
  10688. },
  10689. rule: function rule(t, n) {
  10690. var o = P.get.field(t.identifier),
  10691. a = (n.type, o.val()),
  10692. r = P.get.ancillaryValue(n),
  10693. s = P.get.ruleName(n),
  10694. l = v.rules[s];
  10695. if (e.isFunction(l)) return a = a === i || "" === a || null === a ? "" : e.trim(a + ""), l.call(o, a, r);
  10696. P.error(S.noRule, s);
  10697. }
  10698. },
  10699. setting: function setting(t, n) {
  10700. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  10701. if (n === i) return v[t];
  10702. v[t] = n;
  10703. }
  10704. },
  10705. internal: function internal(t, n) {
  10706. if (e.isPlainObject(t)) e.extend(!0, P, t);else {
  10707. if (n === i) return P[t];
  10708. P[t] = n;
  10709. }
  10710. },
  10711. debug: function debug() {
  10712. !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)));
  10713. },
  10714. verbose: function verbose() {
  10715. !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)));
  10716. },
  10717. error: function error() {
  10718. v.silent || (P.error = Function.prototype.bind.call(console.error, console, v.name + ":"), P.error.apply(console, arguments));
  10719. },
  10720. performance: {
  10721. log: function log(e) {
  10722. var t, n;
  10723. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  10724. Name: e[0],
  10725. Arguments: [].slice.call(e, 1) || "",
  10726. Element: F,
  10727. "Execution Time": n
  10728. })), clearTimeout(P.performance.timer), P.performance.timer = setTimeout(P.performance.display, 500);
  10729. },
  10730. display: function display() {
  10731. var t = v.name + ":",
  10732. n = 0;
  10733. s = !1, clearTimeout(P.performance.timer), e.each(l, function (e, t) {
  10734. n += t["Execution Time"];
  10735. }), 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) {
  10736. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  10737. }), console.groupEnd()), l = [];
  10738. }
  10739. },
  10740. invoke: function invoke(t, n, a) {
  10741. var r,
  10742. s,
  10743. l,
  10744. c = R;
  10745. 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) {
  10746. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  10747. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  10748. if (c[a] !== i) return s = c[a], !1;
  10749. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  10750. c = c[o];
  10751. }
  10752. })), 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;
  10753. }
  10754. }).initialize();
  10755. }), o !== i ? o : this;
  10756. }, e.fn.form.settings = {
  10757. name: "Form",
  10758. namespace: "form",
  10759. debug: !1,
  10760. verbose: !1,
  10761. performance: !0,
  10762. fields: !1,
  10763. keyboardShortcuts: !0,
  10764. on: "submit",
  10765. inline: !1,
  10766. delay: 200,
  10767. revalidate: !0,
  10768. transition: "scale",
  10769. duration: 200,
  10770. onValid: function onValid() {},
  10771. onInvalid: function onInvalid() {},
  10772. onSuccess: function onSuccess() {
  10773. return !0;
  10774. },
  10775. onFailure: function onFailure() {
  10776. return !1;
  10777. },
  10778. metadata: {
  10779. defaultValue: "default",
  10780. validate: "validate"
  10781. },
  10782. regExp: {
  10783. htmlID: /^[a-zA-Z][\w:.-]*$/g,
  10784. bracket: /\[(.*)\]/i,
  10785. decimal: /^\d+\.?\d*$/,
  10786. email: /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
  10787. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  10788. flags: /^\/(.*)\/(.*)?/,
  10789. integer: /^\-?\d+$/,
  10790. number: /^\-?\d*(\.\d+)?$/,
  10791. url: /(https?:\/\/(?:www\.|(?!www))[^\s\.]+\.[^\s]{2,}|www\.[^\s]+\.[^\s]{2,})/i
  10792. },
  10793. text: {
  10794. unspecifiedRule: "Please enter a valid value",
  10795. unspecifiedField: "This field"
  10796. },
  10797. prompt: {
  10798. empty: "{name} must have a value",
  10799. checked: "{name} must be checked",
  10800. email: "{name} must be a valid e-mail",
  10801. url: "{name} must be a valid url",
  10802. regExp: "{name} is not formatted correctly",
  10803. integer: "{name} must be an integer",
  10804. decimal: "{name} must be a decimal number",
  10805. number: "{name} must be set to a number",
  10806. is: '{name} must be "{ruleValue}"',
  10807. isExactly: '{name} must be exactly "{ruleValue}"',
  10808. not: '{name} cannot be set to "{ruleValue}"',
  10809. notExactly: '{name} cannot be set to exactly "{ruleValue}"',
  10810. contain: '{name} must contain "{ruleValue}"',
  10811. containExactly: '{name} must contain exactly "{ruleValue}"',
  10812. doesntContain: '{name} cannot contain "{ruleValue}"',
  10813. doesntContainExactly: '{name} cannot contain exactly "{ruleValue}"',
  10814. minLength: "{name} must be at least {ruleValue} characters",
  10815. length: "{name} must be at least {ruleValue} characters",
  10816. exactLength: "{name} must be exactly {ruleValue} characters",
  10817. maxLength: "{name} cannot be longer than {ruleValue} characters",
  10818. match: "{name} must match {ruleValue} field",
  10819. different: "{name} must have a different value than {ruleValue} field",
  10820. creditCard: "{name} must be a valid credit card number",
  10821. minCount: "{name} must have at least {ruleValue} choices",
  10822. exactCount: "{name} must have exactly {ruleValue} choices",
  10823. maxCount: "{name} must have {ruleValue} or less choices"
  10824. },
  10825. selector: {
  10826. checkbox: 'input[type="checkbox"], input[type="radio"]',
  10827. clear: ".clear",
  10828. field: "input, textarea, select",
  10829. group: ".field",
  10830. input: "input",
  10831. message: ".error.message",
  10832. prompt: ".prompt.label",
  10833. radio: 'input[type="radio"]',
  10834. reset: '.reset:not([type="reset"])',
  10835. submit: '.submit:not([type="submit"])',
  10836. uiCheckbox: ".ui.checkbox",
  10837. uiDropdown: ".ui.dropdown"
  10838. },
  10839. className: {
  10840. error: "error",
  10841. label: "ui prompt label",
  10842. pressed: "down",
  10843. success: "success"
  10844. },
  10845. error: {
  10846. identifier: "You must specify a string identifier for each field",
  10847. method: "The method you called is not defined.",
  10848. noRule: "There is no rule matching the one you specified",
  10849. oldSyntax: "Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically."
  10850. },
  10851. templates: {
  10852. error: function error(t) {
  10853. var n = '<ul class="list">';
  10854. return e.each(t, function (e, t) {
  10855. n += "<li>" + t + "</li>";
  10856. }), e(n += "</ul>");
  10857. },
  10858. prompt: function prompt(t) {
  10859. return e("<div/>").addClass("ui basic red pointing prompt label").html(t[0]);
  10860. }
  10861. },
  10862. rules: {
  10863. empty: function empty(t) {
  10864. return !(t === i || "" === t || e.isArray(t) && 0 === t.length);
  10865. },
  10866. checked: function checked() {
  10867. return e(this).filter(":checked").length > 0;
  10868. },
  10869. email: function email(t) {
  10870. return e.fn.form.settings.regExp.email.test(t);
  10871. },
  10872. url: function url(t) {
  10873. return e.fn.form.settings.regExp.url.test(t);
  10874. },
  10875. regExp: function regExp(t, n) {
  10876. if (n instanceof RegExp) return t.match(n);
  10877. var i,
  10878. o = n.match(e.fn.form.settings.regExp.flags);
  10879. return o && (n = o.length >= 2 ? o[1] : n, i = o.length >= 3 ? o[2] : ""), t.match(new RegExp(n, i));
  10880. },
  10881. integer: function integer(t, n) {
  10882. var o,
  10883. a,
  10884. r,
  10885. s = e.fn.form.settings.regExp.integer;
  10886. 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);
  10887. },
  10888. decimal: function decimal(t) {
  10889. return e.fn.form.settings.regExp.decimal.test(t);
  10890. },
  10891. number: function number(t) {
  10892. return e.fn.form.settings.regExp.number.test(t);
  10893. },
  10894. is: function is(e, t) {
  10895. return t = "string" == typeof t ? t.toLowerCase() : t, (e = "string" == typeof e ? e.toLowerCase() : e) == t;
  10896. },
  10897. isExactly: function isExactly(e, t) {
  10898. return e == t;
  10899. },
  10900. not: function not(e, t) {
  10901. return (e = "string" == typeof e ? e.toLowerCase() : e) != (t = "string" == typeof t ? t.toLowerCase() : t);
  10902. },
  10903. notExactly: function notExactly(e, t) {
  10904. return e != t;
  10905. },
  10906. contains: function contains(t, n) {
  10907. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n, "i"));
  10908. },
  10909. containsExactly: function containsExactly(t, n) {
  10910. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 !== t.search(new RegExp(n));
  10911. },
  10912. doesntContain: function doesntContain(t, n) {
  10913. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n, "i"));
  10914. },
  10915. doesntContainExactly: function doesntContainExactly(t, n) {
  10916. return n = n.replace(e.fn.form.settings.regExp.escape, "\\$&"), -1 === t.search(new RegExp(n));
  10917. },
  10918. minLength: function minLength(e, t) {
  10919. return e !== i && e.length >= t;
  10920. },
  10921. length: function length(e, t) {
  10922. return e !== i && e.length >= t;
  10923. },
  10924. exactLength: function exactLength(e, t) {
  10925. return e !== i && e.length == t;
  10926. },
  10927. maxLength: function maxLength(e, t) {
  10928. return e !== i && e.length <= t;
  10929. },
  10930. match: function match(t, n) {
  10931. var o;
  10932. e(this);
  10933. 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();
  10934. },
  10935. different: function different(t, n) {
  10936. var o;
  10937. e(this);
  10938. 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();
  10939. },
  10940. creditCard: function creditCard(t, n) {
  10941. var i,
  10942. o,
  10943. a = {
  10944. visa: {
  10945. pattern: /^4/,
  10946. length: [16]
  10947. },
  10948. amex: {
  10949. pattern: /^3[47]/,
  10950. length: [15]
  10951. },
  10952. mastercard: {
  10953. pattern: /^5[1-5]/,
  10954. length: [16]
  10955. },
  10956. discover: {
  10957. 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)/,
  10958. length: [16]
  10959. },
  10960. unionPay: {
  10961. pattern: /^(62|88)/,
  10962. length: [16, 17, 18, 19]
  10963. },
  10964. jcb: {
  10965. pattern: /^35(2[89]|[3-8][0-9])/,
  10966. length: [16]
  10967. },
  10968. maestro: {
  10969. pattern: /^(5018|5020|5038|6304|6759|676[1-3])/,
  10970. length: [12, 13, 14, 15, 16, 17, 18, 19]
  10971. },
  10972. dinersClub: {
  10973. pattern: /^(30[0-5]|^36)/,
  10974. length: [14]
  10975. },
  10976. laser: {
  10977. pattern: /^(6304|670[69]|6771)/,
  10978. length: [16, 17, 18, 19]
  10979. },
  10980. visaElectron: {
  10981. pattern: /^(4026|417500|4508|4844|491(3|7))/,
  10982. length: [16]
  10983. }
  10984. },
  10985. r = {},
  10986. s = !1,
  10987. l = "string" == typeof n && n.split(",");
  10988. if ("string" == typeof t && 0 !== t.length) {
  10989. if (t = t.replace(/[\-]/g, ""), l && (e.each(l, function (n, i) {
  10990. (o = a[i]) && (r = {
  10991. length: -1 !== e.inArray(t.length, o.length),
  10992. pattern: -1 !== t.search(o.pattern)
  10993. }).length && r.pattern && (s = !0);
  10994. }), !s)) return !1;
  10995. if ((i = {
  10996. number: -1 !== e.inArray(t.length, a.unionPay.length),
  10997. pattern: -1 !== t.search(a.unionPay.pattern)
  10998. }).number && i.pattern) return !0;
  10999. 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--;) {
  11000. f += d[u][parseInt(t.charAt(c), 10)], u ^= 1;
  11001. }
  11002. return f % 10 == 0 && f > 0;
  11003. }
  11004. },
  11005. minCount: function minCount(e, t) {
  11006. return 0 == t || (1 == t ? "" !== e : e.split(",").length >= t);
  11007. },
  11008. exactCount: function exactCount(e, t) {
  11009. return 0 == t ? "" === e : 1 == t ? "" !== e && -1 === e.search(",") : e.split(",").length == t;
  11010. },
  11011. maxCount: function maxCount(e, t) {
  11012. return 0 != t && (1 == t ? -1 === e.search(",") : e.split(",").length <= t);
  11013. }
  11014. }
  11015. };
  11016. }(jQuery, window, document), function (e, t, n, i) {
  11017. "use strict";
  11018. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.accordion = function (n) {
  11019. var o,
  11020. a = e(this),
  11021. r = new Date().getTime(),
  11022. s = [],
  11023. l = arguments[0],
  11024. c = "string" == typeof l,
  11025. u = [].slice.call(arguments, 1);
  11026. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  11027. return a.each(function () {
  11028. var d,
  11029. f,
  11030. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.accordion.settings, n) : e.extend({}, e.fn.accordion.settings),
  11031. g = m.className,
  11032. p = m.namespace,
  11033. h = m.selector,
  11034. v = m.error,
  11035. b = "." + p,
  11036. y = "module-" + p,
  11037. x = a.selector || "",
  11038. C = e(this),
  11039. w = C.find(h.title),
  11040. S = C.find(h.content),
  11041. k = this,
  11042. T = C.data(y);
  11043. f = {
  11044. initialize: function initialize() {
  11045. f.debug("Initializing", C), f.bind.events(), m.observeChanges && f.observeChanges(), f.instantiate();
  11046. },
  11047. instantiate: function instantiate() {
  11048. T = f, C.data(y, f);
  11049. },
  11050. destroy: function destroy() {
  11051. f.debug("Destroying previous instance", C), C.off(b).removeData(y);
  11052. },
  11053. refresh: function refresh() {
  11054. w = C.find(h.title), S = C.find(h.content);
  11055. },
  11056. observeChanges: function observeChanges() {
  11057. "MutationObserver" in t && ((d = new MutationObserver(function (e) {
  11058. f.debug("DOM tree modified, updating selector cache"), f.refresh();
  11059. })).observe(k, {
  11060. childList: !0,
  11061. subtree: !0
  11062. }), f.debug("Setting up mutation observer", d));
  11063. },
  11064. bind: {
  11065. events: function events() {
  11066. f.debug("Binding delegated events"), C.on(m.on + b, h.trigger, f.event.click);
  11067. }
  11068. },
  11069. event: {
  11070. click: function click() {
  11071. f.toggle.call(this);
  11072. }
  11073. },
  11074. toggle: function toggle(t) {
  11075. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11076. o = n.next(S),
  11077. a = o.hasClass(g.animating),
  11078. r = o.hasClass(g.active),
  11079. s = r && !a,
  11080. l = !r && a;
  11081. 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);
  11082. },
  11083. open: function open(t) {
  11084. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11085. o = n.next(S),
  11086. a = o.hasClass(g.animating);
  11087. 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({
  11088. animation: "fade in",
  11089. queue: !1,
  11090. useFailSafe: !0,
  11091. debug: m.debug,
  11092. verbose: m.verbose,
  11093. duration: m.duration
  11094. }) : o.children().stop(!0, !0).animate({
  11095. opacity: 1
  11096. }, m.duration, f.resetOpacity)), o.slideDown(m.duration, m.easing, function () {
  11097. o.removeClass(g.animating).addClass(g.active), f.reset.display.call(this), m.onOpen.call(this), m.onChange.call(this);
  11098. }));
  11099. },
  11100. close: function close(t) {
  11101. var n = t !== i ? "number" == typeof t ? w.eq(t) : e(t).closest(h.title) : e(this).closest(h.title),
  11102. o = n.next(S),
  11103. a = o.hasClass(g.animating),
  11104. r = o.hasClass(g.active);
  11105. !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({
  11106. animation: "fade out",
  11107. queue: !1,
  11108. useFailSafe: !0,
  11109. debug: m.debug,
  11110. verbose: m.verbose,
  11111. duration: m.duration
  11112. }) : o.children().stop(!0, !0).animate({
  11113. opacity: 0
  11114. }, m.duration, f.resetOpacity)), o.slideUp(m.duration, m.easing, function () {
  11115. o.removeClass(g.animating).removeClass(g.active), f.reset.display.call(this), m.onClose.call(this), m.onChange.call(this);
  11116. }));
  11117. },
  11118. closeOthers: function closeOthers(t) {
  11119. var n,
  11120. o,
  11121. a,
  11122. r = t !== i ? w.eq(t) : e(this).closest(h.title),
  11123. s = r.parents(h.content).prev(h.title),
  11124. l = r.closest(h.accordion),
  11125. c = h.title + "." + g.active + ":visible",
  11126. u = h.content + "." + g.active + ":visible";
  11127. 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({
  11128. animation: "fade out",
  11129. useFailSafe: !0,
  11130. debug: m.debug,
  11131. verbose: m.verbose,
  11132. duration: m.duration
  11133. }) : a.children().stop(!0, !0).animate({
  11134. opacity: 0
  11135. }, m.duration, f.resetOpacity)), a.slideUp(m.duration, m.easing, function () {
  11136. e(this).removeClass(g.active), f.reset.display.call(this);
  11137. }));
  11138. },
  11139. reset: {
  11140. display: function display() {
  11141. f.verbose("Removing inline display from element", this), e(this).css("display", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11142. },
  11143. opacity: function opacity() {
  11144. f.verbose("Removing inline opacity from element", this), e(this).css("opacity", ""), "" === e(this).attr("style") && e(this).attr("style", "").removeAttr("style");
  11145. }
  11146. },
  11147. setting: function setting(t, n) {
  11148. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  11149. if (n === i) return m[t];
  11150. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  11151. }
  11152. },
  11153. internal: function internal(t, n) {
  11154. if (f.debug("Changing internal", t, n), n === i) return f[t];
  11155. e.isPlainObject(t) ? e.extend(!0, f, t) : f[t] = n;
  11156. },
  11157. debug: function debug() {
  11158. !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)));
  11159. },
  11160. verbose: function verbose() {
  11161. !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)));
  11162. },
  11163. error: function error() {
  11164. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  11165. },
  11166. performance: {
  11167. log: function log(e) {
  11168. var t, n;
  11169. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11170. Name: e[0],
  11171. Arguments: [].slice.call(e, 1) || "",
  11172. Element: k,
  11173. "Execution Time": n
  11174. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  11175. },
  11176. display: function display() {
  11177. var t = m.name + ":",
  11178. n = 0;
  11179. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  11180. n += t["Execution Time"];
  11181. }), 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) {
  11182. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11183. }), console.groupEnd()), s = [];
  11184. }
  11185. },
  11186. invoke: function invoke(t, n, a) {
  11187. var r,
  11188. s,
  11189. l,
  11190. c = T;
  11191. 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) {
  11192. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11193. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11194. if (c[a] !== i) return s = c[a], !1;
  11195. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  11196. c = c[o];
  11197. }
  11198. })), 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;
  11199. }
  11200. }, c ? (T === i && f.initialize(), f.invoke(l)) : (T !== i && T.invoke("destroy"), f.initialize());
  11201. }), o !== i ? o : this;
  11202. }, e.fn.accordion.settings = {
  11203. name: "Accordion",
  11204. namespace: "accordion",
  11205. silent: !1,
  11206. debug: !1,
  11207. verbose: !1,
  11208. performance: !0,
  11209. on: "click",
  11210. observeChanges: !0,
  11211. exclusive: !0,
  11212. collapsible: !0,
  11213. closeNested: !1,
  11214. animateChildren: !0,
  11215. duration: 350,
  11216. easing: "easeOutQuad",
  11217. onOpening: function onOpening() {},
  11218. onClosing: function onClosing() {},
  11219. onChanging: function onChanging() {},
  11220. onOpen: function onOpen() {},
  11221. onClose: function onClose() {},
  11222. onChange: function onChange() {},
  11223. error: {
  11224. method: "The method you called is not defined"
  11225. },
  11226. className: {
  11227. active: "active",
  11228. animating: "animating"
  11229. },
  11230. selector: {
  11231. accordion: ".accordion",
  11232. title: ".title",
  11233. trigger: ".title",
  11234. content: ".content"
  11235. }
  11236. }, e.extend(e.easing, {
  11237. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  11238. return -i * (t /= o) * (t - 2) + n;
  11239. }
  11240. });
  11241. }(jQuery, window, document), function (e, t, n, i) {
  11242. "use strict";
  11243. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.checkbox = function (o) {
  11244. var a,
  11245. r = e(this),
  11246. s = r.selector || "",
  11247. l = new Date().getTime(),
  11248. c = [],
  11249. u = arguments[0],
  11250. d = "string" == typeof u,
  11251. f = [].slice.call(arguments, 1);
  11252. return r.each(function () {
  11253. var r,
  11254. m,
  11255. g = e.extend(!0, {}, e.fn.checkbox.settings, o),
  11256. p = g.className,
  11257. h = g.namespace,
  11258. v = g.selector,
  11259. b = g.error,
  11260. y = "." + h,
  11261. x = "module-" + h,
  11262. C = e(this),
  11263. w = e(this).children(v.label),
  11264. S = e(this).children(v.input),
  11265. k = S[0],
  11266. T = !1,
  11267. A = !1,
  11268. R = C.data(x),
  11269. P = this;
  11270. m = {
  11271. initialize: function initialize() {
  11272. m.verbose("Initializing checkbox", g), m.create.label(), m.bind.events(), m.set.tabbable(), m.hide.input(), m.observeChanges(), m.instantiate(), m.setup();
  11273. },
  11274. instantiate: function instantiate() {
  11275. m.verbose("Storing instance of module", m), R = m, C.data(x, m);
  11276. },
  11277. destroy: function destroy() {
  11278. m.verbose("Destroying module"), m.unbind.events(), m.show.input(), C.removeData(x);
  11279. },
  11280. fix: {
  11281. reference: function reference() {
  11282. C.is(v.input) && (m.debug("Behavior called on <input> adjusting invoked element"), C = C.closest(v.checkbox), m.refresh());
  11283. }
  11284. },
  11285. setup: function setup() {
  11286. 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();
  11287. },
  11288. refresh: function refresh() {
  11289. w = C.children(v.label), S = C.children(v.input), k = S[0];
  11290. },
  11291. hide: {
  11292. input: function input() {
  11293. m.verbose("Modifying <input> z-index to be unselectable"), S.addClass(p.hidden);
  11294. }
  11295. },
  11296. show: {
  11297. input: function input() {
  11298. m.verbose("Modifying <input> z-index to be selectable"), S.removeClass(p.hidden);
  11299. }
  11300. },
  11301. observeChanges: function observeChanges() {
  11302. "MutationObserver" in t && ((r = new MutationObserver(function (e) {
  11303. m.debug("DOM tree modified, updating selector cache"), m.refresh();
  11304. })).observe(P, {
  11305. childList: !0,
  11306. subtree: !0
  11307. }), m.debug("Setting up mutation observer", r));
  11308. },
  11309. attachEvents: function attachEvents(t, n) {
  11310. var i = e(t);
  11311. 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);
  11312. },
  11313. event: {
  11314. click: function click(t) {
  11315. var n = e(t.target);
  11316. 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());
  11317. },
  11318. keydown: function keydown(e) {
  11319. var t = e.which,
  11320. n = 13,
  11321. i = 32;
  11322. 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);
  11323. },
  11324. keyup: function keyup(e) {
  11325. A && e.preventDefault();
  11326. }
  11327. },
  11328. check: function check() {
  11329. m.should.allowCheck() && (m.debug("Checking checkbox", S), m.set.checked(), m.should.ignoreCallbacks() || (g.onChecked.call(k), g.onChange.call(k)));
  11330. },
  11331. uncheck: function uncheck() {
  11332. m.should.allowUncheck() && (m.debug("Unchecking checkbox"), m.set.unchecked(), m.should.ignoreCallbacks() || (g.onUnchecked.call(k), g.onChange.call(k)));
  11333. },
  11334. indeterminate: function indeterminate() {
  11335. 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)));
  11336. },
  11337. determinate: function determinate() {
  11338. 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)));
  11339. },
  11340. enable: function enable() {
  11341. m.is.enabled() ? m.debug("Checkbox is already enabled") : (m.debug("Enabling checkbox"), m.set.enabled(), g.onEnable.call(k), g.onEnabled.call(k));
  11342. },
  11343. disable: function disable() {
  11344. m.is.disabled() ? m.debug("Checkbox is already disabled") : (m.debug("Disabling checkbox"), m.set.disabled(), g.onDisable.call(k), g.onDisabled.call(k));
  11345. },
  11346. get: {
  11347. radios: function radios() {
  11348. var t = m.get.name();
  11349. return e('input[name="' + t + '"]').closest(v.checkbox);
  11350. },
  11351. otherRadios: function otherRadios() {
  11352. return m.get.radios().not(C);
  11353. },
  11354. name: function name() {
  11355. return S.attr("name");
  11356. }
  11357. },
  11358. is: {
  11359. initialLoad: function initialLoad() {
  11360. return T;
  11361. },
  11362. radio: function radio() {
  11363. return S.hasClass(p.radio) || "radio" == S.attr("type");
  11364. },
  11365. indeterminate: function indeterminate() {
  11366. return S.prop("indeterminate") !== i && S.prop("indeterminate");
  11367. },
  11368. checked: function checked() {
  11369. return S.prop("checked") !== i && S.prop("checked");
  11370. },
  11371. disabled: function disabled() {
  11372. return S.prop("disabled") !== i && S.prop("disabled");
  11373. },
  11374. enabled: function enabled() {
  11375. return !m.is.disabled();
  11376. },
  11377. determinate: function determinate() {
  11378. return !m.is.indeterminate();
  11379. },
  11380. unchecked: function unchecked() {
  11381. return !m.is.checked();
  11382. }
  11383. },
  11384. should: {
  11385. allowCheck: function allowCheck() {
  11386. 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);
  11387. },
  11388. allowUncheck: function allowUncheck() {
  11389. 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);
  11390. },
  11391. allowIndeterminate: function allowIndeterminate() {
  11392. 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);
  11393. },
  11394. allowDeterminate: function allowDeterminate() {
  11395. 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);
  11396. },
  11397. forceCallbacks: function forceCallbacks() {
  11398. return m.is.initialLoad() && g.fireOnInit;
  11399. },
  11400. ignoreCallbacks: function ignoreCallbacks() {
  11401. return T && !g.fireOnInit;
  11402. }
  11403. },
  11404. can: {
  11405. change: function change() {
  11406. return !(C.hasClass(p.disabled) || C.hasClass(p.readOnly) || S.prop("disabled") || S.prop("readonly"));
  11407. },
  11408. uncheck: function uncheck() {
  11409. return "boolean" == typeof g.uncheckable ? g.uncheckable : !m.is.radio();
  11410. }
  11411. },
  11412. set: {
  11413. initialLoad: function initialLoad() {
  11414. T = !0;
  11415. },
  11416. checked: function checked() {
  11417. 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");
  11418. },
  11419. unchecked: function unchecked() {
  11420. 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");
  11421. },
  11422. indeterminate: function indeterminate() {
  11423. 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());
  11424. },
  11425. determinate: function determinate() {
  11426. 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));
  11427. },
  11428. disabled: function disabled() {
  11429. 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());
  11430. },
  11431. enabled: function enabled() {
  11432. 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());
  11433. },
  11434. tabbable: function tabbable() {
  11435. m.verbose("Adding tabindex to checkbox"), S.attr("tabindex") === i && S.attr("tabindex", 0);
  11436. }
  11437. },
  11438. remove: {
  11439. initialLoad: function initialLoad() {
  11440. T = !1;
  11441. }
  11442. },
  11443. trigger: {
  11444. change: function change() {
  11445. var e = n.createEvent("HTMLEvents"),
  11446. t = S[0];
  11447. t && (m.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  11448. }
  11449. },
  11450. create: {
  11451. label: function label() {
  11452. 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));
  11453. }
  11454. },
  11455. has: {
  11456. label: function label() {
  11457. return w.length > 0;
  11458. }
  11459. },
  11460. bind: {
  11461. events: function events() {
  11462. 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);
  11463. }
  11464. },
  11465. unbind: {
  11466. events: function events() {
  11467. m.debug("Removing events"), C.off(y);
  11468. }
  11469. },
  11470. uncheckOthers: function uncheckOthers() {
  11471. var e = m.get.otherRadios();
  11472. m.debug("Unchecking other radios", e), e.removeClass(p.checked);
  11473. },
  11474. toggle: function toggle() {
  11475. 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");
  11476. },
  11477. setting: function setting(t, n) {
  11478. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11479. if (n === i) return g[t];
  11480. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11481. }
  11482. },
  11483. internal: function internal(t, n) {
  11484. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11485. if (n === i) return m[t];
  11486. m[t] = n;
  11487. }
  11488. },
  11489. debug: function debug() {
  11490. !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)));
  11491. },
  11492. verbose: function verbose() {
  11493. !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)));
  11494. },
  11495. error: function error() {
  11496. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11497. },
  11498. performance: {
  11499. log: function log(e) {
  11500. var t, n;
  11501. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  11502. Name: e[0],
  11503. Arguments: [].slice.call(e, 1) || "",
  11504. Element: P,
  11505. "Execution Time": n
  11506. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11507. },
  11508. display: function display() {
  11509. var t = g.name + ":",
  11510. n = 0;
  11511. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  11512. n += t["Execution Time"];
  11513. }), 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) {
  11514. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11515. }), console.groupEnd()), c = [];
  11516. }
  11517. },
  11518. invoke: function invoke(t, n, o) {
  11519. var r,
  11520. s,
  11521. l,
  11522. c = R;
  11523. 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) {
  11524. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11525. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11526. if (c[a] !== i) return s = c[a], !1;
  11527. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11528. c = c[o];
  11529. }
  11530. })), 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;
  11531. }
  11532. }, d ? (R === i && m.initialize(), m.invoke(u)) : (R !== i && R.invoke("destroy"), m.initialize());
  11533. }), a !== i ? a : this;
  11534. }, e.fn.checkbox.settings = {
  11535. name: "Checkbox",
  11536. namespace: "checkbox",
  11537. silent: !1,
  11538. debug: !1,
  11539. verbose: !0,
  11540. performance: !0,
  11541. uncheckable: "auto",
  11542. fireOnInit: !1,
  11543. onChange: function onChange() {},
  11544. beforeChecked: function beforeChecked() {},
  11545. beforeUnchecked: function beforeUnchecked() {},
  11546. beforeDeterminate: function beforeDeterminate() {},
  11547. beforeIndeterminate: function beforeIndeterminate() {},
  11548. onChecked: function onChecked() {},
  11549. onUnchecked: function onUnchecked() {},
  11550. onDeterminate: function onDeterminate() {},
  11551. onIndeterminate: function onIndeterminate() {},
  11552. onEnable: function onEnable() {},
  11553. onDisable: function onDisable() {},
  11554. onEnabled: function onEnabled() {},
  11555. onDisabled: function onDisabled() {},
  11556. className: {
  11557. checked: "checked",
  11558. indeterminate: "indeterminate",
  11559. disabled: "disabled",
  11560. hidden: "hidden",
  11561. radio: "radio",
  11562. readOnly: "read-only"
  11563. },
  11564. error: {
  11565. method: "The method you called is not defined"
  11566. },
  11567. selector: {
  11568. checkbox: ".ui.checkbox",
  11569. label: "label, .box",
  11570. input: 'input[type="checkbox"], input[type="radio"]',
  11571. link: "a[href]"
  11572. }
  11573. };
  11574. }(jQuery, window, document), function (e, t, n, i) {
  11575. "use strict";
  11576. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dimmer = function (t) {
  11577. var o,
  11578. a = e(this),
  11579. r = new Date().getTime(),
  11580. s = [],
  11581. l = arguments[0],
  11582. c = "string" == typeof l,
  11583. u = [].slice.call(arguments, 1);
  11584. return a.each(function () {
  11585. var d,
  11586. f,
  11587. m,
  11588. g = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.dimmer.settings, t) : e.extend({}, e.fn.dimmer.settings),
  11589. p = g.selector,
  11590. h = g.namespace,
  11591. v = g.className,
  11592. b = g.error,
  11593. y = "." + h,
  11594. x = "module-" + h,
  11595. C = a.selector || "",
  11596. w = "ontouchstart" in n.documentElement ? "touchstart" : "click",
  11597. S = e(this),
  11598. k = this,
  11599. T = S.data(x);
  11600. (m = {
  11601. preinitialize: function preinitialize() {
  11602. 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());
  11603. },
  11604. initialize: function initialize() {
  11605. m.debug("Initializing dimmer", g), m.bind.events(), m.set.dimmable(), m.instantiate();
  11606. },
  11607. instantiate: function instantiate() {
  11608. m.verbose("Storing instance of module", m), T = m, S.data(x, T);
  11609. },
  11610. destroy: function destroy() {
  11611. m.verbose("Destroying previous module", d), m.unbind.events(), m.remove.variation(), f.off(y);
  11612. },
  11613. bind: {
  11614. events: function events() {
  11615. m.is.page() && f.get(0).addEventListener("touchmove", m.event.preventScroll, {
  11616. passive: !1
  11617. }), "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));
  11618. }
  11619. },
  11620. unbind: {
  11621. events: function events() {
  11622. m.is.page() && f.get(0).removeEventListener("touchmove", m.event.preventScroll, {
  11623. passive: !1
  11624. }), S.removeData(x), f.off(y);
  11625. }
  11626. },
  11627. event: {
  11628. click: function click(t) {
  11629. 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());
  11630. },
  11631. preventScroll: function preventScroll(e) {
  11632. e.preventDefault();
  11633. }
  11634. },
  11635. addContent: function addContent(t) {
  11636. var n = e(t);
  11637. m.debug("Add content to dimmer", n), n.parent()[0] !== d[0] && n.detach().appendTo(d);
  11638. },
  11639. create: function create() {
  11640. var t = e(g.template.dimmer());
  11641. return g.dimmerName && (m.debug("Creating named dimmer", g.dimmerName), t.addClass(g.dimmerName)), t.appendTo(f), t;
  11642. },
  11643. show: function show(t) {
  11644. 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));
  11645. },
  11646. hide: function hide(t) {
  11647. 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");
  11648. },
  11649. toggle: function toggle() {
  11650. m.verbose("Toggling dimmer visibility", d), m.is.dimmed() ? m.hide() : m.show();
  11651. },
  11652. animate: {
  11653. show: function show(t) {
  11654. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? ("auto" !== g.opacity && m.set.opacity(), d.transition({
  11655. displayType: "flex",
  11656. animation: g.transition + " in",
  11657. queue: !1,
  11658. duration: m.get.duration(),
  11659. useFailSafe: !0,
  11660. onStart: function onStart() {
  11661. m.set.dimmed();
  11662. },
  11663. onComplete: function onComplete() {
  11664. m.set.active(), t();
  11665. }
  11666. })) : (m.verbose("Showing dimmer animation with javascript"), m.set.dimmed(), "auto" == g.opacity && (g.opacity = .8), d.stop().css({
  11667. opacity: 0,
  11668. width: "100%",
  11669. height: "100%"
  11670. }).fadeTo(m.get.duration(), g.opacity, function () {
  11671. d.removeAttr("style"), m.set.active(), t();
  11672. }));
  11673. },
  11674. hide: function hide(t) {
  11675. t = e.isFunction(t) ? t : function () {}, g.useCSS && e.fn.transition !== i && d.transition("is supported") ? (m.verbose("Hiding dimmer with css"), d.transition({
  11676. displayType: "flex",
  11677. animation: g.transition + " out",
  11678. queue: !1,
  11679. duration: m.get.duration(),
  11680. useFailSafe: !0,
  11681. onStart: function onStart() {
  11682. m.remove.dimmed();
  11683. },
  11684. onComplete: function onComplete() {
  11685. m.remove.active(), t();
  11686. }
  11687. })) : (m.verbose("Hiding dimmer with javascript"), m.remove.dimmed(), d.stop().fadeOut(m.get.duration(), function () {
  11688. m.remove.active(), d.removeAttr("style"), t();
  11689. }));
  11690. }
  11691. },
  11692. get: {
  11693. dimmer: function dimmer() {
  11694. return d;
  11695. },
  11696. duration: function duration() {
  11697. return "object" == _typeof(g.duration) ? m.is.active() ? g.duration.hide : g.duration.show : g.duration;
  11698. }
  11699. },
  11700. has: {
  11701. dimmer: function dimmer() {
  11702. return g.dimmerName ? S.find(p.dimmer).filter("." + g.dimmerName).length > 0 : S.find(p.dimmer).length > 0;
  11703. }
  11704. },
  11705. is: {
  11706. active: function active() {
  11707. return d.hasClass(v.active);
  11708. },
  11709. animating: function animating() {
  11710. return d.is(":animated") || d.hasClass(v.animating);
  11711. },
  11712. closable: function closable() {
  11713. return "auto" == g.closable ? "hover" != g.on : g.closable;
  11714. },
  11715. dimmer: function dimmer() {
  11716. return S.hasClass(v.dimmer);
  11717. },
  11718. dimmable: function dimmable() {
  11719. return S.hasClass(v.dimmable);
  11720. },
  11721. dimmed: function dimmed() {
  11722. return f.hasClass(v.dimmed);
  11723. },
  11724. disabled: function disabled() {
  11725. return f.hasClass(v.disabled);
  11726. },
  11727. enabled: function enabled() {
  11728. return !m.is.disabled();
  11729. },
  11730. page: function page() {
  11731. return f.is("body");
  11732. },
  11733. pageDimmer: function pageDimmer() {
  11734. return d.hasClass(v.pageDimmer);
  11735. }
  11736. },
  11737. can: {
  11738. show: function show() {
  11739. return !d.hasClass(v.disabled);
  11740. }
  11741. },
  11742. set: {
  11743. opacity: function opacity(e) {
  11744. var t = d.css("background-color"),
  11745. n = t.split(","),
  11746. i = n && 3 == n.length,
  11747. o = n && 4 == n.length;
  11748. 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);
  11749. },
  11750. active: function active() {
  11751. d.addClass(v.active);
  11752. },
  11753. dimmable: function dimmable() {
  11754. f.addClass(v.dimmable);
  11755. },
  11756. dimmed: function dimmed() {
  11757. f.addClass(v.dimmed);
  11758. },
  11759. pageDimmer: function pageDimmer() {
  11760. d.addClass(v.pageDimmer);
  11761. },
  11762. disabled: function disabled() {
  11763. d.addClass(v.disabled);
  11764. },
  11765. variation: function variation(e) {
  11766. (e = e || g.variation) && d.addClass(e);
  11767. }
  11768. },
  11769. remove: {
  11770. active: function active() {
  11771. d.removeClass(v.active);
  11772. },
  11773. dimmed: function dimmed() {
  11774. f.removeClass(v.dimmed);
  11775. },
  11776. disabled: function disabled() {
  11777. d.removeClass(v.disabled);
  11778. },
  11779. variation: function variation(e) {
  11780. (e = e || g.variation) && d.removeClass(e);
  11781. }
  11782. },
  11783. setting: function setting(t, n) {
  11784. if (m.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, g, t);else {
  11785. if (n === i) return g[t];
  11786. e.isPlainObject(g[t]) ? e.extend(!0, g[t], n) : g[t] = n;
  11787. }
  11788. },
  11789. internal: function internal(t, n) {
  11790. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  11791. if (n === i) return m[t];
  11792. m[t] = n;
  11793. }
  11794. },
  11795. debug: function debug() {
  11796. !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)));
  11797. },
  11798. verbose: function verbose() {
  11799. !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)));
  11800. },
  11801. error: function error() {
  11802. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  11803. },
  11804. performance: {
  11805. log: function log(e) {
  11806. var t, n;
  11807. g.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  11808. Name: e[0],
  11809. Arguments: [].slice.call(e, 1) || "",
  11810. Element: k,
  11811. "Execution Time": n
  11812. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  11813. },
  11814. display: function display() {
  11815. var t = g.name + ":",
  11816. n = 0;
  11817. r = !1, clearTimeout(m.performance.timer), e.each(s, function (e, t) {
  11818. n += t["Execution Time"];
  11819. }), 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) {
  11820. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  11821. }), console.groupEnd()), s = [];
  11822. }
  11823. },
  11824. invoke: function invoke(t, n, a) {
  11825. var r,
  11826. s,
  11827. l,
  11828. c = T;
  11829. 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) {
  11830. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  11831. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  11832. if (c[a] !== i) return s = c[a], !1;
  11833. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (m.error(b.method, t), !1);
  11834. c = c[o];
  11835. }
  11836. })), 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;
  11837. }
  11838. }).preinitialize(), c ? (T === i && m.initialize(), m.invoke(l)) : (T !== i && T.invoke("destroy"), m.initialize());
  11839. }), o !== i ? o : this;
  11840. }, e.fn.dimmer.settings = {
  11841. name: "Dimmer",
  11842. namespace: "dimmer",
  11843. silent: !1,
  11844. debug: !1,
  11845. verbose: !1,
  11846. performance: !0,
  11847. dimmerName: !1,
  11848. variation: !1,
  11849. closable: "auto",
  11850. useCSS: !0,
  11851. transition: "fade",
  11852. on: !1,
  11853. opacity: "auto",
  11854. duration: {
  11855. show: 500,
  11856. hide: 500
  11857. },
  11858. onChange: function onChange() {},
  11859. onShow: function onShow() {},
  11860. onHide: function onHide() {},
  11861. error: {
  11862. method: "The method you called is not defined."
  11863. },
  11864. className: {
  11865. active: "active",
  11866. animating: "animating",
  11867. dimmable: "dimmable",
  11868. dimmed: "dimmed",
  11869. dimmer: "dimmer",
  11870. disabled: "disabled",
  11871. hide: "hide",
  11872. pageDimmer: "page",
  11873. show: "show"
  11874. },
  11875. selector: {
  11876. dimmer: "> .ui.dimmer",
  11877. content: ".ui.dimmer > .content, .ui.dimmer > .content > .center"
  11878. },
  11879. template: {
  11880. dimmer: function dimmer() {
  11881. return e("<div />").attr("class", "ui dimmer");
  11882. }
  11883. }
  11884. };
  11885. }(jQuery, window, document), function (e, t, n, i) {
  11886. "use strict";
  11887. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.dropdown = function (o) {
  11888. var a,
  11889. r = e(this),
  11890. s = e(n),
  11891. l = r.selector || "",
  11892. c = "ontouchstart" in n.documentElement,
  11893. u = new Date().getTime(),
  11894. d = [],
  11895. f = arguments[0],
  11896. m = "string" == typeof f,
  11897. g = [].slice.call(arguments, 1);
  11898. return r.each(function (p) {
  11899. var h,
  11900. v,
  11901. b,
  11902. y,
  11903. x,
  11904. C,
  11905. w,
  11906. S,
  11907. k = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.dropdown.settings, o) : e.extend({}, e.fn.dropdown.settings),
  11908. T = k.className,
  11909. A = k.message,
  11910. R = k.fields,
  11911. P = k.keys,
  11912. E = k.metadata,
  11913. F = k.namespace,
  11914. O = k.regExp,
  11915. D = k.selector,
  11916. q = k.error,
  11917. j = k.templates,
  11918. z = "." + F,
  11919. I = "module-" + F,
  11920. M = e(this),
  11921. L = e(k.context),
  11922. V = M.find(D.text),
  11923. N = M.find(D.search),
  11924. H = M.find(D.sizer),
  11925. U = M.find(D.input),
  11926. W = M.find(D.icon),
  11927. B = M.prev().find(D.text).length > 0 ? M.prev().find(D.text) : M.prev(),
  11928. Q = M.children(D.menu),
  11929. X = Q.find(D.item),
  11930. $ = !1,
  11931. Y = !1,
  11932. Z = !1,
  11933. K = this,
  11934. J = M.data(I);
  11935. S = {
  11936. initialize: function initialize() {
  11937. 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());
  11938. },
  11939. instantiate: function instantiate() {
  11940. S.verbose("Storing instance of dropdown", S), J = S, M.data(I, S);
  11941. },
  11942. destroy: function destroy() {
  11943. 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();
  11944. },
  11945. observeChanges: function observeChanges() {
  11946. "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());
  11947. },
  11948. disconnect: {
  11949. menuObserver: function menuObserver() {
  11950. w && w.disconnect();
  11951. },
  11952. selectObserver: function selectObserver() {
  11953. C && C.disconnect();
  11954. }
  11955. },
  11956. observe: {
  11957. select: function select() {
  11958. S.has.input() && C.observe(M[0], {
  11959. childList: !0,
  11960. subtree: !0
  11961. });
  11962. },
  11963. menu: function menu() {
  11964. S.has.menu() && w.observe(Q[0], {
  11965. childList: !0,
  11966. subtree: !0
  11967. });
  11968. }
  11969. },
  11970. create: {
  11971. id: function id() {
  11972. x = (Math.random().toString(16) + "000000000").substr(2, 8), y = "." + x, S.verbose("Creating unique id for element", x);
  11973. },
  11974. userChoice: function userChoice(t) {
  11975. var n, o, a;
  11976. return !!(t = t || S.get.userValues()) && (t = e.isArray(t) ? t : [t], e.each(t, function (t, r) {
  11977. !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));
  11978. }), n);
  11979. },
  11980. userLabels: function userLabels(t) {
  11981. var n = S.get.userValues();
  11982. n && (S.debug("Adding user labels", n), e.each(n, function (e, t) {
  11983. S.verbose("Adding custom user value"), S.add.label(t, t);
  11984. }));
  11985. },
  11986. menu: function menu() {
  11987. Q = e("<div />").addClass(T.menu).appendTo(M);
  11988. },
  11989. sizer: function sizer() {
  11990. H = e("<span />").addClass(T.sizer).insertAfter(N);
  11991. }
  11992. },
  11993. search: function search(e) {
  11994. e = e !== i ? e : S.get.query(), S.verbose("Searching for query", e), S.has.minCharacters(e) ? S.filter(e) : S.hide();
  11995. },
  11996. select: {
  11997. firstUnfiltered: function firstUnfiltered() {
  11998. S.verbose("Selecting first non-filtered element"), S.remove.selectedItem(), X.not(D.unselectable).not(D.addition + D.hidden).eq(0).addClass(T.selected);
  11999. },
  12000. nextAvailable: function nextAvailable(e) {
  12001. var t = (e = e.eq(0)).nextAll(D.item).not(D.unselectable).eq(0),
  12002. n = e.prevAll(D.item).not(D.unselectable).eq(0);
  12003. t.length > 0 ? (S.verbose("Moving selection to", t), t.addClass(T.selected)) : (S.verbose("Moving selection to", n), n.addClass(T.selected));
  12004. }
  12005. },
  12006. setup: {
  12007. api: function api() {
  12008. var e = {
  12009. debug: k.debug,
  12010. urlData: {
  12011. value: S.get.value(),
  12012. query: S.get.query()
  12013. },
  12014. on: !1
  12015. };
  12016. S.verbose("First request, initializing API"), M.api(e);
  12017. },
  12018. layout: function layout() {
  12019. 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();
  12020. },
  12021. select: function select() {
  12022. var t = S.get.selectValues();
  12023. 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();
  12024. },
  12025. menu: function menu(e) {
  12026. Q.html(j.menu(e, R)), X = Q.find(D.item);
  12027. },
  12028. reference: function reference() {
  12029. 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();
  12030. },
  12031. returnedObject: function returnedObject() {
  12032. var e = r.slice(0, p),
  12033. t = r.slice(p + 1);
  12034. r = e.add(M).add(t);
  12035. }
  12036. },
  12037. refresh: function refresh() {
  12038. S.refreshSelectors(), S.refreshData();
  12039. },
  12040. refreshItems: function refreshItems() {
  12041. X = Q.find(D.item);
  12042. },
  12043. refreshSelectors: function refreshSelectors() {
  12044. 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);
  12045. },
  12046. refreshData: function refreshData() {
  12047. S.verbose("Refreshing cached metadata"), X.removeData(E.text).removeData(E.value);
  12048. },
  12049. clearData: function clearData() {
  12050. S.verbose("Clearing metadata"), X.removeData(E.text).removeData(E.value), M.removeData(E.defaultText).removeData(E.defaultValue).removeData(E.placeholderText);
  12051. },
  12052. toggle: function toggle() {
  12053. S.verbose("Toggling menu visibility"), S.is.active() ? S.hide() : S.show();
  12054. },
  12055. show: function show(t) {
  12056. 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()) {
  12057. if (S.debug("Showing dropdown"), !S.has.message() || S.has.maxSelections() || S.has.allResultsFiltered() || S.remove.message(), S.is.allFiltered()) return !0;
  12058. !1 !== k.onShow.call(K) && S.animate.show(function () {
  12059. S.can.click() && S.bind.intent(), S.has.menuSearch() && S.focusSearch(), S.set.visible(), t.call(K);
  12060. });
  12061. }
  12062. },
  12063. hide: function hide(t) {
  12064. 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 () {
  12065. S.remove.visible(), t.call(K);
  12066. }));
  12067. },
  12068. hideOthers: function hideOthers() {
  12069. S.verbose("Finding other dropdowns to hide"), r.not(M).has(D.menu + "." + T.visible).dropdown("hide");
  12070. },
  12071. hideMenu: function hideMenu() {
  12072. S.verbose("Hiding menu instantaneously"), S.remove.active(), S.remove.visible(), Q.transition("hide");
  12073. },
  12074. hideSubMenus: function hideSubMenus() {
  12075. var e = Q.children(D.item).find(D.menu);
  12076. S.verbose("Hiding sub menus", e), e.transition("hide");
  12077. },
  12078. bind: {
  12079. events: function events() {
  12080. c && S.bind.touchEvents(), S.bind.keyboardEvents(), S.bind.inputEvents(), S.bind.mouseEvents();
  12081. },
  12082. touchEvents: function touchEvents() {
  12083. 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);
  12084. },
  12085. keyboardEvents: function keyboardEvents() {
  12086. 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);
  12087. },
  12088. inputEvents: function inputEvents() {
  12089. S.verbose("Binding input change events"), M.on("change" + z, D.input, S.event.change);
  12090. },
  12091. mouseEvents: function mouseEvents() {
  12092. 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);
  12093. },
  12094. intent: function intent() {
  12095. 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);
  12096. }
  12097. },
  12098. unbind: {
  12099. intent: function intent() {
  12100. S.verbose("Removing hide intent event from document"), c && s.off("touchstart" + y).off("touchmove" + y), s.off("click" + y);
  12101. }
  12102. },
  12103. filter: function filter(e) {
  12104. var t = e !== i ? e : S.get.query(),
  12105. n = function n() {
  12106. 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();
  12107. };
  12108. k.useLabels && S.has.maxSelections() || (k.apiSettings ? S.can.useAPI() ? S.queryRemote(t, function () {
  12109. k.filterRemoteData && S.filterItems(t), n();
  12110. }) : S.error(q.noAPI) : (S.filterItems(t), n()));
  12111. },
  12112. queryRemote: function queryRemote(t, n) {
  12113. var i = {
  12114. errorDuration: !1,
  12115. cache: "local",
  12116. throttle: k.throttle,
  12117. urlData: {
  12118. query: t
  12119. },
  12120. onError: function onError() {
  12121. S.add.message(A.serverError), n();
  12122. },
  12123. onFailure: function onFailure() {
  12124. S.add.message(A.serverError), n();
  12125. },
  12126. onSuccess: function onSuccess(t) {
  12127. var i = t[R.remoteValues];
  12128. e.isArray(i) && i.length > 0 ? (S.remove.message(), S.setup.menu({
  12129. values: t[R.remoteValues]
  12130. })) : S.add.message(A.noResults), n();
  12131. }
  12132. };
  12133. M.api("get request") || S.setup.api(), i = e.extend(!0, {}, i, k.apiSettings), M.api("setting", i).api("query");
  12134. },
  12135. filterItems: function filterItems(t) {
  12136. var n = t !== i ? t : S.get.query(),
  12137. o = null,
  12138. a = S.escape.string(n),
  12139. r = new RegExp("^" + a, "igm");
  12140. S.has.query() && (o = [], S.verbose("Searching for matching values", n), X.each(function () {
  12141. var t,
  12142. i,
  12143. a = e(this);
  12144. if ("both" == k.match || "text" == k.match) {
  12145. if (-1 !== (t = String(S.get.choiceText(a, !1))).search(r)) return o.push(this), !0;
  12146. if ("exact" === k.fullTextSearch && S.exactSearch(n, t)) return o.push(this), !0;
  12147. if (!0 === k.fullTextSearch && S.fuzzySearch(n, t)) return o.push(this), !0;
  12148. }
  12149. if ("both" == k.match || "value" == k.match) {
  12150. if (-1 !== (i = String(S.get.choiceValue(a, t))).search(r)) return o.push(this), !0;
  12151. if ("exact" === k.fullTextSearch && S.exactSearch(n, i)) return o.push(this), !0;
  12152. if (!0 === k.fullTextSearch && S.fuzzySearch(n, i)) return o.push(this), !0;
  12153. }
  12154. })), S.debug("Showing only matched items", n), S.remove.filteredItem(), o && X.not(o).addClass(T.filtered);
  12155. },
  12156. fuzzySearch: function fuzzySearch(e, t) {
  12157. var n = t.length,
  12158. i = e.length;
  12159. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  12160. if (i === n) return e === t;
  12161. e: for (var o = 0, a = 0; o < i; o++) {
  12162. for (var r = e.charCodeAt(o); a < n;) {
  12163. if (t.charCodeAt(a++) === r) continue e;
  12164. }
  12165. return !1;
  12166. }
  12167. return !0;
  12168. },
  12169. exactSearch: function exactSearch(e, t) {
  12170. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  12171. },
  12172. filterActive: function filterActive() {
  12173. k.useLabels && X.filter("." + T.active).addClass(T.filtered);
  12174. },
  12175. focusSearch: function focusSearch(e) {
  12176. 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());
  12177. },
  12178. forceSelection: function forceSelection() {
  12179. var e = X.not(T.filtered).filter("." + T.selected).eq(0),
  12180. t = X.not(T.filtered).filter("." + T.active).eq(0),
  12181. n = e.length > 0 ? e : t;
  12182. 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);
  12183. k.allowAdditions ? (S.set.selected(S.get.query()), S.remove.searchTerm()) : S.remove.searchTerm();
  12184. },
  12185. change: {
  12186. values: function values(t) {
  12187. k.allowAdditions || S.clear(), S.debug("Creating dropdown with specified values", t), S.setup.menu({
  12188. values: t
  12189. }), e.each(t, function (e, t) {
  12190. if (1 == t.selected) return S.debug("Setting initial selection to", t.value), S.set.selected(t.value), !0;
  12191. });
  12192. }
  12193. },
  12194. event: {
  12195. change: function change() {
  12196. Z || (S.debug("Input changed, updating selection"), S.set.selected());
  12197. },
  12198. focus: function focus() {
  12199. k.showOnFocus && !$ && S.is.hidden() && !v && S.show();
  12200. },
  12201. blur: function blur(e) {
  12202. v = n.activeElement === this, $ || v || (S.remove.activeLabel(), S.hide());
  12203. },
  12204. mousedown: function mousedown() {
  12205. S.is.searchSelection() ? b = !0 : $ = !0;
  12206. },
  12207. mouseup: function mouseup() {
  12208. S.is.searchSelection() ? b = !1 : $ = !1;
  12209. },
  12210. click: function click(t) {
  12211. e(t.target).is(M) && (S.is.focusedOnSearch() ? S.show() : S.focusSearch());
  12212. },
  12213. search: {
  12214. focus: function focus() {
  12215. $ = !0, S.is.multiple() && S.remove.activeLabel(), k.showOnFocus && S.search();
  12216. },
  12217. blur: function blur(e) {
  12218. v = n.activeElement === this, S.is.searchSelection() && !b && (Y || v || (k.forceSelection && S.forceSelection(), S.hide())), b = !1;
  12219. }
  12220. },
  12221. icon: {
  12222. click: function click(e) {
  12223. S.toggle();
  12224. }
  12225. },
  12226. text: {
  12227. focus: function focus(e) {
  12228. $ = !0, S.focusSearch();
  12229. }
  12230. },
  12231. input: function input(e) {
  12232. (S.is.multiple() || S.is.searchSelection()) && S.set.filtered(), clearTimeout(S.timer), S.timer = setTimeout(S.search, k.delay.search);
  12233. },
  12234. label: {
  12235. click: function click(t) {
  12236. var n = e(this),
  12237. i = M.find(D.label),
  12238. o = i.filter("." + T.active),
  12239. a = n.nextAll("." + T.active),
  12240. r = n.prevAll("." + T.active),
  12241. s = a.length > 0 ? n.nextUntil(a).add(o).add(n) : n.prevUntil(r).add(o).add(n);
  12242. 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));
  12243. }
  12244. },
  12245. remove: {
  12246. click: function click() {
  12247. var t = e(this).parent();
  12248. t.hasClass(T.active) ? S.remove.activeLabels() : S.remove.activeLabels(t);
  12249. }
  12250. },
  12251. test: {
  12252. toggle: function toggle(e) {
  12253. var t = S.is.multiple() ? S.show : S.toggle;
  12254. S.is.bubbledLabelClick(e) || S.is.bubbledIconClick(e) || S.determine.eventOnElement(e, t) && e.preventDefault();
  12255. },
  12256. touch: function touch(e) {
  12257. S.determine.eventOnElement(e, function () {
  12258. "touchstart" == e.type ? S.timer = setTimeout(function () {
  12259. S.hide();
  12260. }, k.delay.touch) : "touchmove" == e.type && clearTimeout(S.timer);
  12261. }), e.stopPropagation();
  12262. },
  12263. hide: function hide(e) {
  12264. S.determine.eventInModule(e, S.hide);
  12265. }
  12266. },
  12267. select: {
  12268. mutation: function mutation(t) {
  12269. S.debug("<select> modified, recreating menu");
  12270. var n = !1;
  12271. e.each(t, function (t, i) {
  12272. if (e(i.target).is("select") || e(i.addedNodes).is("select")) return n = !0, !0;
  12273. }), n && (S.disconnect.selectObserver(), S.refresh(), S.setup.select(), S.set.selected(), S.observe.select());
  12274. }
  12275. },
  12276. menu: {
  12277. mutation: function mutation(t) {
  12278. var n = t[0],
  12279. i = n.addedNodes ? e(n.addedNodes[0]) : e(!1),
  12280. o = n.removedNodes ? e(n.removedNodes[0]) : e(!1),
  12281. a = i.add(o),
  12282. r = a.is(D.addition) || a.closest(D.addition).length > 0,
  12283. s = a.is(D.message) || a.closest(D.message).length > 0;
  12284. r || s ? (S.debug("Updating item selector cache"), S.refreshItems()) : (S.debug("Menu modified, updating selector cache"), S.refresh());
  12285. },
  12286. mousedown: function mousedown() {
  12287. Y = !0;
  12288. },
  12289. mouseup: function mouseup() {
  12290. Y = !1;
  12291. }
  12292. },
  12293. item: {
  12294. mouseenter: function mouseenter(t) {
  12295. var n = e(t.target),
  12296. i = e(this),
  12297. o = i.children(D.menu),
  12298. a = i.siblings(D.item).children(D.menu),
  12299. r = o.length > 0;
  12300. !(o.find(n).length > 0) && r && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12301. S.verbose("Showing sub-menu", o), e.each(a, function () {
  12302. S.animate.hide(!1, e(this));
  12303. }), S.animate.show(!1, o);
  12304. }, k.delay.show), t.preventDefault());
  12305. },
  12306. mouseleave: function mouseleave(t) {
  12307. var n = e(this).children(D.menu);
  12308. n.length > 0 && (clearTimeout(S.itemTimer), S.itemTimer = setTimeout(function () {
  12309. S.verbose("Hiding sub-menu", n), S.animate.hide(!1, n);
  12310. }, k.delay.hide));
  12311. },
  12312. click: function click(t, i) {
  12313. var o = e(this),
  12314. a = e(t ? t.target : ""),
  12315. r = o.find(D.menu),
  12316. s = S.get.choiceText(o),
  12317. l = S.get.choiceValue(o, s),
  12318. c = r.length > 0,
  12319. u = r.find(a).length > 0;
  12320. 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));
  12321. }
  12322. },
  12323. document: {
  12324. keydown: function keydown(e) {
  12325. var t = e.which;
  12326. if (S.is.inObject(t, P)) {
  12327. var n = M.find(D.label),
  12328. i = n.filter("." + T.active),
  12329. o = (i.data(E.value), n.index(i)),
  12330. a = n.length,
  12331. r = i.length > 0,
  12332. s = i.length > 1,
  12333. l = 0 === o,
  12334. c = o + 1 == a,
  12335. u = S.is.searchSelection(),
  12336. d = S.is.focusedOnSearch(),
  12337. f = S.is.focused(),
  12338. m = d && 0 === S.get.caretPosition();
  12339. if (u && !r && !d) return;
  12340. 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);
  12341. }
  12342. }
  12343. },
  12344. keydown: function keydown(e) {
  12345. var t = e.which;
  12346. if (S.is.inObject(t, P)) {
  12347. var n,
  12348. i = X.not(D.unselectable).filter("." + T.selected).eq(0),
  12349. o = Q.children("." + T.active).eq(0),
  12350. a = i.length > 0 ? i : o,
  12351. r = a.length > 0 ? a.siblings(":not(." + T.filtered + ")").addBack() : Q.children(":not(." + T.filtered + ")"),
  12352. s = a.children(D.menu),
  12353. l = a.closest(D.menu),
  12354. c = l.hasClass(T.visible) || l.hasClass(T.animating) || l.parent(D.menu).length > 0,
  12355. u = s.length > 0,
  12356. d = a.length > 0,
  12357. f = a.not(D.unselectable).length > 0,
  12358. m = t == P.delimiter && k.allowAdditions && S.is.multiple();
  12359. 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()) {
  12360. 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) {
  12361. 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();
  12362. 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();
  12363. }
  12364. if (t == P.downArrow) {
  12365. 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();
  12366. 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();
  12367. }
  12368. 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());
  12369. } else m && e.preventDefault(), t != P.downArrow || S.is.visible() || (S.verbose("Down key pressed, showing dropdown"), S.show(), e.preventDefault());
  12370. } else S.has.search() || S.set.selectedLetter(String.fromCharCode(t));
  12371. }
  12372. },
  12373. trigger: {
  12374. change: function change() {
  12375. var e = n.createEvent("HTMLEvents"),
  12376. t = U[0];
  12377. t && (S.verbose("Triggering native change event"), e.initEvent("change", !0, !1), t.dispatchEvent(e));
  12378. }
  12379. },
  12380. determine: {
  12381. selectAction: function selectAction(t, n) {
  12382. 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);
  12383. },
  12384. eventInModule: function eventInModule(t, i) {
  12385. var o = e(t.target),
  12386. a = o.closest(n.documentElement).length > 0,
  12387. r = o.closest(M).length > 0;
  12388. 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);
  12389. },
  12390. eventOnElement: function eventOnElement(t, i) {
  12391. var o = e(t.target),
  12392. a = o.closest(D.siblingLabel),
  12393. r = n.body.contains(t.target),
  12394. s = 0 === M.find(a).length,
  12395. l = 0 === o.closest(Q).length;
  12396. 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);
  12397. }
  12398. },
  12399. action: {
  12400. nothing: function nothing() {},
  12401. activate: function activate(t, n, o) {
  12402. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12403. if (S.set.selected(n, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12404. S.hideAndClear();
  12405. }
  12406. },
  12407. select: function select(t, n, o) {
  12408. if (n = n !== i ? n : t, S.can.activate(e(o))) {
  12409. if (S.set.value(n, t, e(o)), S.is.multiple() && !S.is.allFiltered()) return;
  12410. S.hideAndClear();
  12411. }
  12412. },
  12413. combo: function combo(t, n, o) {
  12414. n = n !== i ? n : t, S.set.selected(n, e(o)), S.hideAndClear();
  12415. },
  12416. hide: function hide(e, t, n) {
  12417. S.set.value(t, e), S.hideAndClear();
  12418. }
  12419. },
  12420. get: {
  12421. id: function id() {
  12422. return x;
  12423. },
  12424. defaultText: function defaultText() {
  12425. return M.data(E.defaultText);
  12426. },
  12427. defaultValue: function defaultValue() {
  12428. return M.data(E.defaultValue);
  12429. },
  12430. placeholderText: function placeholderText() {
  12431. return "auto" != k.placeholder && "string" == typeof k.placeholder ? k.placeholder : M.data(E.placeholderText) || "";
  12432. },
  12433. text: function text() {
  12434. return V.text();
  12435. },
  12436. query: function query() {
  12437. return e.trim(N.val());
  12438. },
  12439. searchWidth: function searchWidth(e) {
  12440. return e = e !== i ? e : N.val(), H.text(e), Math.ceil(H.width() + 1);
  12441. },
  12442. selectionCount: function selectionCount() {
  12443. var t = S.get.values();
  12444. return S.is.multiple() ? e.isArray(t) ? t.length : 0 : "" !== S.get.value() ? 1 : 0;
  12445. },
  12446. transition: function transition(e) {
  12447. return "auto" == k.transition ? S.is.upward(e) ? "slide up" : "slide down" : k.transition;
  12448. },
  12449. userValues: function userValues() {
  12450. var t = S.get.values();
  12451. return !!t && (t = e.isArray(t) ? t : [t], e.grep(t, function (e) {
  12452. return !1 === S.get.item(e);
  12453. }));
  12454. },
  12455. uniqueArray: function uniqueArray(t) {
  12456. return e.grep(t, function (n, i) {
  12457. return e.inArray(n, t) === i;
  12458. });
  12459. },
  12460. caretPosition: function caretPosition() {
  12461. var e,
  12462. t,
  12463. i = N.get(0);
  12464. 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;
  12465. },
  12466. value: function value() {
  12467. var t = U.length > 0 ? U.val() : M.data(E.value),
  12468. n = e.isArray(t) && 1 === t.length && "" === t[0];
  12469. return t === i || n ? "" : t;
  12470. },
  12471. values: function values() {
  12472. var e = S.get.value();
  12473. return "" === e ? "" : !S.has.selectInput() && S.is.multiple() ? "string" == typeof e ? e.split(k.delimiter) : "" : e;
  12474. },
  12475. remoteValues: function remoteValues() {
  12476. var t = S.get.values(),
  12477. n = !1;
  12478. return t && ("string" == typeof t && (t = [t]), e.each(t, function (e, t) {
  12479. var i = S.read.remoteData(t);
  12480. S.verbose("Restoring value from session data", i, t), i && (n || (n = {}), n[t] = i);
  12481. })), n;
  12482. },
  12483. choiceText: function choiceText(t, n) {
  12484. 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());
  12485. },
  12486. choiceValue: function choiceValue(t, n) {
  12487. 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));
  12488. },
  12489. inputEvent: function inputEvent() {
  12490. var e = N[0];
  12491. return !!e && (e.oninput !== i ? "input" : e.onpropertychange !== i ? "propertychange" : "keyup");
  12492. },
  12493. selectValues: function selectValues() {
  12494. var t = {
  12495. values: []
  12496. };
  12497. return M.find("option").each(function () {
  12498. var n = e(this),
  12499. o = n.html(),
  12500. a = n.attr("disabled"),
  12501. r = n.attr("value") !== i ? n.attr("value") : o;
  12502. "auto" === k.placeholder && "" === r ? t.placeholder = o : t.values.push({
  12503. name: o,
  12504. value: r,
  12505. disabled: a
  12506. });
  12507. }), 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) {
  12508. return e.name > t.name ? 1 : -1;
  12509. }), S.debug("Retrieved and sorted values from select", t)) : S.debug("Retrieved values from select", t), t;
  12510. },
  12511. activeItem: function activeItem() {
  12512. return X.filter("." + T.active);
  12513. },
  12514. selectedItem: function selectedItem() {
  12515. var e = X.not(D.unselectable).filter("." + T.selected);
  12516. return e.length > 0 ? e : X.eq(0);
  12517. },
  12518. itemWithAdditions: function itemWithAdditions(e) {
  12519. var t = S.get.item(e),
  12520. n = S.create.userChoice(e);
  12521. return n && n.length > 0 && (t = t.length > 0 ? t.add(n) : n), t;
  12522. },
  12523. item: function item(t, n) {
  12524. var o,
  12525. a,
  12526. r = !1;
  12527. 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 () {
  12528. var o = e(this),
  12529. s = S.get.choiceText(o),
  12530. l = S.get.choiceValue(o, s);
  12531. 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) {
  12532. if (S.verbose("Ambiguous dropdown value using strict type check", o, t), l === t || s === t) return r = o, !0;
  12533. } else if (String(l) == String(t) || s == t) return S.verbose("Found select item by value", l, t), r = o, !0;
  12534. }), r;
  12535. }
  12536. },
  12537. check: {
  12538. maxSelections: function maxSelections(e) {
  12539. 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));
  12540. }
  12541. },
  12542. restore: {
  12543. defaults: function defaults() {
  12544. S.clear(), S.restore.defaultText(), S.restore.defaultValue();
  12545. },
  12546. defaultText: function defaultText() {
  12547. var e = S.get.defaultText();
  12548. 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));
  12549. },
  12550. placeholderText: function placeholderText() {
  12551. S.set.placeholderText();
  12552. },
  12553. defaultValue: function defaultValue() {
  12554. var e = S.get.defaultValue();
  12555. e !== i && (S.debug("Restoring default value", e), "" !== e ? (S.set.value(e), S.set.selected()) : (S.remove.activeItem(), S.remove.selectedItem()));
  12556. },
  12557. labels: function labels() {
  12558. k.allowAdditions && (k.useLabels || (S.error(q.labels), k.useLabels = !0), S.debug("Restoring selected values"), S.create.userLabels()), S.check.maxSelections();
  12559. },
  12560. selected: function selected() {
  12561. S.restore.values(), S.is.multiple() ? (S.debug("Restoring previously selected values and labels"), S.restore.labels()) : S.debug("Restoring previously selected values");
  12562. },
  12563. values: function values() {
  12564. S.set.initialLoad(), k.apiSettings && k.saveRemoteData && S.get.remoteValues() ? S.restore.remoteValues() : S.set.selected(), S.remove.initialLoad();
  12565. },
  12566. remoteValues: function remoteValues() {
  12567. var t = S.get.remoteValues();
  12568. S.debug("Recreating selected from session data", t), t && (S.is.single() ? e.each(t, function (e, t) {
  12569. S.set.text(t);
  12570. }) : e.each(t, function (e, t) {
  12571. S.add.label(e, t);
  12572. }));
  12573. }
  12574. },
  12575. read: {
  12576. remoteData: function remoteData(e) {
  12577. var n;
  12578. if (t.Storage !== i) return (n = sessionStorage.getItem(e)) !== i && n;
  12579. S.error(q.noStorage);
  12580. }
  12581. },
  12582. save: {
  12583. defaults: function defaults() {
  12584. S.save.defaultText(), S.save.placeholderText(), S.save.defaultValue();
  12585. },
  12586. defaultValue: function defaultValue() {
  12587. var e = S.get.value();
  12588. S.verbose("Saving default value as", e), M.data(E.defaultValue, e);
  12589. },
  12590. defaultText: function defaultText() {
  12591. var e = S.get.text();
  12592. S.verbose("Saving default text as", e), M.data(E.defaultText, e);
  12593. },
  12594. placeholderText: function placeholderText() {
  12595. var e;
  12596. !1 !== k.placeholder && V.hasClass(T.placeholder) && (e = S.get.text(), S.verbose("Saving placeholder text as", e), M.data(E.placeholderText, e));
  12597. },
  12598. remoteData: function remoteData(e, n) {
  12599. t.Storage !== i ? (S.verbose("Saving remote data to session storage", n, e), sessionStorage.setItem(n, e)) : S.error(q.noStorage);
  12600. }
  12601. },
  12602. clear: function clear() {
  12603. S.is.multiple() && k.useLabels ? S.remove.labels() : (S.remove.activeItem(), S.remove.selectedItem()), S.set.placeholderText(), S.clearValue();
  12604. },
  12605. clearValue: function clearValue() {
  12606. S.set.value("");
  12607. },
  12608. scrollPage: function scrollPage(e, t) {
  12609. var n,
  12610. i,
  12611. o = t || S.get.selectedItem(),
  12612. a = o.closest(D.menu),
  12613. r = a.outerHeight(),
  12614. s = a.scrollTop(),
  12615. l = X.eq(0).outerHeight(),
  12616. c = Math.floor(r / l),
  12617. u = (a.prop("scrollHeight"), "up" == e ? s - l * c : s + l * c),
  12618. d = X.not(D.unselectable);
  12619. 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));
  12620. },
  12621. set: {
  12622. filtered: function filtered() {
  12623. var e = S.is.multiple(),
  12624. t = S.is.searchSelection(),
  12625. n = e && t,
  12626. i = t ? S.get.query() : "",
  12627. o = "string" == typeof i && i.length > 0,
  12628. a = S.get.searchWidth(),
  12629. r = "" !== i;
  12630. 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));
  12631. },
  12632. empty: function empty() {
  12633. M.addClass(T.empty);
  12634. },
  12635. loading: function loading() {
  12636. M.addClass(T.loading);
  12637. },
  12638. placeholderText: function placeholderText(e) {
  12639. e = e || S.get.placeholderText(), S.debug("Setting placeholder text", e), S.set.text(e), V.addClass(T.placeholder);
  12640. },
  12641. tabbable: function tabbable() {
  12642. 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)));
  12643. },
  12644. initialLoad: function initialLoad() {
  12645. S.verbose("Setting initial load"), h = !0;
  12646. },
  12647. activeItem: function activeItem(e) {
  12648. k.allowAdditions && e.filter(D.addition).length > 0 ? e.addClass(T.filtered) : e.addClass(T.active);
  12649. },
  12650. partialSearch: function partialSearch(e) {
  12651. var t = S.get.query().length;
  12652. N.val(e.substr(0, t));
  12653. },
  12654. scrollPosition: function scrollPosition(e, t) {
  12655. var n, o, a, r, s, l;
  12656. 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));
  12657. },
  12658. text: function text(e) {
  12659. "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)));
  12660. },
  12661. selectedItem: function selectedItem(e) {
  12662. var t = S.get.choiceValue(e),
  12663. n = S.get.choiceText(e, !1),
  12664. i = S.get.choiceText(e, !0);
  12665. 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);
  12666. },
  12667. selectedLetter: function selectedLetter(t) {
  12668. var n,
  12669. i = X.filter("." + T.selected),
  12670. o = !1;
  12671. 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 () {
  12672. if (S.has.firstLetter(e(this), t)) return o = e(this), !1;
  12673. }), 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));
  12674. },
  12675. direction: function direction(e) {
  12676. "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);
  12677. },
  12678. upward: function upward(e) {
  12679. (e || M).addClass(T.upward);
  12680. },
  12681. leftward: function leftward(e) {
  12682. (e || Q).addClass(T.leftward);
  12683. },
  12684. value: function value(e, t, n) {
  12685. var o = S.escape.value(e),
  12686. a = U.length > 0,
  12687. r = S.get.values(),
  12688. s = e !== i ? String(e) : e;
  12689. if (a) {
  12690. if (!k.allowReselection && s == r && (S.verbose("Skipping value update already same value", e, r), !S.is.initialLoad())) return;
  12691. 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;
  12692. } else S.verbose("Storing value in metadata", o, U), o !== r && M.data(E.value, s);
  12693. !1 === k.fireOnInit && S.is.initialLoad() ? S.verbose("No callback on initial load", k.onChange) : k.onChange.call(K, e, t, n);
  12694. },
  12695. active: function active() {
  12696. M.addClass(T.active);
  12697. },
  12698. multiple: function multiple() {
  12699. M.addClass(T.multiple);
  12700. },
  12701. visible: function visible() {
  12702. M.addClass(T.visible);
  12703. },
  12704. exactly: function exactly(e, t) {
  12705. S.debug("Setting selected to exact values"), S.clear(), S.set.selected(e, t);
  12706. },
  12707. selected: function selected(t, n) {
  12708. var i = S.is.multiple();
  12709. (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 () {
  12710. var t = e(this),
  12711. o = S.get.choiceText(t),
  12712. a = S.get.choiceValue(t, o),
  12713. r = t.hasClass(T.filtered),
  12714. s = t.hasClass(T.active),
  12715. l = t.hasClass(T.addition),
  12716. c = i && 1 == n.length;
  12717. 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));
  12718. }));
  12719. }
  12720. },
  12721. add: {
  12722. label: function label(t, n, i) {
  12723. var o,
  12724. a = S.is.searchSelection() ? N : V,
  12725. r = S.escape.value(t);
  12726. 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)));
  12727. },
  12728. message: function message(t) {
  12729. var n = Q.children(D.message),
  12730. i = k.templates.message(S.add.variables(t));
  12731. n.length > 0 ? n.html(i) : n = e("<div/>").html(i).addClass(T.message).appendTo(Q);
  12732. },
  12733. optionValue: function optionValue(t) {
  12734. var n = S.escape.value(t);
  12735. 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());
  12736. },
  12737. userSuggestion: function userSuggestion(e) {
  12738. var t,
  12739. n = Q.children(D.addition),
  12740. i = S.get.item(e),
  12741. o = i && i.not(D.addition).length,
  12742. a = n.length > 0;
  12743. 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()));
  12744. },
  12745. variables: function variables(e, t) {
  12746. var n,
  12747. i,
  12748. o = -1 !== e.search("{count}"),
  12749. a = -1 !== e.search("{maxCount}"),
  12750. r = -1 !== e.search("{term}");
  12751. 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;
  12752. },
  12753. value: function value(t, n, i) {
  12754. var o,
  12755. a = S.get.values();
  12756. 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");
  12757. }
  12758. },
  12759. remove: {
  12760. active: function active() {
  12761. M.removeClass(T.active);
  12762. },
  12763. activeLabel: function activeLabel() {
  12764. M.find(D.label).removeClass(T.active);
  12765. },
  12766. empty: function empty() {
  12767. M.removeClass(T.empty);
  12768. },
  12769. loading: function loading() {
  12770. M.removeClass(T.loading);
  12771. },
  12772. initialLoad: function initialLoad() {
  12773. h = !1;
  12774. },
  12775. upward: function upward(e) {
  12776. (e || M).removeClass(T.upward);
  12777. },
  12778. leftward: function leftward(e) {
  12779. (e || Q).removeClass(T.leftward);
  12780. },
  12781. visible: function visible() {
  12782. M.removeClass(T.visible);
  12783. },
  12784. activeItem: function activeItem() {
  12785. X.removeClass(T.active);
  12786. },
  12787. filteredItem: function filteredItem() {
  12788. k.useLabels && S.has.maxSelections() || (k.useLabels && S.is.multiple() ? X.not("." + T.active).removeClass(T.filtered) : X.removeClass(T.filtered), S.remove.empty());
  12789. },
  12790. optionValue: function optionValue(e) {
  12791. var t = S.escape.value(e),
  12792. n = U.find('option[value="' + S.escape.string(t) + '"]');
  12793. 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], {
  12794. childList: !0,
  12795. subtree: !0
  12796. }));
  12797. },
  12798. message: function message() {
  12799. Q.children(D.message).remove();
  12800. },
  12801. searchWidth: function searchWidth() {
  12802. N.css("width", "");
  12803. },
  12804. searchTerm: function searchTerm() {
  12805. S.verbose("Cleared search term"), N.val(""), S.set.filtered();
  12806. },
  12807. userAddition: function userAddition() {
  12808. X.filter(D.addition).remove();
  12809. },
  12810. selected: function selected(t, n) {
  12811. if (!(n = k.allowAdditions ? n || S.get.itemWithAdditions(t) : n || S.get.item(t))) return !1;
  12812. n.each(function () {
  12813. var t = e(this),
  12814. n = S.get.choiceText(t),
  12815. i = S.get.choiceValue(t, n);
  12816. 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);
  12817. });
  12818. },
  12819. selectedItem: function selectedItem() {
  12820. X.removeClass(T.selected);
  12821. },
  12822. value: function value(e, t, n) {
  12823. var i,
  12824. o = S.get.values();
  12825. 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();
  12826. },
  12827. arrayValue: function arrayValue(t, n) {
  12828. return e.isArray(n) || (n = [n]), n = e.grep(n, function (e) {
  12829. return t != e;
  12830. }), S.verbose("Removed value from delimited string", t, n), n;
  12831. },
  12832. label: function label(e, t) {
  12833. var n = M.find(D.label).filter("[data-" + E.value + '="' + S.escape.string(e) + '"]');
  12834. S.verbose("Removing label", n), n.remove();
  12835. },
  12836. activeLabels: function activeLabels(e) {
  12837. e = e || M.find(D.label).filter("." + T.active), S.verbose("Removing active label selections", e), S.remove.labels(e);
  12838. },
  12839. labels: function labels(t) {
  12840. t = t || M.find(D.label), S.verbose("Removing labels", t), t.each(function () {
  12841. var t = e(this),
  12842. n = t.data(E.value),
  12843. o = n !== i ? String(n) : n,
  12844. a = S.is.userValue(o);
  12845. !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");
  12846. });
  12847. },
  12848. tabbable: function tabbable() {
  12849. 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"));
  12850. }
  12851. },
  12852. has: {
  12853. menuSearch: function menuSearch() {
  12854. return S.has.search() && N.closest(Q).length > 0;
  12855. },
  12856. search: function search() {
  12857. return N.length > 0;
  12858. },
  12859. sizer: function sizer() {
  12860. return H.length > 0;
  12861. },
  12862. selectInput: function selectInput() {
  12863. return U.is("select");
  12864. },
  12865. minCharacters: function minCharacters(e) {
  12866. return !k.minCharacters || (e = e !== i ? String(e) : String(S.get.query())).length >= k.minCharacters;
  12867. },
  12868. firstLetter: function firstLetter(e, t) {
  12869. var n;
  12870. return !(!e || 0 === e.length || "string" != typeof t) && (n = S.get.choiceText(e, !1), (t = t.toLowerCase()) == String(n).charAt(0).toLowerCase());
  12871. },
  12872. input: function input() {
  12873. return U.length > 0;
  12874. },
  12875. items: function items() {
  12876. return X.length > 0;
  12877. },
  12878. menu: function menu() {
  12879. return Q.length > 0;
  12880. },
  12881. message: function message() {
  12882. return 0 !== Q.children(D.message).length;
  12883. },
  12884. label: function label(e) {
  12885. var t = S.escape.value(e),
  12886. n = M.find(D.label);
  12887. return k.ignoreCase && (t = t.toLowerCase()), n.filter("[data-" + E.value + '="' + S.escape.string(t) + '"]').length > 0;
  12888. },
  12889. maxSelections: function maxSelections() {
  12890. return k.maxSelections && S.get.selectionCount() >= k.maxSelections;
  12891. },
  12892. allResultsFiltered: function allResultsFiltered() {
  12893. var e = X.not(D.addition);
  12894. return e.filter(D.unselectable).length === e.length;
  12895. },
  12896. userSuggestion: function userSuggestion() {
  12897. return Q.children(D.addition).length > 0;
  12898. },
  12899. query: function query() {
  12900. return "" !== S.get.query();
  12901. },
  12902. value: function value(e) {
  12903. return k.ignoreCase ? S.has.valueIgnoringCase(e) : S.has.valueMatchingCase(e);
  12904. },
  12905. valueMatchingCase: function valueMatchingCase(t) {
  12906. var n = S.get.values();
  12907. return !!(e.isArray(n) ? n && -1 !== e.inArray(t, n) : n == t);
  12908. },
  12909. valueIgnoringCase: function valueIgnoringCase(t) {
  12910. var n = S.get.values(),
  12911. i = !1;
  12912. return e.isArray(n) || (n = [n]), e.each(n, function (e, n) {
  12913. if (String(t).toLowerCase() == String(n).toLowerCase()) return i = !0, !1;
  12914. }), i;
  12915. }
  12916. },
  12917. is: {
  12918. active: function active() {
  12919. return M.hasClass(T.active);
  12920. },
  12921. animatingInward: function animatingInward() {
  12922. return Q.transition("is inward");
  12923. },
  12924. animatingOutward: function animatingOutward() {
  12925. return Q.transition("is outward");
  12926. },
  12927. bubbledLabelClick: function bubbledLabelClick(t) {
  12928. return e(t.target).is("select, input") && M.closest("label").length > 0;
  12929. },
  12930. bubbledIconClick: function bubbledIconClick(t) {
  12931. return e(t.target).closest(W).length > 0;
  12932. },
  12933. alreadySetup: function alreadySetup() {
  12934. return M.is("select") && M.parent(D.dropdown).data(I) !== i && 0 === M.prev().length;
  12935. },
  12936. animating: function animating(e) {
  12937. return e ? e.transition && e.transition("is animating") : Q.transition && Q.transition("is animating");
  12938. },
  12939. leftward: function leftward(e) {
  12940. return (e || Q).hasClass(T.leftward);
  12941. },
  12942. disabled: function disabled() {
  12943. return M.hasClass(T.disabled);
  12944. },
  12945. focused: function focused() {
  12946. return n.activeElement === M[0];
  12947. },
  12948. focusedOnSearch: function focusedOnSearch() {
  12949. return n.activeElement === N[0];
  12950. },
  12951. allFiltered: function allFiltered() {
  12952. return (S.is.multiple() || S.has.search()) && !(0 == k.hideAdditions && S.has.userSuggestion()) && !S.has.message() && S.has.allResultsFiltered();
  12953. },
  12954. hidden: function hidden(e) {
  12955. return !S.is.visible(e);
  12956. },
  12957. initialLoad: function initialLoad() {
  12958. return h;
  12959. },
  12960. inObject: function inObject(t, n) {
  12961. var i = !1;
  12962. return e.each(n, function (e, n) {
  12963. if (n == t) return i = !0, !0;
  12964. }), i;
  12965. },
  12966. multiple: function multiple() {
  12967. return M.hasClass(T.multiple);
  12968. },
  12969. remote: function remote() {
  12970. return k.apiSettings && S.can.useAPI();
  12971. },
  12972. single: function single() {
  12973. return !S.is.multiple();
  12974. },
  12975. selectMutation: function selectMutation(t) {
  12976. var n = !1;
  12977. return e.each(t, function (t, i) {
  12978. if (i.target && e(i.target).is("select")) return n = !0, !0;
  12979. }), n;
  12980. },
  12981. search: function search() {
  12982. return M.hasClass(T.search);
  12983. },
  12984. searchSelection: function searchSelection() {
  12985. return S.has.search() && 1 === N.parent(D.dropdown).length;
  12986. },
  12987. selection: function selection() {
  12988. return M.hasClass(T.selection);
  12989. },
  12990. userValue: function userValue(t) {
  12991. return -1 !== e.inArray(t, S.get.userValues());
  12992. },
  12993. upward: function upward(e) {
  12994. return (e || M).hasClass(T.upward);
  12995. },
  12996. visible: function visible(e) {
  12997. return e ? e.hasClass(T.visible) : Q.hasClass(T.visible);
  12998. },
  12999. verticallyScrollableContext: function verticallyScrollableContext() {
  13000. var e = L.get(0) !== t && L.css("overflow-y");
  13001. return "auto" == e || "scroll" == e;
  13002. },
  13003. horizontallyScrollableContext: function horizontallyScrollableContext() {
  13004. var e = L.get(0) !== t && L.css("overflow-X");
  13005. return "auto" == e || "scroll" == e;
  13006. }
  13007. },
  13008. can: {
  13009. activate: function activate(e) {
  13010. return !!k.useLabels || !S.has.maxSelections() || !(!S.has.maxSelections() || !e.hasClass(T.active));
  13011. },
  13012. openDownward: function openDownward(e) {
  13013. var n,
  13014. i,
  13015. o = e || Q,
  13016. a = !0;
  13017. return o.addClass(T.loading), i = {
  13018. context: {
  13019. offset: L.get(0) === t ? {
  13020. top: 0,
  13021. left: 0
  13022. } : L.offset(),
  13023. scrollTop: L.scrollTop(),
  13024. height: L.outerHeight()
  13025. },
  13026. menu: {
  13027. offset: o.offset(),
  13028. height: o.outerHeight()
  13029. }
  13030. }, S.is.verticallyScrollableContext() && (i.menu.offset.top += i.context.scrollTop), (n = {
  13031. above: i.context.scrollTop <= i.menu.offset.top - i.context.offset.top - i.menu.height,
  13032. below: i.context.scrollTop + i.context.height >= i.menu.offset.top - i.context.offset.top + i.menu.height
  13033. }).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;
  13034. },
  13035. openRightward: function openRightward(e) {
  13036. var n,
  13037. i,
  13038. o = e || Q,
  13039. a = !0;
  13040. return o.addClass(T.loading), i = {
  13041. context: {
  13042. offset: L.get(0) === t ? {
  13043. top: 0,
  13044. left: 0
  13045. } : L.offset(),
  13046. scrollLeft: L.scrollLeft(),
  13047. width: L.outerWidth()
  13048. },
  13049. menu: {
  13050. offset: o.offset(),
  13051. width: o.outerWidth()
  13052. }
  13053. }, 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;
  13054. },
  13055. click: function click() {
  13056. return c || "click" == k.on;
  13057. },
  13058. extendSelect: function extendSelect() {
  13059. return k.allowAdditions || k.apiSettings;
  13060. },
  13061. show: function show() {
  13062. return !S.is.disabled() && (S.has.items() || S.has.message());
  13063. },
  13064. useAPI: function useAPI() {
  13065. return e.fn.api !== i;
  13066. }
  13067. },
  13068. animate: {
  13069. show: function show(t, n) {
  13070. var o,
  13071. a = n || Q,
  13072. r = n ? function () {} : function () {
  13073. S.hideSubMenus(), S.hideOthers(), S.set.active();
  13074. };
  13075. 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({
  13076. animation: o + " in",
  13077. debug: k.debug,
  13078. verbose: k.verbose,
  13079. duration: k.duration,
  13080. queue: !0,
  13081. onStart: r,
  13082. onComplete: function onComplete() {
  13083. t.call(K);
  13084. }
  13085. }) : S.error(q.noTransition, o));
  13086. },
  13087. hide: function hide(t, n) {
  13088. var o = n || Q,
  13089. a = (n ? k.duration : k.duration, n ? function () {} : function () {
  13090. S.can.click() && S.unbind.intent(), S.remove.active();
  13091. }),
  13092. r = S.get.transition(n);
  13093. 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({
  13094. animation: r + " out",
  13095. duration: k.duration,
  13096. debug: k.debug,
  13097. verbose: k.verbose,
  13098. queue: !1,
  13099. onStart: a,
  13100. onComplete: function onComplete() {
  13101. t.call(K);
  13102. }
  13103. }) : S.error(q.transition));
  13104. }
  13105. },
  13106. hideAndClear: function hideAndClear() {
  13107. S.remove.searchTerm(), S.has.maxSelections() || (S.has.search() ? S.hide(function () {
  13108. S.remove.filteredItem();
  13109. }) : S.hide());
  13110. },
  13111. delay: {
  13112. show: function show() {
  13113. S.verbose("Delaying show event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.show, k.delay.show);
  13114. },
  13115. hide: function hide() {
  13116. S.verbose("Delaying hide event to ensure user intent"), clearTimeout(S.timer), S.timer = setTimeout(S.hide, k.delay.hide);
  13117. }
  13118. },
  13119. escape: {
  13120. value: function value(t) {
  13121. var n = e.isArray(t),
  13122. i = "string" == typeof t,
  13123. o = !i && !n,
  13124. a = i && -1 !== t.search(O.quote),
  13125. r = [];
  13126. return o || !a ? t : (S.debug("Encoding quote values for use in select", t), n ? (e.each(t, function (e, t) {
  13127. r.push(t.replace(O.quote, "&quot;"));
  13128. }), r) : t.replace(O.quote, "&quot;"));
  13129. },
  13130. string: function string(e) {
  13131. return (e = String(e)).replace(O.escape, "\\$&");
  13132. }
  13133. },
  13134. setting: function setting(t, n) {
  13135. if (S.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, k, t);else {
  13136. if (n === i) return k[t];
  13137. e.isPlainObject(k[t]) ? e.extend(!0, k[t], n) : k[t] = n;
  13138. }
  13139. },
  13140. internal: function internal(t, n) {
  13141. if (e.isPlainObject(t)) e.extend(!0, S, t);else {
  13142. if (n === i) return S[t];
  13143. S[t] = n;
  13144. }
  13145. },
  13146. debug: function debug() {
  13147. !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)));
  13148. },
  13149. verbose: function verbose() {
  13150. !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)));
  13151. },
  13152. error: function error() {
  13153. k.silent || (S.error = Function.prototype.bind.call(console.error, console, k.name + ":"), S.error.apply(console, arguments));
  13154. },
  13155. performance: {
  13156. log: function log(e) {
  13157. var t, n;
  13158. k.performance && (n = (t = new Date().getTime()) - (u || t), u = t, d.push({
  13159. Name: e[0],
  13160. Arguments: [].slice.call(e, 1) || "",
  13161. Element: K,
  13162. "Execution Time": n
  13163. })), clearTimeout(S.performance.timer), S.performance.timer = setTimeout(S.performance.display, 500);
  13164. },
  13165. display: function display() {
  13166. var t = k.name + ":",
  13167. n = 0;
  13168. u = !1, clearTimeout(S.performance.timer), e.each(d, function (e, t) {
  13169. n += t["Execution Time"];
  13170. }), 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) {
  13171. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13172. }), console.groupEnd()), d = [];
  13173. }
  13174. },
  13175. invoke: function invoke(t, n, o) {
  13176. var r,
  13177. s,
  13178. l,
  13179. c = J;
  13180. 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) {
  13181. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13182. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13183. if (c[a] !== i) return s = c[a], !1;
  13184. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (S.error(q.method, t), !1);
  13185. c = c[o];
  13186. }
  13187. })), 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;
  13188. }
  13189. }, m ? (J === i && S.initialize(), S.invoke(f)) : (J !== i && J.invoke("destroy"), S.initialize());
  13190. }), a !== i ? a : r;
  13191. }, e.fn.dropdown.settings = {
  13192. silent: !1,
  13193. debug: !1,
  13194. verbose: !1,
  13195. performance: !0,
  13196. on: "click",
  13197. action: "activate",
  13198. values: !1,
  13199. apiSettings: !1,
  13200. selectOnKeydown: !0,
  13201. minCharacters: 0,
  13202. filterRemoteData: !1,
  13203. saveRemoteData: !0,
  13204. throttle: 200,
  13205. context: t,
  13206. direction: "auto",
  13207. keepOnScreen: !0,
  13208. match: "both",
  13209. fullTextSearch: !1,
  13210. placeholder: "auto",
  13211. preserveHTML: !0,
  13212. sortSelect: !1,
  13213. forceSelection: !0,
  13214. allowAdditions: !1,
  13215. ignoreCase: !1,
  13216. hideAdditions: !0,
  13217. maxSelections: !1,
  13218. useLabels: !0,
  13219. delimiter: ",",
  13220. showOnFocus: !0,
  13221. allowReselection: !1,
  13222. allowTab: !0,
  13223. allowCategorySelection: !1,
  13224. fireOnInit: !1,
  13225. transition: "auto",
  13226. duration: 200,
  13227. glyphWidth: 1.037,
  13228. label: {
  13229. transition: "scale",
  13230. duration: 200,
  13231. variation: !1
  13232. },
  13233. delay: {
  13234. hide: 300,
  13235. show: 200,
  13236. search: 20,
  13237. touch: 50
  13238. },
  13239. onChange: function onChange(e, t, n) {},
  13240. onAdd: function onAdd(e, t, n) {},
  13241. onRemove: function onRemove(e, t, n) {},
  13242. onLabelSelect: function onLabelSelect(e) {},
  13243. onLabelCreate: function onLabelCreate(t, n) {
  13244. return e(this);
  13245. },
  13246. onLabelRemove: function onLabelRemove(e) {
  13247. return !0;
  13248. },
  13249. onNoResults: function onNoResults(e) {
  13250. return !0;
  13251. },
  13252. onShow: function onShow() {},
  13253. onHide: function onHide() {},
  13254. name: "Dropdown",
  13255. namespace: "dropdown",
  13256. message: {
  13257. addResult: "Add <b>{term}</b>",
  13258. count: "{count} selected",
  13259. maxSelections: "Max {maxCount} selections",
  13260. noResults: "No results found.",
  13261. serverError: "There was an error contacting the server"
  13262. },
  13263. error: {
  13264. action: "You called a dropdown action that was not defined",
  13265. alreadySetup: "Once a select has been initialized behaviors must be called on the created ui dropdown",
  13266. labels: "Allowing user additions currently requires the use of labels.",
  13267. missingMultiple: "<select> requires multiple property to be set to correctly preserve multiple values",
  13268. method: "The method you called is not defined.",
  13269. noAPI: "The API module is required to load resources remotely",
  13270. noStorage: "Saving remote data requires session storage",
  13271. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>"
  13272. },
  13273. regExp: {
  13274. escape: /[-[\]{}()*+?.,\\^$|#\s]/g,
  13275. quote: /"/g
  13276. },
  13277. metadata: {
  13278. defaultText: "defaultText",
  13279. defaultValue: "defaultValue",
  13280. placeholderText: "placeholder",
  13281. text: "text",
  13282. value: "value"
  13283. },
  13284. fields: {
  13285. remoteValues: "results",
  13286. values: "values",
  13287. disabled: "disabled",
  13288. name: "name",
  13289. value: "value",
  13290. text: "text"
  13291. },
  13292. keys: {
  13293. backspace: 8,
  13294. delimiter: 188,
  13295. deleteKey: 46,
  13296. enter: 13,
  13297. escape: 27,
  13298. pageUp: 33,
  13299. pageDown: 34,
  13300. leftArrow: 37,
  13301. upArrow: 38,
  13302. rightArrow: 39,
  13303. downArrow: 40
  13304. },
  13305. selector: {
  13306. addition: ".addition",
  13307. dropdown: ".ui.dropdown",
  13308. hidden: ".hidden",
  13309. icon: "> .dropdown.icon",
  13310. input: '> input[type="hidden"], > select',
  13311. item: ".item",
  13312. label: "> .label",
  13313. remove: "> .label > .delete.icon",
  13314. siblingLabel: ".label",
  13315. menu: ".menu",
  13316. message: ".message",
  13317. menuIcon: ".dropdown.icon",
  13318. search: "input.search, .menu > .search > input, .menu input.search",
  13319. sizer: "> input.sizer",
  13320. text: "> .text:not(.icon)",
  13321. unselectable: ".disabled, .filtered"
  13322. },
  13323. className: {
  13324. active: "active",
  13325. addition: "addition",
  13326. animating: "animating",
  13327. disabled: "disabled",
  13328. empty: "empty",
  13329. dropdown: "ui dropdown",
  13330. filtered: "filtered",
  13331. hidden: "hidden transition",
  13332. item: "item",
  13333. label: "ui label",
  13334. loading: "loading",
  13335. menu: "menu",
  13336. message: "message",
  13337. multiple: "multiple",
  13338. placeholder: "default",
  13339. sizer: "sizer",
  13340. search: "search",
  13341. selected: "selected",
  13342. selection: "selection",
  13343. upward: "upward",
  13344. leftward: "left",
  13345. visible: "visible"
  13346. }
  13347. }, e.fn.dropdown.settings.templates = {
  13348. dropdown: function dropdown(t) {
  13349. var n = t.placeholder || !1,
  13350. i = (t.values, "");
  13351. 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) {
  13352. i += t.disabled ? '<div class="disabled item" data-value="' + t.value + '">' + t.name + "</div>" : '<div class="item" data-value="' + t.value + '">' + t.name + "</div>";
  13353. }), i += "</div>";
  13354. },
  13355. menu: function menu(t, n) {
  13356. var i = t[n.values] || {},
  13357. o = "";
  13358. return e.each(i, function (e, t) {
  13359. var i = t[n.text] ? 'data-text="' + t[n.text] + '"' : "",
  13360. a = t[n.disabled] ? "disabled " : "";
  13361. o += '<div class="' + a + 'item" data-value="' + t[n.value] + '"' + i + ">", o += t[n.name], o += "</div>";
  13362. }), o;
  13363. },
  13364. label: function label(e, t) {
  13365. return t + '<i class="delete icon"></i>';
  13366. },
  13367. message: function message(e) {
  13368. return e;
  13369. },
  13370. addition: function addition(e) {
  13371. return e;
  13372. }
  13373. };
  13374. }(jQuery, window, document), function (e, t, n, i) {
  13375. "use strict";
  13376. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.embed = function (n) {
  13377. var o,
  13378. a = e(this),
  13379. r = a.selector || "",
  13380. s = new Date().getTime(),
  13381. l = [],
  13382. c = arguments[0],
  13383. u = "string" == typeof c,
  13384. d = [].slice.call(arguments, 1);
  13385. return a.each(function () {
  13386. var f,
  13387. m = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.embed.settings, n) : e.extend({}, e.fn.embed.settings),
  13388. g = m.selector,
  13389. p = m.className,
  13390. h = m.sources,
  13391. v = m.error,
  13392. b = m.metadata,
  13393. y = m.namespace,
  13394. x = m.templates,
  13395. C = "." + y,
  13396. w = "module-" + y,
  13397. S = (e(t), e(this)),
  13398. k = (S.find(g.placeholder), S.find(g.icon), S.find(g.embed)),
  13399. T = this,
  13400. A = S.data(w);
  13401. f = {
  13402. initialize: function initialize() {
  13403. f.debug("Initializing embed"), f.determine.autoplay(), f.create(), f.bind.events(), f.instantiate();
  13404. },
  13405. instantiate: function instantiate() {
  13406. f.verbose("Storing instance of module", f), A = f, S.data(w, f);
  13407. },
  13408. destroy: function destroy() {
  13409. f.verbose("Destroying previous instance of embed"), f.reset(), S.removeData(w).off(C);
  13410. },
  13411. refresh: function refresh() {
  13412. f.verbose("Refreshing selector cache"), S.find(g.placeholder), S.find(g.icon), k = S.find(g.embed);
  13413. },
  13414. bind: {
  13415. events: function events() {
  13416. f.has.placeholder() && (f.debug("Adding placeholder events"), S.on("click" + C, g.placeholder, f.createAndShow).on("click" + C, g.icon, f.createAndShow));
  13417. }
  13418. },
  13419. create: function create() {
  13420. f.get.placeholder() ? f.createPlaceholder() : f.createAndShow();
  13421. },
  13422. createPlaceholder: function createPlaceholder(e) {
  13423. var t = f.get.icon(),
  13424. n = f.get.url();
  13425. f.generate.embed(n);
  13426. e = e || f.get.placeholder(), S.html(x.placeholder(e, t)), f.debug("Creating placeholder for embed", e, t);
  13427. },
  13428. createEmbed: function createEmbed(t) {
  13429. 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);
  13430. },
  13431. changeEmbed: function changeEmbed(e) {
  13432. k.html(f.generate.embed(e));
  13433. },
  13434. createAndShow: function createAndShow() {
  13435. f.createEmbed(), f.show();
  13436. },
  13437. change: function change(e, t, n) {
  13438. 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();
  13439. },
  13440. reset: function reset() {
  13441. f.debug("Clearing embed and showing placeholder"), f.remove.active(), f.remove.embed(), f.showPlaceholder(), m.onReset.call(T);
  13442. },
  13443. show: function show() {
  13444. f.debug("Showing embed"), f.set.active(), m.onDisplay.call(T);
  13445. },
  13446. hide: function hide() {
  13447. f.debug("Hiding embed"), f.showPlaceholder();
  13448. },
  13449. showPlaceholder: function showPlaceholder() {
  13450. f.debug("Showing placeholder image"), f.remove.active(), m.onPlaceholderDisplay.call(T);
  13451. },
  13452. get: {
  13453. id: function id() {
  13454. return m.id || S.data(b.id);
  13455. },
  13456. placeholder: function placeholder() {
  13457. return m.placeholder || S.data(b.placeholder);
  13458. },
  13459. icon: function icon() {
  13460. return m.icon ? m.icon : S.data(b.icon) !== i ? S.data(b.icon) : f.determine.icon();
  13461. },
  13462. source: function source(e) {
  13463. return m.source ? m.source : S.data(b.source) !== i ? S.data(b.source) : f.determine.source();
  13464. },
  13465. type: function type() {
  13466. var e = f.get.source();
  13467. return h[e] !== i && h[e].type;
  13468. },
  13469. url: function url() {
  13470. return m.url ? m.url : S.data(b.url) !== i ? S.data(b.url) : f.determine.url();
  13471. }
  13472. },
  13473. determine: {
  13474. autoplay: function autoplay() {
  13475. f.should.autoplay() && (m.autoplay = !0);
  13476. },
  13477. source: function source(t) {
  13478. var n = !1;
  13479. return (t = t || f.get.url()) && e.each(h, function (e, i) {
  13480. if (-1 !== t.search(i.domain)) return n = e, !1;
  13481. }), n;
  13482. },
  13483. icon: function icon() {
  13484. var e = f.get.source();
  13485. return h[e] !== i && h[e].icon;
  13486. },
  13487. url: function url() {
  13488. var e,
  13489. t = m.id || S.data(b.id),
  13490. n = m.source || S.data(b.source);
  13491. return (e = h[n] !== i && h[n].url.replace("{id}", t)) && S.data(b.url, e), e;
  13492. }
  13493. },
  13494. set: {
  13495. active: function active() {
  13496. S.addClass(p.active);
  13497. }
  13498. },
  13499. remove: {
  13500. active: function active() {
  13501. S.removeClass(p.active);
  13502. },
  13503. embed: function embed() {
  13504. k.empty();
  13505. }
  13506. },
  13507. encode: {
  13508. parameters: function parameters(e) {
  13509. var t,
  13510. n = [];
  13511. for (t in e) {
  13512. n.push(encodeURIComponent(t) + "=" + encodeURIComponent(e[t]));
  13513. }
  13514. return n.join("&amp;");
  13515. }
  13516. },
  13517. generate: {
  13518. embed: function embed(e) {
  13519. f.debug("Generating embed html");
  13520. var t,
  13521. n,
  13522. i = f.get.source();
  13523. return (e = f.get.url(e)) ? (n = f.generate.parameters(i), t = x.iframe(e, n)) : f.error(v.noURL, S), t;
  13524. },
  13525. parameters: function parameters(t, n) {
  13526. var o = h[t] && h[t].parameters !== i ? h[t].parameters(m) : {};
  13527. return (n = n || m.parameters) && (o = e.extend({}, o, n)), o = m.onEmbed(o), f.encode.parameters(o);
  13528. }
  13529. },
  13530. has: {
  13531. embed: function embed() {
  13532. return k.length > 0;
  13533. },
  13534. placeholder: function placeholder() {
  13535. return m.placeholder || S.data(b.placeholder);
  13536. }
  13537. },
  13538. should: {
  13539. autoplay: function autoplay() {
  13540. return "auto" === m.autoplay ? m.placeholder || S.data(b.placeholder) !== i : m.autoplay;
  13541. }
  13542. },
  13543. is: {
  13544. video: function video() {
  13545. return "video" == f.get.type();
  13546. }
  13547. },
  13548. setting: function setting(t, n) {
  13549. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  13550. if (n === i) return m[t];
  13551. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  13552. }
  13553. },
  13554. internal: function internal(t, n) {
  13555. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  13556. if (n === i) return f[t];
  13557. f[t] = n;
  13558. }
  13559. },
  13560. debug: function debug() {
  13561. !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)));
  13562. },
  13563. verbose: function verbose() {
  13564. !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)));
  13565. },
  13566. error: function error() {
  13567. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  13568. },
  13569. performance: {
  13570. log: function log(e) {
  13571. var t, n;
  13572. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  13573. Name: e[0],
  13574. Arguments: [].slice.call(e, 1) || "",
  13575. Element: T,
  13576. "Execution Time": n
  13577. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  13578. },
  13579. display: function display() {
  13580. var t = m.name + ":",
  13581. n = 0;
  13582. s = !1, clearTimeout(f.performance.timer), e.each(l, function (e, t) {
  13583. n += t["Execution Time"];
  13584. }), 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) {
  13585. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  13586. }), console.groupEnd()), l = [];
  13587. }
  13588. },
  13589. invoke: function invoke(t, n, a) {
  13590. var r,
  13591. s,
  13592. l,
  13593. c = A;
  13594. 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) {
  13595. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  13596. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  13597. if (c[a] !== i) return s = c[a], !1;
  13598. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (f.error(v.method, t), !1);
  13599. c = c[o];
  13600. }
  13601. })), 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;
  13602. }
  13603. }, u ? (A === i && f.initialize(), f.invoke(c)) : (A !== i && A.invoke("destroy"), f.initialize());
  13604. }), o !== i ? o : this;
  13605. }, e.fn.embed.settings = {
  13606. name: "Embed",
  13607. namespace: "embed",
  13608. silent: !1,
  13609. debug: !1,
  13610. verbose: !1,
  13611. performance: !0,
  13612. icon: !1,
  13613. source: !1,
  13614. url: !1,
  13615. id: !1,
  13616. autoplay: "auto",
  13617. color: "#444444",
  13618. hd: !0,
  13619. brandedUI: !1,
  13620. parameters: !1,
  13621. onDisplay: function onDisplay() {},
  13622. onPlaceholderDisplay: function onPlaceholderDisplay() {},
  13623. onReset: function onReset() {},
  13624. onCreate: function onCreate(e) {},
  13625. onEmbed: function onEmbed(e) {
  13626. return e;
  13627. },
  13628. metadata: {
  13629. id: "id",
  13630. icon: "icon",
  13631. placeholder: "placeholder",
  13632. source: "source",
  13633. url: "url"
  13634. },
  13635. error: {
  13636. noURL: "No URL specified",
  13637. method: "The method you called is not defined"
  13638. },
  13639. className: {
  13640. active: "active",
  13641. embed: "embed"
  13642. },
  13643. selector: {
  13644. embed: ".embed",
  13645. placeholder: ".placeholder",
  13646. icon: ".icon"
  13647. },
  13648. sources: {
  13649. youtube: {
  13650. name: "youtube",
  13651. type: "video",
  13652. icon: "video play",
  13653. domain: "youtube.com",
  13654. url: "//www.youtube.com/embed/{id}",
  13655. parameters: function parameters(e) {
  13656. return {
  13657. autohide: !e.brandedUI,
  13658. autoplay: e.autoplay,
  13659. color: e.color || i,
  13660. hq: e.hd,
  13661. jsapi: e.api,
  13662. modestbranding: !e.brandedUI
  13663. };
  13664. }
  13665. },
  13666. vimeo: {
  13667. name: "vimeo",
  13668. type: "video",
  13669. icon: "video play",
  13670. domain: "vimeo.com",
  13671. url: "//player.vimeo.com/video/{id}",
  13672. parameters: function parameters(e) {
  13673. return {
  13674. api: e.api,
  13675. autoplay: e.autoplay,
  13676. byline: e.brandedUI,
  13677. color: e.color || i,
  13678. portrait: e.brandedUI,
  13679. title: e.brandedUI
  13680. };
  13681. }
  13682. }
  13683. },
  13684. templates: {
  13685. iframe: function iframe(e, t) {
  13686. var n = e;
  13687. return t && (n += "?" + t), '<iframe src="' + n + '" width="100%" height="100%" frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
  13688. },
  13689. placeholder: function placeholder(e, t) {
  13690. var n = "";
  13691. return t && (n += '<i class="' + t + ' icon"></i>'), e && (n += '<img class="placeholder" src="' + e + '">'), n;
  13692. }
  13693. },
  13694. api: !1,
  13695. onPause: function onPause() {},
  13696. onPlay: function onPlay() {},
  13697. onStop: function onStop() {}
  13698. };
  13699. }(jQuery, window, document), function (e, t, n, i) {
  13700. "use strict";
  13701. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.modal = function (o) {
  13702. var a,
  13703. r = e(this),
  13704. s = e(t),
  13705. l = e(n),
  13706. c = e("body"),
  13707. u = r.selector || "",
  13708. d = new Date().getTime(),
  13709. f = [],
  13710. m = arguments[0],
  13711. g = "string" == typeof m,
  13712. p = [].slice.call(arguments, 1),
  13713. h = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  13714. setTimeout(e, 0);
  13715. };
  13716. return r.each(function () {
  13717. var r,
  13718. v,
  13719. b,
  13720. y,
  13721. x,
  13722. C,
  13723. w,
  13724. S,
  13725. k,
  13726. T = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.modal.settings, o) : e.extend({}, e.fn.modal.settings),
  13727. A = T.selector,
  13728. R = T.className,
  13729. P = T.namespace,
  13730. E = T.error,
  13731. F = "." + P,
  13732. O = "module-" + P,
  13733. D = e(this),
  13734. q = e(T.context),
  13735. j = D.find(A.close),
  13736. z = this,
  13737. I = D.data(O),
  13738. M = !1;
  13739. k = {
  13740. initialize: function initialize() {
  13741. k.verbose("Initializing dimmer", q), k.create.id(), k.create.dimmer(), k.refreshModals(), k.bind.events(), T.observeChanges && k.observeChanges(), k.instantiate();
  13742. },
  13743. instantiate: function instantiate() {
  13744. k.verbose("Storing instance of modal"), I = k, D.data(O, I);
  13745. },
  13746. create: {
  13747. dimmer: function dimmer() {
  13748. var t = {
  13749. debug: T.debug,
  13750. variation: !T.centered && "top aligned",
  13751. dimmerName: "modals"
  13752. },
  13753. n = e.extend(!0, t, T.dimmerSettings);
  13754. 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);
  13755. },
  13756. id: function id() {
  13757. w = (Math.random().toString(16) + "000000000").substr(2, 8), C = "." + w, k.verbose("Creating unique id for element", w);
  13758. }
  13759. },
  13760. destroy: function destroy() {
  13761. k.verbose("Destroying previous modal"), D.removeData(O).off(F), s.off(C), x.off(C), j.off(F), q.dimmer("destroy");
  13762. },
  13763. observeChanges: function observeChanges() {
  13764. "MutationObserver" in t && ((S = new MutationObserver(function (e) {
  13765. k.debug("DOM tree modified, refreshing"), k.refresh();
  13766. })).observe(z, {
  13767. childList: !0,
  13768. subtree: !0
  13769. }), k.debug("Setting up mutation observer", S));
  13770. },
  13771. refresh: function refresh() {
  13772. k.remove.scrolling(), k.cacheSizes(), k.set.screenHeight(), k.set.type();
  13773. },
  13774. refreshModals: function refreshModals() {
  13775. v = D.siblings(A.modal), r = v.add(D);
  13776. },
  13777. attachEvents: function attachEvents(t, n) {
  13778. var i = e(t);
  13779. 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);
  13780. },
  13781. bind: {
  13782. events: function events() {
  13783. 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);
  13784. }
  13785. },
  13786. get: {
  13787. id: function id() {
  13788. return (Math.random().toString(16) + "000000000").substr(2, 8);
  13789. }
  13790. },
  13791. event: {
  13792. approve: function approve() {
  13793. M || !1 === T.onApprove.call(z, e(this)) ? k.verbose("Approve callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13794. M = !1;
  13795. }));
  13796. },
  13797. deny: function deny() {
  13798. M || !1 === T.onDeny.call(z, e(this)) ? k.verbose("Deny callback returned false cancelling hide") : (M = !0, k.hide(function () {
  13799. M = !1;
  13800. }));
  13801. },
  13802. close: function close() {
  13803. k.hide();
  13804. },
  13805. click: function click(t) {
  13806. if (T.closable) {
  13807. var i = e(t.target).closest(A.modal).length > 0,
  13808. o = e.contains(n.documentElement, t.target);
  13809. !i && o && k.is.active() && (k.debug("Dimmer clicked, hiding all modals"), k.remove.clickaway(), T.allowMultiple ? k.hide() : k.hideAll());
  13810. } else k.verbose("Dimmer clicked but closable setting is disabled");
  13811. },
  13812. debounce: function debounce(e, t) {
  13813. clearTimeout(k.timer), k.timer = setTimeout(e, t);
  13814. },
  13815. keyboard: function keyboard(e) {
  13816. 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());
  13817. },
  13818. resize: function resize() {
  13819. y.dimmer("is active") && (k.is.animating() || k.is.active()) && h(k.refresh);
  13820. }
  13821. },
  13822. toggle: function toggle() {
  13823. k.is.active() || k.is.animating() ? k.hide() : k.show();
  13824. },
  13825. show: function show(t) {
  13826. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.set.dimmerSettings(), k.showModal(t);
  13827. },
  13828. hide: function hide(t) {
  13829. t = e.isFunction(t) ? t : function () {}, k.refreshModals(), k.hideModal(t);
  13830. },
  13831. showModal: function showModal(t) {
  13832. 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({
  13833. debug: T.debug,
  13834. animation: T.transition + " in",
  13835. queue: T.queue,
  13836. duration: T.duration,
  13837. useFailSafe: !0,
  13838. onComplete: function onComplete() {
  13839. T.onVisible.apply(z), T.keyboardShortcuts && k.add.keyboardShortcuts(), k.save.focus(), k.set.active(), T.autofocus && k.set.autofocus(), t();
  13840. }
  13841. })) : k.error(E.noTransition))) : k.debug("Modal is already visible");
  13842. },
  13843. hideModal: function hideModal(t, n) {
  13844. 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({
  13845. debug: T.debug,
  13846. animation: T.transition + " out",
  13847. queue: T.queue,
  13848. duration: T.duration,
  13849. useFailSafe: !0,
  13850. onStart: function onStart() {
  13851. k.others.active() || n || k.hideDimmer(), T.keyboardShortcuts && k.remove.keyboardShortcuts();
  13852. },
  13853. onComplete: function onComplete() {
  13854. T.onHidden.call(z), k.restore.focus(), t();
  13855. }
  13856. })) : k.error(E.noTransition)) : k.verbose("Hide callback returned false cancelling hide");
  13857. },
  13858. showDimmer: function showDimmer() {
  13859. y.dimmer("is animating") || !y.dimmer("is active") ? (k.debug("Showing dimmer"), y.dimmer("show")) : k.debug("Dimmer already visible");
  13860. },
  13861. hideDimmer: function hideDimmer() {
  13862. y.dimmer("is animating") || y.dimmer("is active") ? y.dimmer("hide", function () {
  13863. k.remove.clickaway(), k.remove.screenHeight();
  13864. }) : k.debug("Dimmer is not visible cannot hide");
  13865. },
  13866. hideAll: function hideAll(t) {
  13867. var n = r.filter("." + R.active + ", ." + R.animating);
  13868. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding all visible modals"), k.hideDimmer(), n.modal("hide modal", t));
  13869. },
  13870. hideOthers: function hideOthers(t) {
  13871. var n = v.filter("." + R.active + ", ." + R.animating);
  13872. t = e.isFunction(t) ? t : function () {}, n.length > 0 && (k.debug("Hiding other modals", v), n.modal("hide modal", t, !0));
  13873. },
  13874. others: {
  13875. active: function active() {
  13876. return v.filter("." + R.active).length > 0;
  13877. },
  13878. animating: function animating() {
  13879. return v.filter("." + R.animating).length > 0;
  13880. }
  13881. },
  13882. add: {
  13883. keyboardShortcuts: function keyboardShortcuts() {
  13884. k.verbose("Adding keyboard shortcuts"), l.on("keyup" + F, k.event.keyboard);
  13885. }
  13886. },
  13887. save: {
  13888. focus: function focus() {
  13889. e(n.activeElement).closest(D).length > 0 || (b = e(n.activeElement).blur());
  13890. }
  13891. },
  13892. restore: {
  13893. focus: function focus() {
  13894. b && b.length > 0 && b.focus();
  13895. }
  13896. },
  13897. remove: {
  13898. active: function active() {
  13899. D.removeClass(R.active);
  13900. },
  13901. clickaway: function clickaway() {
  13902. x.off("click" + C);
  13903. },
  13904. bodyStyle: function bodyStyle() {
  13905. "" === c.attr("style") && (k.verbose("Removing style attribute"), c.removeAttr("style"));
  13906. },
  13907. screenHeight: function screenHeight() {
  13908. k.debug("Removing page height"), c.css("height", "");
  13909. },
  13910. keyboardShortcuts: function keyboardShortcuts() {
  13911. k.verbose("Removing keyboard shortcuts"), l.off("keyup" + F);
  13912. },
  13913. scrolling: function scrolling() {
  13914. y.removeClass(R.scrolling), D.removeClass(R.scrolling);
  13915. }
  13916. },
  13917. cacheSizes: function cacheSizes() {
  13918. D.addClass(R.loading);
  13919. var o = D.prop("scrollHeight"),
  13920. a = D.outerHeight();
  13921. k.cache !== i && 0 === a || (k.cache = {
  13922. pageHeight: e(n).outerHeight(),
  13923. height: a + T.offset,
  13924. scrollHeight: o + T.offset,
  13925. contextHeight: "body" == T.context ? e(t).height() : y.height()
  13926. }, k.cache.topOffset = -k.cache.height / 2), D.removeClass(R.loading), k.debug("Caching modal and container sizes", k.cache);
  13927. },
  13928. can: {
  13929. fit: function fit() {
  13930. var e = k.cache.contextHeight,
  13931. t = k.cache.contextHeight / 2,
  13932. n = k.cache.topOffset,
  13933. i = k.cache.scrollHeight,
  13934. o = k.cache.height,
  13935. a = T.padding;
  13936. return i > o ? t + n + i + a < e : o + 2 * a < e;
  13937. }
  13938. },
  13939. is: {
  13940. active: function active() {
  13941. return D.hasClass(R.active);
  13942. },
  13943. animating: function animating() {
  13944. return D.transition("is supported") ? D.transition("is animating") : D.is(":visible");
  13945. },
  13946. scrolling: function scrolling() {
  13947. return y.hasClass(R.scrolling);
  13948. },
  13949. modernBrowser: function modernBrowser() {
  13950. return !(t.ActiveXObject || "ActiveXObject" in t);
  13951. }
  13952. },
  13953. set: {
  13954. autofocus: function autofocus() {
  13955. var e = D.find("[tabindex], :input").filter(":visible"),
  13956. t = e.filter("[autofocus]"),
  13957. n = t.length > 0 ? t.first() : e.first();
  13958. n.length > 0 && n.focus();
  13959. },
  13960. clickaway: function clickaway() {
  13961. x.on("click" + C, k.event.click);
  13962. },
  13963. dimmerSettings: function dimmerSettings() {
  13964. if (e.fn.dimmer !== i) {
  13965. var t = {
  13966. debug: T.debug,
  13967. dimmerName: "modals",
  13968. closable: "auto",
  13969. variation: !T.centered && "top aligned",
  13970. duration: {
  13971. show: T.duration,
  13972. hide: T.duration
  13973. }
  13974. },
  13975. n = e.extend(!0, t, T.dimmerSettings);
  13976. 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);
  13977. } else k.error(E.dimmer);
  13978. },
  13979. screenHeight: function screenHeight() {
  13980. 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));
  13981. },
  13982. active: function active() {
  13983. D.addClass(R.active);
  13984. },
  13985. scrolling: function scrolling() {
  13986. y.addClass(R.scrolling), D.addClass(R.scrolling);
  13987. },
  13988. type: function type() {
  13989. 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());
  13990. },
  13991. undetached: function undetached() {
  13992. y.addClass(R.undetached);
  13993. }
  13994. },
  13995. setting: function setting(t, n) {
  13996. if (k.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, T, t);else {
  13997. if (n === i) return T[t];
  13998. e.isPlainObject(T[t]) ? e.extend(!0, T[t], n) : T[t] = n;
  13999. }
  14000. },
  14001. internal: function internal(t, n) {
  14002. if (e.isPlainObject(t)) e.extend(!0, k, t);else {
  14003. if (n === i) return k[t];
  14004. k[t] = n;
  14005. }
  14006. },
  14007. debug: function debug() {
  14008. !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)));
  14009. },
  14010. verbose: function verbose() {
  14011. !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)));
  14012. },
  14013. error: function error() {
  14014. T.silent || (k.error = Function.prototype.bind.call(console.error, console, T.name + ":"), k.error.apply(console, arguments));
  14015. },
  14016. performance: {
  14017. log: function log(e) {
  14018. var t, n;
  14019. T.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14020. Name: e[0],
  14021. Arguments: [].slice.call(e, 1) || "",
  14022. Element: z,
  14023. "Execution Time": n
  14024. })), clearTimeout(k.performance.timer), k.performance.timer = setTimeout(k.performance.display, 500);
  14025. },
  14026. display: function display() {
  14027. var t = T.name + ":",
  14028. n = 0;
  14029. d = !1, clearTimeout(k.performance.timer), e.each(f, function (e, t) {
  14030. n += t["Execution Time"];
  14031. }), 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) {
  14032. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14033. }), console.groupEnd()), f = [];
  14034. }
  14035. },
  14036. invoke: function invoke(t, n, o) {
  14037. var r,
  14038. s,
  14039. l,
  14040. c = I;
  14041. 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) {
  14042. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14043. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14044. if (c[a] !== i) return s = c[a], !1;
  14045. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14046. c = c[o];
  14047. }
  14048. })), 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;
  14049. }
  14050. }, g ? (I === i && k.initialize(), k.invoke(m)) : (I !== i && I.invoke("destroy"), k.initialize());
  14051. }), a !== i ? a : this;
  14052. }, e.fn.modal.settings = {
  14053. name: "Modal",
  14054. namespace: "modal",
  14055. silent: !1,
  14056. debug: !1,
  14057. verbose: !1,
  14058. performance: !0,
  14059. observeChanges: !1,
  14060. allowMultiple: !1,
  14061. detachable: !0,
  14062. closable: !0,
  14063. autofocus: !0,
  14064. inverted: !1,
  14065. blurring: !1,
  14066. centered: !0,
  14067. dimmerSettings: {
  14068. closable: !1,
  14069. useCSS: !0
  14070. },
  14071. keyboardShortcuts: !0,
  14072. context: "body",
  14073. queue: !1,
  14074. duration: 500,
  14075. offset: 0,
  14076. transition: "scale",
  14077. padding: 50,
  14078. onShow: function onShow() {},
  14079. onVisible: function onVisible() {},
  14080. onHide: function onHide() {
  14081. return !0;
  14082. },
  14083. onHidden: function onHidden() {},
  14084. onApprove: function onApprove() {
  14085. return !0;
  14086. },
  14087. onDeny: function onDeny() {
  14088. return !0;
  14089. },
  14090. selector: {
  14091. close: "> .close",
  14092. approve: ".actions .positive, .actions .approve, .actions .ok",
  14093. deny: ".actions .negative, .actions .deny, .actions .cancel",
  14094. modal: ".ui.modal"
  14095. },
  14096. error: {
  14097. dimmer: "UI Dimmer, a required component is not included in this page",
  14098. method: "The method you called is not defined.",
  14099. notFound: "The element you specified could not be found"
  14100. },
  14101. className: {
  14102. active: "active",
  14103. animating: "animating",
  14104. blurring: "blurring",
  14105. inverted: "inverted",
  14106. loading: "loading",
  14107. scrolling: "scrolling",
  14108. undetached: "undetached"
  14109. }
  14110. };
  14111. }(jQuery, window, document), function (e, t, n, i) {
  14112. "use strict";
  14113. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.nag = function (n) {
  14114. var o,
  14115. a = e(this),
  14116. r = a.selector || "",
  14117. s = new Date().getTime(),
  14118. l = [],
  14119. c = arguments[0],
  14120. u = "string" == typeof c,
  14121. d = [].slice.call(arguments, 1);
  14122. return a.each(function () {
  14123. var a,
  14124. f = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.nag.settings, n) : e.extend({}, e.fn.nag.settings),
  14125. m = (f.className, f.selector),
  14126. g = f.error,
  14127. p = f.namespace,
  14128. h = "." + p,
  14129. v = p + "-module",
  14130. b = e(this),
  14131. y = (b.find(m.close), f.context ? e(f.context) : e("body")),
  14132. x = this,
  14133. C = b.data(v);
  14134. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  14135. a = {
  14136. initialize: function initialize() {
  14137. 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();
  14138. },
  14139. destroy: function destroy() {
  14140. a.verbose("Destroying instance"), b.removeData(v).off(h);
  14141. },
  14142. show: function show() {
  14143. 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));
  14144. },
  14145. hide: function hide() {
  14146. a.debug("Showing nag", f.animation.hide), "fade" == f.animation.show ? b.fadeIn(f.duration, f.easing) : b.slideUp(f.duration, f.easing);
  14147. },
  14148. onHide: function onHide() {
  14149. a.debug("Removing nag", f.animation.hide), b.remove(), f.onHide && f.onHide();
  14150. },
  14151. dismiss: function dismiss(e) {
  14152. f.storageMethod && a.storage.set(f.key, f.value), a.hide(), e.stopImmediatePropagation(), e.preventDefault();
  14153. },
  14154. should: {
  14155. show: function show() {
  14156. 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);
  14157. }
  14158. },
  14159. get: {
  14160. storageOptions: function storageOptions() {
  14161. var e = {};
  14162. return f.expires && (e.expires = f.expires), f.domain && (e.domain = f.domain), f.path && (e.path = f.path), e;
  14163. }
  14164. },
  14165. clear: function clear() {
  14166. a.storage.remove(f.key);
  14167. },
  14168. storage: {
  14169. set: function set(n, o) {
  14170. var r = a.get.storageOptions();
  14171. 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 {
  14172. if (e.cookie === i) return void a.error(g.noCookieStorage);
  14173. e.cookie(n, o, r), a.debug("Value stored using cookie", n, o, r);
  14174. }
  14175. },
  14176. get: function get(n, o) {
  14177. var r;
  14178. 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;
  14179. },
  14180. remove: function remove(n) {
  14181. var o = a.get.storageOptions();
  14182. "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);
  14183. }
  14184. },
  14185. setting: function setting(t, n) {
  14186. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  14187. if (n === i) return f[t];
  14188. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  14189. }
  14190. },
  14191. internal: function internal(t, n) {
  14192. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  14193. if (n === i) return a[t];
  14194. a[t] = n;
  14195. }
  14196. },
  14197. debug: function debug() {
  14198. !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)));
  14199. },
  14200. verbose: function verbose() {
  14201. !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)));
  14202. },
  14203. error: function error() {
  14204. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  14205. },
  14206. performance: {
  14207. log: function log(e) {
  14208. var t, n;
  14209. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  14210. Name: e[0],
  14211. Arguments: [].slice.call(e, 1) || "",
  14212. Element: x,
  14213. "Execution Time": n
  14214. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  14215. },
  14216. display: function display() {
  14217. var t = f.name + ":",
  14218. n = 0;
  14219. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  14220. n += t["Execution Time"];
  14221. }), 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) {
  14222. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14223. }), console.groupEnd()), l = [];
  14224. }
  14225. },
  14226. invoke: function invoke(t, n, r) {
  14227. var s,
  14228. l,
  14229. c,
  14230. u = C;
  14231. 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) {
  14232. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14233. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  14234. if (u[r] !== i) return l = u[r], !1;
  14235. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(g.method, t), !1);
  14236. u = u[o];
  14237. }
  14238. })), 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;
  14239. }
  14240. }, u ? (C === i && a.initialize(), a.invoke(c)) : (C !== i && C.invoke("destroy"), a.initialize());
  14241. }), o !== i ? o : this;
  14242. }, e.fn.nag.settings = {
  14243. name: "Nag",
  14244. silent: !1,
  14245. debug: !1,
  14246. verbose: !1,
  14247. performance: !0,
  14248. namespace: "Nag",
  14249. persist: !1,
  14250. displayTime: 0,
  14251. animation: {
  14252. show: "slide",
  14253. hide: "slide"
  14254. },
  14255. context: !1,
  14256. detachable: !1,
  14257. expires: 30,
  14258. domain: !1,
  14259. path: "/",
  14260. storageMethod: "cookie",
  14261. key: "nag",
  14262. value: "dismiss",
  14263. error: {
  14264. noCookieStorage: "$.cookie is not included. A storage solution is required.",
  14265. noStorage: "Neither $.cookie or store is defined. A storage solution is required for storing state",
  14266. method: "The method you called is not defined."
  14267. },
  14268. className: {
  14269. bottom: "bottom",
  14270. fixed: "fixed"
  14271. },
  14272. selector: {
  14273. close: ".close.icon"
  14274. },
  14275. speed: 500,
  14276. easing: "easeOutQuad",
  14277. onHide: function onHide() {}
  14278. }, e.extend(e.easing, {
  14279. easeOutQuad: function easeOutQuad(e, t, n, i, o) {
  14280. return -i * (t /= o) * (t - 2) + n;
  14281. }
  14282. });
  14283. }(jQuery, window, document), function (e, t, n, i) {
  14284. "use strict";
  14285. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.popup = function (o) {
  14286. var a,
  14287. r = e(this),
  14288. s = e(n),
  14289. l = e(t),
  14290. c = e("body"),
  14291. u = r.selector || "",
  14292. d = new Date().getTime(),
  14293. f = [],
  14294. m = arguments[0],
  14295. g = "string" == typeof m,
  14296. p = [].slice.call(arguments, 1);
  14297. return r.each(function () {
  14298. var r,
  14299. h,
  14300. v,
  14301. b,
  14302. y,
  14303. x,
  14304. C = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.popup.settings, o) : e.extend({}, e.fn.popup.settings),
  14305. w = C.selector,
  14306. S = C.className,
  14307. k = C.error,
  14308. T = C.metadata,
  14309. A = C.namespace,
  14310. R = "." + C.namespace,
  14311. P = "module-" + A,
  14312. E = e(this),
  14313. F = e(C.context),
  14314. O = e(C.scrollContext),
  14315. D = e(C.boundary),
  14316. q = C.target ? e(C.target) : E,
  14317. j = 0,
  14318. z = !1,
  14319. I = !1,
  14320. M = this,
  14321. L = E.data(P);
  14322. x = {
  14323. initialize: function initialize() {
  14324. x.debug("Initializing", E), x.createID(), x.bind.events(), !x.exists() && C.preserve && x.create(), C.observeChanges && x.observeChanges(), x.instantiate();
  14325. },
  14326. instantiate: function instantiate() {
  14327. x.verbose("Storing instance", x), L = x, E.data(P, L);
  14328. },
  14329. observeChanges: function observeChanges() {
  14330. "MutationObserver" in t && ((v = new MutationObserver(x.event.documentChanged)).observe(n, {
  14331. childList: !0,
  14332. subtree: !0
  14333. }), x.debug("Setting up mutation observer", v));
  14334. },
  14335. refresh: function refresh() {
  14336. 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();
  14337. },
  14338. reposition: function reposition() {
  14339. x.refresh(), x.set.position();
  14340. },
  14341. destroy: function destroy() {
  14342. 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);
  14343. },
  14344. event: {
  14345. start: function start(t) {
  14346. var n = e.isPlainObject(C.delay) ? C.delay.show : C.delay;
  14347. clearTimeout(x.hideTimer), I || (x.showTimer = setTimeout(x.show, n));
  14348. },
  14349. end: function end() {
  14350. var t = e.isPlainObject(C.delay) ? C.delay.hide : C.delay;
  14351. clearTimeout(x.showTimer), x.hideTimer = setTimeout(x.hide, t);
  14352. },
  14353. touchstart: function touchstart(e) {
  14354. I = !0, x.show();
  14355. },
  14356. resize: function resize() {
  14357. x.is.visible() && x.set.position();
  14358. },
  14359. documentChanged: function documentChanged(t) {
  14360. [].forEach.call(t, function (t) {
  14361. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  14362. (t == M || e(t).find(M).length > 0) && (x.debug("Element removed from DOM, tearing down events"), x.destroy());
  14363. });
  14364. });
  14365. },
  14366. hideGracefully: function hideGracefully(t) {
  14367. var i = e(t.target),
  14368. o = e.contains(n.documentElement, t.target),
  14369. a = i.closest(w.popup).length > 0;
  14370. t && !a && o ? (x.debug("Click occurred outside popup hiding popup"), x.hide()) : x.debug("Click was inside popup, keeping popup open");
  14371. }
  14372. },
  14373. create: function create() {
  14374. var t = x.get.html(),
  14375. n = x.get.title(),
  14376. i = x.get.content();
  14377. t || i || n ? (x.debug("Creating pop-up html"), t || (t = C.templates.popup({
  14378. title: n,
  14379. content: i
  14380. })), 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);
  14381. },
  14382. createID: function createID() {
  14383. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, x.verbose("Creating unique id for element", y);
  14384. },
  14385. toggle: function toggle() {
  14386. 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());
  14387. },
  14388. show: function show(e) {
  14389. if (e = e || function () {}, x.debug("Showing pop-up", C.transition), x.is.hidden() && (!x.is.active() || !x.is.dropdown())) {
  14390. if (x.exists() || x.create(), !1 === C.onShow.call(r, M)) return void x.debug("onShow callback returned false, cancelling popup animation");
  14391. C.preserve || C.popup || x.refresh(), r && x.set.position() && (x.save.conditions(), C.exclusive && x.hideAll(), x.animate.show(e));
  14392. }
  14393. },
  14394. hide: function hide(e) {
  14395. if (e = e || function () {}, x.is.visible() || x.is.animating()) {
  14396. if (!1 === C.onHide.call(r, M)) return void x.debug("onHide callback returned false, cancelling popup animation");
  14397. x.remove.visible(), x.unbind.close(), x.restore.conditions(), x.animate.hide(e);
  14398. }
  14399. },
  14400. hideAll: function hideAll() {
  14401. e(w.popup).filter("." + S.popupVisible).each(function () {
  14402. e(this).data(T.activator).popup("hide");
  14403. });
  14404. },
  14405. exists: function exists() {
  14406. return !!r && (C.inline || C.popup ? x.has.popup() : r.closest(F).length >= 1);
  14407. },
  14408. removePopup: function removePopup() {
  14409. x.has.popup() && !C.popup && (x.debug("Removing popup", r), r.remove(), r = i, C.onRemove.call(r, M));
  14410. },
  14411. save: {
  14412. conditions: function conditions() {
  14413. x.cache = {
  14414. title: E.attr("title")
  14415. }, x.cache.title && E.removeAttr("title"), x.verbose("Saving original attributes", x.cache.title);
  14416. }
  14417. },
  14418. restore: {
  14419. conditions: function conditions() {
  14420. return x.cache && x.cache.title && (E.attr("title", x.cache.title), x.verbose("Restoring original attributes", x.cache.title)), !0;
  14421. }
  14422. },
  14423. supports: {
  14424. svg: function svg() {
  14425. return "undefined" == typeof SVGGraphicsElement;
  14426. }
  14427. },
  14428. animate: {
  14429. show: function show(t) {
  14430. t = e.isFunction(t) ? t : function () {}, C.transition && e.fn.transition !== i && E.transition("is supported") ? (x.set.visible(), r.transition({
  14431. animation: C.transition + " in",
  14432. queue: !1,
  14433. debug: C.debug,
  14434. verbose: C.verbose,
  14435. duration: C.duration,
  14436. onComplete: function onComplete() {
  14437. x.bind.close(), t.call(r, M), C.onVisible.call(r, M);
  14438. }
  14439. })) : x.error(k.noTransition);
  14440. },
  14441. hide: function hide(t) {
  14442. 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({
  14443. animation: C.transition + " out",
  14444. queue: !1,
  14445. duration: C.duration,
  14446. debug: C.debug,
  14447. verbose: C.verbose,
  14448. onComplete: function onComplete() {
  14449. x.reset(), t.call(r, M), C.onHidden.call(r, M);
  14450. }
  14451. }) : x.error(k.noTransition) : x.debug("onHide callback returned false, cancelling popup animation");
  14452. }
  14453. },
  14454. change: {
  14455. content: function content(e) {
  14456. r.html(e);
  14457. }
  14458. },
  14459. get: {
  14460. html: function html() {
  14461. return E.removeData(T.html), E.data(T.html) || C.html;
  14462. },
  14463. title: function title() {
  14464. return E.removeData(T.title), E.data(T.title) || C.title;
  14465. },
  14466. content: function content() {
  14467. return E.removeData(T.content), E.data(T.content) || C.content || E.attr("title");
  14468. },
  14469. variation: function variation() {
  14470. return E.removeData(T.variation), E.data(T.variation) || C.variation;
  14471. },
  14472. popup: function popup() {
  14473. return r;
  14474. },
  14475. popupOffset: function popupOffset() {
  14476. return r.offset();
  14477. },
  14478. calculations: function calculations() {
  14479. var e,
  14480. n = x.get.offsetParent(r),
  14481. i = q[0],
  14482. o = D[0] == t,
  14483. a = C.inline || C.popup && C.movePopup ? q.position() : q.offset(),
  14484. s = o ? {
  14485. top: 0,
  14486. left: 0
  14487. } : D.offset(),
  14488. c = {},
  14489. u = o ? {
  14490. top: l.scrollTop(),
  14491. left: l.scrollLeft()
  14492. } : {
  14493. top: 0,
  14494. left: 0
  14495. };
  14496. if (c = {
  14497. target: {
  14498. element: q[0],
  14499. width: q.outerWidth(),
  14500. height: q.outerHeight(),
  14501. top: a.top,
  14502. left: a.left,
  14503. margin: {}
  14504. },
  14505. popup: {
  14506. width: r.outerWidth(),
  14507. height: r.outerHeight()
  14508. },
  14509. parent: {
  14510. width: h.outerWidth(),
  14511. height: h.outerHeight()
  14512. },
  14513. screen: {
  14514. top: s.top,
  14515. left: s.left,
  14516. scroll: {
  14517. top: u.top,
  14518. left: u.left
  14519. },
  14520. width: D.width(),
  14521. height: D.height()
  14522. }
  14523. }, n.get(0) !== h.get(0)) {
  14524. var d = n.offset();
  14525. c.target.top -= d.top, c.target.left -= d.left, c.parent.width = n.outerWidth(), c.parent.height = n.outerHeight();
  14526. }
  14527. return C.setFluidWidth && x.is.fluid() && (c.container = {
  14528. width: r.parent().outerWidth()
  14529. }, 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 = {
  14530. top: e.top + e.scroll.top,
  14531. bottom: e.top + e.scroll.top + e.height,
  14532. left: e.left + e.scroll.left,
  14533. right: e.left + e.scroll.left + e.width
  14534. }, c;
  14535. },
  14536. id: function id() {
  14537. return y;
  14538. },
  14539. startEvent: function startEvent() {
  14540. return "hover" == C.on ? "mouseenter" : "focus" == C.on && "focus";
  14541. },
  14542. scrollEvent: function scrollEvent() {
  14543. return "scroll";
  14544. },
  14545. endEvent: function endEvent() {
  14546. return "hover" == C.on ? "mouseleave" : "focus" == C.on && "blur";
  14547. },
  14548. distanceFromBoundary: function distanceFromBoundary(e, t) {
  14549. var n,
  14550. i,
  14551. o = {};
  14552. return n = (t = t || x.get.calculations()).popup, i = t.boundary, e && (o = {
  14553. top: e.top - i.top,
  14554. left: e.left - i.left,
  14555. right: i.right - (e.left + n.width),
  14556. bottom: i.bottom - (e.top + n.height)
  14557. }, x.verbose("Distance from boundaries determined", e, o)), o;
  14558. },
  14559. offsetParent: function offsetParent(t) {
  14560. var n = (t !== i ? t[0] : q[0]).parentNode,
  14561. o = e(n);
  14562. if (n) for (var a = "none" === o.css("transform"), r = "static" === o.css("position"), s = o.is("body"); n && !s && r && a;) {
  14563. n = n.parentNode, a = "none" === (o = e(n)).css("transform"), r = "static" === o.css("position"), s = o.is("body");
  14564. }
  14565. return o && o.length > 0 ? o : e();
  14566. },
  14567. positions: function positions() {
  14568. return {
  14569. "top left": !1,
  14570. "top center": !1,
  14571. "top right": !1,
  14572. "bottom left": !1,
  14573. "bottom center": !1,
  14574. "bottom right": !1,
  14575. "left center": !1,
  14576. "right center": !1
  14577. };
  14578. },
  14579. nextPosition: function nextPosition(e) {
  14580. var t = e.split(" "),
  14581. n = t[0],
  14582. i = t[1],
  14583. o = "top" == n || "bottom" == n,
  14584. a = !1,
  14585. r = !1,
  14586. s = !1;
  14587. 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 = [{
  14588. top: "bottom",
  14589. bottom: "top",
  14590. left: "right",
  14591. right: "left"
  14592. }[n], i]).join(" "), a = !0 === z[s], x.debug("Trying opposite strategy", s)), "adjacent" === C.prefer && o && (s = (s = [n, {
  14593. left: "center",
  14594. center: "right",
  14595. right: "left"
  14596. }[i]]).join(" "), r = !0 === z[s], x.debug("Trying adjacent strategy", s)), (r || a) && (x.debug("Using backup position", s), s = {
  14597. "top left": "top center",
  14598. "top center": "top right",
  14599. "top right": "right center",
  14600. "right center": "bottom right",
  14601. "bottom right": "bottom center",
  14602. "bottom center": "bottom left",
  14603. "bottom left": "left center",
  14604. "left center": "top left"
  14605. }[e]), s;
  14606. }
  14607. },
  14608. set: {
  14609. position: function position(e, t) {
  14610. if (0 !== q.length && 0 !== r.length) {
  14611. var n, o, a, s, l, c, u, d;
  14612. 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;
  14613. 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) {
  14614. return "left" == e ? "right" : "left";
  14615. }), x.debug("RTL: Popup position updated", e)), j == C.maxSearchDepth && "string" == typeof C.lastResort && (e = C.lastResort), e) {
  14616. case "top left":
  14617. c = {
  14618. top: "auto",
  14619. bottom: l.height - a.top + o,
  14620. left: a.left + n,
  14621. right: "auto"
  14622. };
  14623. break;
  14624. case "top center":
  14625. c = {
  14626. bottom: l.height - a.top + o,
  14627. left: a.left + a.width / 2 - s.width / 2 + n,
  14628. top: "auto",
  14629. right: "auto"
  14630. };
  14631. break;
  14632. case "top right":
  14633. c = {
  14634. bottom: l.height - a.top + o,
  14635. right: l.width - a.left - a.width - n,
  14636. top: "auto",
  14637. left: "auto"
  14638. };
  14639. break;
  14640. case "left center":
  14641. c = {
  14642. top: a.top + a.height / 2 - s.height / 2 + n,
  14643. right: l.width - a.left + o,
  14644. left: "auto",
  14645. bottom: "auto"
  14646. };
  14647. break;
  14648. case "right center":
  14649. c = {
  14650. top: a.top + a.height / 2 - s.height / 2 + n,
  14651. left: a.left + a.width + o,
  14652. bottom: "auto",
  14653. right: "auto"
  14654. };
  14655. break;
  14656. case "bottom left":
  14657. c = {
  14658. top: a.top + a.height + o,
  14659. left: a.left + n,
  14660. bottom: "auto",
  14661. right: "auto"
  14662. };
  14663. break;
  14664. case "bottom center":
  14665. c = {
  14666. top: a.top + a.height + o,
  14667. left: a.left + a.width / 2 - s.width / 2 + n,
  14668. bottom: "auto",
  14669. right: "auto"
  14670. };
  14671. break;
  14672. case "bottom right":
  14673. c = {
  14674. top: a.top + a.height + o,
  14675. right: l.width - a.left - a.width - n,
  14676. left: "auto",
  14677. bottom: "auto"
  14678. };
  14679. }
  14680. 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)) {
  14681. 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);
  14682. 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;
  14683. x.debug("No position found, showing with last position");
  14684. }
  14685. return x.debug("Position is on stage", e), x.remove.attempts(), x.remove.loading(), C.setFluidWidth && x.is.fluid() && x.set.fluidWidth(t), !0;
  14686. }
  14687. x.error(k.notFound);
  14688. },
  14689. fluidWidth: function fluidWidth(e) {
  14690. e = e || x.get.calculations(), x.debug("Automatically setting element width to parent width", e.parent.width), r.css("width", e.container.width);
  14691. },
  14692. variation: function variation(e) {
  14693. (e = e || x.get.variation()) && x.has.popup() && (x.verbose("Adding variation to popup", e), r.addClass(e));
  14694. },
  14695. visible: function visible() {
  14696. E.addClass(S.visible);
  14697. }
  14698. },
  14699. remove: {
  14700. loading: function loading() {
  14701. r.removeClass(S.loading);
  14702. },
  14703. variation: function variation(e) {
  14704. (e = e || x.get.variation()) && (x.verbose("Removing variation", e), r.removeClass(e));
  14705. },
  14706. visible: function visible() {
  14707. E.removeClass(S.visible);
  14708. },
  14709. attempts: function attempts() {
  14710. x.verbose("Resetting all searched positions"), j = 0, z = !1;
  14711. }
  14712. },
  14713. bind: {
  14714. events: function events() {
  14715. 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);
  14716. },
  14717. popup: function popup() {
  14718. 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);
  14719. },
  14720. close: function close() {
  14721. (!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();
  14722. },
  14723. closeOnScroll: function closeOnScroll() {
  14724. x.verbose("Binding scroll close event to document"), O.one(x.get.scrollEvent() + b, x.event.hideGracefully);
  14725. },
  14726. touchClose: function touchClose() {
  14727. x.verbose("Binding popup touchclose event to document"), s.on("touchstart" + b, function (e) {
  14728. x.verbose("Touched away from popup"), x.event.hideGracefully.call(M, e);
  14729. });
  14730. },
  14731. clickaway: function clickaway() {
  14732. x.verbose("Binding popup close event to document"), s.on("click" + b, function (e) {
  14733. x.verbose("Clicked away from popup"), x.event.hideGracefully.call(M, e);
  14734. });
  14735. }
  14736. },
  14737. unbind: {
  14738. events: function events() {
  14739. l.off(b), E.off(R);
  14740. },
  14741. close: function close() {
  14742. s.off(b), O.off(b);
  14743. }
  14744. },
  14745. has: {
  14746. popup: function popup() {
  14747. return r && r.length > 0;
  14748. }
  14749. },
  14750. should: {
  14751. centerArrow: function centerArrow(e) {
  14752. return !x.is.basic() && e.target.width <= 2 * C.arrowPixelsFromEdge;
  14753. }
  14754. },
  14755. is: {
  14756. offstage: function offstage(t, n) {
  14757. var i = [];
  14758. return e.each(t, function (e, t) {
  14759. t < -C.jitter && (x.debug("Position exceeds allowable distance from edge", e, t, n), i.push(e));
  14760. }), i.length > 0;
  14761. },
  14762. svg: function svg(e) {
  14763. return x.supports.svg() && e instanceof SVGGraphicsElement;
  14764. },
  14765. basic: function basic() {
  14766. return E.hasClass(S.basic);
  14767. },
  14768. active: function active() {
  14769. return E.hasClass(S.active);
  14770. },
  14771. animating: function animating() {
  14772. return r !== i && r.hasClass(S.animating);
  14773. },
  14774. fluid: function fluid() {
  14775. return r !== i && r.hasClass(S.fluid);
  14776. },
  14777. visible: function visible() {
  14778. return r !== i && r.hasClass(S.popupVisible);
  14779. },
  14780. dropdown: function dropdown() {
  14781. return E.hasClass(S.dropdown);
  14782. },
  14783. hidden: function hidden() {
  14784. return !x.is.visible();
  14785. },
  14786. rtl: function rtl() {
  14787. return "rtl" == E.css("direction");
  14788. }
  14789. },
  14790. reset: function reset() {
  14791. x.remove.visible(), C.preserve ? e.fn.transition !== i && r.transition("remove transition") : x.removePopup();
  14792. },
  14793. setting: function setting(t, n) {
  14794. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  14795. if (n === i) return C[t];
  14796. C[t] = n;
  14797. }
  14798. },
  14799. internal: function internal(t, n) {
  14800. if (e.isPlainObject(t)) e.extend(!0, x, t);else {
  14801. if (n === i) return x[t];
  14802. x[t] = n;
  14803. }
  14804. },
  14805. debug: function debug() {
  14806. !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)));
  14807. },
  14808. verbose: function verbose() {
  14809. !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)));
  14810. },
  14811. error: function error() {
  14812. C.silent || (x.error = Function.prototype.bind.call(console.error, console, C.name + ":"), x.error.apply(console, arguments));
  14813. },
  14814. performance: {
  14815. log: function log(e) {
  14816. var t, n;
  14817. C.performance && (n = (t = new Date().getTime()) - (d || t), d = t, f.push({
  14818. Name: e[0],
  14819. Arguments: [].slice.call(e, 1) || "",
  14820. Element: M,
  14821. "Execution Time": n
  14822. })), clearTimeout(x.performance.timer), x.performance.timer = setTimeout(x.performance.display, 500);
  14823. },
  14824. display: function display() {
  14825. var t = C.name + ":",
  14826. n = 0;
  14827. d = !1, clearTimeout(x.performance.timer), e.each(f, function (e, t) {
  14828. n += t["Execution Time"];
  14829. }), 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) {
  14830. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  14831. }), console.groupEnd()), f = [];
  14832. }
  14833. },
  14834. invoke: function invoke(t, n, o) {
  14835. var r,
  14836. s,
  14837. l,
  14838. c = L;
  14839. 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) {
  14840. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  14841. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  14842. if (c[a] !== i) return s = c[a], !1;
  14843. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  14844. c = c[o];
  14845. }
  14846. })), 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;
  14847. }
  14848. }, g ? (L === i && x.initialize(), x.invoke(m)) : (L !== i && L.invoke("destroy"), x.initialize());
  14849. }), a !== i ? a : this;
  14850. }, e.fn.popup.settings = {
  14851. name: "Popup",
  14852. silent: !1,
  14853. debug: !1,
  14854. verbose: !1,
  14855. performance: !0,
  14856. namespace: "popup",
  14857. observeChanges: !0,
  14858. onCreate: function onCreate() {},
  14859. onRemove: function onRemove() {},
  14860. onShow: function onShow() {},
  14861. onVisible: function onVisible() {},
  14862. onHide: function onHide() {},
  14863. onUnplaceable: function onUnplaceable() {},
  14864. onHidden: function onHidden() {},
  14865. on: "hover",
  14866. boundary: t,
  14867. addTouchEvents: !0,
  14868. position: "top left",
  14869. variation: "",
  14870. movePopup: !0,
  14871. target: !1,
  14872. popup: !1,
  14873. inline: !1,
  14874. preserve: !1,
  14875. hoverable: !1,
  14876. content: !1,
  14877. html: !1,
  14878. title: !1,
  14879. closable: !0,
  14880. hideOnScroll: "auto",
  14881. exclusive: !1,
  14882. context: "body",
  14883. scrollContext: t,
  14884. prefer: "opposite",
  14885. lastResort: !1,
  14886. arrowPixelsFromEdge: 20,
  14887. delay: {
  14888. show: 50,
  14889. hide: 70
  14890. },
  14891. setFluidWidth: !0,
  14892. duration: 200,
  14893. transition: "scale",
  14894. distanceAway: 0,
  14895. jitter: 2,
  14896. offset: 0,
  14897. maxSearchDepth: 15,
  14898. error: {
  14899. invalidPosition: "The position you specified is not a valid position",
  14900. cannotPlace: "Popup does not fit within the boundaries of the viewport",
  14901. method: "The method you called is not defined.",
  14902. noTransition: "This module requires ui transitions <https://github.com/Semantic-Org/UI-Transition>",
  14903. notFound: "The target or popup you specified does not exist on the page"
  14904. },
  14905. metadata: {
  14906. activator: "activator",
  14907. content: "content",
  14908. html: "html",
  14909. offset: "offset",
  14910. position: "position",
  14911. title: "title",
  14912. variation: "variation"
  14913. },
  14914. className: {
  14915. active: "active",
  14916. basic: "basic",
  14917. animating: "animating",
  14918. dropdown: "dropdown",
  14919. fluid: "fluid",
  14920. loading: "loading",
  14921. popup: "ui popup",
  14922. position: "top left center bottom right",
  14923. visible: "visible",
  14924. popupVisible: "visible"
  14925. },
  14926. selector: {
  14927. popup: ".ui.popup"
  14928. },
  14929. templates: {
  14930. escape: function escape(e) {
  14931. var t = {
  14932. "&": "&amp;",
  14933. "<": "&lt;",
  14934. ">": "&gt;",
  14935. '"': "&quot;",
  14936. "'": "&#x27;",
  14937. "`": "&#x60;"
  14938. };
  14939. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  14940. return t[e];
  14941. }) : e;
  14942. },
  14943. popup: function popup(t) {
  14944. var n = "",
  14945. o = e.fn.popup.settings.templates.escape;
  14946. return _typeof(t) !== i && (_typeof(t.title) !== i && t.title && (t.title = o(t.title), n += '<div class="header">' + t.title + "</div>"), _typeof(t.content) !== i && t.content && (t.content = o(t.content), n += '<div class="content">' + t.content + "</div>")), n;
  14947. }
  14948. }
  14949. };
  14950. }(jQuery, window, document), function (e, t, n, i) {
  14951. "use strict";
  14952. 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")());
  14953. e.fn.progress = function (t) {
  14954. var o,
  14955. a = e(this),
  14956. r = a.selector || "",
  14957. s = new Date().getTime(),
  14958. l = [],
  14959. c = arguments[0],
  14960. u = "string" == typeof c,
  14961. d = [].slice.call(arguments, 1);
  14962. return a.each(function () {
  14963. var a,
  14964. f = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.progress.settings, t) : e.extend({}, e.fn.progress.settings),
  14965. m = f.className,
  14966. g = f.metadata,
  14967. p = f.namespace,
  14968. h = f.selector,
  14969. v = f.error,
  14970. b = "." + p,
  14971. y = "module-" + p,
  14972. x = e(this),
  14973. C = e(this).find(h.bar),
  14974. w = e(this).find(h.progress),
  14975. S = e(this).find(h.label),
  14976. k = this,
  14977. T = x.data(y),
  14978. A = !1;
  14979. a = {
  14980. initialize: function initialize() {
  14981. a.debug("Initializing progress bar", f), a.set.duration(), a.set.transitionEvent(), a.read.metadata(), a.read.settings(), a.instantiate();
  14982. },
  14983. instantiate: function instantiate() {
  14984. a.verbose("Storing instance of progress", a), T = a, x.data(y, a);
  14985. },
  14986. destroy: function destroy() {
  14987. a.verbose("Destroying previous progress for", x), clearInterval(T.interval), a.remove.state(), x.removeData(y), T = i;
  14988. },
  14989. reset: function reset() {
  14990. a.remove.nextValue(), a.update.progress(0);
  14991. },
  14992. complete: function complete() {
  14993. (a.percent === i || a.percent < 100) && (a.remove.progressPoll(), a.set.percent(100));
  14994. },
  14995. read: {
  14996. metadata: function metadata() {
  14997. var e = {
  14998. percent: x.data(g.percent),
  14999. total: x.data(g.total),
  15000. value: x.data(g.value)
  15001. };
  15002. 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));
  15003. },
  15004. settings: function settings() {
  15005. !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));
  15006. }
  15007. },
  15008. bind: {
  15009. transitionEnd: function transitionEnd(e) {
  15010. var t = a.get.transitionEnd();
  15011. C.one(t + b, function (t) {
  15012. clearTimeout(a.failSafeTimer), e.call(this, t);
  15013. }), a.failSafeTimer = setTimeout(function () {
  15014. C.triggerHandler(t);
  15015. }, f.duration + f.failSafeDelay), a.verbose("Adding fail safe timer", a.timer);
  15016. }
  15017. },
  15018. increment: function increment(e) {
  15019. var t, n;
  15020. 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);
  15021. },
  15022. decrement: function decrement(e) {
  15023. var t, n;
  15024. 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);
  15025. },
  15026. has: {
  15027. progressPoll: function progressPoll() {
  15028. return a.progressPoll;
  15029. },
  15030. total: function total() {
  15031. return !1 !== a.get.total();
  15032. }
  15033. },
  15034. get: {
  15035. text: function text(e) {
  15036. var t = a.value || 0,
  15037. n = a.total || 0,
  15038. i = A ? a.get.displayPercent() : a.percent || 0,
  15039. o = a.total > 0 ? n - t : 100 - i;
  15040. 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;
  15041. },
  15042. normalizedValue: function normalizedValue(e) {
  15043. if (e < 0) return a.debug("Value cannot decrement below 0"), 0;
  15044. if (a.has.total()) {
  15045. if (e > a.total) return a.debug("Value cannot increment above total", a.total), a.total;
  15046. } else if (e > 100) return a.debug("Value cannot increment above 100 percent"), 100;
  15047. return e;
  15048. },
  15049. updateInterval: function updateInterval() {
  15050. return "auto" == f.updateInterval ? f.duration : f.updateInterval;
  15051. },
  15052. randomValue: function randomValue() {
  15053. return a.debug("Generating random increment percentage"), Math.floor(Math.random() * f.random.max + f.random.min);
  15054. },
  15055. numericValue: function numericValue(e) {
  15056. return "string" == typeof e ? "" !== e.replace(/[^\d.]/g, "") && +e.replace(/[^\d.]/g, "") : e;
  15057. },
  15058. transitionEnd: function transitionEnd() {
  15059. var e,
  15060. t = n.createElement("element"),
  15061. o = {
  15062. transition: "transitionend",
  15063. OTransition: "oTransitionEnd",
  15064. MozTransition: "transitionend",
  15065. WebkitTransition: "webkitTransitionEnd"
  15066. };
  15067. for (e in o) {
  15068. if (t.style[e] !== i) return o[e];
  15069. }
  15070. },
  15071. displayPercent: function displayPercent() {
  15072. var e = C.width(),
  15073. t = x.width(),
  15074. n = e > parseInt(C.css("min-width"), 10) ? e / t * 100 : a.percent;
  15075. return f.precision > 0 ? Math.round(n * (10 * f.precision)) / (10 * f.precision) : Math.round(n);
  15076. },
  15077. percent: function percent() {
  15078. return a.percent || 0;
  15079. },
  15080. value: function value() {
  15081. return a.nextValue || a.value || 0;
  15082. },
  15083. total: function total() {
  15084. return a.total || !1;
  15085. }
  15086. },
  15087. create: {
  15088. progressPoll: function progressPoll() {
  15089. a.progressPoll = setTimeout(function () {
  15090. a.update.toNextValue(), a.remove.progressPoll();
  15091. }, a.get.updateInterval());
  15092. }
  15093. },
  15094. is: {
  15095. complete: function complete() {
  15096. return a.is.success() || a.is.warning() || a.is.error();
  15097. },
  15098. success: function success() {
  15099. return x.hasClass(m.success);
  15100. },
  15101. warning: function warning() {
  15102. return x.hasClass(m.warning);
  15103. },
  15104. error: function error() {
  15105. return x.hasClass(m.error);
  15106. },
  15107. active: function active() {
  15108. return x.hasClass(m.active);
  15109. },
  15110. visible: function visible() {
  15111. return x.is(":visible");
  15112. }
  15113. },
  15114. remove: {
  15115. progressPoll: function progressPoll() {
  15116. a.verbose("Removing progress poll timer"), a.progressPoll && (clearTimeout(a.progressPoll), delete a.progressPoll);
  15117. },
  15118. nextValue: function nextValue() {
  15119. a.verbose("Removing progress value stored for next update"), delete a.nextValue;
  15120. },
  15121. state: function state() {
  15122. a.verbose("Removing stored state"), delete a.total, delete a.percent, delete a.value;
  15123. },
  15124. active: function active() {
  15125. a.verbose("Removing active state"), x.removeClass(m.active);
  15126. },
  15127. success: function success() {
  15128. a.verbose("Removing success state"), x.removeClass(m.success);
  15129. },
  15130. warning: function warning() {
  15131. a.verbose("Removing warning state"), x.removeClass(m.warning);
  15132. },
  15133. error: function error() {
  15134. a.verbose("Removing error state"), x.removeClass(m.error);
  15135. }
  15136. },
  15137. set: {
  15138. barWidth: function barWidth(e) {
  15139. 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)));
  15140. },
  15141. duration: function duration(e) {
  15142. e = "number" == typeof (e = e || f.duration) ? e + "ms" : e, a.verbose("Setting progress bar transition duration", e), C.css({
  15143. "transition-duration": e
  15144. });
  15145. },
  15146. percent: function percent(e) {
  15147. 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);
  15148. },
  15149. labelInterval: function labelInterval() {
  15150. clearInterval(a.interval), a.bind.transitionEnd(function () {
  15151. a.verbose("Bar finished animating, removing continuous label updates"), clearInterval(a.interval), A = !1, a.set.labels();
  15152. }), A = !0, a.interval = setInterval(function () {
  15153. e.contains(n.documentElement, k) || (clearInterval(a.interval), A = !1), a.set.labels();
  15154. }, f.framerate);
  15155. },
  15156. labels: function labels() {
  15157. a.verbose("Setting both bar progress and outer label text"), a.set.barLabel(), a.set.state();
  15158. },
  15159. label: function label(e) {
  15160. (e = e || "") && (e = a.get.text(e), a.verbose("Setting label to text", e), S.text(e));
  15161. },
  15162. state: function state(e) {
  15163. 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));
  15164. },
  15165. barLabel: function barLabel(e) {
  15166. 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)));
  15167. },
  15168. active: function active(e) {
  15169. 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 () {
  15170. f.onActive.call(k, a.value, a.total);
  15171. });
  15172. },
  15173. success: function success(e) {
  15174. 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 () {
  15175. f.onSuccess.call(k, a.total);
  15176. });
  15177. },
  15178. warning: function warning(e) {
  15179. 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 () {
  15180. f.onWarning.call(k, a.value, a.total);
  15181. });
  15182. },
  15183. error: function error(e) {
  15184. 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 () {
  15185. f.onError.call(k, a.value, a.total);
  15186. });
  15187. },
  15188. transitionEvent: function transitionEvent() {
  15189. a.get.transitionEnd();
  15190. },
  15191. total: function total(e) {
  15192. a.total = e;
  15193. },
  15194. value: function value(e) {
  15195. a.value = e;
  15196. },
  15197. progress: function progress(e) {
  15198. 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());
  15199. },
  15200. nextValue: function nextValue(e) {
  15201. a.nextValue = e;
  15202. }
  15203. },
  15204. update: {
  15205. toNextValue: function toNextValue() {
  15206. var e = a.nextValue;
  15207. e && (a.debug("Update interval complete using last updated value", e), a.update.progress(e), a.remove.nextValue());
  15208. },
  15209. progress: function progress(e) {
  15210. var t;
  15211. !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));
  15212. }
  15213. },
  15214. setting: function setting(t, n) {
  15215. if (a.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, f, t);else {
  15216. if (n === i) return f[t];
  15217. e.isPlainObject(f[t]) ? e.extend(!0, f[t], n) : f[t] = n;
  15218. }
  15219. },
  15220. internal: function internal(t, n) {
  15221. if (e.isPlainObject(t)) e.extend(!0, a, t);else {
  15222. if (n === i) return a[t];
  15223. a[t] = n;
  15224. }
  15225. },
  15226. debug: function debug() {
  15227. !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)));
  15228. },
  15229. verbose: function verbose() {
  15230. !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)));
  15231. },
  15232. error: function error() {
  15233. f.silent || (a.error = Function.prototype.bind.call(console.error, console, f.name + ":"), a.error.apply(console, arguments));
  15234. },
  15235. performance: {
  15236. log: function log(e) {
  15237. var t, n;
  15238. f.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  15239. Name: e[0],
  15240. Arguments: [].slice.call(e, 1) || "",
  15241. Element: k,
  15242. "Execution Time": n
  15243. })), clearTimeout(a.performance.timer), a.performance.timer = setTimeout(a.performance.display, 500);
  15244. },
  15245. display: function display() {
  15246. var t = f.name + ":",
  15247. n = 0;
  15248. s = !1, clearTimeout(a.performance.timer), e.each(l, function (e, t) {
  15249. n += t["Execution Time"];
  15250. }), 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) {
  15251. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15252. }), console.groupEnd()), l = [];
  15253. }
  15254. },
  15255. invoke: function invoke(t, n, r) {
  15256. var s,
  15257. l,
  15258. c,
  15259. u = T;
  15260. 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) {
  15261. var r = n != s ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15262. if (e.isPlainObject(u[r]) && n != s) u = u[r];else {
  15263. if (u[r] !== i) return l = u[r], !1;
  15264. if (!e.isPlainObject(u[o]) || n == s) return u[o] !== i ? (l = u[o], !1) : (a.error(v.method, t), !1);
  15265. u = u[o];
  15266. }
  15267. })), 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;
  15268. }
  15269. }, u ? (T === i && a.initialize(), a.invoke(c)) : (T !== i && T.invoke("destroy"), a.initialize());
  15270. }), o !== i ? o : this;
  15271. }, e.fn.progress.settings = {
  15272. name: "Progress",
  15273. namespace: "progress",
  15274. silent: !1,
  15275. debug: !1,
  15276. verbose: !1,
  15277. performance: !0,
  15278. random: {
  15279. min: 2,
  15280. max: 5
  15281. },
  15282. duration: 300,
  15283. updateInterval: "auto",
  15284. autoSuccess: !0,
  15285. showActivity: !0,
  15286. limitValues: !0,
  15287. label: "percent",
  15288. precision: 0,
  15289. framerate: 1e3 / 30,
  15290. percent: !1,
  15291. total: !1,
  15292. value: !1,
  15293. failSafeDelay: 100,
  15294. onLabelUpdate: function onLabelUpdate(e, t, n, i) {
  15295. return t;
  15296. },
  15297. onChange: function onChange(e, t, n) {},
  15298. onSuccess: function onSuccess(e) {},
  15299. onActive: function onActive(e, t) {},
  15300. onError: function onError(e, t) {},
  15301. onWarning: function onWarning(e, t) {},
  15302. error: {
  15303. method: "The method you called is not defined.",
  15304. nonNumeric: "Progress value is non numeric",
  15305. tooHigh: "Value specified is above 100%",
  15306. tooLow: "Value specified is below 0%"
  15307. },
  15308. regExp: {
  15309. variable: /\{\$*[A-z0-9]+\}/g
  15310. },
  15311. metadata: {
  15312. percent: "percent",
  15313. total: "total",
  15314. value: "value"
  15315. },
  15316. selector: {
  15317. bar: "> .bar",
  15318. label: "> .label",
  15319. progress: ".bar > .progress"
  15320. },
  15321. text: {
  15322. active: !1,
  15323. error: !1,
  15324. success: !1,
  15325. warning: !1,
  15326. percent: "{percent}%",
  15327. ratio: "{value} of {total}"
  15328. },
  15329. className: {
  15330. active: "active",
  15331. error: "error",
  15332. success: "success",
  15333. warning: "warning"
  15334. }
  15335. };
  15336. }(jQuery, window, document), function (e, t, n, i) {
  15337. "use strict";
  15338. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.rating = function (t) {
  15339. var n,
  15340. o = e(this),
  15341. a = o.selector || "",
  15342. r = new Date().getTime(),
  15343. s = [],
  15344. l = arguments[0],
  15345. c = "string" == typeof l,
  15346. u = [].slice.call(arguments, 1);
  15347. return o.each(function () {
  15348. var d,
  15349. f,
  15350. m = e.isPlainObject(t) ? e.extend(!0, {}, e.fn.rating.settings, t) : e.extend({}, e.fn.rating.settings),
  15351. g = m.namespace,
  15352. p = m.className,
  15353. h = m.metadata,
  15354. v = m.selector,
  15355. b = (m.error, "." + g),
  15356. y = "module-" + g,
  15357. x = this,
  15358. C = e(this).data(y),
  15359. w = e(this),
  15360. S = w.find(v.icon);
  15361. f = {
  15362. initialize: function initialize() {
  15363. 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();
  15364. },
  15365. instantiate: function instantiate() {
  15366. f.verbose("Instantiating module", m), C = f, w.data(y, f);
  15367. },
  15368. destroy: function destroy() {
  15369. f.verbose("Destroying previous instance", C), f.remove.events(), w.removeData(y);
  15370. },
  15371. refresh: function refresh() {
  15372. S = w.find(v.icon);
  15373. },
  15374. setup: {
  15375. layout: function layout() {
  15376. var t = f.get.maxRating(),
  15377. n = e.fn.rating.settings.templates.icon(t);
  15378. f.debug("Generating icon html dynamically"), w.html(n), f.refresh();
  15379. }
  15380. },
  15381. event: {
  15382. mouseenter: function mouseenter() {
  15383. var t = e(this);
  15384. t.nextAll().removeClass(p.selected), w.addClass(p.selected), t.addClass(p.selected).prevAll().addClass(p.selected);
  15385. },
  15386. mouseleave: function mouseleave() {
  15387. w.removeClass(p.selected), S.removeClass(p.selected);
  15388. },
  15389. click: function click() {
  15390. var t = e(this),
  15391. n = f.get.rating(),
  15392. i = S.index(t) + 1;
  15393. ("auto" == m.clearable ? 1 === S.length : m.clearable) && n == i ? f.clearRating() : f.set.rating(i);
  15394. }
  15395. },
  15396. clearRating: function clearRating() {
  15397. f.debug("Clearing current rating"), f.set.rating(0);
  15398. },
  15399. bind: {
  15400. events: function events() {
  15401. 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);
  15402. }
  15403. },
  15404. remove: {
  15405. events: function events() {
  15406. f.verbose("Removing events"), w.off(b);
  15407. },
  15408. initialLoad: function initialLoad() {
  15409. d = !1;
  15410. }
  15411. },
  15412. enable: function enable() {
  15413. f.debug("Setting rating to interactive mode"), f.bind.events(), w.removeClass(p.disabled);
  15414. },
  15415. disable: function disable() {
  15416. f.debug("Setting rating to read-only mode"), f.remove.events(), w.addClass(p.disabled);
  15417. },
  15418. is: {
  15419. initialLoad: function initialLoad() {
  15420. return d;
  15421. }
  15422. },
  15423. get: {
  15424. initialRating: function initialRating() {
  15425. return w.data(h.rating) !== i ? (w.removeData(h.rating), w.data(h.rating)) : m.initialRating;
  15426. },
  15427. maxRating: function maxRating() {
  15428. return w.data(h.maxRating) !== i ? (w.removeData(h.maxRating), w.data(h.maxRating)) : m.maxRating;
  15429. },
  15430. rating: function rating() {
  15431. var e = S.filter("." + p.active).length;
  15432. return f.verbose("Current rating retrieved", e), e;
  15433. }
  15434. },
  15435. set: {
  15436. rating: function rating(e) {
  15437. var t = e - 1 >= 0 ? e - 1 : 0,
  15438. n = S.eq(t);
  15439. 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);
  15440. },
  15441. initialLoad: function initialLoad() {
  15442. d = !0;
  15443. }
  15444. },
  15445. setting: function setting(t, n) {
  15446. if (f.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  15447. if (n === i) return m[t];
  15448. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  15449. }
  15450. },
  15451. internal: function internal(t, n) {
  15452. if (e.isPlainObject(t)) e.extend(!0, f, t);else {
  15453. if (n === i) return f[t];
  15454. f[t] = n;
  15455. }
  15456. },
  15457. debug: function debug() {
  15458. !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)));
  15459. },
  15460. verbose: function verbose() {
  15461. !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)));
  15462. },
  15463. error: function error() {
  15464. m.silent || (f.error = Function.prototype.bind.call(console.error, console, m.name + ":"), f.error.apply(console, arguments));
  15465. },
  15466. performance: {
  15467. log: function log(e) {
  15468. var t, n;
  15469. m.performance && (n = (t = new Date().getTime()) - (r || t), r = t, s.push({
  15470. Name: e[0],
  15471. Arguments: [].slice.call(e, 1) || "",
  15472. Element: x,
  15473. "Execution Time": n
  15474. })), clearTimeout(f.performance.timer), f.performance.timer = setTimeout(f.performance.display, 500);
  15475. },
  15476. display: function display() {
  15477. var t = m.name + ":",
  15478. n = 0;
  15479. r = !1, clearTimeout(f.performance.timer), e.each(s, function (e, t) {
  15480. n += t["Execution Time"];
  15481. }), 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) {
  15482. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15483. }), console.groupEnd()), s = [];
  15484. }
  15485. },
  15486. invoke: function invoke(t, o, a) {
  15487. var r,
  15488. s,
  15489. l,
  15490. c = C;
  15491. 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) {
  15492. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15493. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  15494. if (c[a] !== i) return s = c[a], !1;
  15495. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  15496. c = c[o];
  15497. }
  15498. })), 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;
  15499. }
  15500. }, c ? (C === i && f.initialize(), f.invoke(l)) : (C !== i && C.invoke("destroy"), f.initialize());
  15501. }), n !== i ? n : this;
  15502. }, e.fn.rating.settings = {
  15503. name: "Rating",
  15504. namespace: "rating",
  15505. slent: !1,
  15506. debug: !1,
  15507. verbose: !1,
  15508. performance: !0,
  15509. initialRating: 0,
  15510. interactive: !0,
  15511. maxRating: 4,
  15512. clearable: "auto",
  15513. fireOnInit: !1,
  15514. onRate: function onRate(e) {},
  15515. error: {
  15516. method: "The method you called is not defined",
  15517. noMaximum: "No maximum rating specified. Cannot generate HTML automatically"
  15518. },
  15519. metadata: {
  15520. rating: "rating",
  15521. maxRating: "maxRating"
  15522. },
  15523. className: {
  15524. active: "active",
  15525. disabled: "disabled",
  15526. selected: "selected",
  15527. loading: "loading"
  15528. },
  15529. selector: {
  15530. icon: ".icon"
  15531. },
  15532. templates: {
  15533. icon: function icon(e) {
  15534. for (var t = 1, n = ""; t <= e;) {
  15535. n += '<i class="icon"></i>', t++;
  15536. }
  15537. return n;
  15538. }
  15539. }
  15540. };
  15541. }(jQuery, window, document), function (e, t, n, i) {
  15542. "use strict";
  15543. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.search = function (o) {
  15544. var a,
  15545. r = e(this),
  15546. s = r.selector || "",
  15547. l = new Date().getTime(),
  15548. c = [],
  15549. u = arguments[0],
  15550. d = "string" == typeof u,
  15551. f = [].slice.call(arguments, 1);
  15552. return e(this).each(function () {
  15553. var m,
  15554. g = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.search.settings, o) : e.extend({}, e.fn.search.settings),
  15555. p = g.className,
  15556. h = g.metadata,
  15557. v = g.regExp,
  15558. b = g.fields,
  15559. y = g.selector,
  15560. x = g.error,
  15561. C = g.namespace,
  15562. w = "." + C,
  15563. S = C + "-module",
  15564. k = e(this),
  15565. T = k.find(y.prompt),
  15566. A = k.find(y.searchButton),
  15567. R = k.find(y.results),
  15568. P = k.find(y.result),
  15569. E = (k.find(y.category), this),
  15570. F = k.data(S),
  15571. O = !1,
  15572. D = !1;
  15573. m = {
  15574. initialize: function initialize() {
  15575. m.verbose("Initializing module"), m.get.settings(), m.determine.searchFields(), m.bind.events(), m.set.type(), m.create.results(), m.instantiate();
  15576. },
  15577. instantiate: function instantiate() {
  15578. m.verbose("Storing instance of module", m), F = m, k.data(S, m);
  15579. },
  15580. destroy: function destroy() {
  15581. m.verbose("Destroying instance"), k.off(w).removeData(S);
  15582. },
  15583. refresh: function refresh() {
  15584. 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);
  15585. },
  15586. refreshResults: function refreshResults() {
  15587. R = k.find(y.results), P = k.find(y.result);
  15588. },
  15589. bind: {
  15590. events: function events() {
  15591. 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);
  15592. }
  15593. },
  15594. determine: {
  15595. searchFields: function searchFields() {
  15596. o && o.searchFields !== i && (g.searchFields = o.searchFields);
  15597. }
  15598. },
  15599. event: {
  15600. input: function input() {
  15601. g.searchDelay ? (clearTimeout(m.timer), m.timer = setTimeout(function () {
  15602. m.is.focused() && m.query();
  15603. }, g.searchDelay)) : m.query();
  15604. },
  15605. focus: function focus() {
  15606. m.set.focus(), g.searchOnFocus && m.has.minimumCharacters() && m.query(function () {
  15607. m.can.show() && m.showResults();
  15608. });
  15609. },
  15610. blur: function blur(e) {
  15611. var t = function t() {
  15612. m.cancel.query(), m.remove.focus(), m.timer = setTimeout(m.hideResults, g.hideDelay);
  15613. };
  15614. 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) {
  15615. m.is.inMessage(e) || O ? T.focus() : (O = !1, m.is.animating() || m.is.hidden() || t());
  15616. })) : (m.debug("Input blurred without user action, closing results"), t()));
  15617. },
  15618. result: {
  15619. mousedown: function mousedown() {
  15620. m.resultsClicked = !0;
  15621. },
  15622. mouseup: function mouseup() {
  15623. m.resultsClicked = !1;
  15624. },
  15625. click: function click(n) {
  15626. m.debug("Search result selected");
  15627. var i = e(this),
  15628. o = i.find(y.title).eq(0),
  15629. a = i.is("a[href]") ? i : i.find("a[href]").eq(0),
  15630. r = a.attr("href") || !1,
  15631. s = a.attr("target") || !1,
  15632. l = (o.html(), o.length > 0 && o.text()),
  15633. c = m.get.results(),
  15634. u = i.data(h.result) || m.get.result(l, c);
  15635. 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);
  15636. 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);
  15637. }
  15638. }
  15639. },
  15640. handleKeyboard: function handleKeyboard(e) {
  15641. var t,
  15642. n = k.find(y.result),
  15643. i = k.find(y.category),
  15644. o = n.filter("." + p.active),
  15645. a = n.index(o),
  15646. r = n.length,
  15647. s = o.length > 0,
  15648. l = e.which,
  15649. c = 13,
  15650. u = 38,
  15651. d = 40;
  15652. if (l == 27 && (m.verbose("Escape key pressed, blurring search field"), m.hideResults(), D = !0), m.is.visible()) {
  15653. if (l == c) {
  15654. 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;
  15655. } 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());
  15656. } else l == c && (m.verbose("Enter key pressed, executing query"), m.query(), m.set.buttonPressed(), T.one("keyup", m.remove.buttonFocus));
  15657. },
  15658. setup: {
  15659. api: function api(t, n) {
  15660. var i = {
  15661. debug: g.debug,
  15662. on: !1,
  15663. cache: g.cache,
  15664. action: "search",
  15665. urlData: {
  15666. query: t
  15667. },
  15668. onSuccess: function onSuccess(e) {
  15669. m.parse.response.call(E, e, t), n();
  15670. },
  15671. onFailure: function onFailure() {
  15672. m.displayMessage(x.serverError), n();
  15673. },
  15674. onAbort: function onAbort(e) {},
  15675. onError: m.error
  15676. };
  15677. e.extend(!0, i, g.apiSettings), m.verbose("Setting up API request", i), k.api(i);
  15678. }
  15679. },
  15680. can: {
  15681. useAPI: function useAPI() {
  15682. return e.fn.api !== i;
  15683. },
  15684. show: function show() {
  15685. return m.is.focused() && !m.is.visible() && !m.is.empty();
  15686. },
  15687. transition: function transition() {
  15688. return g.transition && e.fn.transition !== i && k.transition("is supported");
  15689. }
  15690. },
  15691. is: {
  15692. animating: function animating() {
  15693. return R.hasClass(p.animating);
  15694. },
  15695. hidden: function hidden() {
  15696. return R.hasClass(p.hidden);
  15697. },
  15698. inMessage: function inMessage(t) {
  15699. if (t.target) {
  15700. var i = e(t.target);
  15701. return e.contains(n.documentElement, t.target) && i.closest(y.message).length > 0;
  15702. }
  15703. },
  15704. empty: function empty() {
  15705. return "" === R.html();
  15706. },
  15707. visible: function visible() {
  15708. return R.filter(":visible").length > 0;
  15709. },
  15710. focused: function focused() {
  15711. return T.filter(":focus").length > 0;
  15712. }
  15713. },
  15714. get: {
  15715. settings: function settings() {
  15716. e.isPlainObject(o) && o.searchFullText && (g.fullTextSearch = o.searchFullText, m.error(g.error.oldSearchSyntax, E));
  15717. },
  15718. inputEvent: function inputEvent() {
  15719. var e = T[0];
  15720. return e !== i && e.oninput !== i ? "input" : e !== i && e.onpropertychange !== i ? "propertychange" : "keyup";
  15721. },
  15722. value: function value() {
  15723. return T.val();
  15724. },
  15725. results: function results() {
  15726. return k.data(h.results);
  15727. },
  15728. result: function result(t, n) {
  15729. var o = ["title", "id"],
  15730. a = !1;
  15731. 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) {
  15732. if (e.isArray(i.results) && (a = m.search.object(t, i.results, o)[0])) return !1;
  15733. })) : (m.debug("Finding result in results object", t), a = m.search.object(t, n, o)[0]), a || !1;
  15734. }
  15735. },
  15736. select: {
  15737. firstResult: function firstResult() {
  15738. m.verbose("Selecting first result"), P.first().addClass(p.active);
  15739. }
  15740. },
  15741. set: {
  15742. focus: function focus() {
  15743. k.addClass(p.focus);
  15744. },
  15745. loading: function loading() {
  15746. k.addClass(p.loading);
  15747. },
  15748. value: function value(e) {
  15749. m.verbose("Setting search input value", e), T.val(e);
  15750. },
  15751. type: function type(e) {
  15752. e = e || g.type, "category" == g.type && k.addClass(g.type);
  15753. },
  15754. buttonPressed: function buttonPressed() {
  15755. A.addClass(p.pressed);
  15756. }
  15757. },
  15758. remove: {
  15759. loading: function loading() {
  15760. k.removeClass(p.loading);
  15761. },
  15762. focus: function focus() {
  15763. k.removeClass(p.focus);
  15764. },
  15765. buttonPressed: function buttonPressed() {
  15766. A.removeClass(p.pressed);
  15767. }
  15768. },
  15769. query: function query(t) {
  15770. t = e.isFunction(t) ? t : function () {};
  15771. var n = m.get.value(),
  15772. i = m.read.cache(n);
  15773. 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();
  15774. },
  15775. search: {
  15776. local: function local(e) {
  15777. var t,
  15778. n = m.search.object(e, g.content);
  15779. 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({
  15780. results: n
  15781. }), m.remove.loading(), m.addResults(t), m.inject.id(n), m.write.cache(e, {
  15782. html: t,
  15783. results: n
  15784. });
  15785. },
  15786. remote: function remote(t, n) {
  15787. n = e.isFunction(n) ? n : function () {}, k.api("is loading") && k.api("abort"), m.setup.api(t, n), k.api("query");
  15788. },
  15789. object: function object(t, n, o) {
  15790. var a = [],
  15791. r = [],
  15792. s = [],
  15793. l = t.toString().replace(v.escape, "\\$&"),
  15794. c = new RegExp(v.beginsWith + l, "i"),
  15795. u = function u(t, n) {
  15796. var i = -1 == e.inArray(n, a),
  15797. o = -1 == e.inArray(n, s),
  15798. l = -1 == e.inArray(n, r);
  15799. i && o && l && t.push(n);
  15800. };
  15801. 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) {
  15802. e.each(n, function (e, n) {
  15803. "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));
  15804. });
  15805. }), e.merge(r, s), e.merge(a, r), a);
  15806. }
  15807. },
  15808. exactSearch: function exactSearch(e, t) {
  15809. return e = e.toLowerCase(), (t = t.toLowerCase()).indexOf(e) > -1;
  15810. },
  15811. fuzzySearch: function fuzzySearch(e, t) {
  15812. var n = t.length,
  15813. i = e.length;
  15814. if ("string" != typeof e) return !1;
  15815. if (e = e.toLowerCase(), t = t.toLowerCase(), i > n) return !1;
  15816. if (i === n) return e === t;
  15817. e: for (var o = 0, a = 0; o < i; o++) {
  15818. for (var r = e.charCodeAt(o); a < n;) {
  15819. if (t.charCodeAt(a++) === r) continue e;
  15820. }
  15821. return !1;
  15822. }
  15823. return !0;
  15824. },
  15825. parse: {
  15826. response: function response(e, t) {
  15827. var n = m.generateResults(e);
  15828. 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, {
  15829. html: n,
  15830. results: e[b.results]
  15831. }), m.save.results(e[b.results]));
  15832. }
  15833. },
  15834. cancel: {
  15835. query: function query() {
  15836. m.can.useAPI() && k.api("abort");
  15837. }
  15838. },
  15839. has: {
  15840. minimumCharacters: function minimumCharacters() {
  15841. return m.get.value().length >= g.minCharacters;
  15842. },
  15843. results: function results() {
  15844. return 0 !== R.length && "" != R.html();
  15845. }
  15846. },
  15847. clear: {
  15848. cache: function cache(e) {
  15849. var t = k.data(h.cache);
  15850. 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));
  15851. }
  15852. },
  15853. read: {
  15854. cache: function cache(e) {
  15855. var t = k.data(h.cache);
  15856. return !!g.cache && (m.verbose("Checking cache for generated html for query", e), "object" == _typeof(t) && t[e] !== i && t[e]);
  15857. }
  15858. },
  15859. create: {
  15860. categoryResults: function categoryResults(t) {
  15861. var n = {};
  15862. return e.each(t, function (e, t) {
  15863. t.category && (n[t.category] === i ? (m.verbose("Creating new category of results", t.category), n[t.category] = {
  15864. name: t.category,
  15865. results: [t]
  15866. }) : n[t.category].results.push(t));
  15867. }), n;
  15868. },
  15869. id: function id(e, t) {
  15870. var n,
  15871. o = e + 1;
  15872. 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;
  15873. },
  15874. results: function results() {
  15875. 0 === R.length && (R = e("<div />").addClass(p.results).appendTo(k));
  15876. }
  15877. },
  15878. inject: {
  15879. result: function result(e, t, n) {
  15880. m.verbose("Injecting result into results");
  15881. var o = n !== i ? R.children().eq(n).children(y.results).first().children(y.result).eq(t) : R.children(y.result).eq(t);
  15882. m.verbose("Injecting results metadata", o), o.data(h.result, e);
  15883. },
  15884. id: function id(t) {
  15885. m.debug("Injecting unique ids into results");
  15886. var n = 0,
  15887. o = 0;
  15888. return "category" === g.type ? e.each(t, function (t, a) {
  15889. o = 0, e.each(a.results, function (e, t) {
  15890. var r = a.results[e];
  15891. r.id === i && (r.id = m.create.id(o, n)), m.inject.result(r, o, n), o++;
  15892. }), n++;
  15893. }) : e.each(t, function (e, n) {
  15894. var a = t[e];
  15895. a.id === i && (a.id = m.create.id(o)), m.inject.result(a, o), o++;
  15896. }), t;
  15897. }
  15898. },
  15899. save: {
  15900. results: function results(e) {
  15901. m.verbose("Saving current search results to metadata", e), k.data(h.results, e);
  15902. }
  15903. },
  15904. write: {
  15905. cache: function cache(e, t) {
  15906. var n = k.data(h.cache) !== i ? k.data(h.cache) : {};
  15907. g.cache && (m.verbose("Writing generated html to cache", e, t), n[e] = t, k.data(h.cache, n));
  15908. }
  15909. },
  15910. addResults: function addResults(t) {
  15911. if (e.isFunction(g.onResultsAdd) && !1 === g.onResultsAdd.call(R, t)) return m.debug("onResultsAdd callback cancelled default action"), !1;
  15912. t ? (R.html(t), m.refreshResults(), g.selectFirstResult && m.select.firstResult(), m.showResults()) : m.hideResults(function () {
  15913. R.empty();
  15914. });
  15915. },
  15916. showResults: function showResults(t) {
  15917. 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({
  15918. animation: g.transition + " in",
  15919. debug: g.debug,
  15920. verbose: g.verbose,
  15921. duration: g.duration,
  15922. onComplete: function onComplete() {
  15923. t();
  15924. },
  15925. queue: !0
  15926. })) : (m.debug("Showing results with javascript"), R.stop().fadeIn(g.duration, g.easing)), g.onResultsOpen.call(R));
  15927. },
  15928. hideResults: function hideResults(t) {
  15929. t = e.isFunction(t) ? t : function () {}, m.is.visible() && (m.can.transition() ? (m.debug("Hiding results with css animations"), R.transition({
  15930. animation: g.transition + " out",
  15931. debug: g.debug,
  15932. verbose: g.verbose,
  15933. duration: g.duration,
  15934. onComplete: function onComplete() {
  15935. t();
  15936. },
  15937. queue: !0
  15938. })) : (m.debug("Hiding results with javascript"), R.stop().fadeOut(g.duration, g.easing)), g.onResultsClose.call(R));
  15939. },
  15940. generateResults: function generateResults(t) {
  15941. m.debug("Generating html from response", t);
  15942. var n = g.templates[g.type],
  15943. i = e.isPlainObject(t[b.results]) && !e.isEmptyObject(t[b.results]),
  15944. o = e.isArray(t[b.results]) && t[b.results].length > 0,
  15945. a = "";
  15946. 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;
  15947. },
  15948. displayMessage: function displayMessage(e, t) {
  15949. return t = t || "standard", m.debug("Displaying message", e, t), m.addResults(g.templates.message(e, t)), g.templates.message(e, t);
  15950. },
  15951. setting: function setting(t, n) {
  15952. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  15953. if (n === i) return g[t];
  15954. g[t] = n;
  15955. }
  15956. },
  15957. internal: function internal(t, n) {
  15958. if (e.isPlainObject(t)) e.extend(!0, m, t);else {
  15959. if (n === i) return m[t];
  15960. m[t] = n;
  15961. }
  15962. },
  15963. debug: function debug() {
  15964. !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)));
  15965. },
  15966. verbose: function verbose() {
  15967. !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)));
  15968. },
  15969. error: function error() {
  15970. g.silent || (m.error = Function.prototype.bind.call(console.error, console, g.name + ":"), m.error.apply(console, arguments));
  15971. },
  15972. performance: {
  15973. log: function log(e) {
  15974. var t, n;
  15975. g.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  15976. Name: e[0],
  15977. Arguments: [].slice.call(e, 1) || "",
  15978. Element: E,
  15979. "Execution Time": n
  15980. })), clearTimeout(m.performance.timer), m.performance.timer = setTimeout(m.performance.display, 500);
  15981. },
  15982. display: function display() {
  15983. var t = g.name + ":",
  15984. n = 0;
  15985. l = !1, clearTimeout(m.performance.timer), e.each(c, function (e, t) {
  15986. n += t["Execution Time"];
  15987. }), 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) {
  15988. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  15989. }), console.groupEnd()), c = [];
  15990. }
  15991. },
  15992. invoke: function invoke(t, n, o) {
  15993. var r,
  15994. s,
  15995. l,
  15996. c = F;
  15997. 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) {
  15998. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  15999. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16000. if (c[a] !== i) return s = c[a], !1;
  16001. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16002. c = c[o];
  16003. }
  16004. })), 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;
  16005. }
  16006. }, d ? (F === i && m.initialize(), m.invoke(u)) : (F !== i && F.invoke("destroy"), m.initialize());
  16007. }), a !== i ? a : this;
  16008. }, e.fn.search.settings = {
  16009. name: "Search",
  16010. namespace: "search",
  16011. silent: !1,
  16012. debug: !1,
  16013. verbose: !1,
  16014. performance: !0,
  16015. type: "standard",
  16016. minCharacters: 1,
  16017. selectFirstResult: !1,
  16018. apiSettings: !1,
  16019. source: !1,
  16020. searchOnFocus: !0,
  16021. searchFields: ["title", "description"],
  16022. displayField: "",
  16023. fullTextSearch: "exact",
  16024. automatic: !0,
  16025. hideDelay: 0,
  16026. searchDelay: 200,
  16027. maxResults: 7,
  16028. cache: !0,
  16029. showNoResults: !0,
  16030. transition: "scale",
  16031. duration: 200,
  16032. easing: "easeOutExpo",
  16033. onSelect: !1,
  16034. onResultsAdd: !1,
  16035. onSearchQuery: function onSearchQuery(e) {},
  16036. onResults: function onResults(e) {},
  16037. onResultsOpen: function onResultsOpen() {},
  16038. onResultsClose: function onResultsClose() {},
  16039. className: {
  16040. animating: "animating",
  16041. active: "active",
  16042. empty: "empty",
  16043. focus: "focus",
  16044. hidden: "hidden",
  16045. loading: "loading",
  16046. results: "results",
  16047. pressed: "down"
  16048. },
  16049. error: {
  16050. source: "Cannot search. No source used, and Semantic API module was not included",
  16051. noResults: "Your search returned no results",
  16052. logging: "Error in debug logging, exiting.",
  16053. noEndpoint: "No search endpoint was specified",
  16054. noTemplate: "A valid template name was not specified.",
  16055. oldSearchSyntax: "searchFullText setting has been renamed fullTextSearch for consistency, please adjust your settings.",
  16056. serverError: "There was an issue querying the server.",
  16057. maxResults: "Results must be an array to use maxResults setting",
  16058. method: "The method you called is not defined."
  16059. },
  16060. metadata: {
  16061. cache: "cache",
  16062. results: "results",
  16063. result: "result"
  16064. },
  16065. regExp: {
  16066. escape: /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,
  16067. beginsWith: "(?:s|^)"
  16068. },
  16069. fields: {
  16070. categories: "results",
  16071. categoryName: "name",
  16072. categoryResults: "results",
  16073. description: "description",
  16074. image: "image",
  16075. price: "price",
  16076. results: "results",
  16077. title: "title",
  16078. url: "url",
  16079. action: "action",
  16080. actionText: "text",
  16081. actionURL: "url"
  16082. },
  16083. selector: {
  16084. prompt: ".prompt",
  16085. searchButton: ".search.button",
  16086. results: ".results",
  16087. message: ".results > .message",
  16088. category: ".category",
  16089. result: ".result",
  16090. title: ".title, .name"
  16091. },
  16092. templates: {
  16093. escape: function escape(e) {
  16094. var t = {
  16095. "&": "&amp;",
  16096. "<": "&lt;",
  16097. ">": "&gt;",
  16098. '"': "&quot;",
  16099. "'": "&#x27;",
  16100. "`": "&#x60;"
  16101. };
  16102. return /[&<>"'`]/.test(e) ? e.replace(/[&<>"'`]/g, function (e) {
  16103. return t[e];
  16104. }) : e;
  16105. },
  16106. message: function message(e, t) {
  16107. var n = "";
  16108. 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;
  16109. },
  16110. category: function category(t, n) {
  16111. var o = "";
  16112. e.fn.search.settings.templates.escape;
  16113. return t[n.categoryResults] !== i && (e.each(t[n.categoryResults], function (t, a) {
  16114. 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) {
  16115. 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>";
  16116. }), o += "</div>", o += "</div>");
  16117. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16118. },
  16119. standard: function standard(t, n) {
  16120. var o = "";
  16121. return t[n.results] !== i && (e.each(t[n.results], function (e, t) {
  16122. 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>";
  16123. }), t[n.action] && (o += '<a href="' + t[n.action][n.actionURL] + '" class="action">' + t[n.action][n.actionText] + "</a>"), o);
  16124. }
  16125. }
  16126. };
  16127. }(jQuery, window, document), function (e, t, n, i) {
  16128. "use strict";
  16129. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.shape = function (o) {
  16130. var a,
  16131. r = e(this),
  16132. s = (e("body"), new Date().getTime()),
  16133. l = [],
  16134. c = arguments[0],
  16135. u = "string" == typeof c,
  16136. d = [].slice.call(arguments, 1),
  16137. f = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16138. setTimeout(e, 0);
  16139. };
  16140. return r.each(function () {
  16141. var t,
  16142. m,
  16143. g,
  16144. p = r.selector || "",
  16145. h = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.shape.settings, o) : e.extend({}, e.fn.shape.settings),
  16146. v = h.namespace,
  16147. b = h.selector,
  16148. y = h.error,
  16149. x = h.className,
  16150. C = "." + v,
  16151. w = "module-" + v,
  16152. S = e(this),
  16153. k = S.find(b.sides),
  16154. T = S.find(b.side),
  16155. A = !1,
  16156. R = this,
  16157. P = S.data(w);
  16158. g = {
  16159. initialize: function initialize() {
  16160. g.verbose("Initializing module for", R), g.set.defaultSide(), g.instantiate();
  16161. },
  16162. instantiate: function instantiate() {
  16163. g.verbose("Storing instance of module", g), P = g, S.data(w, P);
  16164. },
  16165. destroy: function destroy() {
  16166. g.verbose("Destroying previous module for", R), S.removeData(w).off(C);
  16167. },
  16168. refresh: function refresh() {
  16169. g.verbose("Refreshing selector cache for", R), S = e(R), k = e(this).find(b.shape), T = e(this).find(b.side);
  16170. },
  16171. repaint: function repaint() {
  16172. g.verbose("Forcing repaint event");
  16173. (k[0] || n.createElement("div")).offsetWidth;
  16174. },
  16175. animate: function animate(e, n) {
  16176. g.verbose("Animating box with properties", e), n = n || function (e) {
  16177. g.verbose("Executing animation callback"), e !== i && e.stopPropagation(), g.reset(), g.set.active();
  16178. }, 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 () {
  16179. S.addClass(x.animating), t.addClass(x.hidden);
  16180. })) : n();
  16181. },
  16182. queue: function queue(e) {
  16183. g.debug("Queueing animation of", e), k.one(g.get.transitionEvent(), function () {
  16184. g.debug("Executing queued animation"), setTimeout(function () {
  16185. S.shape(e);
  16186. }, 0);
  16187. });
  16188. },
  16189. reset: function reset() {
  16190. 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");
  16191. },
  16192. is: {
  16193. complete: function complete() {
  16194. return T.filter("." + x.active)[0] == m[0];
  16195. },
  16196. animating: function animating() {
  16197. return S.hasClass(x.animating);
  16198. }
  16199. },
  16200. set: {
  16201. defaultSide: function defaultSide() {
  16202. 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);
  16203. },
  16204. duration: function duration(e) {
  16205. 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({
  16206. "-webkit-transition-duration": e,
  16207. "-moz-transition-duration": e,
  16208. "-ms-transition-duration": e,
  16209. "-o-transition-duration": e,
  16210. "transition-duration": e
  16211. });
  16212. },
  16213. currentStageSize: function currentStageSize() {
  16214. var e = S.find("." + h.className.active),
  16215. t = e.outerWidth(!0),
  16216. n = e.outerHeight(!0);
  16217. S.css({
  16218. width: t,
  16219. height: n
  16220. });
  16221. },
  16222. stageSize: function stageSize() {
  16223. var e = S.clone().addClass(x.loading),
  16224. t = e.find("." + h.className.active),
  16225. n = A ? e.find(b.side).eq(A) : t.next(b.side).length > 0 ? t.next(b.side) : e.find(b.side).first(),
  16226. i = "next" == h.width ? n.outerWidth(!0) : "initial" == h.width ? S.width() : h.width,
  16227. o = "next" == h.height ? n.outerHeight(!0) : "initial" == h.height ? S.height() : h.height;
  16228. 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));
  16229. },
  16230. nextSide: function nextSide(e) {
  16231. 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);
  16232. },
  16233. active: function active() {
  16234. g.verbose("Setting new side to active", m), T.removeClass(x.active), m.addClass(x.active), h.onChange.call(m[0]), g.set.defaultSide();
  16235. }
  16236. },
  16237. flip: {
  16238. up: function up() {
  16239. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16240. if (g.is.animating()) g.queue("flip up");else {
  16241. g.debug("Flipping up", m);
  16242. var e = g.get.transform.up();
  16243. g.set.stageSize(), g.stage.above(), g.animate(e);
  16244. }
  16245. } else g.debug("Side already visible", m);
  16246. },
  16247. down: function down() {
  16248. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16249. if (g.is.animating()) g.queue("flip down");else {
  16250. g.debug("Flipping down", m);
  16251. var e = g.get.transform.down();
  16252. g.set.stageSize(), g.stage.below(), g.animate(e);
  16253. }
  16254. } else g.debug("Side already visible", m);
  16255. },
  16256. left: function left() {
  16257. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16258. if (g.is.animating()) g.queue("flip left");else {
  16259. g.debug("Flipping left", m);
  16260. var e = g.get.transform.left();
  16261. g.set.stageSize(), g.stage.left(), g.animate(e);
  16262. }
  16263. } else g.debug("Side already visible", m);
  16264. },
  16265. right: function right() {
  16266. if (!g.is.complete() || g.is.animating() || h.allowRepeats) {
  16267. if (g.is.animating()) g.queue("flip right");else {
  16268. g.debug("Flipping right", m);
  16269. var e = g.get.transform.right();
  16270. g.set.stageSize(), g.stage.right(), g.animate(e);
  16271. }
  16272. } else g.debug("Side already visible", m);
  16273. },
  16274. over: function over() {
  16275. !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);
  16276. },
  16277. back: function back() {
  16278. !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);
  16279. }
  16280. },
  16281. get: {
  16282. transform: {
  16283. up: function up() {
  16284. return {
  16285. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(-90deg)"
  16286. };
  16287. },
  16288. down: function down() {
  16289. return {
  16290. transform: "translateY(" + -(t.outerHeight(!0) - m.outerHeight(!0)) / 2 + "px) translateZ(" + -t.outerHeight(!0) / 2 + "px) rotateX(90deg)"
  16291. };
  16292. },
  16293. left: function left() {
  16294. return {
  16295. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(90deg)"
  16296. };
  16297. },
  16298. right: function right() {
  16299. return {
  16300. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) translateZ(" + -t.outerWidth(!0) / 2 + "px) rotateY(-90deg)"
  16301. };
  16302. },
  16303. over: function over() {
  16304. return {
  16305. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(180deg)"
  16306. };
  16307. },
  16308. back: function back() {
  16309. return {
  16310. transform: "translateX(" + -(t.outerWidth(!0) - m.outerWidth(!0)) / 2 + "px) rotateY(-180deg)"
  16311. };
  16312. }
  16313. },
  16314. transitionEvent: function transitionEvent() {
  16315. var e,
  16316. t = n.createElement("element"),
  16317. o = {
  16318. transition: "transitionend",
  16319. OTransition: "oTransitionEnd",
  16320. MozTransition: "transitionend",
  16321. WebkitTransition: "webkitTransitionEnd"
  16322. };
  16323. for (e in o) {
  16324. if (t.style[e] !== i) return o[e];
  16325. }
  16326. },
  16327. nextSide: function nextSide() {
  16328. return t.next(b.side).length > 0 ? t.next(b.side) : S.find(b.side).first();
  16329. }
  16330. },
  16331. stage: {
  16332. above: function above() {
  16333. var e = {
  16334. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16335. depth: {
  16336. active: m.outerHeight(!0) / 2,
  16337. next: t.outerHeight(!0) / 2
  16338. }
  16339. };
  16340. g.verbose("Setting the initial animation position as above", m, e), k.css({
  16341. transform: "translateZ(-" + e.depth.active + "px)"
  16342. }), t.css({
  16343. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16344. }), m.addClass(x.animating).css({
  16345. top: e.origin + "px",
  16346. transform: "rotateX(90deg) translateZ(" + e.depth.next + "px)"
  16347. });
  16348. },
  16349. below: function below() {
  16350. var e = {
  16351. origin: (t.outerHeight(!0) - m.outerHeight(!0)) / 2,
  16352. depth: {
  16353. active: m.outerHeight(!0) / 2,
  16354. next: t.outerHeight(!0) / 2
  16355. }
  16356. };
  16357. g.verbose("Setting the initial animation position as below", m, e), k.css({
  16358. transform: "translateZ(-" + e.depth.active + "px)"
  16359. }), t.css({
  16360. transform: "rotateY(0deg) translateZ(" + e.depth.active + "px)"
  16361. }), m.addClass(x.animating).css({
  16362. top: e.origin + "px",
  16363. transform: "rotateX(-90deg) translateZ(" + e.depth.next + "px)"
  16364. });
  16365. },
  16366. left: function left() {
  16367. var e = t.outerWidth(!0),
  16368. n = m.outerWidth(!0),
  16369. i = {
  16370. origin: (e - n) / 2,
  16371. depth: {
  16372. active: n / 2,
  16373. next: e / 2
  16374. }
  16375. };
  16376. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16377. transform: "translateZ(-" + i.depth.active + "px)"
  16378. }), t.css({
  16379. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16380. }), m.addClass(x.animating).css({
  16381. left: i.origin + "px",
  16382. transform: "rotateY(-90deg) translateZ(" + i.depth.next + "px)"
  16383. });
  16384. },
  16385. right: function right() {
  16386. var e = t.outerWidth(!0),
  16387. n = m.outerWidth(!0),
  16388. i = {
  16389. origin: (e - n) / 2,
  16390. depth: {
  16391. active: n / 2,
  16392. next: e / 2
  16393. }
  16394. };
  16395. g.verbose("Setting the initial animation position as left", m, i), k.css({
  16396. transform: "translateZ(-" + i.depth.active + "px)"
  16397. }), t.css({
  16398. transform: "rotateY(0deg) translateZ(" + i.depth.active + "px)"
  16399. }), m.addClass(x.animating).css({
  16400. left: i.origin + "px",
  16401. transform: "rotateY(90deg) translateZ(" + i.depth.next + "px)"
  16402. });
  16403. },
  16404. behind: function behind() {
  16405. var e = t.outerWidth(!0),
  16406. n = m.outerWidth(!0),
  16407. i = {
  16408. origin: (e - n) / 2,
  16409. depth: {
  16410. active: n / 2,
  16411. next: e / 2
  16412. }
  16413. };
  16414. g.verbose("Setting the initial animation position as behind", m, i), t.css({
  16415. transform: "rotateY(0deg)"
  16416. }), m.addClass(x.animating).css({
  16417. left: i.origin + "px",
  16418. transform: "rotateY(-180deg)"
  16419. });
  16420. }
  16421. },
  16422. setting: function setting(t, n) {
  16423. if (g.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, h, t);else {
  16424. if (n === i) return h[t];
  16425. e.isPlainObject(h[t]) ? e.extend(!0, h[t], n) : h[t] = n;
  16426. }
  16427. },
  16428. internal: function internal(t, n) {
  16429. if (e.isPlainObject(t)) e.extend(!0, g, t);else {
  16430. if (n === i) return g[t];
  16431. g[t] = n;
  16432. }
  16433. },
  16434. debug: function debug() {
  16435. !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)));
  16436. },
  16437. verbose: function verbose() {
  16438. !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)));
  16439. },
  16440. error: function error() {
  16441. h.silent || (g.error = Function.prototype.bind.call(console.error, console, h.name + ":"), g.error.apply(console, arguments));
  16442. },
  16443. performance: {
  16444. log: function log(e) {
  16445. var t, n;
  16446. h.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  16447. Name: e[0],
  16448. Arguments: [].slice.call(e, 1) || "",
  16449. Element: R,
  16450. "Execution Time": n
  16451. })), clearTimeout(g.performance.timer), g.performance.timer = setTimeout(g.performance.display, 500);
  16452. },
  16453. display: function display() {
  16454. var t = h.name + ":",
  16455. n = 0;
  16456. s = !1, clearTimeout(g.performance.timer), e.each(l, function (e, t) {
  16457. n += t["Execution Time"];
  16458. }), 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) {
  16459. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16460. }), console.groupEnd()), l = [];
  16461. }
  16462. },
  16463. invoke: function invoke(t, n, o) {
  16464. var r,
  16465. s,
  16466. l,
  16467. c = P;
  16468. 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) {
  16469. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16470. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16471. if (c[a] !== i) return s = c[a], !1;
  16472. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  16473. c = c[o];
  16474. }
  16475. })), 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;
  16476. }
  16477. }, u ? (P === i && g.initialize(), g.invoke(c)) : (P !== i && P.invoke("destroy"), g.initialize());
  16478. }), a !== i ? a : this;
  16479. }, e.fn.shape.settings = {
  16480. name: "Shape",
  16481. silent: !1,
  16482. debug: !1,
  16483. verbose: !1,
  16484. jitter: 0,
  16485. performance: !0,
  16486. namespace: "shape",
  16487. width: "initial",
  16488. height: "initial",
  16489. beforeChange: function beforeChange() {},
  16490. onChange: function onChange() {},
  16491. allowRepeats: !1,
  16492. duration: !1,
  16493. error: {
  16494. side: "You tried to switch to a side that does not exist.",
  16495. method: "The method you called is not defined"
  16496. },
  16497. className: {
  16498. animating: "animating",
  16499. hidden: "hidden",
  16500. loading: "loading",
  16501. active: "active"
  16502. },
  16503. selector: {
  16504. sides: ".sides",
  16505. side: ".side"
  16506. }
  16507. };
  16508. }(jQuery, window, document), function (e, t, n, i) {
  16509. "use strict";
  16510. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sidebar = function (o) {
  16511. var a,
  16512. r = e(this),
  16513. s = e(t),
  16514. l = e(n),
  16515. c = e("html"),
  16516. u = e("head"),
  16517. d = r.selector || "",
  16518. f = new Date().getTime(),
  16519. m = [],
  16520. g = arguments[0],
  16521. p = "string" == typeof g,
  16522. h = [].slice.call(arguments, 1),
  16523. v = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16524. setTimeout(e, 0);
  16525. };
  16526. return r.each(function () {
  16527. var r,
  16528. b,
  16529. y,
  16530. x,
  16531. C,
  16532. w,
  16533. S = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sidebar.settings, o) : e.extend({}, e.fn.sidebar.settings),
  16534. k = S.selector,
  16535. T = S.className,
  16536. A = S.namespace,
  16537. R = S.regExp,
  16538. P = S.error,
  16539. E = "." + A,
  16540. F = "module-" + A,
  16541. O = e(this),
  16542. D = e(S.context),
  16543. q = O.children(k.sidebar),
  16544. j = (D.children(k.fixed), D.children(k.pusher)),
  16545. z = this,
  16546. I = O.data(F);
  16547. w = {
  16548. initialize: function initialize() {
  16549. w.debug("Initializing sidebar", o), w.create.id(), C = w.get.transitionEvent(), S.delaySetup ? v(w.setup.layout) : w.setup.layout(), v(function () {
  16550. w.setup.cache();
  16551. }), w.instantiate();
  16552. },
  16553. instantiate: function instantiate() {
  16554. w.verbose("Storing instance of module", w), I = w, O.data(F, w);
  16555. },
  16556. create: {
  16557. id: function id() {
  16558. y = (Math.random().toString(16) + "000000000").substr(2, 8), b = "." + y, w.verbose("Creating unique id for element", y);
  16559. }
  16560. },
  16561. destroy: function destroy() {
  16562. 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);
  16563. },
  16564. event: {
  16565. clickaway: function clickaway(e) {
  16566. var t = j.find(e.target).length > 0 || j.is(e.target),
  16567. n = D.is(e.target);
  16568. t && (w.verbose("User clicked on dimmed page"), w.hide()), n && (w.verbose("User clicked on dimmable context (scaled out page)"), w.hide());
  16569. },
  16570. touch: function touch(e) {},
  16571. containScroll: function containScroll(e) {
  16572. z.scrollTop <= 0 && (z.scrollTop = 1), z.scrollTop + z.offsetHeight >= z.scrollHeight && (z.scrollTop = z.scrollHeight - z.offsetHeight - 1);
  16573. },
  16574. scroll: function scroll(t) {
  16575. 0 === e(t.target).closest(k.sidebar).length && t.preventDefault();
  16576. }
  16577. },
  16578. bind: {
  16579. clickaway: function clickaway() {
  16580. w.verbose("Adding clickaway events to context", D), S.closable && D.on("click" + b, w.event.clickaway).on("touchend" + b, w.event.clickaway);
  16581. },
  16582. scrollLock: function scrollLock() {
  16583. 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);
  16584. }
  16585. },
  16586. unbind: {
  16587. clickaway: function clickaway() {
  16588. w.verbose("Removing clickaway events from context", D), D.off(b);
  16589. },
  16590. scrollLock: function scrollLock() {
  16591. w.verbose("Removing scroll lock from page"), l.off(b), s.off(b), O.off("scroll" + E);
  16592. }
  16593. },
  16594. add: {
  16595. inlineCSS: function inlineCSS() {
  16596. var t,
  16597. n = w.cache.width || O.outerWidth(),
  16598. i = w.cache.height || O.outerHeight(),
  16599. o = w.is.rtl(),
  16600. a = w.get.direction(),
  16601. s = {
  16602. left: n,
  16603. right: -n,
  16604. top: i,
  16605. bottom: -i
  16606. };
  16607. 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);
  16608. }
  16609. },
  16610. refresh: function refresh() {
  16611. 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();
  16612. },
  16613. refreshSidebars: function refreshSidebars() {
  16614. w.verbose("Refreshing other sidebars"), q = D.children(k.sidebar);
  16615. },
  16616. repaint: function repaint() {
  16617. w.verbose("Forcing repaint event"), z.style.display = "none";
  16618. z.offsetHeight;
  16619. z.scrollTop = z.scrollTop, z.style.display = "";
  16620. },
  16621. setup: {
  16622. cache: function cache() {
  16623. w.cache = {
  16624. width: O.outerWidth(),
  16625. height: O.outerHeight(),
  16626. rtl: "rtl" == O.css("direction")
  16627. };
  16628. },
  16629. layout: function layout() {
  16630. 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();
  16631. }
  16632. },
  16633. attachEvents: function attachEvents(t, n) {
  16634. var i = e(t);
  16635. 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);
  16636. },
  16637. show: function show(t) {
  16638. if (t = e.isFunction(t) ? t : function () {}, w.is.hidden()) {
  16639. 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) {
  16640. if ("overlay" != S.transition) return void w.hideOthers(w.show);
  16641. w.hideOthers();
  16642. } else S.transition = "overlay";
  16643. w.pushPage(function () {
  16644. t.call(z), S.onShow.call(z);
  16645. }), S.onChange.call(z), S.onVisible.call(z);
  16646. } else w.debug("Sidebar is already visible");
  16647. },
  16648. hide: function hide(t) {
  16649. t = e.isFunction(t) ? t : function () {}, (w.is.visible() || w.is.animating()) && (w.debug("Hiding sidebar", t), w.refreshSidebars(), w.pullPage(function () {
  16650. t.call(z), S.onHidden.call(z);
  16651. }), S.onChange.call(z), S.onHide.call(z));
  16652. },
  16653. othersAnimating: function othersAnimating() {
  16654. return q.not(O).filter("." + T.animating).length > 0;
  16655. },
  16656. othersVisible: function othersVisible() {
  16657. return q.not(O).filter("." + T.visible).length > 0;
  16658. },
  16659. othersActive: function othersActive() {
  16660. return w.othersVisible() || w.othersAnimating();
  16661. },
  16662. hideOthers: function hideOthers(e) {
  16663. var t = q.not(O).filter("." + T.visible),
  16664. n = t.length,
  16665. i = 0;
  16666. e = e || function () {}, t.sidebar("hide", function () {
  16667. ++i == n && e();
  16668. });
  16669. },
  16670. toggle: function toggle() {
  16671. w.verbose("Determining toggled direction"), w.is.hidden() ? w.show() : w.hide();
  16672. },
  16673. pushPage: function pushPage(t) {
  16674. var n,
  16675. i,
  16676. _o,
  16677. a = w.get.transition(),
  16678. r = "overlay" === a || w.othersActive() ? O : j;
  16679. t = e.isFunction(t) ? t : function () {}, "scale down" == S.transition && w.scrollToTop(), w.set.transition(a), w.repaint(), n = function n() {
  16680. w.bind.clickaway(), w.add.inlineCSS(), w.set.animating(), w.set.visible();
  16681. }, i = function i() {
  16682. w.set.dimmed();
  16683. }, _o = function o(e) {
  16684. e.target == r[0] && (r.off(C + b, _o), w.remove.animating(), w.bind.scrollLock(), t.call(z));
  16685. }, r.off(C + b), r.on(C + b, _o), v(n), S.dimPage && !w.othersVisible() && v(i);
  16686. },
  16687. pullPage: function pullPage(t) {
  16688. var n,
  16689. _i,
  16690. o = w.get.transition(),
  16691. a = "overlay" == o || w.othersActive() ? O : j;
  16692. t = e.isFunction(t) ? t : function () {}, w.verbose("Removing context push state", w.get.direction()), w.unbind.clickaway(), w.unbind.scrollLock(), n = function n() {
  16693. w.set.transition(o), w.set.animating(), w.remove.visible(), S.dimPage && !w.othersVisible() && j.removeClass(T.dimmed);
  16694. }, _i = function i(e) {
  16695. 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));
  16696. }, a.off(C + b), a.on(C + b, _i), v(n);
  16697. },
  16698. scrollToTop: function scrollToTop() {
  16699. w.verbose("Scrolling to top of page to avoid animation issues"), x = e(t).scrollTop(), O.scrollTop(0), t.scrollTo(0, 0);
  16700. },
  16701. scrollBack: function scrollBack() {
  16702. w.verbose("Scrolling back to original page position"), t.scrollTo(0, x);
  16703. },
  16704. clear: {
  16705. cache: function cache() {
  16706. w.verbose("Clearing cached dimensions"), w.cache = {};
  16707. }
  16708. },
  16709. set: {
  16710. ios: function ios() {
  16711. c.addClass(T.ios);
  16712. },
  16713. pushed: function pushed() {
  16714. D.addClass(T.pushed);
  16715. },
  16716. pushable: function pushable() {
  16717. D.addClass(T.pushable);
  16718. },
  16719. dimmed: function dimmed() {
  16720. j.addClass(T.dimmed);
  16721. },
  16722. active: function active() {
  16723. O.addClass(T.active);
  16724. },
  16725. animating: function animating() {
  16726. O.addClass(T.animating);
  16727. },
  16728. transition: function transition(e) {
  16729. e = e || w.get.transition(), O.addClass(e);
  16730. },
  16731. direction: function direction(e) {
  16732. e = e || w.get.direction(), O.addClass(T[e]);
  16733. },
  16734. visible: function visible() {
  16735. O.addClass(T.visible);
  16736. },
  16737. overlay: function overlay() {
  16738. O.addClass(T.overlay);
  16739. }
  16740. },
  16741. remove: {
  16742. inlineCSS: function inlineCSS() {
  16743. w.debug("Removing inline css styles", r), r && r.length > 0 && r.remove();
  16744. },
  16745. ios: function ios() {
  16746. c.removeClass(T.ios);
  16747. },
  16748. pushed: function pushed() {
  16749. D.removeClass(T.pushed);
  16750. },
  16751. pushable: function pushable() {
  16752. D.removeClass(T.pushable);
  16753. },
  16754. active: function active() {
  16755. O.removeClass(T.active);
  16756. },
  16757. animating: function animating() {
  16758. O.removeClass(T.animating);
  16759. },
  16760. transition: function transition(e) {
  16761. e = e || w.get.transition(), O.removeClass(e);
  16762. },
  16763. direction: function direction(e) {
  16764. e = e || w.get.direction(), O.removeClass(T[e]);
  16765. },
  16766. visible: function visible() {
  16767. O.removeClass(T.visible);
  16768. },
  16769. overlay: function overlay() {
  16770. O.removeClass(T.overlay);
  16771. }
  16772. },
  16773. get: {
  16774. direction: function direction() {
  16775. return O.hasClass(T.top) ? T.top : O.hasClass(T.right) ? T.right : O.hasClass(T.bottom) ? T.bottom : T.left;
  16776. },
  16777. transition: function transition() {
  16778. var e,
  16779. t = w.get.direction();
  16780. 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;
  16781. },
  16782. transitionEvent: function transitionEvent() {
  16783. var e,
  16784. t = n.createElement("element"),
  16785. o = {
  16786. transition: "transitionend",
  16787. OTransition: "oTransitionEnd",
  16788. MozTransition: "transitionend",
  16789. WebkitTransition: "webkitTransitionEnd"
  16790. };
  16791. for (e in o) {
  16792. if (t.style[e] !== i) return o[e];
  16793. }
  16794. }
  16795. },
  16796. is: {
  16797. ie: function ie() {
  16798. return !t.ActiveXObject && "ActiveXObject" in t || "ActiveXObject" in t;
  16799. },
  16800. ios: function ios() {
  16801. var e = navigator.userAgent,
  16802. t = e.match(R.ios),
  16803. n = e.match(R.mobileChrome);
  16804. return !(!t || n) && (w.verbose("Browser was found to be iOS", e), !0);
  16805. },
  16806. mobile: function mobile() {
  16807. var e = navigator.userAgent;
  16808. 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);
  16809. },
  16810. hidden: function hidden() {
  16811. return !w.is.visible();
  16812. },
  16813. visible: function visible() {
  16814. return O.hasClass(T.visible);
  16815. },
  16816. open: function open() {
  16817. return w.is.visible();
  16818. },
  16819. closed: function closed() {
  16820. return w.is.hidden();
  16821. },
  16822. vertical: function vertical() {
  16823. return O.hasClass(T.top);
  16824. },
  16825. animating: function animating() {
  16826. return D.hasClass(T.animating);
  16827. },
  16828. rtl: function rtl() {
  16829. return w.cache.rtl === i && (w.cache.rtl = "rtl" == O.css("direction")), w.cache.rtl;
  16830. }
  16831. },
  16832. setting: function setting(t, n) {
  16833. if (w.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, S, t);else {
  16834. if (n === i) return S[t];
  16835. e.isPlainObject(S[t]) ? e.extend(!0, S[t], n) : S[t] = n;
  16836. }
  16837. },
  16838. internal: function internal(t, n) {
  16839. if (e.isPlainObject(t)) e.extend(!0, w, t);else {
  16840. if (n === i) return w[t];
  16841. w[t] = n;
  16842. }
  16843. },
  16844. debug: function debug() {
  16845. !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)));
  16846. },
  16847. verbose: function verbose() {
  16848. !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)));
  16849. },
  16850. error: function error() {
  16851. S.silent || (w.error = Function.prototype.bind.call(console.error, console, S.name + ":"), w.error.apply(console, arguments));
  16852. },
  16853. performance: {
  16854. log: function log(e) {
  16855. var t, n;
  16856. S.performance && (n = (t = new Date().getTime()) - (f || t), f = t, m.push({
  16857. Name: e[0],
  16858. Arguments: [].slice.call(e, 1) || "",
  16859. Element: z,
  16860. "Execution Time": n
  16861. })), clearTimeout(w.performance.timer), w.performance.timer = setTimeout(w.performance.display, 500);
  16862. },
  16863. display: function display() {
  16864. var t = S.name + ":",
  16865. n = 0;
  16866. f = !1, clearTimeout(w.performance.timer), e.each(m, function (e, t) {
  16867. n += t["Execution Time"];
  16868. }), 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) {
  16869. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  16870. }), console.groupEnd()), m = [];
  16871. }
  16872. },
  16873. invoke: function invoke(t, n, o) {
  16874. var r,
  16875. s,
  16876. l,
  16877. c = I;
  16878. 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) {
  16879. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  16880. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  16881. if (c[a] !== i) return s = c[a], !1;
  16882. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (w.error(P.method, t), !1);
  16883. c = c[o];
  16884. }
  16885. })), 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;
  16886. }
  16887. }, p ? (I === i && w.initialize(), w.invoke(g)) : (I !== i && w.invoke("destroy"), w.initialize());
  16888. }), a !== i ? a : this;
  16889. }, e.fn.sidebar.settings = {
  16890. name: "Sidebar",
  16891. namespace: "sidebar",
  16892. silent: !1,
  16893. debug: !1,
  16894. verbose: !1,
  16895. performance: !0,
  16896. transition: "auto",
  16897. mobileTransition: "auto",
  16898. defaultTransition: {
  16899. computer: {
  16900. left: "uncover",
  16901. right: "uncover",
  16902. top: "overlay",
  16903. bottom: "overlay"
  16904. },
  16905. mobile: {
  16906. left: "uncover",
  16907. right: "uncover",
  16908. top: "overlay",
  16909. bottom: "overlay"
  16910. }
  16911. },
  16912. context: "body",
  16913. exclusive: !1,
  16914. closable: !0,
  16915. dimPage: !0,
  16916. scrollLock: !1,
  16917. returnScroll: !1,
  16918. delaySetup: !1,
  16919. duration: 500,
  16920. onChange: function onChange() {},
  16921. onShow: function onShow() {},
  16922. onHide: function onHide() {},
  16923. onHidden: function onHidden() {},
  16924. onVisible: function onVisible() {},
  16925. className: {
  16926. active: "active",
  16927. animating: "animating",
  16928. dimmed: "dimmed",
  16929. ios: "ios",
  16930. pushable: "pushable",
  16931. pushed: "pushed",
  16932. right: "right",
  16933. top: "top",
  16934. left: "left",
  16935. bottom: "bottom",
  16936. visible: "visible"
  16937. },
  16938. selector: {
  16939. fixed: ".fixed",
  16940. omitted: "script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed",
  16941. pusher: ".pusher",
  16942. sidebar: ".ui.sidebar"
  16943. },
  16944. regExp: {
  16945. ios: /(iPad|iPhone|iPod)/g,
  16946. mobileChrome: /(CriOS)/g,
  16947. 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
  16948. },
  16949. error: {
  16950. method: "The method you called is not defined.",
  16951. pusher: "Had to add pusher element. For optimal performance make sure body content is inside a pusher element",
  16952. movedSidebar: "Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag",
  16953. overlay: "The overlay setting is no longer supported, use animation: overlay",
  16954. notFound: "There were no elements that matched the specified selector"
  16955. }
  16956. };
  16957. }(jQuery, window, document), function (e, t, n, i) {
  16958. "use strict";
  16959. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.sticky = function (o) {
  16960. var a,
  16961. r = e(this),
  16962. s = r.selector || "",
  16963. l = new Date().getTime(),
  16964. c = [],
  16965. u = arguments[0],
  16966. d = "string" == typeof u,
  16967. f = [].slice.call(arguments, 1);
  16968. return r.each(function () {
  16969. var r,
  16970. m,
  16971. g,
  16972. p,
  16973. h,
  16974. v = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.sticky.settings, o) : e.extend({}, e.fn.sticky.settings),
  16975. b = v.className,
  16976. y = v.namespace,
  16977. x = v.error,
  16978. C = "." + y,
  16979. w = "module-" + y,
  16980. S = e(this),
  16981. k = e(t),
  16982. T = e(v.scrollContext),
  16983. A = (S.selector, S.data(w)),
  16984. R = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  16985. setTimeout(e, 0);
  16986. },
  16987. P = this;
  16988. h = {
  16989. initialize: function initialize() {
  16990. h.determineContainer(), h.determineContext(), h.verbose("Initializing sticky", v, r), h.save.positions(), h.checkErrors(), h.bind.events(), v.observeChanges && h.observeChanges(), h.instantiate();
  16991. },
  16992. instantiate: function instantiate() {
  16993. h.verbose("Storing instance of module", h), A = h, S.data(w, h);
  16994. },
  16995. destroy: function destroy() {
  16996. 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);
  16997. },
  16998. observeChanges: function observeChanges() {
  16999. "MutationObserver" in t && (g = new MutationObserver(h.event.documentChanged), p = new MutationObserver(h.event.changed), g.observe(n, {
  17000. childList: !0,
  17001. subtree: !0
  17002. }), p.observe(P, {
  17003. childList: !0,
  17004. subtree: !0
  17005. }), p.observe(m[0], {
  17006. childList: !0,
  17007. subtree: !0
  17008. }), h.debug("Setting up mutation observer", p));
  17009. },
  17010. determineContainer: function determineContainer() {
  17011. r = v.container ? e(v.container) : S.offsetParent();
  17012. },
  17013. determineContext: function determineContext() {
  17014. 0 !== (m = v.context ? e(v.context) : r).length || h.error(x.invalidContext, v.context, S);
  17015. },
  17016. checkErrors: function checkErrors() {
  17017. 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);
  17018. },
  17019. bind: {
  17020. events: function events() {
  17021. 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);
  17022. }
  17023. },
  17024. event: {
  17025. changed: function changed(e) {
  17026. clearTimeout(h.timer), h.timer = setTimeout(function () {
  17027. h.verbose("DOM tree modified, updating sticky menu", e), h.refresh();
  17028. }, 100);
  17029. },
  17030. documentChanged: function documentChanged(t) {
  17031. [].forEach.call(t, function (t) {
  17032. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  17033. (t == P || e(t).find(P).length > 0) && (h.debug("Element removed from DOM, tearing down events"), h.destroy());
  17034. });
  17035. });
  17036. },
  17037. load: function load() {
  17038. h.verbose("Page contents finished loading"), R(h.refresh);
  17039. },
  17040. resize: function resize() {
  17041. h.verbose("Window resized"), R(h.refresh);
  17042. },
  17043. scroll: function scroll() {
  17044. R(function () {
  17045. T.triggerHandler("scrollchange" + C, T.scrollTop());
  17046. });
  17047. },
  17048. scrollchange: function scrollchange(e, t) {
  17049. h.stick(t), v.onScroll.call(P);
  17050. }
  17051. },
  17052. refresh: function refresh(e) {
  17053. h.reset(), v.context || h.determineContext(), e && h.determineContainer(), h.save.positions(), h.stick(), v.onReposition.call(P);
  17054. },
  17055. supports: {
  17056. sticky: function sticky() {
  17057. var t = e("<div/>");
  17058. t[0];
  17059. return t.addClass(b.supported), t.css("position").match("sticky");
  17060. }
  17061. },
  17062. save: {
  17063. lastScroll: function lastScroll(e) {
  17064. h.lastScroll = e;
  17065. },
  17066. elementScroll: function elementScroll(e) {
  17067. h.elementScroll = e;
  17068. },
  17069. positions: function positions() {
  17070. var e = {
  17071. height: T.height()
  17072. },
  17073. t = {
  17074. margin: {
  17075. top: parseInt(S.css("margin-top"), 10),
  17076. bottom: parseInt(S.css("margin-bottom"), 10)
  17077. },
  17078. offset: S.offset(),
  17079. width: S.outerWidth(),
  17080. height: S.outerHeight()
  17081. },
  17082. n = {
  17083. offset: m.offset(),
  17084. height: m.outerHeight()
  17085. };
  17086. r.outerHeight();
  17087. 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 = {
  17088. fits: t.height + v.offset <= e.height,
  17089. sameHeight: t.height == n.height,
  17090. scrollContext: {
  17091. height: e.height
  17092. },
  17093. element: {
  17094. margin: t.margin,
  17095. top: t.offset.top - t.margin.top,
  17096. left: t.offset.left,
  17097. width: t.width,
  17098. height: t.height,
  17099. bottom: t.offset.top + t.height
  17100. },
  17101. context: {
  17102. top: n.offset.top,
  17103. height: n.height,
  17104. bottom: n.offset.top + n.height
  17105. }
  17106. }, h.set.containerSize(), h.stick(), h.debug("Caching element positions", h.cache);
  17107. }
  17108. },
  17109. get: {
  17110. direction: function direction(e) {
  17111. var t = "down";
  17112. return e = e || T.scrollTop(), h.lastScroll !== i && (h.lastScroll < e ? t = "down" : h.lastScroll > e && (t = "up")), t;
  17113. },
  17114. scrollChange: function scrollChange(e) {
  17115. return e = e || T.scrollTop(), h.lastScroll ? e - h.lastScroll : 0;
  17116. },
  17117. currentElementScroll: function currentElementScroll() {
  17118. return h.elementScroll ? h.elementScroll : h.is.top() ? Math.abs(parseInt(S.css("top"), 10)) || 0 : Math.abs(parseInt(S.css("bottom"), 10)) || 0;
  17119. },
  17120. elementScroll: function elementScroll(e) {
  17121. e = e || T.scrollTop();
  17122. var t = h.cache.element,
  17123. n = h.cache.scrollContext,
  17124. i = h.get.scrollChange(e),
  17125. o = t.height - n.height + v.offset,
  17126. a = h.get.currentElementScroll(),
  17127. r = a + i;
  17128. return a = h.cache.fits || r < 0 ? 0 : r > o ? o : r;
  17129. }
  17130. },
  17131. remove: {
  17132. lastScroll: function lastScroll() {
  17133. delete h.lastScroll;
  17134. },
  17135. elementScroll: function elementScroll(e) {
  17136. delete h.elementScroll;
  17137. },
  17138. minimumSize: function minimumSize() {
  17139. r.css("min-height", "");
  17140. },
  17141. offset: function offset() {
  17142. S.css("margin-top", "");
  17143. }
  17144. },
  17145. set: {
  17146. offset: function offset() {
  17147. h.verbose("Setting offset on element", v.offset), S.css("margin-top", v.offset);
  17148. },
  17149. containerSize: function containerSize() {
  17150. var e = r.get(0).tagName;
  17151. "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({
  17152. height: h.cache.context.height
  17153. }));
  17154. },
  17155. minimumSize: function minimumSize() {
  17156. var e = h.cache.element;
  17157. r.css("min-height", e.height);
  17158. },
  17159. scroll: function scroll(e) {
  17160. 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));
  17161. },
  17162. size: function size() {
  17163. 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"));
  17164. }
  17165. },
  17166. is: {
  17167. standardScroll: function standardScroll() {
  17168. return T[0] == t;
  17169. },
  17170. top: function top() {
  17171. return S.hasClass(b.top);
  17172. },
  17173. bottom: function bottom() {
  17174. return S.hasClass(b.bottom);
  17175. },
  17176. initialPosition: function initialPosition() {
  17177. return !h.is.fixed() && !h.is.bound();
  17178. },
  17179. hidden: function hidden() {
  17180. return !S.is(":visible");
  17181. },
  17182. bound: function bound() {
  17183. return S.hasClass(b.bound);
  17184. },
  17185. fixed: function fixed() {
  17186. return S.hasClass(b.fixed);
  17187. }
  17188. },
  17189. stick: function stick(e) {
  17190. var t = e || T.scrollTop(),
  17191. n = h.cache,
  17192. i = n.fits,
  17193. o = n.sameHeight,
  17194. a = n.element,
  17195. r = n.scrollContext,
  17196. s = n.context,
  17197. l = h.is.bottom() && v.pushing ? v.bottomOffset : v.offset,
  17198. c = (e = {
  17199. top: t + l,
  17200. bottom: t + l + r.height
  17201. }, h.get.direction(e.top), i ? 0 : h.get.elementScroll(e.top)),
  17202. u = !i;
  17203. 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())));
  17204. },
  17205. bindTop: function bindTop() {
  17206. h.debug("Binding element to top of parent container"), h.remove.offset(), S.css({
  17207. left: "",
  17208. top: "",
  17209. marginBottom: ""
  17210. }).removeClass(b.fixed).removeClass(b.bottom).addClass(b.bound).addClass(b.top), v.onTop.call(P), v.onUnstick.call(P);
  17211. },
  17212. bindBottom: function bindBottom() {
  17213. h.debug("Binding element to bottom of parent container"), h.remove.offset(), S.css({
  17214. left: "",
  17215. top: ""
  17216. }).removeClass(b.fixed).removeClass(b.top).addClass(b.bound).addClass(b.bottom), v.onBottom.call(P), v.onUnstick.call(P);
  17217. },
  17218. setInitialPosition: function setInitialPosition() {
  17219. h.debug("Returning to initial position"), h.unfix(), h.unbind();
  17220. },
  17221. fixTop: function fixTop() {
  17222. h.debug("Fixing element to top of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17223. left: h.cache.element.left,
  17224. bottom: "",
  17225. marginBottom: ""
  17226. }).removeClass(b.bound).removeClass(b.bottom).addClass(b.fixed).addClass(b.top), v.onStick.call(P);
  17227. },
  17228. fixBottom: function fixBottom() {
  17229. h.debug("Sticking element to bottom of page"), v.setSize && h.set.size(), h.set.minimumSize(), h.set.offset(), S.css({
  17230. left: h.cache.element.left,
  17231. bottom: "",
  17232. marginBottom: ""
  17233. }).removeClass(b.bound).removeClass(b.top).addClass(b.fixed).addClass(b.bottom), v.onStick.call(P);
  17234. },
  17235. unbind: function unbind() {
  17236. h.is.bound() && (h.debug("Removing container bound position on element"), h.remove.offset(), S.removeClass(b.bound).removeClass(b.top).removeClass(b.bottom));
  17237. },
  17238. unfix: function unfix() {
  17239. 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));
  17240. },
  17241. reset: function reset() {
  17242. h.debug("Resetting elements position"), h.unbind(), h.unfix(), h.resetCSS(), h.remove.offset(), h.remove.lastScroll();
  17243. },
  17244. resetCSS: function resetCSS() {
  17245. S.css({
  17246. width: "",
  17247. height: ""
  17248. }), r.css({
  17249. height: ""
  17250. });
  17251. },
  17252. setting: function setting(t, n) {
  17253. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  17254. if (n === i) return v[t];
  17255. v[t] = n;
  17256. }
  17257. },
  17258. internal: function internal(t, n) {
  17259. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  17260. if (n === i) return h[t];
  17261. h[t] = n;
  17262. }
  17263. },
  17264. debug: function debug() {
  17265. !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)));
  17266. },
  17267. verbose: function verbose() {
  17268. !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)));
  17269. },
  17270. error: function error() {
  17271. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  17272. },
  17273. performance: {
  17274. log: function log(e) {
  17275. var t, n;
  17276. v.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17277. Name: e[0],
  17278. Arguments: [].slice.call(e, 1) || "",
  17279. Element: P,
  17280. "Execution Time": n
  17281. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 0);
  17282. },
  17283. display: function display() {
  17284. var t = v.name + ":",
  17285. n = 0;
  17286. l = !1, clearTimeout(h.performance.timer), e.each(c, function (e, t) {
  17287. n += t["Execution Time"];
  17288. }), 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) {
  17289. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17290. }), console.groupEnd()), c = [];
  17291. }
  17292. },
  17293. invoke: function invoke(t, n, o) {
  17294. var r,
  17295. s,
  17296. l,
  17297. c = A;
  17298. 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) {
  17299. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17300. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17301. if (c[a] !== i) return s = c[a], !1;
  17302. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  17303. c = c[o];
  17304. }
  17305. })), 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;
  17306. }
  17307. }, d ? (A === i && h.initialize(), h.invoke(u)) : (A !== i && A.invoke("destroy"), h.initialize());
  17308. }), a !== i ? a : this;
  17309. }, e.fn.sticky.settings = {
  17310. name: "Sticky",
  17311. namespace: "sticky",
  17312. silent: !1,
  17313. debug: !1,
  17314. verbose: !0,
  17315. performance: !0,
  17316. pushing: !1,
  17317. context: !1,
  17318. container: !1,
  17319. scrollContext: t,
  17320. offset: 0,
  17321. bottomOffset: 0,
  17322. jitter: 5,
  17323. setSize: !0,
  17324. observeChanges: !1,
  17325. onReposition: function onReposition() {},
  17326. onScroll: function onScroll() {},
  17327. onStick: function onStick() {},
  17328. onUnstick: function onUnstick() {},
  17329. onTop: function onTop() {},
  17330. onBottom: function onBottom() {},
  17331. error: {
  17332. container: "Sticky element must be inside a relative container",
  17333. visible: "Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.",
  17334. method: "The method you called is not defined.",
  17335. invalidContext: "Context specified does not exist",
  17336. elementSize: "Sticky element is larger than its container, cannot create sticky."
  17337. },
  17338. className: {
  17339. bound: "bound",
  17340. fixed: "fixed",
  17341. supported: "native",
  17342. top: "top",
  17343. bottom: "bottom"
  17344. }
  17345. };
  17346. }(jQuery, window, document), function (e, t, n, i) {
  17347. "use strict";
  17348. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.tab = function (o) {
  17349. var a,
  17350. r = e.isFunction(this) ? e(t) : e(this),
  17351. s = r.selector || "",
  17352. l = new Date().getTime(),
  17353. c = [],
  17354. u = arguments[0],
  17355. d = "string" == typeof u,
  17356. f = [].slice.call(arguments, 1),
  17357. m = !1;
  17358. return r.each(function () {
  17359. var g,
  17360. p,
  17361. h,
  17362. v,
  17363. b,
  17364. y,
  17365. x = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.tab.settings, o) : e.extend({}, e.fn.tab.settings),
  17366. C = x.className,
  17367. w = x.metadata,
  17368. S = x.selector,
  17369. k = x.error,
  17370. T = "." + x.namespace,
  17371. A = "module-" + x.namespace,
  17372. R = e(this),
  17373. P = {},
  17374. E = !0,
  17375. F = 0,
  17376. O = this,
  17377. D = R.data(A);
  17378. b = {
  17379. initialize: function initialize() {
  17380. 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();
  17381. },
  17382. instantiate: function instantiate() {
  17383. b.verbose("Storing instance of module", b), D = b, R.data(A, b);
  17384. },
  17385. destroy: function destroy() {
  17386. b.debug("Destroying tabs", R), R.removeData(A).off(T);
  17387. },
  17388. bind: {
  17389. events: function events() {
  17390. e.isWindow(O) || (b.debug("Attaching tab activation events to element", R), R.on("click" + T, b.event.click));
  17391. }
  17392. },
  17393. determineTabs: function determineTabs() {
  17394. var t;
  17395. "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));
  17396. },
  17397. fix: {
  17398. callbacks: function callbacks() {
  17399. 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));
  17400. }
  17401. },
  17402. initializeHistory: function initializeHistory() {
  17403. if (b.debug("Initializing page state"), e.address === i) return b.error(k.state), !1;
  17404. if ("state" == x.historyType) {
  17405. if (b.debug("Using HTML5 to manage state"), !1 === x.path) return b.error(k.path), !1;
  17406. e.address.history(!0).state(x.path);
  17407. }
  17408. e.address.bind("change", b.event.history.change);
  17409. },
  17410. event: {
  17411. click: function click(t) {
  17412. var n = e(this).data(w.tab);
  17413. 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");
  17414. },
  17415. history: {
  17416. change: function change(t) {
  17417. var n = t.pathNames.join("/") || b.get.initialPath(),
  17418. o = x.templates.determineTitle(n) || !1;
  17419. b.performance.display(), b.debug("History change event", n, t), y = t, n !== i && b.changeTab(n), o && e.address.title(o);
  17420. }
  17421. }
  17422. },
  17423. refresh: function refresh() {
  17424. h && (b.debug("Refreshing tab", h), b.changeTab(h));
  17425. },
  17426. cache: {
  17427. read: function read(e) {
  17428. return e !== i && P[e];
  17429. },
  17430. add: function add(e, t) {
  17431. e = e || h, b.debug("Adding cached content for", e), P[e] = t;
  17432. },
  17433. remove: function remove(e) {
  17434. e = e || h, b.debug("Removing cached content for", e), delete P[e];
  17435. }
  17436. },
  17437. set: {
  17438. auto: function auto() {
  17439. var t = "string" == typeof x.path ? x.path.replace(/\/$/, "") + "/{$tab}" : "/{$tab}";
  17440. b.verbose("Setting up automatic tab retrieval from server", t), e.isPlainObject(x.apiSettings) ? x.apiSettings.url = t : x.apiSettings = {
  17441. url: t
  17442. };
  17443. },
  17444. loading: function loading(e) {
  17445. var t = b.get.tabElement(e);
  17446. 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));
  17447. },
  17448. state: function state(t) {
  17449. e.address.value(t);
  17450. }
  17451. },
  17452. changeTab: function changeTab(n) {
  17453. var i = t.history && t.history.pushState && x.ignoreFirstLoad && E,
  17454. o = x.auto || e.isPlainObject(x.apiSettings),
  17455. a = o && !i ? b.utilities.pathToArray(n) : b.get.defaultPathArray(n);
  17456. n = b.utilities.arrayToPath(a), e.each(a, function (t, r) {
  17457. var s,
  17458. l,
  17459. c,
  17460. u,
  17461. d = a.slice(0, t + 1),
  17462. f = b.utilities.arrayToPath(d),
  17463. m = b.is.tab(f),
  17464. p = t + 1 == a.length,
  17465. S = b.get.tabElement(f);
  17466. if (b.verbose("Looking for tab", r), m) {
  17467. 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;
  17468. 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);
  17469. } else {
  17470. if (-1 != n.search("/") || "" === n) return b.error(k.missingTab, R, g, f), !1;
  17471. 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 () {
  17472. b.scrollTo(s);
  17473. }, 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;
  17474. }
  17475. });
  17476. },
  17477. scrollTo: function scrollTo(t) {
  17478. var i = !!(t && t.length > 0) && t.offset().top;
  17479. !1 !== i && (b.debug("Forcing scroll to an in-page link in a hidden tab", i, t), e(n).scrollTop(i));
  17480. },
  17481. update: {
  17482. content: function content(t, n, o) {
  17483. var a = b.get.tabElement(t),
  17484. r = a[0];
  17485. 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);
  17486. }
  17487. },
  17488. fetch: {
  17489. content: function content(t, n) {
  17490. var o,
  17491. a,
  17492. r = b.get.tabElement(t),
  17493. s = {
  17494. dataType: "html",
  17495. encodeParameters: !1,
  17496. on: "now",
  17497. cache: x.alwaysRefresh,
  17498. headers: {
  17499. "X-Remote": !0
  17500. },
  17501. onSuccess: function onSuccess(e) {
  17502. "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 () {
  17503. var e = r.children().clone(!0);
  17504. e = e.not("script"), b.cache.add(n, e);
  17505. }, 0) : b.cache.add(n, r.html());
  17506. },
  17507. urlData: {
  17508. tab: n
  17509. }
  17510. },
  17511. l = r.api("get request") || !1,
  17512. c = l && "pending" === l.state();
  17513. 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);
  17514. }
  17515. },
  17516. activate: {
  17517. all: function all(e) {
  17518. b.activate.tab(e), b.activate.navigation(e);
  17519. },
  17520. tab: function tab(e) {
  17521. var t = b.get.tabElement(e),
  17522. n = "siblings" == x.deactivate ? t.siblings(p) : p.not(t),
  17523. i = t.hasClass(C.active);
  17524. 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));
  17525. },
  17526. navigation: function navigation(e) {
  17527. var t = b.get.navElement(e),
  17528. n = "siblings" == x.deactivate ? t.siblings(r) : r.not(t),
  17529. i = t.hasClass(C.active);
  17530. b.verbose("Activating tab navigation for", t, e), i || (t.addClass(C.active), n.removeClass(C.active + " " + C.loading));
  17531. }
  17532. },
  17533. deactivate: {
  17534. all: function all() {
  17535. b.deactivate.navigation(), b.deactivate.tabs();
  17536. },
  17537. navigation: function navigation() {
  17538. r.removeClass(C.active);
  17539. },
  17540. tabs: function tabs() {
  17541. p.removeClass(C.active + " " + C.loading);
  17542. }
  17543. },
  17544. is: {
  17545. tab: function tab(e) {
  17546. return e !== i && b.get.tabElement(e).length > 0;
  17547. }
  17548. },
  17549. get: {
  17550. initialPath: function initialPath() {
  17551. return r.eq(0).data(w.tab) || p.eq(0).data(w.tab);
  17552. },
  17553. path: function path() {
  17554. return e.address.value();
  17555. },
  17556. defaultPathArray: function defaultPathArray(e) {
  17557. return b.utilities.pathToArray(b.get.defaultPath(e));
  17558. },
  17559. defaultPath: function defaultPath(e) {
  17560. var t = r.filter("[data-" + w.tab + '^="' + e + '/"]').eq(0).data(w.tab) || !1;
  17561. if (t) {
  17562. if (b.debug("Found default tab", t), F < x.maxDepth) return F++, b.get.defaultPath(t);
  17563. b.error(k.recursion);
  17564. } else b.debug("No default tabs found for", e, p);
  17565. return F = 0, e;
  17566. },
  17567. navElement: function navElement(e) {
  17568. return e = e || h, r.filter("[data-" + w.tab + '="' + e + '"]');
  17569. },
  17570. tabElement: function tabElement(e) {
  17571. var t, n, i, o;
  17572. 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;
  17573. },
  17574. tab: function tab() {
  17575. return h;
  17576. }
  17577. },
  17578. utilities: {
  17579. filterArray: function filterArray(t, n) {
  17580. return e.grep(t, function (t) {
  17581. return -1 == e.inArray(t, n);
  17582. });
  17583. },
  17584. last: function last(t) {
  17585. return !!e.isArray(t) && t[t.length - 1];
  17586. },
  17587. pathToArray: function pathToArray(e) {
  17588. return e === i && (e = h), "string" == typeof e ? e.split("/") : [e];
  17589. },
  17590. arrayToPath: function arrayToPath(t) {
  17591. return !!e.isArray(t) && t.join("/");
  17592. }
  17593. },
  17594. setting: function setting(t, n) {
  17595. if (b.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, x, t);else {
  17596. if (n === i) return x[t];
  17597. e.isPlainObject(x[t]) ? e.extend(!0, x[t], n) : x[t] = n;
  17598. }
  17599. },
  17600. internal: function internal(t, n) {
  17601. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  17602. if (n === i) return b[t];
  17603. b[t] = n;
  17604. }
  17605. },
  17606. debug: function debug() {
  17607. !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)));
  17608. },
  17609. verbose: function verbose() {
  17610. !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)));
  17611. },
  17612. error: function error() {
  17613. x.silent || (b.error = Function.prototype.bind.call(console.error, console, x.name + ":"), b.error.apply(console, arguments));
  17614. },
  17615. performance: {
  17616. log: function log(e) {
  17617. var t, n;
  17618. x.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  17619. Name: e[0],
  17620. Arguments: [].slice.call(e, 1) || "",
  17621. Element: O,
  17622. "Execution Time": n
  17623. })), clearTimeout(b.performance.timer), b.performance.timer = setTimeout(b.performance.display, 500);
  17624. },
  17625. display: function display() {
  17626. var t = x.name + ":",
  17627. n = 0;
  17628. l = !1, clearTimeout(b.performance.timer), e.each(c, function (e, t) {
  17629. n += t["Execution Time"];
  17630. }), 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) {
  17631. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  17632. }), console.groupEnd()), c = [];
  17633. }
  17634. },
  17635. invoke: function invoke(t, n, o) {
  17636. var r,
  17637. s,
  17638. l,
  17639. c = D;
  17640. 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) {
  17641. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  17642. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  17643. if (c[a] !== i) return s = c[a], !1;
  17644. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (b.error(k.method, t), !1);
  17645. c = c[o];
  17646. }
  17647. })), 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;
  17648. }
  17649. }, d ? (D === i && b.initialize(), b.invoke(u)) : (D !== i && D.invoke("destroy"), b.initialize());
  17650. }), a !== i ? a : this;
  17651. }, e.tab = function () {
  17652. e(t).tab.apply(this, arguments);
  17653. }, e.fn.tab.settings = {
  17654. name: "Tab",
  17655. namespace: "tab",
  17656. silent: !1,
  17657. debug: !1,
  17658. verbose: !1,
  17659. performance: !0,
  17660. auto: !1,
  17661. history: !1,
  17662. historyType: "hash",
  17663. path: !1,
  17664. context: !1,
  17665. childrenOnly: !1,
  17666. maxDepth: 25,
  17667. deactivate: "siblings",
  17668. alwaysRefresh: !1,
  17669. cache: !0,
  17670. loadOnce: !1,
  17671. cacheType: "response",
  17672. ignoreFirstLoad: !1,
  17673. apiSettings: !1,
  17674. evaluateScripts: "once",
  17675. onFirstLoad: function onFirstLoad(e, t, n) {},
  17676. onLoad: function onLoad(e, t, n) {},
  17677. onVisible: function onVisible(e, t, n) {},
  17678. onRequest: function onRequest(e, t, n) {},
  17679. templates: {
  17680. determineTitle: function determineTitle(e) {}
  17681. },
  17682. error: {
  17683. api: "You attempted to load content without API module",
  17684. method: "The method you called is not defined",
  17685. missingTab: "Activated tab cannot be found. Tabs are case-sensitive.",
  17686. noContent: "The tab you specified is missing a content url.",
  17687. path: "History enabled, but no path was specified",
  17688. recursion: "Max recursive depth reached",
  17689. legacyInit: "onTabInit has been renamed to onFirstLoad in 2.0, please adjust your code.",
  17690. legacyLoad: "onTabLoad has been renamed to onLoad in 2.0. Please adjust your code",
  17691. state: "History requires Asual's Address library <https://github.com/asual/jquery-address>"
  17692. },
  17693. metadata: {
  17694. tab: "tab",
  17695. loaded: "loaded",
  17696. promise: "promise"
  17697. },
  17698. className: {
  17699. loading: "loading",
  17700. active: "active"
  17701. },
  17702. selector: {
  17703. tabs: ".ui.tab",
  17704. ui: ".ui"
  17705. }
  17706. };
  17707. }(jQuery, window, document), function (e, t, n, i) {
  17708. "use strict";
  17709. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.transition = function () {
  17710. var o,
  17711. a = e(this),
  17712. r = a.selector || "",
  17713. s = new Date().getTime(),
  17714. l = [],
  17715. c = arguments,
  17716. u = c[0],
  17717. d = [].slice.call(arguments, 1),
  17718. f = "string" == typeof u;
  17719. t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame;
  17720. return a.each(function (t) {
  17721. var m,
  17722. g,
  17723. p,
  17724. h,
  17725. v,
  17726. b,
  17727. y,
  17728. x,
  17729. C,
  17730. w = e(this),
  17731. S = this;
  17732. (C = {
  17733. initialize: function initialize() {
  17734. 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());
  17735. },
  17736. instantiate: function instantiate() {
  17737. C.verbose("Storing instance of module", C), g = C, w.data(y, g);
  17738. },
  17739. destroy: function destroy() {
  17740. C.verbose("Destroying previous module for", S), w.removeData(y);
  17741. },
  17742. refresh: function refresh() {
  17743. C.verbose("Refreshing display type on next animation"), delete C.displayType;
  17744. },
  17745. forceRepaint: function forceRepaint() {
  17746. C.verbose("Forcing element repaint");
  17747. var e = w.parent(),
  17748. t = w.next();
  17749. 0 === t.length ? w.detach().appendTo(e) : w.detach().insertBefore(t);
  17750. },
  17751. repaint: function repaint() {
  17752. C.verbose("Repainting element");
  17753. S.offsetWidth;
  17754. },
  17755. delay: function delay(e) {
  17756. var n,
  17757. o = C.get.animationDirection();
  17758. 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);
  17759. },
  17760. animate: function animate(e) {
  17761. if (m = e || m, !C.is.supported()) return C.error(p.support), !1;
  17762. if (C.debug("Preparing animation", m.animation), C.is.animating()) {
  17763. 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;
  17764. if (!m.allowRepeats && C.is.occurring()) return C.debug("Animation is already occurring, will not execute repeated animation", m.animation), !1;
  17765. C.debug("New animation started, completing previous early", m.animation), g.complete();
  17766. }
  17767. C.can.animate() ? C.set.animating(m.animation) : C.error(p.noAnimation, m.animation, S);
  17768. },
  17769. reset: function reset() {
  17770. C.debug("Resetting animation to beginning conditions"), C.remove.animationCallbacks(), C.restore.conditions(), C.remove.animating();
  17771. },
  17772. queue: function queue(e) {
  17773. C.debug("Queueing animation of", e), C.queuing = !0, w.one(b + ".queue" + x, function () {
  17774. C.queuing = !1, C.repaint(), C.animate.apply(this, m);
  17775. });
  17776. },
  17777. complete: function complete(e) {
  17778. 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)));
  17779. },
  17780. force: {
  17781. visible: function visible() {
  17782. var e = w.attr("style"),
  17783. t = C.get.userStyle(),
  17784. n = C.get.displayType(),
  17785. o = t + "display: " + n + " !important;",
  17786. a = w.css("display"),
  17787. r = e === i || "" === e;
  17788. a !== n ? (C.verbose("Overriding default display to show element", n), w.attr("style", o)) : r && w.removeAttr("style");
  17789. },
  17790. hidden: function hidden() {
  17791. var e = w.attr("style"),
  17792. t = w.css("display"),
  17793. n = e === i || "" === e;
  17794. "none" === t || C.is.hidden() ? n && w.removeAttr("style") : (C.verbose("Overriding default display to hide element"), w.css("display", "none"));
  17795. }
  17796. },
  17797. has: {
  17798. direction: function direction(t) {
  17799. var n = !1;
  17800. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17801. t !== h.inward && t !== h.outward || (n = !0);
  17802. })), n;
  17803. },
  17804. inlineDisplay: function inlineDisplay() {
  17805. var t = w.attr("style") || "";
  17806. return e.isArray(t.match(/display.*?;/, ""));
  17807. }
  17808. },
  17809. set: {
  17810. animating: function animating(e) {
  17811. var t;
  17812. 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);
  17813. },
  17814. duration: function duration(e, t) {
  17815. ((t = "number" == typeof (t = t || m.duration) ? t + "ms" : t) || 0 === t) && (C.verbose("Setting animation duration", t), w.css({
  17816. "animation-duration": t
  17817. }));
  17818. },
  17819. direction: function direction(e) {
  17820. (e = e || C.get.direction()) == h.inward ? C.set.inward() : C.set.outward();
  17821. },
  17822. looping: function looping() {
  17823. C.debug("Transition set to loop"), w.addClass(h.looping);
  17824. },
  17825. hidden: function hidden() {
  17826. w.addClass(h.transition).addClass(h.hidden);
  17827. },
  17828. inward: function inward() {
  17829. C.debug("Setting direction to inward"), w.removeClass(h.outward).addClass(h.inward);
  17830. },
  17831. outward: function outward() {
  17832. C.debug("Setting direction to outward"), w.removeClass(h.inward).addClass(h.outward);
  17833. },
  17834. visible: function visible() {
  17835. w.addClass(h.transition).addClass(h.visible);
  17836. }
  17837. },
  17838. start: {
  17839. animation: function animation(e) {
  17840. 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);
  17841. }
  17842. },
  17843. save: {
  17844. animation: function animation(e) {
  17845. C.cache || (C.cache = {}), C.cache.animation = e;
  17846. },
  17847. displayType: function displayType(e) {
  17848. "none" !== e && w.data(v.displayType, e);
  17849. },
  17850. transitionExists: function transitionExists(t, n) {
  17851. e.fn.transition.exists[t] = n, C.verbose("Saving existence of transition", t, n);
  17852. }
  17853. },
  17854. restore: {
  17855. conditions: function conditions() {
  17856. var e = C.get.currentAnimation();
  17857. e && (w.removeClass(e), C.verbose("Removing animation class", C.cache)), C.remove.duration();
  17858. }
  17859. },
  17860. add: {
  17861. failSafe: function failSafe() {
  17862. var e = C.get.duration();
  17863. C.timer = setTimeout(function () {
  17864. w.triggerHandler(b);
  17865. }, e + m.failSafeDelay), C.verbose("Adding fail safe timer", C.timer);
  17866. }
  17867. },
  17868. remove: {
  17869. animating: function animating() {
  17870. w.removeClass(h.animating);
  17871. },
  17872. animationCallbacks: function animationCallbacks() {
  17873. C.remove.queueCallback(), C.remove.completeCallback();
  17874. },
  17875. queueCallback: function queueCallback() {
  17876. w.off(".queue" + x);
  17877. },
  17878. completeCallback: function completeCallback() {
  17879. w.off(".complete" + x);
  17880. },
  17881. display: function display() {
  17882. w.css("display", "");
  17883. },
  17884. direction: function direction() {
  17885. w.removeClass(h.inward).removeClass(h.outward);
  17886. },
  17887. duration: function duration() {
  17888. w.css("animation-duration", "");
  17889. },
  17890. failSafe: function failSafe() {
  17891. C.verbose("Removing fail safe timer", C.timer), C.timer && clearTimeout(C.timer);
  17892. },
  17893. hidden: function hidden() {
  17894. w.removeClass(h.hidden);
  17895. },
  17896. visible: function visible() {
  17897. w.removeClass(h.visible);
  17898. },
  17899. looping: function looping() {
  17900. C.debug("Transitions are no longer looping"), C.is.looping() && (C.reset(), w.removeClass(h.looping));
  17901. },
  17902. transition: function transition() {
  17903. w.removeClass(h.visible).removeClass(h.hidden);
  17904. }
  17905. },
  17906. get: {
  17907. settings: function settings(t, n, i) {
  17908. return "object" == _typeof(t) ? e.extend(!0, {}, e.fn.transition.settings, t) : "function" == typeof i ? e.extend({}, e.fn.transition.settings, {
  17909. animation: t,
  17910. onComplete: i,
  17911. duration: n
  17912. }) : "string" == typeof n || "number" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17913. animation: t,
  17914. duration: n
  17915. }) : "object" == _typeof(n) ? e.extend({}, e.fn.transition.settings, n, {
  17916. animation: t
  17917. }) : "function" == typeof n ? e.extend({}, e.fn.transition.settings, {
  17918. animation: t,
  17919. onComplete: n
  17920. }) : e.extend({}, e.fn.transition.settings, {
  17921. animation: t
  17922. });
  17923. },
  17924. animationClass: function animationClass(e) {
  17925. var t = e || m.animation,
  17926. n = C.can.transition() && !C.has.direction() ? C.get.direction() + " " : "";
  17927. return h.animating + " " + h.transition + " " + n + t;
  17928. },
  17929. currentAnimation: function currentAnimation() {
  17930. return !(!C.cache || C.cache.animation === i) && C.cache.animation;
  17931. },
  17932. currentDirection: function currentDirection() {
  17933. return C.is.inward() ? h.inward : h.outward;
  17934. },
  17935. direction: function direction() {
  17936. return C.is.hidden() || !C.is.visible() ? h.inward : h.outward;
  17937. },
  17938. animationDirection: function animationDirection(t) {
  17939. var n;
  17940. return "string" == typeof (t = t || m.animation) && (t = t.split(" "), e.each(t, function (e, t) {
  17941. t === h.inward ? n = h.inward : t === h.outward && (n = h.outward);
  17942. })), n || !1;
  17943. },
  17944. duration: function duration(e) {
  17945. 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;
  17946. },
  17947. displayType: function displayType(e) {
  17948. return e = e === i || e, m.displayType ? m.displayType : (e && w.data(v.displayType) === i && C.can.transition(!0), w.data(v.displayType));
  17949. },
  17950. userStyle: function userStyle(e) {
  17951. return (e = e || w.attr("style") || "").replace(/display.*?;/, "");
  17952. },
  17953. transitionExists: function transitionExists(t) {
  17954. return e.fn.transition.exists[t];
  17955. },
  17956. animationStartEvent: function animationStartEvent() {
  17957. var e,
  17958. t = n.createElement("div"),
  17959. o = {
  17960. animation: "animationstart",
  17961. OAnimation: "oAnimationStart",
  17962. MozAnimation: "mozAnimationStart",
  17963. WebkitAnimation: "webkitAnimationStart"
  17964. };
  17965. for (e in o) {
  17966. if (t.style[e] !== i) return o[e];
  17967. }
  17968. return !1;
  17969. },
  17970. animationEndEvent: function animationEndEvent() {
  17971. var e,
  17972. t = n.createElement("div"),
  17973. o = {
  17974. animation: "animationend",
  17975. OAnimation: "oAnimationEnd",
  17976. MozAnimation: "mozAnimationEnd",
  17977. WebkitAnimation: "webkitAnimationEnd"
  17978. };
  17979. for (e in o) {
  17980. if (t.style[e] !== i) return o[e];
  17981. }
  17982. return !1;
  17983. }
  17984. },
  17985. can: {
  17986. transition: function transition(t) {
  17987. var n,
  17988. o,
  17989. a,
  17990. r,
  17991. s,
  17992. l,
  17993. c = m.animation,
  17994. u = C.get.transitionExists(c),
  17995. d = C.get.displayType(!1);
  17996. if (u === i || t) {
  17997. 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 {
  17998. if ("none" == r || !r) return void C.debug("No animation defined in css", c);
  17999. C.debug("Static animation found", c, d), l = !1;
  18000. }
  18001. C.save.transitionExists(c, l);
  18002. }
  18003. return u !== i ? u : l;
  18004. },
  18005. animate: function animate() {
  18006. return C.can.transition() !== i;
  18007. }
  18008. },
  18009. is: {
  18010. animating: function animating() {
  18011. return w.hasClass(h.animating);
  18012. },
  18013. inward: function inward() {
  18014. return w.hasClass(h.inward);
  18015. },
  18016. outward: function outward() {
  18017. return w.hasClass(h.outward);
  18018. },
  18019. looping: function looping() {
  18020. return w.hasClass(h.looping);
  18021. },
  18022. occurring: function occurring(e) {
  18023. return e = "." + (e = e || m.animation).replace(" ", "."), w.filter(e).length > 0;
  18024. },
  18025. visible: function visible() {
  18026. return w.is(":visible");
  18027. },
  18028. hidden: function hidden() {
  18029. return "hidden" === w.css("visibility");
  18030. },
  18031. supported: function supported() {
  18032. return !1 !== b;
  18033. }
  18034. },
  18035. hide: function hide() {
  18036. 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);
  18037. },
  18038. show: function show(e) {
  18039. C.verbose("Showing element", e), C.remove.hidden(), C.set.visible(), C.force.visible(), m.onShow.call(S), m.onComplete.call(S);
  18040. },
  18041. toggle: function toggle() {
  18042. C.is.visible() ? C.hide() : C.show();
  18043. },
  18044. stop: function stop() {
  18045. C.debug("Stopping current animation"), w.triggerHandler(b);
  18046. },
  18047. stopAll: function stopAll() {
  18048. C.debug("Stopping all animation"), C.remove.queueCallback(), w.triggerHandler(b);
  18049. },
  18050. clear: {
  18051. queue: function queue() {
  18052. C.debug("Clearing animation queue"), C.remove.queueCallback();
  18053. }
  18054. },
  18055. enable: function enable() {
  18056. C.verbose("Starting animation"), w.removeClass(h.disabled);
  18057. },
  18058. disable: function disable() {
  18059. C.debug("Stopping animation"), w.addClass(h.disabled);
  18060. },
  18061. setting: function setting(t, n) {
  18062. if (C.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, m, t);else {
  18063. if (n === i) return m[t];
  18064. e.isPlainObject(m[t]) ? e.extend(!0, m[t], n) : m[t] = n;
  18065. }
  18066. },
  18067. internal: function internal(t, n) {
  18068. if (e.isPlainObject(t)) e.extend(!0, C, t);else {
  18069. if (n === i) return C[t];
  18070. C[t] = n;
  18071. }
  18072. },
  18073. debug: function debug() {
  18074. !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)));
  18075. },
  18076. verbose: function verbose() {
  18077. !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)));
  18078. },
  18079. error: function error() {
  18080. m.silent || (C.error = Function.prototype.bind.call(console.error, console, m.name + ":"), C.error.apply(console, arguments));
  18081. },
  18082. performance: {
  18083. log: function log(e) {
  18084. var t, n;
  18085. m.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18086. Name: e[0],
  18087. Arguments: [].slice.call(e, 1) || "",
  18088. Element: S,
  18089. "Execution Time": n
  18090. })), clearTimeout(C.performance.timer), C.performance.timer = setTimeout(C.performance.display, 500);
  18091. },
  18092. display: function display() {
  18093. var t = m.name + ":",
  18094. n = 0;
  18095. s = !1, clearTimeout(C.performance.timer), e.each(l, function (e, t) {
  18096. n += t["Execution Time"];
  18097. }), 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) {
  18098. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18099. }), console.groupEnd()), l = [];
  18100. }
  18101. },
  18102. invoke: function invoke(t, n, a) {
  18103. var r,
  18104. s,
  18105. l,
  18106. c = g;
  18107. 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) {
  18108. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18109. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18110. if (c[a] !== i) return s = c[a], !1;
  18111. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i && (s = c[o], !1);
  18112. c = c[o];
  18113. }
  18114. })), 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;
  18115. }
  18116. }).initialize();
  18117. }), o !== i ? o : this;
  18118. }, e.fn.transition.exists = {}, e.fn.transition.settings = {
  18119. name: "Transition",
  18120. silent: !1,
  18121. debug: !1,
  18122. verbose: !1,
  18123. performance: !0,
  18124. namespace: "transition",
  18125. interval: 0,
  18126. reverse: "auto",
  18127. onStart: function onStart() {},
  18128. onComplete: function onComplete() {},
  18129. onShow: function onShow() {},
  18130. onHide: function onHide() {},
  18131. useFailSafe: !0,
  18132. failSafeDelay: 100,
  18133. allowRepeats: !1,
  18134. displayType: !1,
  18135. animation: "fade",
  18136. duration: !1,
  18137. queue: !0,
  18138. metadata: {
  18139. displayType: "display"
  18140. },
  18141. className: {
  18142. animating: "animating",
  18143. disabled: "disabled",
  18144. hidden: "hidden",
  18145. inward: "in",
  18146. loading: "loading",
  18147. looping: "looping",
  18148. outward: "out",
  18149. transition: "transition",
  18150. visible: "visible"
  18151. },
  18152. error: {
  18153. noAnimation: "Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.",
  18154. repeated: "That animation is already occurring, cancelling repeated animation",
  18155. method: "The method you called is not defined",
  18156. support: "This browser does not support CSS animations"
  18157. }
  18158. };
  18159. }(jQuery, window, document), function (e, t, n, i) {
  18160. "use strict";
  18161. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")();
  18162. e.api = e.fn.api = function (n) {
  18163. var o,
  18164. a = e.isFunction(this) ? e(t) : e(this),
  18165. r = a.selector || "",
  18166. s = new Date().getTime(),
  18167. l = [],
  18168. c = arguments[0],
  18169. u = "string" == typeof c,
  18170. d = [].slice.call(arguments, 1);
  18171. return a.each(function () {
  18172. var a,
  18173. f,
  18174. m,
  18175. g,
  18176. p,
  18177. h,
  18178. v = e.isPlainObject(n) ? e.extend(!0, {}, e.fn.api.settings, n) : e.extend({}, e.fn.api.settings),
  18179. b = v.namespace,
  18180. y = v.metadata,
  18181. x = v.selector,
  18182. C = v.error,
  18183. w = v.className,
  18184. S = "." + b,
  18185. k = "module-" + b,
  18186. T = e(this),
  18187. A = T.closest(x.form),
  18188. R = v.stateContext ? e(v.stateContext) : T,
  18189. P = this,
  18190. E = R[0],
  18191. F = T.data(k);
  18192. h = {
  18193. initialize: function initialize() {
  18194. u || h.bind.events(), h.instantiate();
  18195. },
  18196. instantiate: function instantiate() {
  18197. h.verbose("Storing instance of module", h), F = h, T.data(k, F);
  18198. },
  18199. destroy: function destroy() {
  18200. h.verbose("Destroying previous module for", P), T.removeData(k).off(S);
  18201. },
  18202. bind: {
  18203. events: function events() {
  18204. var e = h.get.event();
  18205. 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());
  18206. }
  18207. },
  18208. decode: {
  18209. json: function json(e) {
  18210. if (e !== i && "string" == typeof e) try {
  18211. e = JSON.parse(e);
  18212. } catch (e) {}
  18213. return e;
  18214. }
  18215. },
  18216. read: {
  18217. cachedResponse: function cachedResponse(e) {
  18218. var n;
  18219. if (t.Storage !== i) return n = sessionStorage.getItem(e), h.debug("Using cached response", e, n), n = h.decode.json(n);
  18220. h.error(C.noStorage);
  18221. }
  18222. },
  18223. write: {
  18224. cachedResponse: function cachedResponse(n, o) {
  18225. 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);
  18226. }
  18227. },
  18228. query: function query() {
  18229. if (h.is.disabled()) h.debug("Element is disabled API request aborted");else {
  18230. if (h.is.loading()) {
  18231. if (!v.interruptRequests) return void h.debug("Cancelling request, previous request is still pending");
  18232. h.debug("Interrupting previous request"), h.abort();
  18233. }
  18234. 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);
  18235. if (h.cancelled = !1, (m = h.get.templatedURL()) || h.is.mocked()) {
  18236. if ((m = h.add.urlData(m)) || h.is.mocked()) {
  18237. if (f.url = v.base + m, a = e.extend(!0, {}, v, {
  18238. type: v.method || v.type,
  18239. data: g,
  18240. url: v.base + m,
  18241. beforeSend: v.beforeXHR,
  18242. success: function success() {},
  18243. failure: function failure() {},
  18244. complete: function complete() {}
  18245. }), 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)]);
  18246. v.throttle ? v.throttleFirstRequest || h.timer ? (h.debug("Throttling request", v.throttle), clearTimeout(h.timer), h.timer = setTimeout(function () {
  18247. h.timer && delete h.timer, h.debug("Sending throttled request", g, a.method), h.send.request();
  18248. }, 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());
  18249. }
  18250. } else h.error(C.missingURL);
  18251. }
  18252. },
  18253. should: {
  18254. removeError: function removeError() {
  18255. return !0 === v.hideError || "auto" === v.hideError && !h.is.form();
  18256. }
  18257. },
  18258. is: {
  18259. disabled: function disabled() {
  18260. return T.filter(x.disabled).length > 0;
  18261. },
  18262. expectingJSON: function expectingJSON() {
  18263. return "json" === v.dataType || "jsonp" === v.dataType;
  18264. },
  18265. form: function form() {
  18266. return T.is("form") || R.is("form");
  18267. },
  18268. mocked: function mocked() {
  18269. return v.mockResponse || v.mockResponseAsync || v.response || v.responseAsync;
  18270. },
  18271. input: function input() {
  18272. return T.is("input");
  18273. },
  18274. loading: function loading() {
  18275. return !!h.request && "pending" == h.request.state();
  18276. },
  18277. abortedRequest: function abortedRequest(e) {
  18278. 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);
  18279. },
  18280. validResponse: function validResponse(t) {
  18281. 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);
  18282. }
  18283. },
  18284. was: {
  18285. cancelled: function cancelled() {
  18286. return h.cancelled || !1;
  18287. },
  18288. succesful: function succesful() {
  18289. return h.request && "resolved" == h.request.state();
  18290. },
  18291. failure: function failure() {
  18292. return h.request && "rejected" == h.request.state();
  18293. },
  18294. complete: function complete() {
  18295. return h.request && ("resolved" == h.request.state() || "rejected" == h.request.state());
  18296. }
  18297. },
  18298. add: {
  18299. urlData: function urlData(t, n) {
  18300. var o, a;
  18301. 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) {
  18302. var r = -1 !== a.indexOf("$") ? a.substr(2, a.length - 3) : a.substr(1, a.length - 2),
  18303. 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];
  18304. if (s === i) return h.error(C.requiredParameter, r, t), t = !1, !1;
  18305. h.verbose("Found required variable", r, s), s = v.encodeParameters ? h.get.urlEncodedValue(s) : s, t = t.replace(a, s);
  18306. })), a && (h.debug("Looking for optional URL variables", o), e.each(a, function (o, a) {
  18307. var r = -1 !== a.indexOf("$") ? a.substr(3, a.length - 4) : a.substr(2, a.length - 3),
  18308. 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];
  18309. 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, ""));
  18310. }))), t;
  18311. },
  18312. formData: function formData(t) {
  18313. var n = e.fn.serializeObject !== i,
  18314. o = n ? A.serializeObject() : A.serialize();
  18315. 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;
  18316. }
  18317. },
  18318. send: {
  18319. request: function request() {
  18320. 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);
  18321. }
  18322. },
  18323. event: {
  18324. trigger: function trigger(e) {
  18325. h.query(), "submit" != e.type && "click" != e.type || e.preventDefault();
  18326. },
  18327. xhr: {
  18328. always: function always() {},
  18329. done: function done(t, n, i) {
  18330. var o = this,
  18331. a = new Date().getTime() - p,
  18332. r = v.loadingDuration - a,
  18333. s = !!e.isFunction(v.onResponse) && (h.is.expectingJSON() ? v.onResponse.call(o, e.extend(!0, {}, t)) : v.onResponse.call(o, t));
  18334. 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 () {
  18335. h.is.validResponse(t) ? h.request.resolveWith(o, [t, i]) : h.request.rejectWith(o, [i, "invalid"]);
  18336. }, r);
  18337. },
  18338. fail: function fail(e, t, n) {
  18339. var i = this,
  18340. o = new Date().getTime() - p,
  18341. a = v.loadingDuration - o;
  18342. (a = a > 0 ? a : 0) > 0 && h.debug("Response completed early delaying state change by", a), setTimeout(function () {
  18343. h.is.abortedRequest(e) ? h.request.rejectWith(i, [e, "aborted", n]) : h.request.rejectWith(i, [e, "error", t, n]);
  18344. }, a);
  18345. }
  18346. },
  18347. request: {
  18348. done: function done(e, t) {
  18349. 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);
  18350. },
  18351. complete: function complete(e, t) {
  18352. var n, i;
  18353. h.was.succesful() ? (i = e, n = t) : (n = e, i = h.get.responseFromXHR(n)), h.remove.loading(), v.onComplete.call(E, i, T, n);
  18354. },
  18355. fail: function fail(e, t, n) {
  18356. var o = h.get.responseFromXHR(e),
  18357. r = h.get.errorFromRequest(o, t, n);
  18358. 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;
  18359. "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);
  18360. }
  18361. }
  18362. },
  18363. create: {
  18364. request: function request() {
  18365. return e.Deferred().always(h.event.request.complete).done(h.event.request.done).fail(h.event.request.fail);
  18366. },
  18367. mockedXHR: function mockedXHR() {
  18368. var t,
  18369. n,
  18370. i,
  18371. o = v.mockResponse || v.response,
  18372. a = v.mockResponseAsync || v.responseAsync;
  18373. 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, {
  18374. responseText: n
  18375. }])) : e.isFunction(a) && (t = function t(e) {
  18376. h.debug("Async callback returned response", e), e ? i.resolveWith(E, [e, !1, {
  18377. responseText: e
  18378. }]) : i.rejectWith(E, [{
  18379. responseText: e
  18380. }, !1, !1]);
  18381. }, h.debug("Using specified async response callback", a), a.call(E, f, t)), i;
  18382. },
  18383. xhr: function xhr() {
  18384. var t;
  18385. 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;
  18386. }
  18387. },
  18388. set: {
  18389. error: function error() {
  18390. h.verbose("Adding error state to element", R), R.addClass(w.error);
  18391. },
  18392. loading: function loading() {
  18393. h.verbose("Adding loading state to element", R), R.addClass(w.loading), p = new Date().getTime();
  18394. }
  18395. },
  18396. remove: {
  18397. error: function error() {
  18398. h.verbose("Removing error state from element", R), R.removeClass(w.error);
  18399. },
  18400. loading: function loading() {
  18401. h.verbose("Removing loading state from element", R), R.removeClass(w.loading);
  18402. }
  18403. },
  18404. get: {
  18405. responseFromXHR: function responseFromXHR(t) {
  18406. return !!e.isPlainObject(t) && (h.is.expectingJSON() ? h.decode.json(t.responseText) : t.responseText);
  18407. },
  18408. errorFromRequest: function errorFromRequest(t, n, o) {
  18409. return e.isPlainObject(t) && t.error !== i ? t.error : v.error[n] !== i ? v.error[n] : o;
  18410. },
  18411. request: function request() {
  18412. return h.request || !1;
  18413. },
  18414. xhr: function xhr() {
  18415. return h.xhr || !1;
  18416. },
  18417. settings: function settings() {
  18418. var t;
  18419. 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);
  18420. },
  18421. urlEncodedValue: function urlEncodedValue(e) {
  18422. var n = t.decodeURIComponent(e),
  18423. i = t.encodeURIComponent(e);
  18424. return n !== e ? (h.debug("URL value is already encoded, avoiding double encoding", e), e) : (h.verbose("Encoding value using encodeURIComponent", e, i), i);
  18425. },
  18426. defaultData: function defaultData() {
  18427. var t = {};
  18428. return e.isWindow(P) || (h.is.input() ? t.value = T.val() : h.is.form() || (t.text = T.text())), t;
  18429. },
  18430. event: function event() {
  18431. 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;
  18432. },
  18433. templatedURL: function templatedURL(e) {
  18434. 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;
  18435. if (e) {
  18436. 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);
  18437. m = v.api[e];
  18438. } else h.is.form() && (m = T.attr("action") || R.attr("action") || !1, h.debug("No url or action specified, defaulting to form action", m));
  18439. return m;
  18440. }
  18441. },
  18442. abort: function abort() {
  18443. var e = h.get.xhr();
  18444. e && "resolved" !== e.state() && (h.debug("Cancelling API request"), e.abort());
  18445. },
  18446. reset: function reset() {
  18447. h.remove.error(), h.remove.loading();
  18448. },
  18449. setting: function setting(t, n) {
  18450. if (h.debug("Changing setting", t, n), e.isPlainObject(t)) e.extend(!0, v, t);else {
  18451. if (n === i) return v[t];
  18452. e.isPlainObject(v[t]) ? e.extend(!0, v[t], n) : v[t] = n;
  18453. }
  18454. },
  18455. internal: function internal(t, n) {
  18456. if (e.isPlainObject(t)) e.extend(!0, h, t);else {
  18457. if (n === i) return h[t];
  18458. h[t] = n;
  18459. }
  18460. },
  18461. debug: function debug() {
  18462. !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)));
  18463. },
  18464. verbose: function verbose() {
  18465. !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)));
  18466. },
  18467. error: function error() {
  18468. v.silent || (h.error = Function.prototype.bind.call(console.error, console, v.name + ":"), h.error.apply(console, arguments));
  18469. },
  18470. performance: {
  18471. log: function log(e) {
  18472. var t, n;
  18473. v.performance && (n = (t = new Date().getTime()) - (s || t), s = t, l.push({
  18474. Name: e[0],
  18475. Arguments: [].slice.call(e, 1) || "",
  18476. "Execution Time": n
  18477. })), clearTimeout(h.performance.timer), h.performance.timer = setTimeout(h.performance.display, 500);
  18478. },
  18479. display: function display() {
  18480. var t = v.name + ":",
  18481. n = 0;
  18482. s = !1, clearTimeout(h.performance.timer), e.each(l, function (e, t) {
  18483. n += t["Execution Time"];
  18484. }), 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) {
  18485. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18486. }), console.groupEnd()), l = [];
  18487. }
  18488. },
  18489. invoke: function invoke(t, n, a) {
  18490. var r,
  18491. s,
  18492. l,
  18493. c = F;
  18494. 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) {
  18495. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  18496. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  18497. if (c[a] !== i) return s = c[a], !1;
  18498. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (h.error(C.method, t), !1);
  18499. c = c[o];
  18500. }
  18501. })), 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;
  18502. }
  18503. }, u ? (F === i && h.initialize(), h.invoke(c)) : (F !== i && F.invoke("destroy"), h.initialize());
  18504. }), o !== i ? o : this;
  18505. }, e.api.settings = {
  18506. name: "API",
  18507. namespace: "api",
  18508. debug: !1,
  18509. verbose: !1,
  18510. performance: !0,
  18511. api: {},
  18512. cache: !0,
  18513. interruptRequests: !0,
  18514. on: "auto",
  18515. stateContext: !1,
  18516. loadingDuration: 0,
  18517. hideError: "auto",
  18518. errorDuration: 2e3,
  18519. encodeParameters: !0,
  18520. action: !1,
  18521. url: !1,
  18522. base: "",
  18523. urlData: {},
  18524. defaultData: !0,
  18525. serializeForm: !1,
  18526. throttle: 0,
  18527. throttleFirstRequest: !0,
  18528. method: "get",
  18529. data: {},
  18530. dataType: "json",
  18531. mockResponse: !1,
  18532. mockResponseAsync: !1,
  18533. response: !1,
  18534. responseAsync: !1,
  18535. beforeSend: function beforeSend(e) {
  18536. return e;
  18537. },
  18538. beforeXHR: function beforeXHR(e) {},
  18539. onRequest: function onRequest(e, t) {},
  18540. onResponse: !1,
  18541. onSuccess: function onSuccess(e, t) {},
  18542. onComplete: function onComplete(e, t) {},
  18543. onFailure: function onFailure(e, t) {},
  18544. onError: function onError(e, t) {},
  18545. onAbort: function onAbort(e, t) {},
  18546. successTest: !1,
  18547. error: {
  18548. beforeSend: "The before send function has aborted the request",
  18549. error: "There was an error with your request",
  18550. exitConditions: "API Request Aborted. Exit conditions met",
  18551. JSONParse: "JSON could not be parsed during error handling",
  18552. legacyParameters: "You are using legacy API success callback names",
  18553. method: "The method you called is not defined",
  18554. missingAction: "API action used but no url was defined",
  18555. missingSerialize: "jquery-serialize-object is required to add form data to an existing data object",
  18556. missingURL: "No URL specified for api event",
  18557. noReturnedValue: "The beforeSend callback must return a settings object, beforeSend ignored.",
  18558. noStorage: "Caching responses locally requires session storage",
  18559. parseError: "There was an error parsing your request",
  18560. requiredParameter: "Missing a required URL parameter: ",
  18561. statusMessage: "Server gave an error: ",
  18562. timeout: "Your request timed out"
  18563. },
  18564. regExp: {
  18565. required: /\{\$*[A-z0-9]+\}/g,
  18566. optional: /\{\/\$*[A-z0-9]+\}/g
  18567. },
  18568. className: {
  18569. loading: "loading",
  18570. error: "error"
  18571. },
  18572. selector: {
  18573. disabled: ".disabled",
  18574. form: "form"
  18575. },
  18576. metadata: {
  18577. action: "action",
  18578. url: "url"
  18579. }
  18580. };
  18581. }(jQuery, window, document), function (e, t, n, i) {
  18582. "use strict";
  18583. t = void 0 !== t && t.Math == Math ? t : "undefined" != typeof self && self.Math == Math ? self : Function("return this")(), e.fn.visibility = function (o) {
  18584. var a,
  18585. r = e(this),
  18586. s = r.selector || "",
  18587. l = new Date().getTime(),
  18588. c = [],
  18589. u = arguments[0],
  18590. d = "string" == typeof u,
  18591. f = [].slice.call(arguments, 1),
  18592. m = r.length,
  18593. g = 0;
  18594. return r.each(function () {
  18595. var r,
  18596. p,
  18597. h,
  18598. v,
  18599. b = e.isPlainObject(o) ? e.extend(!0, {}, e.fn.visibility.settings, o) : e.extend({}, e.fn.visibility.settings),
  18600. y = b.className,
  18601. x = b.namespace,
  18602. C = b.error,
  18603. w = b.metadata,
  18604. S = "." + x,
  18605. k = "module-" + x,
  18606. T = e(t),
  18607. A = e(this),
  18608. R = e(b.context),
  18609. P = (A.selector, A.data(k)),
  18610. E = t.requestAnimationFrame || t.mozRequestAnimationFrame || t.webkitRequestAnimationFrame || t.msRequestAnimationFrame || function (e) {
  18611. setTimeout(e, 0);
  18612. },
  18613. F = this,
  18614. O = !1;
  18615. v = {
  18616. initialize: function initialize() {
  18617. 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();
  18618. },
  18619. instantiate: function instantiate() {
  18620. v.debug("Storing instance", v), A.data(k, v), P = v;
  18621. },
  18622. destroy: function destroy() {
  18623. 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);
  18624. },
  18625. observeChanges: function observeChanges() {
  18626. "MutationObserver" in t && (p = new MutationObserver(v.event.contextChanged), h = new MutationObserver(v.event.changed), p.observe(n, {
  18627. childList: !0,
  18628. subtree: !0
  18629. }), h.observe(F, {
  18630. childList: !0,
  18631. subtree: !0
  18632. }), v.debug("Setting up mutation observer", h));
  18633. },
  18634. bind: {
  18635. events: function events() {
  18636. 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);
  18637. }
  18638. },
  18639. event: {
  18640. changed: function changed(e) {
  18641. v.verbose("DOM tree modified, updating visibility calculations"), v.timer = setTimeout(function () {
  18642. v.verbose("DOM tree modified, updating sticky menu"), v.refresh();
  18643. }, 100);
  18644. },
  18645. contextChanged: function contextChanged(t) {
  18646. [].forEach.call(t, function (t) {
  18647. t.removedNodes && [].forEach.call(t.removedNodes, function (t) {
  18648. (t == F || e(t).find(F).length > 0) && (v.debug("Element removed from DOM, tearing down events"), v.destroy());
  18649. });
  18650. });
  18651. },
  18652. resize: function resize() {
  18653. v.debug("Window resized"), b.refreshOnResize && E(v.refresh);
  18654. },
  18655. load: function load() {
  18656. v.debug("Page finished loading"), E(v.refresh);
  18657. },
  18658. scroll: function scroll() {
  18659. b.throttle ? (clearTimeout(v.timer), v.timer = setTimeout(function () {
  18660. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18661. }, b.throttle)) : E(function () {
  18662. R.triggerHandler("scrollchange" + S, [R.scrollTop()]);
  18663. });
  18664. },
  18665. scrollchange: function scrollchange(e, t) {
  18666. v.checkVisibility(t);
  18667. }
  18668. },
  18669. precache: function precache(t, i) {
  18670. t instanceof Array || (t = [t]);
  18671. for (var o = t.length, a = 0, r = [], s = n.createElement("img"), l = function l() {
  18672. ++a >= t.length && e.isFunction(i) && i();
  18673. }; o--;) {
  18674. (s = n.createElement("img")).onload = l, s.onerror = l, s.src = t[o], r.push(s);
  18675. }
  18676. },
  18677. enableCallbacks: function enableCallbacks() {
  18678. v.debug("Allowing callbacks to occur"), O = !1;
  18679. },
  18680. disableCallbacks: function disableCallbacks() {
  18681. v.debug("Disabling all callbacks temporarily"), O = !0;
  18682. },
  18683. should: {
  18684. trackChanges: function trackChanges() {
  18685. return d ? (v.debug("One time query, no need to bind events"), !1) : (v.debug("Callbacks being attached"), !0);
  18686. }
  18687. },
  18688. setup: {
  18689. cache: function cache() {
  18690. v.cache = {
  18691. occurred: {},
  18692. screen: {},
  18693. element: {}
  18694. };
  18695. },
  18696. image: function image() {
  18697. var e = A.data(w.src);
  18698. e && (v.verbose("Lazy loading image", e), b.once = !0, b.observeChanges = !1, b.onOnScreen = function () {
  18699. v.debug("Image on screen", F), v.precache(e, function () {
  18700. v.set.image(e, function () {
  18701. ++g == m && b.onAllLoaded.call(this), b.onLoad.call(this);
  18702. });
  18703. });
  18704. });
  18705. },
  18706. fixed: function fixed() {
  18707. 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 () {
  18708. 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);
  18709. }, b.onTopPassedReverse = function () {
  18710. v.debug("Element returned to position, removing fixed", A), v.hide.placeholder(), v.remove.fixed();
  18711. };
  18712. }
  18713. },
  18714. create: {
  18715. placeholder: function placeholder() {
  18716. v.verbose("Creating fixed position placeholder"), r = A.clone(!1).css("display", "none").addClass(y.placeholder).insertAfter(A);
  18717. }
  18718. },
  18719. show: {
  18720. placeholder: function placeholder() {
  18721. v.verbose("Showing placeholder"), r.css("display", "block").css("visibility", "hidden");
  18722. }
  18723. },
  18724. hide: {
  18725. placeholder: function placeholder() {
  18726. v.verbose("Hiding placeholder"), r.css("display", "none").css("visibility", "");
  18727. }
  18728. },
  18729. set: {
  18730. fixed: function fixed() {
  18731. v.verbose("Setting element to fixed position"), A.addClass(y.fixed).css({
  18732. position: "fixed",
  18733. top: b.offset + "px",
  18734. left: "auto",
  18735. zIndex: b.zIndex
  18736. }), b.onFixed.call(F);
  18737. },
  18738. image: function image(t, n) {
  18739. if (A.attr("src", t), b.transition) {
  18740. if (e.fn.transition !== i) {
  18741. if (A.hasClass(y.visible)) return void v.debug("Transition already occurred on this image, skipping animation");
  18742. A.transition(b.transition, b.duration, n);
  18743. } else A.fadeIn(b.duration, n);
  18744. } else A.show();
  18745. }
  18746. },
  18747. is: {
  18748. onScreen: function onScreen() {
  18749. return v.get.elementCalculations().onScreen;
  18750. },
  18751. offScreen: function offScreen() {
  18752. return v.get.elementCalculations().offScreen;
  18753. },
  18754. visible: function visible() {
  18755. return !(!v.cache || !v.cache.element) && !(0 === v.cache.element.width && 0 === v.cache.element.offset.top);
  18756. },
  18757. verticallyScrollableContext: function verticallyScrollableContext() {
  18758. var e = R.get(0) !== t && R.css("overflow-y");
  18759. return "auto" == e || "scroll" == e;
  18760. },
  18761. horizontallyScrollableContext: function horizontallyScrollableContext() {
  18762. var e = R.get(0) !== t && R.css("overflow-x");
  18763. return "auto" == e || "scroll" == e;
  18764. }
  18765. },
  18766. refresh: function refresh() {
  18767. v.debug("Refreshing constants (width/height)"), "fixed" == b.type && v.resetFixed(), v.reset(), v.save.position(), b.checkOnRefresh && v.checkVisibility(), b.onRefresh.call(F);
  18768. },
  18769. resetFixed: function resetFixed() {
  18770. v.remove.fixed(), v.remove.occurred();
  18771. },
  18772. reset: function reset() {
  18773. v.verbose("Resetting all cached values"), e.isPlainObject(v.cache) && (v.cache.screen = {}, v.cache.element = {});
  18774. },
  18775. checkVisibility: function checkVisibility(e) {
  18776. 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()));
  18777. },
  18778. passed: function passed(t, n) {
  18779. var o = v.get.elementCalculations();
  18780. if (t && n) b.onPassed[t] = n;else {
  18781. if (t !== i) return v.get.pixelsPassed(t) > o.pixelsPassed;
  18782. o.passing && e.each(b.onPassed, function (e, t) {
  18783. o.bottomVisible || o.pixelsPassed > v.get.pixelsPassed(e) ? v.execute(t, e) : b.once || v.remove.occurred(t);
  18784. });
  18785. }
  18786. },
  18787. onScreen: function onScreen(e) {
  18788. var t = v.get.elementCalculations(),
  18789. n = e || b.onOnScreen,
  18790. o = "onScreen";
  18791. 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;
  18792. },
  18793. offScreen: function offScreen(e) {
  18794. var t = v.get.elementCalculations(),
  18795. n = e || b.onOffScreen,
  18796. o = "offScreen";
  18797. 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;
  18798. },
  18799. passing: function passing(e) {
  18800. var t = v.get.elementCalculations(),
  18801. n = e || b.onPassing,
  18802. o = "passing";
  18803. 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;
  18804. },
  18805. topVisible: function topVisible(e) {
  18806. var t = v.get.elementCalculations(),
  18807. n = e || b.onTopVisible,
  18808. o = "topVisible";
  18809. 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;
  18810. },
  18811. bottomVisible: function bottomVisible(e) {
  18812. var t = v.get.elementCalculations(),
  18813. n = e || b.onBottomVisible,
  18814. o = "bottomVisible";
  18815. 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;
  18816. },
  18817. topPassed: function topPassed(e) {
  18818. var t = v.get.elementCalculations(),
  18819. n = e || b.onTopPassed,
  18820. o = "topPassed";
  18821. 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;
  18822. },
  18823. bottomPassed: function bottomPassed(e) {
  18824. var t = v.get.elementCalculations(),
  18825. n = e || b.onBottomPassed,
  18826. o = "bottomPassed";
  18827. 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;
  18828. },
  18829. passingReverse: function passingReverse(e) {
  18830. var t = v.get.elementCalculations(),
  18831. n = e || b.onPassingReverse,
  18832. o = "passingReverse";
  18833. 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;
  18834. },
  18835. topVisibleReverse: function topVisibleReverse(e) {
  18836. var t = v.get.elementCalculations(),
  18837. n = e || b.onTopVisibleReverse,
  18838. o = "topVisibleReverse";
  18839. 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;
  18840. },
  18841. bottomVisibleReverse: function bottomVisibleReverse(e) {
  18842. var t = v.get.elementCalculations(),
  18843. n = e || b.onBottomVisibleReverse,
  18844. o = "bottomVisibleReverse";
  18845. 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;
  18846. },
  18847. topPassedReverse: function topPassedReverse(e) {
  18848. var t = v.get.elementCalculations(),
  18849. n = e || b.onTopPassedReverse,
  18850. o = "topPassedReverse";
  18851. 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;
  18852. },
  18853. bottomPassedReverse: function bottomPassedReverse(e) {
  18854. var t = v.get.elementCalculations(),
  18855. n = e || b.onBottomPassedReverse,
  18856. o = "bottomPassedReverse";
  18857. 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;
  18858. },
  18859. execute: function execute(e, t) {
  18860. var n = v.get.elementCalculations(),
  18861. i = v.get.screenCalculations();
  18862. (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);
  18863. },
  18864. remove: {
  18865. fixed: function fixed() {
  18866. v.debug("Removing fixed position"), A.removeClass(y.fixed).css({
  18867. position: "",
  18868. top: "",
  18869. left: "",
  18870. zIndex: ""
  18871. }), b.onUnfixed.call(F);
  18872. },
  18873. placeholder: function placeholder() {
  18874. v.debug("Removing placeholder content"), r && r.remove();
  18875. },
  18876. occurred: function occurred(e) {
  18877. if (e) {
  18878. var t = v.cache.occurred;
  18879. t[e] !== i && !0 === t[e] && (v.debug("Callback can now be called again", e), v.cache.occurred[e] = !1);
  18880. } else v.cache.occurred = {};
  18881. }
  18882. },
  18883. save: {
  18884. calculations: function calculations() {
  18885. v.verbose("Saving all calculations necessary to determine positioning"), v.save.direction(), v.save.screenCalculations(), v.save.elementCalculations();
  18886. },
  18887. occurred: function occurred(e) {
  18888. e && (v.cache.occurred[e] !== i && !0 === v.cache.occurred[e] || (v.verbose("Saving callback occurred", e), v.cache.occurred[e] = !0));
  18889. },
  18890. scroll: function scroll(e) {
  18891. e = e + b.offset || R.scrollTop() + b.offset, v.cache.scroll = e;
  18892. },
  18893. direction: function direction() {
  18894. var e,
  18895. t = v.get.scroll(),
  18896. n = v.get.lastScroll();
  18897. return e = t > n && n ? "down" : t < n && n ? "up" : "static", v.cache.direction = e, v.cache.direction;
  18898. },
  18899. elementPosition: function elementPosition() {
  18900. var e = v.cache.element,
  18901. t = v.get.screenSize();
  18902. 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;
  18903. },
  18904. elementCalculations: function elementCalculations() {
  18905. var e = v.get.screenCalculations(),
  18906. t = v.get.elementPosition();
  18907. 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;
  18908. },
  18909. screenCalculations: function screenCalculations() {
  18910. var e = v.get.scroll();
  18911. return v.save.direction(), v.cache.screen.top = e, v.cache.screen.bottom = e + v.cache.screen.height, v.cache.screen;
  18912. },
  18913. screenSize: function screenSize() {
  18914. v.verbose("Saving window position"), v.cache.screen = {
  18915. height: R.height()
  18916. };
  18917. },
  18918. position: function position() {
  18919. v.save.screenSize(), v.save.elementPosition();
  18920. }
  18921. },
  18922. get: {
  18923. pixelsPassed: function pixelsPassed(e) {
  18924. var t = v.get.elementCalculations();
  18925. return e.search("%") > -1 ? t.height * (parseInt(e, 10) / 100) : parseInt(e, 10);
  18926. },
  18927. occurred: function occurred(e) {
  18928. return v.cache.occurred !== i && v.cache.occurred[e] || !1;
  18929. },
  18930. direction: function direction() {
  18931. return v.cache.direction === i && v.save.direction(), v.cache.direction;
  18932. },
  18933. elementPosition: function elementPosition() {
  18934. return v.cache.element === i && v.save.elementPosition(), v.cache.element;
  18935. },
  18936. elementCalculations: function elementCalculations() {
  18937. return v.cache.element === i && v.save.elementCalculations(), v.cache.element;
  18938. },
  18939. screenCalculations: function screenCalculations() {
  18940. return v.cache.screen === i && v.save.screenCalculations(), v.cache.screen;
  18941. },
  18942. screenSize: function screenSize() {
  18943. return v.cache.screen === i && v.save.screenSize(), v.cache.screen;
  18944. },
  18945. scroll: function scroll() {
  18946. return v.cache.scroll === i && v.save.scroll(), v.cache.scroll;
  18947. },
  18948. lastScroll: function lastScroll() {
  18949. return v.cache.screen === i ? (v.debug("First scroll event, no last scroll could be found"), !1) : v.cache.screen.top;
  18950. }
  18951. },
  18952. setting: function setting(t, n) {
  18953. if (e.isPlainObject(t)) e.extend(!0, b, t);else {
  18954. if (n === i) return b[t];
  18955. b[t] = n;
  18956. }
  18957. },
  18958. internal: function internal(t, n) {
  18959. if (e.isPlainObject(t)) e.extend(!0, v, t);else {
  18960. if (n === i) return v[t];
  18961. v[t] = n;
  18962. }
  18963. },
  18964. debug: function debug() {
  18965. !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)));
  18966. },
  18967. verbose: function verbose() {
  18968. !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)));
  18969. },
  18970. error: function error() {
  18971. b.silent || (v.error = Function.prototype.bind.call(console.error, console, b.name + ":"), v.error.apply(console, arguments));
  18972. },
  18973. performance: {
  18974. log: function log(e) {
  18975. var t, n;
  18976. b.performance && (n = (t = new Date().getTime()) - (l || t), l = t, c.push({
  18977. Name: e[0],
  18978. Arguments: [].slice.call(e, 1) || "",
  18979. Element: F,
  18980. "Execution Time": n
  18981. })), clearTimeout(v.performance.timer), v.performance.timer = setTimeout(v.performance.display, 500);
  18982. },
  18983. display: function display() {
  18984. var t = b.name + ":",
  18985. n = 0;
  18986. l = !1, clearTimeout(v.performance.timer), e.each(c, function (e, t) {
  18987. n += t["Execution Time"];
  18988. }), 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) {
  18989. console.log(t.Name + ": " + t["Execution Time"] + "ms");
  18990. }), console.groupEnd()), c = [];
  18991. }
  18992. },
  18993. invoke: function invoke(t, n, o) {
  18994. var r,
  18995. s,
  18996. l,
  18997. c = P;
  18998. 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) {
  18999. var a = n != r ? o + t[n + 1].charAt(0).toUpperCase() + t[n + 1].slice(1) : t;
  19000. if (e.isPlainObject(c[a]) && n != r) c = c[a];else {
  19001. if (c[a] !== i) return s = c[a], !1;
  19002. if (!e.isPlainObject(c[o]) || n == r) return c[o] !== i ? (s = c[o], !1) : (v.error(C.method, t), !1);
  19003. c = c[o];
  19004. }
  19005. })), 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;
  19006. }
  19007. }, d ? (P === i && v.initialize(), P.save.scroll(), P.save.calculations(), v.invoke(u)) : (P !== i && P.invoke("destroy"), v.initialize());
  19008. }), a !== i ? a : this;
  19009. }, e.fn.visibility.settings = {
  19010. name: "Visibility",
  19011. namespace: "visibility",
  19012. debug: !1,
  19013. verbose: !1,
  19014. performance: !0,
  19015. observeChanges: !0,
  19016. initialCheck: !0,
  19017. refreshOnLoad: !0,
  19018. refreshOnResize: !0,
  19019. checkOnRefresh: !0,
  19020. once: !0,
  19021. continuous: !1,
  19022. offset: 0,
  19023. includeMargin: !1,
  19024. context: t,
  19025. throttle: !1,
  19026. type: !1,
  19027. zIndex: "10",
  19028. transition: "fade in",
  19029. duration: 1e3,
  19030. onPassed: {},
  19031. onOnScreen: !1,
  19032. onOffScreen: !1,
  19033. onPassing: !1,
  19034. onTopVisible: !1,
  19035. onBottomVisible: !1,
  19036. onTopPassed: !1,
  19037. onBottomPassed: !1,
  19038. onPassingReverse: !1,
  19039. onTopVisibleReverse: !1,
  19040. onBottomVisibleReverse: !1,
  19041. onTopPassedReverse: !1,
  19042. onBottomPassedReverse: !1,
  19043. onLoad: function onLoad() {},
  19044. onAllLoaded: function onAllLoaded() {},
  19045. onFixed: function onFixed() {},
  19046. onUnfixed: function onUnfixed() {},
  19047. onUpdate: !1,
  19048. onRefresh: function onRefresh() {},
  19049. metadata: {
  19050. src: "src"
  19051. },
  19052. className: {
  19053. fixed: "fixed",
  19054. placeholder: "placeholder",
  19055. visible: "visible"
  19056. },
  19057. error: {
  19058. method: "The method you called is not defined.",
  19059. visible: "Element is hidden, you must call refresh after element becomes visible"
  19060. }
  19061. };
  19062. }(jQuery, window, document);
  19063. /***/ }),
  19064. /***/ "./js/services/i18nHelper.js":
  19065. /*!***********************************!*\
  19066. !*** ./js/services/i18nHelper.js ***!
  19067. \***********************************/
  19068. /*! exports provided: i18nHelper */
  19069. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19070. "use strict";
  19071. __webpack_require__.r(__webpack_exports__);
  19072. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i18nHelper", function() { return i18nHelper; });
  19073. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19074. /* harmony import */ var _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./localizedStringsService */ "./js/services/localizedStringsService.js");
  19075. var StringTypes = line_i18n__WEBPACK_IMPORTED_MODULE_0__["default"].StringTypes;
  19076. var i18nHelper = Object.freeze({
  19077. i18n: function i18n(identifier) {
  19078. var opts = identifier.split(':');
  19079. var type = opts[0].toLowerCase();
  19080. var id = opts[1];
  19081. if (StringTypes.ERROR === type) {
  19082. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError(id);
  19083. } else if (StringTypes.MESSAGE === type) {
  19084. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getMessage(id);
  19085. } else if (StringTypes.UI === type) {
  19086. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getUI(id);
  19087. } else {
  19088. console.warn("A string has been passed to the i18n helper function that was not in the form type:id -> " + identifier);
  19089. return _localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getString(identifier, type);
  19090. }
  19091. }
  19092. });
  19093. /***/ }),
  19094. /***/ "./js/services/languageService.js":
  19095. /*!****************************************!*\
  19096. !*** ./js/services/languageService.js ***!
  19097. \****************************************/
  19098. /*! exports provided: LanguageService */
  19099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19100. "use strict";
  19101. __webpack_require__.r(__webpack_exports__);
  19102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  19103. /* harmony import */ var _grammar___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../../grammar/ */ "./grammar/index.js");
  19104. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19105. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../util/config */ "./js/util/config.js");
  19106. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19107. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19108. 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); } }
  19109. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19110. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19111. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19112. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19113. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19114. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19115. var LanguageServiceExtended =
  19116. /*#__PURE__*/
  19117. function (_line_i18n$LanguageSe) {
  19118. _inherits(LanguageServiceExtended, _line_i18n$LanguageSe);
  19119. function LanguageServiceExtended() {
  19120. _classCallCheck(this, LanguageServiceExtended);
  19121. return _possibleConstructorReturn(this, _getPrototypeOf(LanguageServiceExtended).call(this, typeof iLMparameters === 'undefined' ? _util_config__WEBPACK_IMPORTED_MODULE_2__["Config"].default_lang : iLMparameters.lang));
  19122. }
  19123. _createClass(LanguageServiceExtended, [{
  19124. key: "getCurrentLexer",
  19125. value: function getCurrentLexer() {
  19126. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19127. if (langInfo === null || langInfo === undefined) {
  19128. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].lexer;
  19129. } else {
  19130. return langInfo.lexer;
  19131. }
  19132. }
  19133. }, {
  19134. key: "getCurrentLangFuncs",
  19135. value: function getCurrentLangFuncs() {
  19136. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19137. if (langInfo === null || langInfo === undefined) {
  19138. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langFuncs;
  19139. } else {
  19140. return langInfo.langFuncs;
  19141. }
  19142. }
  19143. }, {
  19144. key: "getCurrentLangLibs",
  19145. value: function getCurrentLangLibs() {
  19146. var langInfo = _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getLang()];
  19147. if (langInfo === null || langInfo === undefined) {
  19148. return _grammar___WEBPACK_IMPORTED_MODULE_0__["default"][this.getDefaultLang()].langLibs;
  19149. }
  19150. return langInfo.langLibs;
  19151. }
  19152. }]);
  19153. return LanguageServiceExtended;
  19154. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LanguageServiceNoLS);
  19155. var LanguageService = new LanguageServiceExtended();
  19156. /***/ }),
  19157. /***/ "./js/services/localizedStringsService.js":
  19158. /*!************************************************!*\
  19159. !*** ./js/services/localizedStringsService.js ***!
  19160. \************************************************/
  19161. /*! exports provided: LocalizedStrings, getInstance */
  19162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19163. "use strict";
  19164. __webpack_require__.r(__webpack_exports__);
  19165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  19166. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getInstance", function() { return getInstance; });
  19167. /* harmony import */ var _languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./languageService */ "./js/services/languageService.js");
  19168. /* harmony import */ var line_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! line-i18n */ "./node_modules/line-i18n/dist/index.js");
  19169. /* harmony import */ var _i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./../../i18n */ "./i18n/index.js");
  19170. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19171. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19172. 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); } }
  19173. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19174. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19175. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19176. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19177. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19178. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19179. var IVProgLocalizedStrings =
  19180. /*#__PURE__*/
  19181. function (_line_i18n$LocalizedS) {
  19182. _inherits(IVProgLocalizedStrings, _line_i18n$LocalizedS);
  19183. function IVProgLocalizedStrings(langService, langsJsons) {
  19184. var shouldListenToChange = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  19185. _classCallCheck(this, IVProgLocalizedStrings);
  19186. return _possibleConstructorReturn(this, _getPrototypeOf(IVProgLocalizedStrings).call(this, langService, langsJsons, shouldListenToChange));
  19187. }
  19188. _createClass(IVProgLocalizedStrings, [{
  19189. key: "translateType",
  19190. value: function translateType(type, dim) {
  19191. switch (dim) {
  19192. case 0:
  19193. return this.getUI(type);
  19194. default:
  19195. var transType = this.getUI(type);
  19196. if (dim === 1) return this.getUI("vector_string", [transType]);else return this.getUI("matrix_string", [transType]);
  19197. }
  19198. }
  19199. }, {
  19200. key: "translateOp",
  19201. value: function translateOp(op) {
  19202. switch (op.ord) {
  19203. case Operators.AND.ord:
  19204. case Operators.OR.ord:
  19205. case Operators.NOT.ord:
  19206. return this.getUI(op.value);
  19207. default:
  19208. return op.value;
  19209. }
  19210. }
  19211. }]);
  19212. return IVProgLocalizedStrings;
  19213. }(line_i18n__WEBPACK_IMPORTED_MODULE_1__["default"].LocalizedStrings);
  19214. var LocalizedStrings = Object.freeze(new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"], true));
  19215. var _instance = null;
  19216. function getInstance() {
  19217. if (_instance == null) {
  19218. _instance = new IVProgLocalizedStrings(_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"], _i18n__WEBPACK_IMPORTED_MODULE_2__["default"]);
  19219. }
  19220. return _instance;
  19221. }
  19222. /***/ }),
  19223. /***/ "./js/typeSystem/baseTypes.js":
  19224. /*!************************************!*\
  19225. !*** ./js/typeSystem/baseTypes.js ***!
  19226. \************************************/
  19227. /*! exports provided: BaseTypes */
  19228. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19229. "use strict";
  19230. __webpack_require__.r(__webpack_exports__);
  19231. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BaseTypes", function() { return BaseTypes; });
  19232. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19233. 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); } }
  19234. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19235. var BaseType =
  19236. /*#__PURE__*/
  19237. function () {
  19238. function BaseType(name, ord) {
  19239. _classCallCheck(this, BaseType);
  19240. this.name = name;
  19241. this.ord = ord;
  19242. }
  19243. _createClass(BaseType, [{
  19244. key: "isCompatible",
  19245. value: function isCompatible(another) {
  19246. if (another instanceof BaseType) {
  19247. return this.name === another.name && this.ord === another.ord;
  19248. }
  19249. return false;
  19250. }
  19251. }, {
  19252. key: "value",
  19253. get: function get() {
  19254. return this.name;
  19255. }
  19256. }]);
  19257. return BaseType;
  19258. }(); // Base types names are the same as i18n ui type keys
  19259. var BaseTypes = Object.freeze({
  19260. INTEGER: new BaseType("integer", 0),
  19261. REAL: new BaseType("real", 1),
  19262. STRING: new BaseType("text", 2),
  19263. BOOLEAN: new BaseType("boolean", 3),
  19264. VOID: new BaseType("void", 4),
  19265. UNDEFINED: new BaseType("undefined", 5)
  19266. });
  19267. /***/ }),
  19268. /***/ "./js/typeSystem/compoundType.js":
  19269. /*!***************************************!*\
  19270. !*** ./js/typeSystem/compoundType.js ***!
  19271. \***************************************/
  19272. /*! exports provided: CompoundType */
  19273. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19274. "use strict";
  19275. __webpack_require__.r(__webpack_exports__);
  19276. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompoundType", function() { return CompoundType; });
  19277. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19278. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19279. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19280. 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); } }
  19281. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19282. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19283. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19284. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19285. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19286. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19287. var CompoundType =
  19288. /*#__PURE__*/
  19289. function (_Type) {
  19290. _inherits(CompoundType, _Type);
  19291. function CompoundType(type, dimensions) {
  19292. var _this;
  19293. _classCallCheck(this, CompoundType);
  19294. _this = _possibleConstructorReturn(this, _getPrototypeOf(CompoundType).call(this, null));
  19295. _this.innerType = type;
  19296. _this.dimensions = dimensions;
  19297. return _this;
  19298. }
  19299. _createClass(CompoundType, [{
  19300. key: "isCompatible",
  19301. value: function isCompatible(another) {
  19302. if (another instanceof CompoundType) {
  19303. if (this.dimensions !== another.dimensions) {
  19304. return false;
  19305. }
  19306. return this.innerType.isCompatible(another.innerType);
  19307. }
  19308. return false;
  19309. }
  19310. }, {
  19311. key: "stringInfo",
  19312. value: function stringInfo() {
  19313. var _this2 = this;
  19314. var list = this.innerType.stringInfo();
  19315. list.forEach(function (v) {
  19316. v.dim = _this2.dimensions;
  19317. });
  19318. return list;
  19319. }
  19320. }, {
  19321. key: "canAccept",
  19322. value: function canAccept(another) {
  19323. if (another instanceof CompoundType) {
  19324. return this.dimensions > another.dimensions && this.innerType.isCompatible(another.innerType);
  19325. } else {
  19326. return this.innerType.isCompatible(another);
  19327. }
  19328. }
  19329. }]);
  19330. return CompoundType;
  19331. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19332. /***/ }),
  19333. /***/ "./js/typeSystem/multiType.js":
  19334. /*!************************************!*\
  19335. !*** ./js/typeSystem/multiType.js ***!
  19336. \************************************/
  19337. /*! exports provided: MultiType */
  19338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19339. "use strict";
  19340. __webpack_require__.r(__webpack_exports__);
  19341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MultiType", function() { return MultiType; });
  19342. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19343. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19344. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19345. 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); } }
  19346. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19347. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19348. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19349. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19350. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19351. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19352. var MultiType =
  19353. /*#__PURE__*/
  19354. function (_Type) {
  19355. _inherits(MultiType, _Type);
  19356. function MultiType(types) {
  19357. var _this;
  19358. _classCallCheck(this, MultiType);
  19359. _this = _possibleConstructorReturn(this, _getPrototypeOf(MultiType).call(this, null));
  19360. _this.types = types;
  19361. return _this;
  19362. }
  19363. _createClass(MultiType, [{
  19364. key: "stringInfo",
  19365. value: function stringInfo() {
  19366. var list = [];
  19367. for (var i = 0; i < this.types.length; i++) {
  19368. var t = this.types[i];
  19369. list = list.concat(t.stringInfo());
  19370. }
  19371. return list;
  19372. }
  19373. }, {
  19374. key: "isCompatible",
  19375. value: function isCompatible(another) {
  19376. if (another instanceof _type__WEBPACK_IMPORTED_MODULE_0__["Type"]) {
  19377. for (var i = 0; i < this.types.length; i++) {
  19378. var t = this.types[i];
  19379. if (another.isCompatible(t)) {
  19380. return true;
  19381. }
  19382. }
  19383. }
  19384. return false;
  19385. }
  19386. }, {
  19387. key: "value",
  19388. get: function get() {
  19389. return null;
  19390. }
  19391. }, {
  19392. key: "ord",
  19393. get: function get() {
  19394. return null;
  19395. }
  19396. }]);
  19397. return MultiType;
  19398. }(_type__WEBPACK_IMPORTED_MODULE_0__["Type"]);
  19399. /***/ }),
  19400. /***/ "./js/typeSystem/parsers.js":
  19401. /*!**********************************!*\
  19402. !*** ./js/typeSystem/parsers.js ***!
  19403. \**********************************/
  19404. /*! exports provided: toInt, toString, toReal, toBool, convertBoolToString, convertToString */
  19405. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19406. "use strict";
  19407. __webpack_require__.r(__webpack_exports__);
  19408. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toInt", function() { return toInt; });
  19409. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toString", function() { return toString; });
  19410. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toReal", function() { return toReal; });
  19411. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toBool", function() { return toBool; });
  19412. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertBoolToString", function() { return convertBoolToString; });
  19413. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToString", function() { return convertToString; });
  19414. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19415. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/typeSystem/types.js");
  19416. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! decimal.js */ "./node_modules/decimal.js/decimal.js");
  19417. /* harmony import */ var decimal_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(decimal_js__WEBPACK_IMPORTED_MODULE_2__);
  19418. function toInt(str) {
  19419. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(str);
  19420. }
  19421. function toString(str) {
  19422. var value = str.replace(/^"/, '');
  19423. value = value.replace(/"$/, '');
  19424. value = value.replace(/\\b/g, "\b");
  19425. value = value.replace(/\\t/g, "\t");
  19426. value = value.replace(/\\n/g, "\n");
  19427. value = value.replace(/\\r/g, "\r");
  19428. value = value.replace(/\\\"/g, "\"");
  19429. value = value.replace(/\\\'/g, "\'");
  19430. value = value.replace(/\\\\/g, "\\");
  19431. return value;
  19432. }
  19433. function toReal(value) {
  19434. return new decimal_js__WEBPACK_IMPORTED_MODULE_2___default.a(value);
  19435. }
  19436. function toBool(str) {
  19437. var val = "'" + str + "'";
  19438. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19439. var instance = new lexer(null);
  19440. if (instance.literalNames[lexer.RK_TRUE] === val) {
  19441. return true;
  19442. } else if (instance.literalNames[lexer.RK_FALSE] === val) {
  19443. return false;
  19444. } else {
  19445. // TODO: better error message
  19446. throw new Error(str + "not a valid boolean");
  19447. }
  19448. }
  19449. function convertBoolToString(bool) {
  19450. var lexer = _services_languageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"].getCurrentLexer();
  19451. var instance = new lexer(null);
  19452. if (bool) {
  19453. return instance.literalNames[lexer.RK_TRUE];
  19454. } else {
  19455. return instance.literalNames[lexer.RK_FALSE];
  19456. }
  19457. }
  19458. function convertToString(value, type) {
  19459. switch (type.ord) {
  19460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER.ord:
  19461. return value.toString();
  19462. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL.ord:
  19463. {
  19464. if (value.dp() <= 0) {
  19465. return value.toFixed(1);
  19466. } else {
  19467. return value.toNumber();
  19468. }
  19469. }
  19470. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN.ord:
  19471. return convertBoolToString(value);
  19472. default:
  19473. return value;
  19474. }
  19475. }
  19476. /***/ }),
  19477. /***/ "./js/typeSystem/type.js":
  19478. /*!*******************************!*\
  19479. !*** ./js/typeSystem/type.js ***!
  19480. \*******************************/
  19481. /*! exports provided: Type */
  19482. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19483. "use strict";
  19484. __webpack_require__.r(__webpack_exports__);
  19485. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
  19486. /* harmony import */ var _util_config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/config */ "./js/util/config.js");
  19487. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19488. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19489. 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); } }
  19490. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19491. var Type =
  19492. /*#__PURE__*/
  19493. function () {
  19494. function Type(baseType) {
  19495. _classCallCheck(this, Type);
  19496. this.baseType = baseType;
  19497. }
  19498. _createClass(Type, [{
  19499. key: "stringInfo",
  19500. value: function stringInfo() {
  19501. return [{
  19502. type: this.baseType.name,
  19503. dim: 0
  19504. }];
  19505. }
  19506. }, {
  19507. key: "isCompatible",
  19508. value: function isCompatible(another) {
  19509. if (another instanceof Type) {
  19510. return this.baseType.isCompatible(another.baseType);
  19511. }
  19512. return false;
  19513. }
  19514. }, {
  19515. key: "value",
  19516. get: function get() {
  19517. return this.baseType.value;
  19518. }
  19519. }, {
  19520. key: "ord",
  19521. get: function get() {
  19522. return this.baseType.ord;
  19523. }
  19524. }]);
  19525. return Type;
  19526. }();
  19527. /***/ }),
  19528. /***/ "./js/typeSystem/types.js":
  19529. /*!********************************!*\
  19530. !*** ./js/typeSystem/types.js ***!
  19531. \********************************/
  19532. /*! exports provided: Types */
  19533. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19534. "use strict";
  19535. __webpack_require__.r(__webpack_exports__);
  19536. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  19537. /* harmony import */ var _baseTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./baseTypes */ "./js/typeSystem/baseTypes.js");
  19538. /* harmony import */ var _type__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./type */ "./js/typeSystem/type.js");
  19539. /* harmony import */ var _multiType__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./multiType */ "./js/typeSystem/multiType.js");
  19540. var INTEGER = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].INTEGER);
  19541. var REAL = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].REAL);
  19542. var STRING = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].STRING);
  19543. var BOOLEAN = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].BOOLEAN);
  19544. var VOID = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].VOID);
  19545. var UNDEFINED = new _type__WEBPACK_IMPORTED_MODULE_1__["Type"](_baseTypes__WEBPACK_IMPORTED_MODULE_0__["BaseTypes"].UNDEFINED);
  19546. var ALL = new _multiType__WEBPACK_IMPORTED_MODULE_2__["MultiType"]([INTEGER, REAL, STRING, BOOLEAN]);
  19547. var Types = Object.freeze({
  19548. INTEGER: INTEGER,
  19549. REAL: REAL,
  19550. STRING: STRING,
  19551. BOOLEAN: BOOLEAN,
  19552. VOID: VOID,
  19553. UNDEFINED: UNDEFINED,
  19554. ALL: ALL
  19555. });
  19556. /***/ }),
  19557. /***/ "./js/util/config.js":
  19558. /*!***************************!*\
  19559. !*** ./js/util/config.js ***!
  19560. \***************************/
  19561. /*! exports provided: Config */
  19562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19563. "use strict";
  19564. __webpack_require__.r(__webpack_exports__);
  19565. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Config", function() { return Config; });
  19566. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19567. 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); } }
  19568. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19569. var ConfigObject =
  19570. /*#__PURE__*/
  19571. function () {
  19572. function ConfigObject() {
  19573. _classCallCheck(this, ConfigObject);
  19574. this.loopTimeout = 5000;
  19575. this.decimalPlaces = 8;
  19576. this.intConvertRoundMode = 2;
  19577. this.default_lang = 'pt';
  19578. this.enable_type_casting = true;
  19579. }
  19580. _createClass(ConfigObject, [{
  19581. key: "setConfig",
  19582. value: function setConfig(opts) {
  19583. for (var key in opts) {
  19584. if (this.hasOwnProperty(key)) {
  19585. this[key] = opts[key];
  19586. }
  19587. }
  19588. }
  19589. }]);
  19590. return ConfigObject;
  19591. }();
  19592. var config = new ConfigObject();
  19593. var Config = config;
  19594. /***/ }),
  19595. /***/ "./js/util/inputTest.js":
  19596. /*!******************************!*\
  19597. !*** ./js/util/inputTest.js ***!
  19598. \******************************/
  19599. /*! exports provided: InputTest */
  19600. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19601. "use strict";
  19602. __webpack_require__.r(__webpack_exports__);
  19603. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InputTest", function() { return InputTest; });
  19604. /* harmony import */ var _io_input__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/input */ "./js/io/input.js");
  19605. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19606. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19607. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19608. 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); } }
  19609. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19610. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19611. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19612. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19613. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19614. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19615. var InputTest =
  19616. /*#__PURE__*/
  19617. function (_Input) {
  19618. _inherits(InputTest, _Input);
  19619. function InputTest(inputList) {
  19620. var _this;
  19621. _classCallCheck(this, InputTest);
  19622. _this = _possibleConstructorReturn(this, _getPrototypeOf(InputTest).call(this));
  19623. _this.index = 0;
  19624. _this.inputList = inputList;
  19625. return _this;
  19626. }
  19627. _createClass(InputTest, [{
  19628. key: "requestInput",
  19629. value: function requestInput(callback) {
  19630. if (this.index < this.inputList.length) {
  19631. callback(this.inputList[this.index]);
  19632. this.index++;
  19633. } else {
  19634. throw new Error(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"].getError("exceeded_input_request"));
  19635. }
  19636. }
  19637. }]);
  19638. return InputTest;
  19639. }(_io_input__WEBPACK_IMPORTED_MODULE_0__["Input"]);
  19640. /***/ }),
  19641. /***/ "./js/util/outputTest.js":
  19642. /*!*******************************!*\
  19643. !*** ./js/util/outputTest.js ***!
  19644. \*******************************/
  19645. /*! exports provided: OutputTest */
  19646. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19647. "use strict";
  19648. __webpack_require__.r(__webpack_exports__);
  19649. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutputTest", function() { return OutputTest; });
  19650. /* harmony import */ var _io_output__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./../io/output */ "./js/io/output.js");
  19651. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  19652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  19653. 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); } }
  19654. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  19655. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  19656. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  19657. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  19658. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  19659. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  19660. var OutputTest =
  19661. /*#__PURE__*/
  19662. function (_Output) {
  19663. _inherits(OutputTest, _Output);
  19664. function OutputTest() {
  19665. var _this;
  19666. _classCallCheck(this, OutputTest);
  19667. _this = _possibleConstructorReturn(this, _getPrototypeOf(OutputTest).call(this));
  19668. _this.list = [];
  19669. return _this;
  19670. }
  19671. _createClass(OutputTest, [{
  19672. key: "sendOutput",
  19673. value: function sendOutput(text) {
  19674. this.list.push(text);
  19675. }
  19676. }]);
  19677. return OutputTest;
  19678. }(_io_output__WEBPACK_IMPORTED_MODULE_0__["Output"]);
  19679. /***/ }),
  19680. /***/ "./js/visualUI/algorithm.js":
  19681. /*!**********************************!*\
  19682. !*** ./js/visualUI/algorithm.js ***!
  19683. \**********************************/
  19684. /*! exports provided: renderAlgorithm */
  19685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19686. "use strict";
  19687. __webpack_require__.r(__webpack_exports__);
  19688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderAlgorithm", function() { return renderAlgorithm; });
  19689. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19690. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19691. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19692. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19693. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19694. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19695. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19696. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19697. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  19698. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  19699. /* harmony import */ var _functions__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./functions */ "./js/visualUI/functions.js");
  19700. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  19701. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  19702. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  19703. /* harmony import */ var _services_languageService__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../services/languageService */ "./js/services/languageService.js");
  19704. window.block_render = false;
  19705. function renderAlgorithm() {
  19706. if (window.block_render) {
  19707. return;
  19708. }
  19709. if (window.draging) {
  19710. return;
  19711. }
  19712. window.block_render = true;
  19713. console.log('rendering algorithm');
  19714. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children().off();
  19715. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').empty();
  19716. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').children().off();
  19717. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').empty();
  19718. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19719. _functions__WEBPACK_IMPORTED_MODULE_9__["renderFunction"](window.program_obj.functions[i]);
  19720. }
  19721. for (var i = 0; i < window.program_obj.globals.length; i++) {
  19722. _globals__WEBPACK_IMPORTED_MODULE_4__["renderGlobal"](window.program_obj.globals[i]);
  19723. }
  19724. setTimeout(function () {
  19725. window.block_render = false;
  19726. }, 100);
  19727. console.log('fim do render');
  19728. }
  19729. /***/ }),
  19730. /***/ "./js/visualUI/code_generator.js":
  19731. /*!***************************************!*\
  19732. !*** ./js/visualUI/code_generator.js ***!
  19733. \***************************************/
  19734. /*! exports provided: generate */
  19735. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  19736. "use strict";
  19737. __webpack_require__.r(__webpack_exports__);
  19738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; });
  19739. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  19740. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  19741. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  19742. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  19743. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  19744. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  19745. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  19746. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  19747. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  19748. function generate() {
  19749. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').find('.error_icon').remove();
  19750. var code = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('program') + ' { ';
  19751. code += globalsCode();
  19752. code += '\n';
  19753. var has_error = false;
  19754. for (var i = 0; i < window.program_obj.functions.length; i++) {
  19755. var n_code = functionsCode(window.program_obj.functions[i]);
  19756. if (n_code == null) {
  19757. has_error = true;
  19758. }
  19759. code += n_code;
  19760. code += '\n';
  19761. }
  19762. code += '\n}';
  19763. if (has_error) {
  19764. return null;
  19765. } else {
  19766. return code;
  19767. }
  19768. }
  19769. function functionsCode(function_obj) {
  19770. var ret = '\n\t' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('function') + ' ';
  19771. var has_error = false;
  19772. switch (function_obj.return_type) {
  19773. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  19774. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  19775. break;
  19776. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  19777. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  19778. break;
  19779. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  19780. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  19781. break;
  19782. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  19783. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  19784. break;
  19785. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID:
  19786. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void');
  19787. break;
  19788. }
  19789. ret += ' ';
  19790. if (function_obj.return_dimensions == 1) {
  19791. ret += '[] ';
  19792. } else if (function_obj.return_dimensions == 2) {
  19793. ret += '[][] ';
  19794. }
  19795. ret += function_obj.name + ' ( ';
  19796. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  19797. ret += parametersCode(function_obj.parameters_list[j]);
  19798. if (j + 1 < function_obj.parameters_list.length) {
  19799. ret += ',';
  19800. }
  19801. }
  19802. ret += ' ) {';
  19803. for (var j = 0; j < function_obj.variables_list.length; j++) {
  19804. ret += variablesCode(function_obj.variables_list[j]);
  19805. }
  19806. for (var j = 0; j < function_obj.commands.length; j++) {
  19807. try {
  19808. ret += commandsCode(function_obj.commands[j]);
  19809. } catch (err) {
  19810. has_error = true;
  19811. console.error(err.message);
  19812. var todos = jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').find('.command_container');
  19813. for (var i = 0; i < todos.length; i++) {
  19814. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).data('command') == function_obj.commands[j]) {
  19815. jquery__WEBPACK_IMPORTED_MODULE_0___default()(todos[i]).prepend(' <i class="ui icon red exclamation triangle error_icon"></i> ');
  19816. break;
  19817. }
  19818. }
  19819. }
  19820. }
  19821. ret += '\n\t}';
  19822. if (has_error) {
  19823. return null;
  19824. } else {
  19825. return ret;
  19826. }
  19827. }
  19828. function commandsCode(command_obj) {
  19829. var indentation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
  19830. switch (command_obj.type) {
  19831. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  19832. return breaksCode(command_obj, indentation);
  19833. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  19834. return commentsCode(command_obj, indentation);
  19835. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  19836. return readersCode(command_obj, indentation);
  19837. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  19838. return writersCode(command_obj, indentation);
  19839. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  19840. return functioncallsCode(command_obj, indentation);
  19841. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  19842. return attributionsCode(command_obj, indentation);
  19843. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  19844. return whiletruesCode(command_obj, indentation);
  19845. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  19846. return doWhilesCode(command_obj, indentation);
  19847. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  19848. return iftruesCode(command_obj, indentation);
  19849. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  19850. return repeatNtimesCode(command_obj, indentation);
  19851. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  19852. return switchsCode(command_obj, indentation);
  19853. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  19854. return returnsCode(command_obj, indentation);
  19855. }
  19856. }
  19857. function returnsCode(command_obj, indentation) {
  19858. var ret = '\n';
  19859. for (var i = 0; i < indentation; i++) {
  19860. ret += '\t';
  19861. }
  19862. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return');
  19863. if (command_obj.variable_value_menu) {
  19864. try {
  19865. ret += ' ' + variableValueMenuCode(command_obj.variable_value_menu, true);
  19866. } catch (err) {}
  19867. }
  19868. return ret;
  19869. }
  19870. function breaksCode(command_obj, indentation) {
  19871. var ret = '\n';
  19872. for (var i = 0; i < indentation; i++) {
  19873. ret += '\t';
  19874. }
  19875. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break');
  19876. return ret;
  19877. }
  19878. function switchsCode(command_obj, indentation) {
  19879. var ret = '\n';
  19880. for (var i = 0; i < indentation; i++) {
  19881. ret += '\t';
  19882. }
  19883. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( ';
  19884. ret += variableValueMenuCode(command_obj.variable);
  19885. ret += ' ) { ';
  19886. if (command_obj.cases) {
  19887. for (var i = 0; i < command_obj.cases.length; i++) {
  19888. ret += switchcasesCode(command_obj.cases[i], indentation + 1);
  19889. }
  19890. }
  19891. ret += '\n';
  19892. for (var i = 0; i < indentation; i++) {
  19893. ret += '\t';
  19894. }
  19895. ret += '} ';
  19896. return ret;
  19897. }
  19898. function switchcasesCode(switchcase, indentation) {
  19899. var ret = '\n';
  19900. for (var i = 0; i < indentation; i++) {
  19901. ret += '\t';
  19902. }
  19903. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' ';
  19904. ret += variableValueMenuCode(switchcase.variable_value_menu);
  19905. ret += ' :';
  19906. if (switchcase.commands_block) {
  19907. for (var i = 0; i < switchcase.commands_block.length; i++) {
  19908. ret += commandsCode(switchcase.commands_block[i], indentation + 1);
  19909. }
  19910. }
  19911. return ret;
  19912. }
  19913. function repeatNtimesCode(command_obj, indentation) {
  19914. var ret = '\n';
  19915. for (var i = 0; i < indentation; i++) {
  19916. ret += '\t';
  19917. }
  19918. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( ';
  19919. if (command_obj.var_attribution) {
  19920. ret += variableValueMenuCode(command_obj.var_attribution);
  19921. ret += ' = ';
  19922. ret += variableValueMenuCode(command_obj.expression1);
  19923. }
  19924. ret += ' ; ';
  19925. if (command_obj.expression2) {
  19926. switch (command_obj.expression2.expression.type) {
  19927. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19928. ret += logicExpressionCode(command_obj.expression2.expression);
  19929. break;
  19930. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19931. ret += arithmeticExpressionCode(command_obj.expression2.expression);
  19932. break;
  19933. }
  19934. }
  19935. ret += ' ; ';
  19936. if (command_obj.var_incrementation) {
  19937. ret += variableValueMenuCode(command_obj.var_incrementation);
  19938. ret += ' = ';
  19939. ret += variableValueMenuCode(command_obj.expression3.itens[0]);
  19940. switch (command_obj.expression3.itens[1]) {
  19941. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  19942. ret += ' + ';
  19943. break;
  19944. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  19945. ret += ' - ';
  19946. break;
  19947. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  19948. ret += ' * ';
  19949. break;
  19950. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  19951. ret += ' / ';
  19952. break;
  19953. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  19954. ret += ' % ';
  19955. break;
  19956. }
  19957. ret += variableValueMenuCode(command_obj.expression3.itens[2]);
  19958. }
  19959. ret += ' ) { ';
  19960. if (command_obj.commands_block) {
  19961. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19962. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19963. }
  19964. }
  19965. ret += '\n';
  19966. for (var i = 0; i < indentation; i++) {
  19967. ret += '\t';
  19968. }
  19969. ret += '}';
  19970. return ret;
  19971. }
  19972. function iftruesCode(command_obj, indentation) {
  19973. var ret = '\n';
  19974. for (var i = 0; i < indentation; i++) {
  19975. ret += '\t';
  19976. }
  19977. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if');
  19978. if (!command_obj.expression.expression) {
  19979. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  19980. }
  19981. switch (command_obj.expression.expression.type) {
  19982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  19983. ret += logicExpressionCode(command_obj.expression.expression);
  19984. break;
  19985. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  19986. ret += arithmeticExpressionCode(command_obj.expression.expression);
  19987. break;
  19988. }
  19989. ret += ' { ';
  19990. if (command_obj.commands_block) {
  19991. for (var i = 0; i < command_obj.commands_block.length; i++) {
  19992. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  19993. }
  19994. }
  19995. ret += '\n';
  19996. for (var i = 0; i < indentation; i++) {
  19997. ret += '\t';
  19998. }
  19999. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' {';
  20000. if (command_obj.commands_else) {
  20001. for (var i = 0; i < command_obj.commands_else.length; i++) {
  20002. ret += commandsCode(command_obj.commands_else[i], indentation + 1);
  20003. }
  20004. }
  20005. ret += '\n';
  20006. for (var i = 0; i < indentation; i++) {
  20007. ret += '\t';
  20008. }
  20009. ret += '}';
  20010. return ret;
  20011. }
  20012. function doWhilesCode(command_obj, indentation) {
  20013. var ret = '\n';
  20014. for (var i = 0; i < indentation; i++) {
  20015. ret += '\t';
  20016. }
  20017. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_do') + ' { ';
  20018. if (command_obj.commands_block) {
  20019. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20020. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20021. }
  20022. }
  20023. ret += '\n';
  20024. for (var i = 0; i < indentation; i++) {
  20025. ret += '\t';
  20026. }
  20027. ret += '} ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20028. if (!command_obj.expression.expression) {
  20029. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20030. }
  20031. switch (command_obj.expression.expression.type) {
  20032. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20033. ret += logicExpressionCode(command_obj.expression.expression);
  20034. break;
  20035. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20036. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20037. break;
  20038. }
  20039. return ret;
  20040. }
  20041. function whiletruesCode(command_obj, indentation) {
  20042. var ret = '\n';
  20043. for (var i = 0; i < indentation; i++) {
  20044. ret += '\t';
  20045. }
  20046. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while');
  20047. if (!command_obj.expression.expression) {
  20048. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](command_obj.expression.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_expression'));
  20049. }
  20050. switch (command_obj.expression.expression.type) {
  20051. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  20052. ret += logicExpressionCode(command_obj.expression.expression);
  20053. break;
  20054. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  20055. ret += arithmeticExpressionCode(command_obj.expression.expression);
  20056. break;
  20057. }
  20058. ret += ' { ';
  20059. if (command_obj.commands_block) {
  20060. for (var i = 0; i < command_obj.commands_block.length; i++) {
  20061. ret += commandsCode(command_obj.commands_block[i], indentation + 1);
  20062. }
  20063. }
  20064. ret += '\n';
  20065. for (var i = 0; i < indentation; i++) {
  20066. ret += '\t';
  20067. }
  20068. ret += '}';
  20069. return ret;
  20070. }
  20071. function logicExpressionCode(expression) {
  20072. var ret = ' ( ';
  20073. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20074. ret += logicExpressionCode(expression.first_operand);
  20075. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20076. ret += arithmeticExpressionCode(expression.first_operand);
  20077. } else {
  20078. ret += variableValueMenuCode(expression.first_operand);
  20079. }
  20080. if (expression.operator) {
  20081. switch (expression.operator) {
  20082. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to:
  20083. ret += ' == ';
  20084. break;
  20085. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to:
  20086. ret += ' != ';
  20087. break;
  20088. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and:
  20089. ret += ' && ';
  20090. break;
  20091. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or:
  20092. ret += ' || ';
  20093. break;
  20094. }
  20095. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20096. ret += logicExpressionCode(expression.second_operand);
  20097. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20098. ret += arithmeticExpressionCode(expression.second_operand);
  20099. } else {
  20100. ret += variableValueMenuCode(expression.second_operand);
  20101. }
  20102. }
  20103. ret += ' ) ';
  20104. return ret;
  20105. }
  20106. function arithmeticExpressionCode(expression) {
  20107. var ret = ' ( ';
  20108. if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20109. ret += logicExpressionCode(expression.first_operand);
  20110. } else if (expression.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20111. ret += arithmeticExpressionCode(expression.first_operand);
  20112. } else {
  20113. ret += variableValueMenuCode(expression.first_operand);
  20114. }
  20115. switch (expression.operator) {
  20116. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than:
  20117. ret += ' > ';
  20118. break;
  20119. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than:
  20120. ret += ' < ';
  20121. break;
  20122. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to:
  20123. ret += ' == ';
  20124. break;
  20125. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to:
  20126. ret += ' != ';
  20127. break;
  20128. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to:
  20129. ret += ' >= ';
  20130. break;
  20131. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to:
  20132. ret += ' <= ';
  20133. break;
  20134. }
  20135. if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  20136. ret += logicExpressionCode(expression.second_operand);
  20137. } else if (expression.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  20138. ret += arithmeticExpressionCode(expression.second_operand);
  20139. } else {
  20140. ret += variableValueMenuCode(expression.second_operand);
  20141. }
  20142. ret += ' ) ';
  20143. return ret;
  20144. }
  20145. function attributionsCode(command_obj, indentation) {
  20146. var ret = '\n';
  20147. for (var i = 0; i < indentation; i++) {
  20148. ret += '\t';
  20149. }
  20150. ret += variableValueMenuCode(command_obj.variable) + ' = ';
  20151. for (var i = 0; i < command_obj.expression.length; i++) {
  20152. ret += elementExpressionCode(command_obj.expression[i]);
  20153. }
  20154. return ret;
  20155. }
  20156. function elementExpressionCode(expression_obj) {
  20157. var ret = '';
  20158. for (var i = 0; i < expression_obj.itens.length; i++) {
  20159. if (expression_obj.itens[i].type) {
  20160. ret += variableValueMenuCode(expression_obj.itens[i]);
  20161. } else if (expression_obj.itens[i].type_exp) {
  20162. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20163. ret += ' ( ';
  20164. }
  20165. ret += elementExpressionCode(expression_obj.itens[i]);
  20166. if (expression_obj.itens[i].type_exp == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par) {
  20167. ret += ' ) ';
  20168. }
  20169. } else {
  20170. switch (expression_obj.itens[i]) {
  20171. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  20172. ret += ' + ';
  20173. break;
  20174. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  20175. ret += ' - ';
  20176. break;
  20177. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  20178. ret += ' * ';
  20179. break;
  20180. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  20181. ret += ' / ';
  20182. break;
  20183. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  20184. ret += ' % ';
  20185. break;
  20186. }
  20187. }
  20188. }
  20189. return ret;
  20190. }
  20191. function functioncallsCode(command_obj, indentation) {
  20192. var ret = '\n';
  20193. for (var i = 0; i < indentation; i++) {
  20194. ret += '\t';
  20195. }
  20196. ret += variableValueMenuCode(command_obj.function_called);
  20197. return ret;
  20198. }
  20199. function readersCode(command_obj, indentation) {
  20200. var ret = '\n';
  20201. for (var i = 0; i < indentation; i++) {
  20202. ret += '\t';
  20203. }
  20204. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( ';
  20205. ret += variableValueMenuCode(command_obj.variable_value_menu);
  20206. ret += ' ) ';
  20207. return ret;
  20208. }
  20209. function variableValueMenuCode(variable_obj) {
  20210. var is_return = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  20211. var ret = '';
  20212. try {
  20213. if (variable_obj.function_called) {
  20214. if (variable_obj.function_called.name) {
  20215. ret += variable_obj.function_called.name + ' ( ';
  20216. } else {
  20217. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + ' ( ';
  20218. }
  20219. if (variable_obj.parameters_list) {
  20220. for (var i = 0; i < variable_obj.parameters_list.length; i++) {
  20221. ret += variableValueMenuCode(variable_obj.parameters_list[i]);
  20222. if (i + 1 < variable_obj.parameters_list.length) {
  20223. ret += ', ';
  20224. }
  20225. }
  20226. }
  20227. ret += ' )';
  20228. } else if (variable_obj.content.type) {
  20229. ret += variable_obj.content.name;
  20230. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  20231. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20232. }
  20233. if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  20234. ret += ' [ ' + variableValueMenuCode(variable_obj.row) + ' ] ';
  20235. ret += ' [ ' + variableValueMenuCode(variable_obj.column) + ' ] ';
  20236. }
  20237. } else {
  20238. if (isNaN(variable_obj.content)) {
  20239. ret += '"' + variable_obj.content + '"';
  20240. } else {
  20241. ret += variable_obj.content;
  20242. }
  20243. }
  20244. } catch (err) {
  20245. if (!is_return) {
  20246. _utils__WEBPACK_IMPORTED_MODULE_7__["renderErrorMessage"](variable_obj.dom_object, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_content'));
  20247. throw err;
  20248. }
  20249. }
  20250. return ret;
  20251. }
  20252. function writersCode(command_obj, indentation) {
  20253. var ret = '\n';
  20254. for (var i = 0; i < indentation; i++) {
  20255. ret += '\t';
  20256. }
  20257. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( ';
  20258. for (var i = 0; i < command_obj.content.length; i++) {
  20259. ret += variableValueMenuCode(command_obj.content[i]);
  20260. if (i + 1 < command_obj.content.length) {
  20261. ret += ' + ';
  20262. }
  20263. }
  20264. ret += ' ) ';
  20265. return ret;
  20266. }
  20267. function commentsCode(command_obj, indentation) {
  20268. var ret = '\n';
  20269. for (var i = 0; i < indentation; i++) {
  20270. ret += '\t';
  20271. }
  20272. ret += '// ';
  20273. ret += command_obj.comment_text.content;
  20274. return ret;
  20275. }
  20276. function parametersCode(parameter_obj) {
  20277. var ret = '';
  20278. switch (parameter_obj.type) {
  20279. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20280. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20281. break;
  20282. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20283. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20284. break;
  20285. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20286. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20287. break;
  20288. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20289. ret += ' ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20290. break;
  20291. }
  20292. ret += parameter_obj.name + '';
  20293. if (parameter_obj.dimensions == 1) {
  20294. ret += ' []';
  20295. } else if (parameter_obj.dimensions == 2) {
  20296. ret += ' [][]';
  20297. }
  20298. return ret;
  20299. }
  20300. function variablesCode(variable_obj) {
  20301. var ret = '';
  20302. var temp = variable_obj;
  20303. ret += '\n\t\t';
  20304. if (temp.is_constant) {
  20305. ret += 'const ';
  20306. }
  20307. switch (temp.type) {
  20308. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20309. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer') + ' ';
  20310. break;
  20311. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20312. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real') + ' ';
  20313. break;
  20314. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20315. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text') + ' ';
  20316. break;
  20317. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20318. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean') + ' ';
  20319. break;
  20320. }
  20321. ret += temp.name + ' ';
  20322. if (temp.dimensions == 1) {
  20323. ret += '[' + temp.columns + '] ';
  20324. switch (temp.type) {
  20325. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20326. ret += '= {' + temp.value + '}';
  20327. break;
  20328. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20329. ret += '= {' + temp.value.toFixed(2) + '}';
  20330. break;
  20331. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20332. ret += '= {';
  20333. for (var j = 0; j < temp.value.length; j++) {
  20334. ret += '"' + temp.value[j] + '"';
  20335. if (j + 1 < temp.value.length) {
  20336. ret += ',';
  20337. }
  20338. }
  20339. ret += '}';
  20340. break;
  20341. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20342. ret += '= {';
  20343. for (var j = 0; j < temp.value.length; j++) {
  20344. if (temp.value[j]) {
  20345. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20346. } else {
  20347. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20348. }
  20349. if (j + 1 < temp.value.length) {
  20350. ret += ',';
  20351. }
  20352. }
  20353. ret += '}';
  20354. break;
  20355. }
  20356. } else if (temp.dimensions == 2) {
  20357. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20358. switch (temp.type) {
  20359. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20360. ret += '= {';
  20361. for (var j = 0; j < temp.rows; j++) {
  20362. ret += '{' + temp.value[j] + '}';
  20363. if (j + 1 < temp.rows) {
  20364. ret += ',';
  20365. }
  20366. }
  20367. ret += '}';
  20368. break;
  20369. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20370. ret += '= {';
  20371. for (var j = 0; j < temp.rows; j++) {
  20372. ret += '{' + temp.value[j].toFixed(2) + '}';
  20373. if (j + 1 < temp.rows) {
  20374. ret += ',';
  20375. }
  20376. }
  20377. ret += '}';
  20378. break;
  20379. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20380. ret += '= {';
  20381. for (var j = 0; j < temp.rows; j++) {
  20382. ret += '{';
  20383. for (var k = 0; k < temp.columns; k++) {
  20384. ret += '"' + temp.value[j][k] + '"';
  20385. if (k + 1 < temp.columns) {
  20386. ret += ',';
  20387. }
  20388. }
  20389. ret += '}';
  20390. if (j + 1 < temp.rows) {
  20391. ret += ',';
  20392. }
  20393. }
  20394. ret += '}';
  20395. break;
  20396. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20397. ret += '= {';
  20398. for (var j = 0; j < temp.rows; j++) {
  20399. ret += '{';
  20400. for (var k = 0; k < temp.columns; k++) {
  20401. if (temp.value[j][k]) {
  20402. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20403. } else {
  20404. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20405. }
  20406. if (k + 1 < temp.columns) {
  20407. ret += ',';
  20408. }
  20409. }
  20410. ret += '}';
  20411. if (j + 1 < temp.rows) {
  20412. ret += ',';
  20413. }
  20414. }
  20415. ret += '}';
  20416. break;
  20417. }
  20418. } else {
  20419. switch (temp.type) {
  20420. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20421. ret += '= ' + temp.value;
  20422. break;
  20423. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20424. ret += '= ' + temp.value.toFixed(2);
  20425. break;
  20426. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20427. ret += '= "' + temp.value + '"';
  20428. break;
  20429. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20430. ret += '= ';
  20431. if (temp.value) {
  20432. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20433. } else {
  20434. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20435. }
  20436. break;
  20437. }
  20438. }
  20439. return ret;
  20440. }
  20441. function globalsCode() {
  20442. var ret = '';
  20443. if (window.program_obj.globals) {
  20444. for (var i = 0; i < window.program_obj.globals.length; i++) {
  20445. var temp = window.program_obj.globals[i];
  20446. ret += '\n\t';
  20447. if (temp.is_constant) {
  20448. ret += 'const ';
  20449. }
  20450. switch (temp.type) {
  20451. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20452. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('integer');
  20453. break;
  20454. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20455. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('real');
  20456. break;
  20457. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20458. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text');
  20459. break;
  20460. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20461. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('boolean');
  20462. break;
  20463. }
  20464. ret += ' ' + temp.name + ' ';
  20465. if (temp.dimensions == 1) {
  20466. ret += '[' + temp.columns + '] ';
  20467. switch (temp.type) {
  20468. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20469. ret += '= {' + temp.value + '}';
  20470. break;
  20471. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20472. ret += '= {';
  20473. for (var j = 0; j < temp.value.length; j++) {
  20474. ret += temp.value[j].toFixed(2);
  20475. if (j + 1 < temp.value.length) {
  20476. ret += ',';
  20477. }
  20478. }
  20479. ret += '}';
  20480. break;
  20481. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20482. ret += '= {';
  20483. for (var j = 0; j < temp.value.length; j++) {
  20484. ret += '"' + temp.value[j] + '"';
  20485. if (j + 1 < temp.value.length) {
  20486. ret += ',';
  20487. }
  20488. }
  20489. ret += '}';
  20490. break;
  20491. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20492. ret += '= {';
  20493. for (var j = 0; j < temp.value.length; j++) {
  20494. if (temp.value[j]) {
  20495. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20496. } else {
  20497. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20498. }
  20499. if (j + 1 < temp.value.length) {
  20500. ret += ',';
  20501. }
  20502. }
  20503. ret += '}';
  20504. break;
  20505. }
  20506. } else if (temp.dimensions == 2) {
  20507. ret += '[' + temp.rows + '][' + temp.columns + '] ';
  20508. switch (temp.type) {
  20509. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20510. ret += '= {';
  20511. for (var j = 0; j < temp.rows; j++) {
  20512. ret += '{' + temp.value[j] + '}';
  20513. if (j + 1 < temp.rows) {
  20514. ret += ',';
  20515. }
  20516. }
  20517. ret += '}';
  20518. break;
  20519. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20520. ret += '= {';
  20521. for (var j = 0; j < temp.rows; j++) {
  20522. ret += '{';
  20523. for (var k = 0; k < temp.columns; k++) {
  20524. ret += temp.value[j][k].toFixed(2);
  20525. if (k + 1 < temp.columns) {
  20526. ret += ',';
  20527. }
  20528. }
  20529. ret += '}';
  20530. if (j + 1 < temp.rows) {
  20531. ret += ',';
  20532. }
  20533. }
  20534. ret += '}';
  20535. break;
  20536. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20537. ret += '= {';
  20538. for (var j = 0; j < temp.rows; j++) {
  20539. ret += '{';
  20540. for (var k = 0; k < temp.columns; k++) {
  20541. ret += '"' + temp.value[j][k] + '"';
  20542. if (k + 1 < temp.columns) {
  20543. ret += ',';
  20544. }
  20545. }
  20546. ret += '}';
  20547. if (j + 1 < temp.rows) {
  20548. ret += ',';
  20549. }
  20550. }
  20551. ret += '}';
  20552. break;
  20553. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20554. ret += '= {';
  20555. for (var j = 0; j < temp.rows; j++) {
  20556. ret += '{';
  20557. for (var k = 0; k < temp.columns; k++) {
  20558. if (temp.value[j][k]) {
  20559. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20560. } else {
  20561. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20562. }
  20563. if (k + 1 < temp.columns) {
  20564. ret += ',';
  20565. }
  20566. }
  20567. ret += '}';
  20568. if (j + 1 < temp.rows) {
  20569. ret += ',';
  20570. }
  20571. }
  20572. ret += '}';
  20573. break;
  20574. }
  20575. } else {
  20576. switch (temp.type) {
  20577. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER:
  20578. ret += '= ' + temp.value;
  20579. break;
  20580. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL:
  20581. ret += '= ' + temp.value.toFixed(2);
  20582. break;
  20583. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT:
  20584. ret += '= "' + temp.value + '"';
  20585. break;
  20586. case _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN:
  20587. ret += '= ';
  20588. if (temp.value) {
  20589. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("true");
  20590. ;
  20591. } else {
  20592. ret += _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("false");
  20593. ;
  20594. }
  20595. break;
  20596. }
  20597. }
  20598. }
  20599. }
  20600. return ret;
  20601. }
  20602. /***/ }),
  20603. /***/ "./js/visualUI/commands.js":
  20604. /*!*********************************!*\
  20605. !*** ./js/visualUI/commands.js ***!
  20606. \*********************************/
  20607. /*! exports provided: removeCommand, createFloatingCommand, renderCommand, genericCreateCommand */
  20608. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  20609. "use strict";
  20610. __webpack_require__.r(__webpack_exports__);
  20611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeCommand", function() { return removeCommand; });
  20612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  20613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  20614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "genericCreateCommand", function() { return genericCreateCommand; });
  20615. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  20616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  20617. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  20618. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  20619. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  20620. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  20621. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  20622. /* harmony import */ var _commands_comment__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands/comment */ "./js/visualUI/commands/comment.js");
  20623. /* harmony import */ var _commands_reader__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./commands/reader */ "./js/visualUI/commands/reader.js");
  20624. /* harmony import */ var _commands_writer__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/writer */ "./js/visualUI/commands/writer.js");
  20625. /* harmony import */ var _commands_attribution__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./commands/attribution */ "./js/visualUI/commands/attribution.js");
  20626. /* harmony import */ var _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./commands/iftrue */ "./js/visualUI/commands/iftrue.js");
  20627. /* harmony import */ var _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./commands/repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  20628. /* harmony import */ var _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./commands/whiletrue */ "./js/visualUI/commands/whiletrue.js");
  20629. /* harmony import */ var _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./commands/dowhiletrue */ "./js/visualUI/commands/dowhiletrue.js");
  20630. /* harmony import */ var _commands_switch__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./commands/switch */ "./js/visualUI/commands/switch.js");
  20631. /* harmony import */ var _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./commands/functioncall */ "./js/visualUI/commands/functioncall.js");
  20632. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  20633. /* harmony import */ var _commands_break__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./commands/break */ "./js/visualUI/commands/break.js");
  20634. /* harmony import */ var _commands_return__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./commands/return */ "./js/visualUI/commands/return.js");
  20635. var has_element_created_draged = false;
  20636. var which_element_is_draged = null;
  20637. function removeCommand(command, function_obj, dom_obj) {
  20638. if (function_obj.commands.indexOf(command) > -1) {
  20639. function_obj.commands.splice(function_obj.commands.indexOf(command), 1);
  20640. return true;
  20641. } // Utilize dois parantNode, pois o primeiro é o div de comandos
  20642. try {
  20643. if (dom_obj.parent().parent().data('command').commands_block.indexOf(command) > -1) {
  20644. dom_obj.parent().parent().data('command').commands_block.splice(dom_obj.parent().parent().data('command').commands_block.indexOf(command), 1);
  20645. return true;
  20646. }
  20647. } catch (err) {}
  20648. try {
  20649. if (dom_obj.parent().parent().data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  20650. if (dom_obj.parent().parent().data('command').commands_else.indexOf(command) > -1) {
  20651. dom_obj.parent().parent().data('command').commands_else.splice(dom_obj.parent().parent().data('command').commands_else.indexOf(command), 1);
  20652. return true;
  20653. }
  20654. }
  20655. } catch (err) {}
  20656. if (dom_obj.parent().data('switchcase')) {
  20657. console.log("o que encontrei: ");
  20658. console.log(dom_obj.parent().data('switchcase'));
  20659. dom_obj.parent().data('switchcase').commands_block.splice(dom_obj.parent().data('switchcase').commands_block.indexOf(command), 1);
  20660. return true;
  20661. }
  20662. return false;
  20663. }
  20664. window.function_container_active = null;
  20665. function createFloatingCommand(function_obj, function_container, command_type, mouse_event) {
  20666. var floatingObject;
  20667. switch (command_type) {
  20668. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20669. floatingObject = _commands_break__WEBPACK_IMPORTED_MODULE_17__["createFloatingCommand"]();
  20670. break;
  20671. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20672. floatingObject = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"]();
  20673. break;
  20674. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20675. floatingObject = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["createFloatingCommand"]();
  20676. break;
  20677. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20678. floatingObject = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["createFloatingCommand"]();
  20679. break;
  20680. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20681. floatingObject = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["createFloatingCommand"]();
  20682. break;
  20683. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20684. floatingObject = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["createFloatingCommand"]();
  20685. break;
  20686. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20687. floatingObject = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["createFloatingCommand"]();
  20688. break;
  20689. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20690. floatingObject = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["createFloatingCommand"]();
  20691. break;
  20692. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20693. floatingObject = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["createFloatingCommand"]();
  20694. break;
  20695. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20696. floatingObject = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["createFloatingCommand"]();
  20697. break;
  20698. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20699. floatingObject = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["createFloatingCommand"]();
  20700. break;
  20701. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20702. floatingObject = _commands_return__WEBPACK_IMPORTED_MODULE_18__["createFloatingCommand"]();
  20703. break;
  20704. }
  20705. floatingObject.draggable().appendTo("body");
  20706. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').mouseup(function (evt) {
  20707. manageCommand(function_obj, function_container, evt, command_type);
  20708. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  20709. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseover');
  20710. });
  20711. if (!function_container.hasClass('function_div') || function_container.length < 1) {
  20712. window.mouse_event = mouse_event;
  20713. function_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mouse_event.originalEvent.srcElement.closest('.function_div'));
  20714. }
  20715. console.log('function_container', function_container);
  20716. function_container_active = function_container;
  20717. function_container.find('.commands_list_div').on('mousemove', function (evt) {
  20718. addGhostDiv(evt);
  20719. });
  20720. function_container.find('.commands_list_div').find("*").on('mousemove', function (evt) {
  20721. addGhostDiv(evt);
  20722. });
  20723. function_container.on('mouseout', function (event) {
  20724. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  20725. if (el.closest('.commands_list_div').length < 1) {
  20726. window.ghostDiv.remove();
  20727. }
  20728. });
  20729. floatingObject.css("position", "absolute");
  20730. mouse_event.type = "mousedown.draggable";
  20731. mouse_event.target = floatingObject[0];
  20732. floatingObject.css("left", mouse_event.pageX - window.divx);
  20733. floatingObject.css("top", mouse_event.pageY);
  20734. floatingObject.trigger(mouse_event);
  20735. }
  20736. window.divx = 100;
  20737. window.ghostDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ghost_div">');
  20738. window.active_container = null;
  20739. function addGhostToEmptyBlock(element, evt) {
  20740. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20741. var container = element.closest('.command_container');
  20742. if (container.hasClass('switch')) {
  20743. container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.case_div');
  20744. }
  20745. if (!container.hasClass('dowhiletrue') && !container.hasClass('iftrue') && !container.hasClass('repeatNtimes') && !container.hasClass('case_div') && !container.hasClass('whiletrue')) {
  20746. addGhostToNotEmptyBlock(element, evt);
  20747. return;
  20748. }
  20749. if (window.active_container != null) {
  20750. if (window.active_container.is(container)) {
  20751. console.log('é o mesmo, não mudou!');
  20752. } else {
  20753. if (container.length < 1) {
  20754. container = element.closest('.commands_list_div');
  20755. if (window.active_container.is(container)) {
  20756. console.log('é o mesmo command list');
  20757. } else {
  20758. console.log('mudou para um command list');
  20759. window.active_container = container;
  20760. }
  20761. } else {
  20762. console.log('mudou para um outro container?');
  20763. }
  20764. }
  20765. }
  20766. window.active_container = container;
  20767. if (container.hasClass('iftrue')) {
  20768. var containerIf = container.find('.commands_if').get(0);
  20769. var containerElse = container.find('.commands_else').get(0);
  20770. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20771. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20772. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20773. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20774. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20775. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).append(window.ghostDiv);
  20776. } else {
  20777. jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).append(window.ghostDiv);
  20778. }
  20779. } else if (container.hasClass('case_div')) {
  20780. container.find('.case_commands_block').append(window.ghostDiv);
  20781. } else {
  20782. container.find('.block_commands').append(window.ghostDiv);
  20783. }
  20784. }
  20785. function addGhostToNotEmptyBlock(element, evt) {
  20786. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20787. var container = element.closest('.dowhiletrue, .iftrue, .repeatNtimes, .case_div, .whiletrue'); //console.log("\n\nNOT EMPTY: ", container);
  20788. //if (window.active_container != null) {
  20789. //}
  20790. if (container.length < 1) {
  20791. container = element.closest('.commands_list_div');
  20792. window.active_container = container;
  20793. addGhostToFunctionArea(element, evt);
  20794. } else {//console.log('mudou para um outro container?');
  20795. }
  20796. window.active_container = container; // quem está mais próximo? // Essa regra se aplica somente quando o over está sobre um comando
  20797. var allfilhos;
  20798. console.log('olha o container: ', container);
  20799. if (container.hasClass('iftrue')) {
  20800. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_if').length > 0) {
  20801. allfilhos = container.find('.commands_if').children('.command_container');
  20802. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.data_block_else').length > 0) {
  20803. allfilhos = container.find('.commands_else').children('.command_container');
  20804. } else {
  20805. var containerIf = container.find('.commands_if').get(0);
  20806. var containerElse = container.find('.commands_else').get(0);
  20807. var topIfDistance = Math.abs(evt.clientY - containerIf.getBoundingClientRect().top);
  20808. var bottomIfDistance = Math.abs(containerIf.getBoundingClientRect().top + containerIf.getBoundingClientRect().height - evt.clientY);
  20809. var topElseDistance = Math.abs(evt.clientY - containerElse.getBoundingClientRect().top);
  20810. var bottomElseDistance = Math.abs(containerElse.getBoundingClientRect().top + containerElse.getBoundingClientRect().height - evt.clientY);
  20811. if (topIfDistance < topElseDistance && topIfDistance < bottomElseDistance) {
  20812. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerIf).children('.command_container');
  20813. } else {
  20814. allfilhos = jquery__WEBPACK_IMPORTED_MODULE_0___default()(containerElse).children('.command_container');
  20815. }
  20816. }
  20817. } else if (container.hasClass('case_div')) {
  20818. allfilhos = container.children('.case_commands_block').children('.command_container');
  20819. } else if (container.hasClass('commands_list_div')) {
  20820. allfilhos = container.children('.command_container');
  20821. } else {
  20822. allfilhos = container.children('.block_commands').children('.command_container');
  20823. }
  20824. var topDistances = [];
  20825. var bottomDistances = [];
  20826. for (var i = 0; i < allfilhos.length; i++) {
  20827. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20828. topDistances.push(topD);
  20829. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20830. bottomDistances.push(botD);
  20831. }
  20832. console.log('topDistances\n', topDistances, '\nbottomDistances\n', bottomDistances);
  20833. var menorTop = Math.min.apply(null, topDistances);
  20834. var indiceTop = topDistances.indexOf(menorTop);
  20835. var menorBot = Math.min.apply(null, bottomDistances);
  20836. var indiceBot = bottomDistances.indexOf(menorBot);
  20837. if (menorTop < menorBot) {
  20838. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20839. } else {
  20840. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20841. }
  20842. console.log('distancias: menorTop ', menorTop, ' menorBot ', menorBot);
  20843. }
  20844. function addGhostToFunctionArea(undermouse, evt) {
  20845. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  20846. var allfilhos = undermouse.closest('.commands_list_div').children('.command_container');
  20847. var topDistances = [];
  20848. var bottomDistances = [];
  20849. for (var i = 0; i < allfilhos.length; i++) {
  20850. var topD = Math.abs(evt.clientY - allfilhos.get(i).getBoundingClientRect().top);
  20851. topDistances.push(topD);
  20852. var botD = Math.abs(allfilhos.get(i).getBoundingClientRect().top + allfilhos.get(i).getBoundingClientRect().height - evt.clientY);
  20853. bottomDistances.push(botD);
  20854. }
  20855. var menorTop = Math.min.apply(null, topDistances);
  20856. var indiceTop = topDistances.indexOf(menorTop);
  20857. var menorBot = Math.min.apply(null, bottomDistances);
  20858. var indiceBot = bottomDistances.indexOf(menorBot);
  20859. if (menorTop < menorBot) {
  20860. window.ghostDiv.insertBefore(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceTop)));
  20861. } else {
  20862. window.ghostDiv.insertAfter(jquery__WEBPACK_IMPORTED_MODULE_0___default()(allfilhos.get(indiceBot)));
  20863. }
  20864. }
  20865. function addGhostDiv(evt) {
  20866. console.log('a');
  20867. var undermouse = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  20868. console.log('undermouse', undermouse);
  20869. if (undermouse.hasClass('ghost_div')) {
  20870. return;
  20871. } else if (undermouse.hasClass('commands_list_div')) {
  20872. addGhostToFunctionArea(undermouse, evt);
  20873. return;
  20874. } else if (undermouse.hasClass('block_commands')) {
  20875. if (undermouse.find('.command_container').length > 0) {
  20876. addGhostToNotEmptyBlock(undermouse, evt);
  20877. } else {
  20878. addGhostToEmptyBlock(undermouse, evt);
  20879. }
  20880. } else if (undermouse.hasClass('case_div')) {
  20881. if (undermouse.find('.case_commands_block').find('.command_container').length > 0) {
  20882. addGhostToNotEmptyBlock(undermouse, evt);
  20883. } else {
  20884. addGhostToEmptyBlock(undermouse, evt);
  20885. }
  20886. } else {
  20887. addGhostToNotEmptyBlock(undermouse, evt);
  20888. }
  20889. }
  20890. function borderMouseDragCommand(function_obj, function_container, evt) {
  20891. function_container.find('.over_command_drag').each(function (index) {
  20892. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass('over_command_drag');
  20893. });
  20894. var prev = null;
  20895. function_container.find('.commands_list_div').each(function (index) {
  20896. prev = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20897. if (prev) {
  20898. var objLeft = prev.offset().left;
  20899. var objTop = prev.offset().top;
  20900. var objRight = objLeft + prev.width();
  20901. var objBottom = objTop + prev.height();
  20902. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20903. prev.addClass("over_command_drag");
  20904. }
  20905. }
  20906. });
  20907. function_container.find('.command_container').each(function (index) {
  20908. var obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  20909. var objLeft = obj.offset().left;
  20910. var objTop = obj.offset().top;
  20911. var objRight = objLeft + obj.width();
  20912. var objBottom = objTop + obj.height();
  20913. if (evt.pageX > objLeft && evt.pageX < objRight && evt.pageY > objTop && evt.pageY < objBottom) {
  20914. if (prev) {
  20915. prev.removeClass('over_command_drag');
  20916. }
  20917. obj.addClass("over_command_drag");
  20918. return;
  20919. }
  20920. });
  20921. } // before_after_inside: 1 -> before, 2 -> after, 3 -> inside
  20922. function renderCommand(command, element_reference, before_after_inside, function_obj) {
  20923. var createdElement;
  20924. switch (command.type) {
  20925. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20926. createdElement = _commands_comment__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command, function_obj);
  20927. break;
  20928. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20929. createdElement = _commands_break__WEBPACK_IMPORTED_MODULE_17__["renderCommand"](command, function_obj);
  20930. break;
  20931. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20932. createdElement = _commands_reader__WEBPACK_IMPORTED_MODULE_7__["renderCommand"](command, function_obj);
  20933. break;
  20934. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20935. createdElement = _commands_writer__WEBPACK_IMPORTED_MODULE_8__["renderCommand"](command, function_obj);
  20936. break;
  20937. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20938. createdElement = _commands_attribution__WEBPACK_IMPORTED_MODULE_9__["renderCommand"](command, function_obj);
  20939. break;
  20940. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20941. createdElement = _commands_functioncall__WEBPACK_IMPORTED_MODULE_15__["renderCommand"](command, function_obj);
  20942. break;
  20943. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20944. createdElement = _commands_iftrue__WEBPACK_IMPORTED_MODULE_10__["renderCommand"](command, function_obj);
  20945. break;
  20946. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20947. createdElement = _commands_repeatNtimes__WEBPACK_IMPORTED_MODULE_11__["renderCommand"](command, function_obj);
  20948. break;
  20949. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20950. createdElement = _commands_whiletrue__WEBPACK_IMPORTED_MODULE_12__["renderCommand"](command, function_obj);
  20951. break;
  20952. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20953. createdElement = _commands_dowhiletrue__WEBPACK_IMPORTED_MODULE_13__["renderCommand"](command, function_obj);
  20954. break;
  20955. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20956. createdElement = _commands_switch__WEBPACK_IMPORTED_MODULE_14__["renderCommand"](command, function_obj);
  20957. break;
  20958. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  20959. createdElement = _commands_return__WEBPACK_IMPORTED_MODULE_18__["renderCommand"](command, function_obj);
  20960. break;
  20961. }
  20962. switch (before_after_inside) {
  20963. case 1:
  20964. createdElement.insertBefore(element_reference);
  20965. break;
  20966. case 2:
  20967. createdElement.insertAfter(element_reference);
  20968. break;
  20969. case 3:
  20970. element_reference.append(createdElement);
  20971. break;
  20972. }
  20973. }
  20974. function genericCreateCommand(command_type) {
  20975. switch (command_type) {
  20976. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  20977. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Break"]();
  20978. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment:
  20979. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_value, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment'), null, null, false));
  20980. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader:
  20981. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Reader"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false));
  20982. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer:
  20983. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Writer"]([new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  20984. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution:
  20985. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Attribution"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), []);
  20986. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall:
  20987. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["FunctionCall"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_function, null, null, null, false), null);
  20988. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  20989. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["IfTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20990. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  20991. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["RepeatNTimes"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].only_variable, null, null, null, false), null, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null, null);
  20992. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  20993. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["WhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20994. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  20995. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["DoWhileTrue"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ConditionalExpression"](null), null);
  20996. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  20997. var sc = [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true))];
  20998. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Switch"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true), sc);
  20999. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return:
  21000. return new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Return"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_16__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21001. }
  21002. }
  21003. function dragTrash(event) {
  21004. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ghost_div').remove();
  21005. var trash = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon trash alternate outline"></i>');
  21006. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').append(trash);
  21007. trash.css('position', 'absolute');
  21008. trash.css('top', event.clientY);
  21009. trash.css('left', event.clientX - 20);
  21010. trash.css('font-size', '3em');
  21011. trash.css('display', 'none');
  21012. function_container_active.find('.commands_list_div').off('mousemove');
  21013. function_container_active.find('.commands_list_div').find("*").off('mousemove');
  21014. trash.fadeIn(200, function () {
  21015. trash.fadeOut(200, function () {
  21016. trash.remove();
  21017. });
  21018. });
  21019. }
  21020. function manageCommand(function_obj, function_container, event, command_type) {
  21021. jquery__WEBPACK_IMPORTED_MODULE_0___default()(".created_element").each(function (index) {
  21022. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  21023. });
  21024. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21025. if (el.hasClass('ghost_div')) {
  21026. if (el.closest('.command_container').length < 1) {
  21027. console.log('\n\nvou tentar!!!!');
  21028. console.log(el.closest('.commands_list_div'), '\n\n');
  21029. el.closest('.commands_list_div').css('height', el.closest('.commands_list_div').css('height') + 30); //$('.ghost_div').remove();
  21030. el = el.closest('.commands_list_div');
  21031. }
  21032. }
  21033. console.log('soltou no: ');
  21034. console.log(el);
  21035. console.log(el.data('fun')); // Primeiro verificar se ele soltou no espaço da função correta:
  21036. var hier = el.parentsUntil(".all_functions");
  21037. var esta_correto = false;
  21038. var esta_na_div_correta = false;
  21039. if (el.hasClass("commands_list_div")) {
  21040. esta_na_div_correta = true;
  21041. }
  21042. for (var i = 0; i < hier.length; i++) {
  21043. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21044. if (temp.hasClass("commands_list_div")) {
  21045. esta_na_div_correta = true;
  21046. }
  21047. if (temp.data('fun') == function_obj) {
  21048. esta_correto = true;
  21049. break;
  21050. }
  21051. }
  21052. if (!esta_correto) {
  21053. has_element_created_draged = false;
  21054. which_element_is_draged = null;
  21055. dragTrash(event);
  21056. return;
  21057. } else {
  21058. if (!esta_na_div_correta) {
  21059. has_element_created_draged = false;
  21060. which_element_is_draged = null;
  21061. dragTrash(event);
  21062. return;
  21063. }
  21064. } // Agora é descobrir qual o escopo para adicionar o comando:
  21065. // Se o elemento clicado possuir o atributo "fun", então, é direto na div dos comandos:
  21066. if (typeof el.data('fun') !== 'undefined') {
  21067. // Se a lista de comandos estiver vazia, então é o primeiro.
  21068. // Portanto, ele deve soltar o elemento obrigatoriamente no objeto vazio
  21069. if (el.data('fun').commands == null || el.data('fun').commands.length == 0) {
  21070. // pode adicionar
  21071. el.data('fun').commands = [];
  21072. var new_cmd = genericCreateCommand(command_type);
  21073. el.data('fun').commands.push(new_cmd);
  21074. renderCommand(new_cmd, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), 3, function_obj);
  21075. } else {
  21076. // Entra nesse else, caso já existam outros comandos no bloco:
  21077. findNearbyCommandToAddInFunctionScope(el, event, jquery__WEBPACK_IMPORTED_MODULE_0___default()(function_container).find('.commands_list_div'), function_obj, command_type);
  21078. }
  21079. } else {
  21080. console.log("soltou em um comando"); // descobrir em qual comando ele soltou:
  21081. var hier_find = el.parentsUntil(".commands_list_div");
  21082. var hierarquia_bottom_up = [];
  21083. if (typeof el.data('command') !== 'undefined') {
  21084. hierarquia_bottom_up.push(el.data('command'));
  21085. }
  21086. for (var i = 0; i < hier_find.length; i++) {
  21087. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21088. hierarquia_bottom_up.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command'));
  21089. }
  21090. }
  21091. console.log("comando em que soltou: ");
  21092. console.log(hierarquia_bottom_up[0]);
  21093. console.log("hierarquia de baixo para cima na árvore, de onde ele soltou: ");
  21094. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21095. console.log(hierarquia_bottom_up[i]);
  21096. } // Se for do tipo break, verificar se está no contexto correto:
  21097. // Caso não esteja no contexto, apenas retorna sem dar continuidade:
  21098. var is_correct_context = false;
  21099. if (command_type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break) {
  21100. for (var i = 0; i < hierarquia_bottom_up.length; i++) {
  21101. if (hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || hierarquia_bottom_up[i].type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21102. is_correct_context = true;
  21103. break;
  21104. }
  21105. }
  21106. if (!is_correct_context) {
  21107. console.error("Context not allowed to insert BREAK COMMAND!");
  21108. return;
  21109. }
  21110. } // se a hierarquia possuir apenas um elemento, então está na raiz dos comandos:
  21111. if (hierarquia_bottom_up.length == 1) {
  21112. console.log('QQ1');
  21113. var sub_elemento = false;
  21114. for (var i = 0; i < hier_find.length; i++) {
  21115. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21116. console.log('QQ2');
  21117. findBeforeOrAfterCommandToAdd(hier_find[i], event, function_obj, command_type);
  21118. sub_elemento = true;
  21119. break;
  21120. }
  21121. }
  21122. if (!sub_elemento) {
  21123. console.log('QQ3');
  21124. findBeforeOrAfterCommandToAdd(el[0], event, function_obj, command_type);
  21125. }
  21126. } else {
  21127. console.log('QQ4'); // caso exista mais de um elemento na hierarquia:
  21128. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command') !== 'undefined') {
  21129. console.log('QQ5');
  21130. console.log("PPP1");
  21131. insertCommandInBlockHierar(el[0], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21132. } else {
  21133. console.log('QQ6');
  21134. var sub_elemento = false;
  21135. for (var i = 0; i < hier_find.length; i++) {
  21136. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('command') !== 'undefined') {
  21137. console.log('QQ7');
  21138. insertCommandInBlockHierar(hier_find[i], event, function_obj, command_type, hier_find, hierarquia_bottom_up);
  21139. sub_elemento = true;
  21140. break;
  21141. }
  21142. }
  21143. }
  21144. }
  21145. }
  21146. has_element_created_draged = false;
  21147. which_element_is_draged = null;
  21148. renderAlgorithm();
  21149. }
  21150. function insertCommandInBlockHierar(el, event, function_obj, command_type, hier_dom, hier_obj) {
  21151. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21152. var command_parent = el_jq.data('command');
  21153. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21154. console.log('QQ17');
  21155. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21156. console.log('QQ18'); // Se não tiver outro comando ainda no bloco, só adiciona:
  21157. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21158. command_parent.commands_block = [];
  21159. var recentComand = genericCreateCommand(command_type);
  21160. command_parent.commands_block.push(recentComand);
  21161. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21162. } else {
  21163. // Se já tem algum comando no bloco:
  21164. findNearbyCommandToAddInBlockScope(el, event, el, function_obj, command_type, command_parent);
  21165. }
  21166. } else {
  21167. // QUANDO FOR BLOCO DO TIPO IF OU SWITCH/CASE:
  21168. addCommandToSwitchCase(event, function_obj, command_type);
  21169. }
  21170. } else {
  21171. console.log('QQ19'); // entra neste bloco, se soltou o comando sobre outro comando dentro de um subbloco:
  21172. findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type);
  21173. }
  21174. }
  21175. function findNearbyCommandToAddInBlockScope(el, event, node_list_commands, function_obj, command_type, command_parent) {
  21176. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21177. var menor_distancia = 999999999;
  21178. var elemento_menor_distancia = null;
  21179. var antes = true;
  21180. var t_bot;
  21181. var t_top; // Descobrindo o elemento mais próximo:
  21182. for (var i = 0; i < all_sub.length; i++) {
  21183. t_top = all_sub[i].getBoundingClientRect().top;
  21184. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21185. if (t_top - event.clientY < menor_distancia) {
  21186. menor_distancia = event.clientY - t_top;
  21187. elemento_menor_distancia = all_sub[i];
  21188. }
  21189. }
  21190. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21191. if (borda_inferior - event.clientY < menor_distancia) {
  21192. var recentComand = genericCreateCommand(command_type);
  21193. command_parent.commands_block.push(recentComand); //
  21194. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21195. } else {
  21196. var recentComand = genericCreateCommand(command_type);
  21197. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21198. if (index > -1) {
  21199. command_parent.commands_block.splice(index, 0, recentComand);
  21200. }
  21201. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21202. }
  21203. }
  21204. function findBeforeOrAfterCommandToAddInsertBlock(el, event, function_obj, command_type) {
  21205. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21206. var command_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode).data('command');
  21207. var command_target = el_jq.data('command');
  21208. var temp_parent = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.parentNode.parentNode);
  21209. var is_in_else = false;
  21210. if (!command_parent) {
  21211. command_parent = el_jq.data('command');
  21212. temp_parent = el_jq;
  21213. var hier = el_jq.parentsUntil(".command_container");
  21214. for (var i = 0; i < hier.length; i++) {
  21215. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21216. if (typeof temp.data('else') != 'undefined') {
  21217. is_in_else = true;
  21218. }
  21219. if (typeof temp.data('command') != 'undefined') {
  21220. command_parent = temp.data('command');
  21221. temp_parent = temp;
  21222. }
  21223. }
  21224. }
  21225. var hier = el_jq.parentsUntil(".command_container");
  21226. for (var i = 0; i < hier.length; i++) {
  21227. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21228. if (typeof temp.data('else') != 'undefined') {
  21229. is_in_else = true;
  21230. }
  21231. }
  21232. if (command_parent == command_target) {
  21233. var hier = el_jq.parentsUntil(".command_container");
  21234. for (var i = 0; i < hier.length; i++) {
  21235. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21236. if (typeof temp.data('else') !== 'undefined') {
  21237. is_in_else = true;
  21238. break;
  21239. }
  21240. }
  21241. }
  21242. if (command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue && command_parent.type != _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch) {
  21243. var hier = temp_parent.parentsUntil(".all_cases_div");
  21244. console.log("vou procurar!!");
  21245. for (var i = 0; i < hier.length; i++) {
  21246. console.log("estou vasculhando...");
  21247. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21248. if (typeof temp.data('switchcase') !== 'undefined') {
  21249. console.log("encontrei");
  21250. command_parent = temp.data('switchcase');
  21251. is_in_else = false;
  21252. break;
  21253. }
  21254. }
  21255. }
  21256. console.log('debugging:');
  21257. console.log('el_jq');
  21258. console.log(el_jq);
  21259. console.log('command_parent');
  21260. console.log(command_parent);
  21261. console.log('command_target');
  21262. console.log(command_target);
  21263. var menor_distancia = 999999999;
  21264. var antes = true;
  21265. var t_bot;
  21266. var t_top;
  21267. t_top = el.getBoundingClientRect().top;
  21268. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21269. var d_top = event.clientY - t_top; // distancia topo
  21270. var d_bot = t_bot - event.clientY; // distancia baixo
  21271. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21272. if (d_top < d_bot) {
  21273. var recentComand = genericCreateCommand(command_type);
  21274. console.log('MMM1');
  21275. if (is_in_else) {
  21276. console.log('MMM2');
  21277. if (command_parent == command_target) {
  21278. console.log('MMM3');
  21279. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21280. command_parent.commands_else = [];
  21281. var recentComand = genericCreateCommand(command_type);
  21282. command_parent.commands_else.push(recentComand);
  21283. renderCommand(recentComand, el_jq, 3, function_obj);
  21284. } else {
  21285. // Se já tem algum comando no bloco:
  21286. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21287. }
  21288. return;
  21289. }
  21290. console.log('MMM7');
  21291. var index = command_parent.commands_else.indexOf(command_target);
  21292. if (index > -1) {
  21293. command_parent.commands_else.splice(index, 0, recentComand);
  21294. }
  21295. renderCommand(recentComand, el, 1, function_obj);
  21296. } else {
  21297. console.log('MMM4');
  21298. if (command_parent == command_target) {
  21299. console.log('Nxxxx5');
  21300. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21301. command_parent.commands_block = [];
  21302. console.log('SSS4');
  21303. var recentComand = genericCreateCommand(command_type);
  21304. command_parent.commands_block.push(recentComand);
  21305. renderCommand(recentComand, el_jq, 3, function_obj);
  21306. } else {
  21307. console.log('SSS5');
  21308. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21309. }
  21310. return;
  21311. }
  21312. console.log('MMM6');
  21313. var index = command_parent.commands_block.indexOf(command_target);
  21314. if (index > -1) {
  21315. command_parent.commands_block.splice(index, 0, recentComand);
  21316. }
  21317. renderCommand(recentComand, el, 1, function_obj);
  21318. }
  21319. } else {
  21320. console.log('XXX1');
  21321. var recentComand = genericCreateCommand(command_type);
  21322. if (is_in_else) {
  21323. if (command_parent == command_target) {
  21324. console.log('MMM3');
  21325. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21326. command_parent.commands_else = [];
  21327. console.log('SSS1');
  21328. var recentComand = genericCreateCommand(command_type);
  21329. command_parent.commands_else.push(recentComand);
  21330. renderCommand(recentComand, el_jq, 3, function_obj);
  21331. } else {
  21332. // Se já tem algum comando no bloco:
  21333. console.log('SSS2');
  21334. findInBlockCorrectPlace(el_jq, event, function_obj, command_type, true);
  21335. }
  21336. return;
  21337. }
  21338. console.log('XXX2');
  21339. var index = command_parent.commands_else.indexOf(command_target);
  21340. if (index > -1) {
  21341. command_parent.commands_else.splice(index + 1, 0, recentComand);
  21342. }
  21343. renderCommand(recentComand, el, 2, function_obj);
  21344. } else {
  21345. if (command_parent == command_target) {
  21346. console.log('Nxxxx78');
  21347. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21348. command_parent.commands_block = [];
  21349. var recentComand = genericCreateCommand(command_type);
  21350. command_parent.commands_block.push(recentComand);
  21351. console.log('SSS6');
  21352. renderCommand(recentComand, el_jq, 3, function_obj);
  21353. } else {
  21354. console.log('SSS7');
  21355. findInBlockCorrectPlace(el_jq, event, function_obj, command_type);
  21356. }
  21357. return;
  21358. }
  21359. console.log('XXX3');
  21360. var index = command_parent.commands_block.indexOf(command_target);
  21361. if (index > -1) {
  21362. command_parent.commands_block.splice(index + 1, 0, recentComand);
  21363. }
  21364. renderCommand(recentComand, el, 2, function_obj);
  21365. }
  21366. }
  21367. }
  21368. function insertCommandInBlock(el, event, function_obj, command_type) {
  21369. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21370. var command_parent = el_jq.data('command');
  21371. if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  21372. // Se não tiver outro comando ainda no bloco, só adiciona:
  21373. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21374. command_parent.commands_block = [];
  21375. var recentComand = genericCreateCommand(command_type);
  21376. command_parent.commands_block.push(recentComand);
  21377. renderCommand(recentComand, el_jq.find('.block_commands'), 3, function_obj);
  21378. } else {
  21379. // Se já tem algum comando no bloco:
  21380. findInBlockCorrectPlace(el, event, function_obj, command_type);
  21381. }
  21382. } else if (el_jq.data('command').type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue) {
  21383. console.log('QQ9'); // no if ou no else?
  21384. var correct_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.pageX, event.pageY));
  21385. var is_in_if = true;
  21386. if (correct_div.data('if')) {
  21387. is_in_if = true;
  21388. } else if (correct_div.data('else')) {
  21389. is_in_if = false;
  21390. } else {
  21391. var hier = correct_div.parentsUntil(".command_container");
  21392. for (var i = 0; i < hier.length; i++) {
  21393. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21394. if (typeof temp.data('if') !== 'undefined') {
  21395. is_in_if = true;
  21396. break;
  21397. }
  21398. if (typeof temp.data('else') !== 'undefined') {
  21399. is_in_if = false;
  21400. break;
  21401. }
  21402. }
  21403. }
  21404. if (is_in_if) {
  21405. if (command_parent.commands_block == null || command_parent.commands_block.length == 0) {
  21406. command_parent.commands_block = [];
  21407. var recentComand = genericCreateCommand(command_type);
  21408. command_parent.commands_block.push(recentComand);
  21409. renderCommand(recentComand, el_jq.find('.commands_if'), 3, function_obj);
  21410. } else {
  21411. // Se já tem algum comando no bloco:
  21412. findInBlockCorrectPlace(el_jq.find('.commands_if'), event, function_obj, command_type);
  21413. }
  21414. } else {
  21415. if (command_parent.commands_else == null || command_parent.commands_else.length == 0) {
  21416. command_parent.commands_else = [];
  21417. var recentComand = genericCreateCommand(command_type);
  21418. command_parent.commands_else.push(recentComand);
  21419. renderCommand(recentComand, el_jq.find('.commands_else'), 3, function_obj);
  21420. } else {
  21421. // Se já tem algum comando no bloco:
  21422. findInBlockCorrectPlace(el_jq.find('.commands_else'), event, function_obj, command_type, true);
  21423. }
  21424. }
  21425. } else {
  21426. // é do tipo switch
  21427. console.log("está tentando inserir em um switch que está na raiz!");
  21428. addCommandToSwitchCase(event, function_obj, command_type);
  21429. }
  21430. }
  21431. function addCommandToSwitchCase(event, function_obj, command_type) {
  21432. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document.elementFromPoint(event.clientX, event.clientY));
  21433. var which_case = el.data('switchcase');
  21434. var case_div = el;
  21435. if (!which_case) {
  21436. var hier_find = el.parentsUntil(".all_cases_div");
  21437. for (var i = 0; i < hier_find.length; i++) {
  21438. if (typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase') !== 'undefined') {
  21439. which_case = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]).data('switchcase');
  21440. case_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier_find[i]);
  21441. break;
  21442. }
  21443. }
  21444. }
  21445. if (which_case.commands_block == null || which_case.commands_block.length < 1) {
  21446. which_case.commands_block = [];
  21447. var recentComand = genericCreateCommand(command_type);
  21448. which_case.commands_block.push(recentComand);
  21449. renderCommand(recentComand, case_div.find('.case_commands_block'), 3, function_obj);
  21450. } else {
  21451. findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type);
  21452. }
  21453. }
  21454. function findInBlockCorrectPlaceInSwitchCase(which_case, case_div, event, function_obj, command_type) {
  21455. var all_sub = case_div.find('div.command_container');
  21456. var menor_distancia = 999999999;
  21457. var elemento_menor_distancia = null;
  21458. var antes = true;
  21459. var t_bot;
  21460. var t_top; // Descobrindo o elemento mais próximo:
  21461. for (var i = 0; i < all_sub.length; i++) {
  21462. t_top = all_sub[i].getBoundingClientRect().top;
  21463. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21464. if (t_top - event.clientY < menor_distancia) {
  21465. menor_distancia = event.clientY - t_top;
  21466. elemento_menor_distancia = all_sub[i];
  21467. }
  21468. }
  21469. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21470. if (borda_inferior - event.clientY < menor_distancia) {
  21471. var recentComand = genericCreateCommand(command_type);
  21472. which_case.commands_block.push(recentComand);
  21473. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(case_div.find('.case_commands_block')[0]), 3, function_obj);
  21474. } else {
  21475. var recentComand = genericCreateCommand(command_type);
  21476. var index = which_case.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21477. if (index > -1) {
  21478. which_case.commands_block.splice(index, 0, recentComand);
  21479. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21480. }
  21481. }
  21482. }
  21483. function findInBlockCorrectPlace(el, event, function_obj, command_type) {
  21484. var is_in_else = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  21485. var el_jq = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  21486. var all_sub = el_jq.find('div.command_container');
  21487. var menor_distancia = 999999999;
  21488. var elemento_menor_distancia = null;
  21489. var antes = true;
  21490. var t_bot;
  21491. var t_top; // Descobrindo o elemento mais próximo:
  21492. for (var i = 0; i < all_sub.length; i++) {
  21493. t_top = all_sub[i].getBoundingClientRect().top;
  21494. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21495. if (t_top - event.clientY < menor_distancia) {
  21496. menor_distancia = event.clientY - t_top;
  21497. elemento_menor_distancia = all_sub[i];
  21498. }
  21499. }
  21500. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height;
  21501. console.log("menor_distancia: ");
  21502. console.log(elemento_menor_distancia); // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21503. if (borda_inferior - event.clientY < menor_distancia) {
  21504. console.log('QQ11');
  21505. var recentComand = genericCreateCommand(command_type);
  21506. var command_parent = el_jq.data('command');
  21507. if (is_in_else) {
  21508. console.log('QQ15');
  21509. command_parent.commands_else.push(recentComand);
  21510. console.log('el_jq');
  21511. console.log(el_jq);
  21512. console.log("$(el_jq.find('.commands_else')[0]):: ");
  21513. console.log(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.commands_else')[0]));
  21514. renderCommand(recentComand, el_jq, 3, function_obj);
  21515. } else {
  21516. console.log('QQ16');
  21517. command_parent.commands_block.push(recentComand);
  21518. renderCommand(recentComand, jquery__WEBPACK_IMPORTED_MODULE_0___default()(el_jq.find('.block_commands')[0]), 3, function_obj);
  21519. }
  21520. } else {
  21521. console.log('QQ12');
  21522. var recentComand = genericCreateCommand(command_type);
  21523. var command_parent = el_jq.data('command');
  21524. if (is_in_else) {
  21525. var index = command_parent.commands_else.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21526. if (index > -1) {
  21527. command_parent.commands_else.splice(index, 0, recentComand);
  21528. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21529. }
  21530. } else {
  21531. var index = command_parent.commands_block.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21532. if (index > -1) {
  21533. command_parent.commands_block.splice(index, 0, recentComand);
  21534. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21535. }
  21536. }
  21537. }
  21538. }
  21539. function findBeforeOrAfterCommandToAdd(el, event, function_obj, command_type) {
  21540. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command').type) {
  21541. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue:
  21542. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch:
  21543. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes:
  21544. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue:
  21545. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue:
  21546. insertCommandInBlock(el, event, function_obj, command_type);
  21547. return;
  21548. }
  21549. var menor_distancia = 999999999;
  21550. var antes = true;
  21551. var t_bot;
  21552. var t_top;
  21553. t_top = el.getBoundingClientRect().top;
  21554. t_bot = el.getBoundingClientRect().top + el.getBoundingClientRect().height;
  21555. var d_top = event.clientY - t_top; // distancia topo
  21556. var d_bot = t_bot - event.clientY; // distancia baixo
  21557. // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21558. if (d_top < d_bot) {
  21559. var recentComand = genericCreateCommand(command_type);
  21560. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21561. if (index > -1) {
  21562. function_obj.commands.splice(index, 0, recentComand);
  21563. }
  21564. renderCommand(recentComand, el, 1, function_obj);
  21565. } else {
  21566. var recentComand = genericCreateCommand(command_type);
  21567. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).data('command'));
  21568. if (index > -1) {
  21569. function_obj.commands.splice(index + 1, 0, recentComand);
  21570. }
  21571. renderCommand(recentComand, el, 2, function_obj);
  21572. }
  21573. }
  21574. function findNearbyCommandToAddInFunctionScope(el, event, node_list_commands, function_obj, command_type) {
  21575. var all_sub = jquery__WEBPACK_IMPORTED_MODULE_0___default()(node_list_commands).find('div.command_container');
  21576. var menor_distancia = 999999999;
  21577. var elemento_menor_distancia = null;
  21578. var antes = true;
  21579. var t_bot;
  21580. var t_top; // Descobrindo o elemento mais próximo:
  21581. for (var i = 0; i < all_sub.length; i++) {
  21582. t_top = all_sub[i].getBoundingClientRect().top;
  21583. t_bot = all_sub[i].getBoundingClientRect().top + all_sub[i].getBoundingClientRect().height;
  21584. if (t_top - event.clientY < menor_distancia) {
  21585. menor_distancia = event.clientY - t_top;
  21586. elemento_menor_distancia = all_sub[i];
  21587. }
  21588. }
  21589. var borda_inferior = elemento_menor_distancia.parentNode.getBoundingClientRect().top + elemento_menor_distancia.parentNode.getBoundingClientRect().height; // Está mais próximo da borda de baixo, ou seja.. inserir por último:
  21590. if (borda_inferior - event.clientY < menor_distancia) {
  21591. var recentComand = genericCreateCommand(command_type);
  21592. function_obj.commands.push(recentComand); //
  21593. renderCommand(recentComand, node_list_commands, 3, function_obj);
  21594. } else {
  21595. var recentComand = genericCreateCommand(command_type);
  21596. var index = function_obj.commands.indexOf(jquery__WEBPACK_IMPORTED_MODULE_0___default()(elemento_menor_distancia).data('command'));
  21597. if (index > -1) {
  21598. function_obj.commands.splice(index, 0, recentComand);
  21599. }
  21600. renderCommand(recentComand, elemento_menor_distancia, 1, function_obj);
  21601. }
  21602. }
  21603. /***/ }),
  21604. /***/ "./js/visualUI/commands/attribution.js":
  21605. /*!*********************************************!*\
  21606. !*** ./js/visualUI/commands/attribution.js ***!
  21607. \*********************************************/
  21608. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, renderMenuOperations */
  21609. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21610. "use strict";
  21611. __webpack_require__.r(__webpack_exports__);
  21612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  21615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenuOperations", function() { return renderMenuOperations; });
  21616. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21617. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21618. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21619. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21620. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21621. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  21622. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  21623. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  21624. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21625. /* harmony import */ var _generic_expression__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./generic_expression */ "./js/visualUI/commands/generic_expression.js");
  21626. function createFloatingCommand() {
  21627. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution created_element"> <i class="ui icon small arrow left"></i> <span> x = 1 + 1 </span></div>');
  21628. }
  21629. function renderCommand(command, function_obj) {
  21630. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui attribution command_container"><i class="ui icon small arrow left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_attributed"></div> <span class="text_attr_receives span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives') + '</span> ' + '<div class="expression_elements"></div> </div>');
  21631. el.data('command', command);
  21632. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable, el.find('.var_attributed'), function_obj);
  21633. if (!command.expression || command.expression.length < 1) {
  21634. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  21635. command.expression.push(exp);
  21636. }
  21637. addHandlers(command, function_obj, el);
  21638. _generic_expression__WEBPACK_IMPORTED_MODULE_8__["renderExpression"](command, function_obj, el.find('.expression_elements'), command.expression); //renderExpressionElements(command, function_obj, el);
  21639. return el;
  21640. }
  21641. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, selectedItem, expression_element) {
  21642. var index_to_move = expression_element.itens.indexOf(ref_object);
  21643. switch (selectedItem.data('exp')) {
  21644. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21645. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [expression_element.itens[index_to_move], _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21646. expression_element.itens[index_to_move] = exp;
  21647. break;
  21648. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21649. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, expression_element.itens[index_to_move]]);
  21650. expression_element.itens[index_to_move] = exp;
  21651. break;
  21652. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21653. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [expression_element.itens[index_to_move]]);
  21654. expression_element.itens[index_to_move] = exp;
  21655. break;
  21656. }
  21657. renderExpressionElements(command, function_obj, dom_object);
  21658. }
  21659. function renderExpressionElements(command, function_obj, el) {
  21660. var expression_div = el.find('.expression_elements');
  21661. var command_container;
  21662. if (el.hasClass("command_container") == false) {
  21663. var hier = el.parentsUntil(".command_container");
  21664. for (var i = 0; i < hier.length; i++) {
  21665. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21666. command_container = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21667. break;
  21668. }
  21669. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21670. expression_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21671. break;
  21672. }
  21673. }
  21674. }
  21675. if (command_container) {
  21676. expression_div = command_container.find('.expression_elements');
  21677. }
  21678. expression_div.text('');
  21679. for (var i = 0; i < command.expression.length; i++) {
  21680. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21681. temp.data('ref_element', command.expression[i]);
  21682. temp.data('ref_index', i);
  21683. expression_div.append(temp);
  21684. renderElement(command, function_obj, temp, command.expression[i]);
  21685. }
  21686. }
  21687. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  21688. var context_menu = '<div class="ui dropdown"><div class="text">';
  21689. switch (expression_element.itens[index_op]) {
  21690. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21691. context_menu += '+';
  21692. break;
  21693. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21694. context_menu += '-';
  21695. break;
  21696. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21697. context_menu += '*';
  21698. break;
  21699. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21700. context_menu += '/';
  21701. break;
  21702. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21703. context_menu += '%';
  21704. break;
  21705. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none:
  21706. context_menu += '...';
  21707. break;
  21708. }
  21709. context_menu += '</div><div class="menu">';
  21710. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  21711. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  21712. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  21713. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  21714. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  21715. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].none + '" data-text="...">Nenhum</div>';
  21716. context_menu += '</div></div>';
  21717. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21718. temp_op.append(context_menu);
  21719. context_menu.dropdown({
  21720. onChange: function onChange(value, text, $selectedItem) {
  21721. expression_element.itens[index_op] = value;
  21722. }
  21723. });
  21724. }
  21725. function renderMenuAddExpression(command, function_obj, el, dom_append_menu, expression_append_new_expression) {
  21726. if (el.hasClass("command_container") == false) {
  21727. var hier = el.parentsUntil(".commands_list_div");
  21728. for (var i = 0; i < hier.length; i++) {
  21729. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("command_container")) {
  21730. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21731. break;
  21732. }
  21733. }
  21734. }
  21735. if (dom_append_menu.hasClass("expression_elements") == false) {
  21736. var hier = el.parentsUntil(".commands_list_div");
  21737. for (var i = 0; i < hier.length; i++) {
  21738. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]).hasClass("expression_elements")) {
  21739. dom_append_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(hier[i]);
  21740. break;
  21741. }
  21742. }
  21743. }
  21744. var context_menu = '<div class="ui dropdown"><div class="text"></div><i class="ui icon arrow alternate circle right outline"></i><div class="menu">';
  21745. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp + '">EXP OP EXP</div>';
  21746. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp + '">OP EXP</div>';
  21747. context_menu += '<div class="item" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par + '">( EXP )</div>';
  21748. context_menu += '</div></div>';
  21749. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21750. dom_append_menu.append(context_menu);
  21751. context_menu.dropdown({
  21752. onChange: function onChange(value, text, $selectedItem) {
  21753. switch (value) {
  21754. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21755. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21756. expression_append_new_expression.push(exp);
  21757. break;
  21758. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21759. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp, [_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21760. expression_append_new_expression.push(exp);
  21761. break;
  21762. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21763. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  21764. expression_append_new_expression.push(exp);
  21765. break;
  21766. }
  21767. renderExpressionElements(command, function_obj, el);
  21768. }
  21769. });
  21770. }
  21771. function renderElement(command, function_obj, el, expression_element) {
  21772. switch (expression_element.type_exp) {
  21773. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp:
  21774. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21775. var temp_exp_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21776. var temp_exp_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21777. el.append(temp_exp_1);
  21778. el.append(temp_op);
  21779. el.append(temp_exp_2);
  21780. if (expression_element.itens[0].type) {
  21781. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[0], temp_exp_1, function_obj, 2, expression_element);
  21782. } else {
  21783. renderElement(command, function_obj, temp_exp_1, expression_element.itens[0]);
  21784. }
  21785. renderOperator(command, function_obj, temp_op, expression_element, 1);
  21786. if (expression_element.itens[2].type) {
  21787. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[2], temp_exp_2, function_obj, 2, expression_element);
  21788. } else {
  21789. renderElement(command, function_obj, temp_exp_2, expression_element.itens[2]);
  21790. }
  21791. break;
  21792. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].op_exp:
  21793. var temp_op = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21794. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21795. el.append(temp_op);
  21796. el.append(temp_exp);
  21797. renderOperator(command, function_obj, temp_op, expression_element, 0);
  21798. if (expression_element.itens[1].type) {
  21799. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[1], temp_exp, function_obj, 2, expression_element);
  21800. } else {
  21801. renderElement(command, function_obj, temp_exp, expression_element.itens[1]);
  21802. }
  21803. break;
  21804. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].par_exp_par:
  21805. var temp_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ( </div>');
  21806. var temp_exp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"></div>');
  21807. var temp_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="component_element"> ) </div>');
  21808. el.append(temp_par_1);
  21809. el.append(temp_exp);
  21810. for (var j = 0; j < expression_element.itens.length; j++) {
  21811. if (expression_element.itens[j].type) {
  21812. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_element.itens[j], temp_exp, function_obj, 2, expression_element);
  21813. } else {
  21814. renderElement(command, function_obj, temp_exp, expression_element.itens[j]);
  21815. }
  21816. } //renderMenuAddExpression(command, function_obj, el, el, expression_element.itens);
  21817. el.append(temp_par_2);
  21818. break;
  21819. }
  21820. }
  21821. function renderExpression(command, function_obj, el) {
  21822. var expression_div = el.find('.expression_elements');
  21823. expression_div.text('');
  21824. var menu_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21825. menu_add_item.data('index_add', 0);
  21826. expression_div.append(menu_add_item);
  21827. for (var i = 0; i < command.expression.length; i++) {
  21828. if (command.expression[i].type) {
  21829. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  21830. temp.data('ref_element', command.expression[i]);
  21831. temp.data('ref_index', i);
  21832. expression_div.append(temp);
  21833. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.expression[i], temp, function_obj);
  21834. } else if (command.expression[i] == "(" || command.expression[i] == ")") {
  21835. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element">' + command.expression[i] + '</div>');
  21836. temp.data('ref_element', command.expression[i]);
  21837. temp.data('ref_index', i);
  21838. expression_div.append(temp);
  21839. } else {
  21840. var temp = '<div class="expression_element">';
  21841. switch (command.expression[i]) {
  21842. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus:
  21843. temp += '+';
  21844. break;
  21845. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus:
  21846. temp += '-';
  21847. break;
  21848. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication:
  21849. temp += '*';
  21850. break;
  21851. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division:
  21852. temp += '/';
  21853. break;
  21854. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module:
  21855. temp += '%';
  21856. break;
  21857. }
  21858. temp += '</div>';
  21859. temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(temp);
  21860. temp.data('ref_element', command.expression[i]);
  21861. temp.data('ref_index', i);
  21862. expression_div.append(temp);
  21863. }
  21864. var menu_add_item_seq = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="menu_add_item"></div>');
  21865. var index_temp = i + 1;
  21866. menu_add_item_seq.data('index_add', index_temp);
  21867. expression_div.append(menu_add_item_seq);
  21868. }
  21869. addMenuItens(command, function_obj, el);
  21870. }
  21871. function addMenuItens(command, function_obj, expression_div) {
  21872. var divs_expression = expression_div.find('.menu_add_item');
  21873. for (var i = 0; i < divs_expression.length; i++) {
  21874. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).data('index_add');
  21875. var context_menu = '<div class="ui dropdown context_menu_clear"><i class="ui icon plus square outline"></i><div class="menu">';
  21876. context_menu += '<div class="item" data-option="value" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  21877. context_menu += '<div class="item" data-option="operator" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_operator') + '</div>';
  21878. context_menu += '<div class="item" data-option="parentheses" data-index="' + temp + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_parentheses') + '</div>';
  21879. context_menu += '</div></div>';
  21880. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  21881. jquery__WEBPACK_IMPORTED_MODULE_0___default()(divs_expression[i]).append(context_menu);
  21882. context_menu.dropdown({
  21883. on: 'hover',
  21884. onChange: function onChange(value, text, $selectedItem) {
  21885. switch ($selectedItem.data('option')) {
  21886. case "value":
  21887. command.expression.splice($selectedItem.data('index'), 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21888. renderExpression(command, function_obj, expression_div);
  21889. break;
  21890. case "operator":
  21891. command.expression.splice($selectedItem.data('index'), 0, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  21892. renderExpression(command, function_obj, expression_div);
  21893. break;
  21894. case "parentheses":
  21895. command.expression.splice($selectedItem.data('index'), 0, "(");
  21896. command.expression.splice($selectedItem.data('index') + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  21897. command.expression.splice($selectedItem.data('index') + 2, 0, ")");
  21898. renderExpression(command, function_obj, expression_div);
  21899. break;
  21900. }
  21901. }
  21902. });
  21903. }
  21904. }
  21905. function addHandlers(command, function_obj, attribution_dom) {
  21906. attribution_dom.find('.button_remove_command').on('click', function () {
  21907. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, attribution_dom)) {
  21908. attribution_dom.fadeOut(400, function () {
  21909. attribution_dom.remove();
  21910. });
  21911. }
  21912. });
  21913. attribution_dom.find('.button_refresh_attribution').on('click', function () {
  21914. renderExpressionElements(command, function_obj, attribution_dom);
  21915. });
  21916. }
  21917. function renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected) {
  21918. /*console.log("recebido o seguinte DOM: ");
  21919. console.log(dom_object);
  21920. if (dom_object.hasClass('var_attributed')) {
  21921. return;
  21922. } else {
  21923. var hier = dom_object.parentsUntil(".command_container");
  21924. for (var i = 0; i < hier.length; i++) {
  21925. if ($(hier[i]).hasClass('var_attributed') || $(hier[i]).hasClass('parameters_function_called')) {
  21926. return;
  21927. }
  21928. }
  21929. }
  21930. dom_object.find('.context_menu_clear').remove();
  21931. var menu_operations = '<div class="ui dropdown menu_operations"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  21932. for (var tm in Models.ARITHMETIC_TYPES) {
  21933. menu_operations += '<div class="item" data-option="'+tm+'">'+LocalizedStrings.getUI('btn_arithmetic_' + tm)+'</div>';
  21934. }
  21935. menu_operations += '<div class="item" data-option="clear">'+LocalizedStrings.getUI('btn_clear')+'</div>';
  21936. menu_operations += '</div></div>';
  21937. menu_operations = $(menu_operations);
  21938. dom_object.append(menu_operations);
  21939. menu_operations.dropdown({
  21940. onChange: function(value, text, $selectedItem) {
  21941. switch ($($selectedItem).data('option')) {
  21942. case "clear":
  21943. $(dom_object).text('');
  21944. VariableValueMenu.renderMenu(command, ref_object, dom_object, function_obj);
  21945. break;
  21946. default:
  21947. createExpressionAround(command, ref_object, dom_object, function_obj);
  21948. menu_operations.find('.text').text('');
  21949. }
  21950. }
  21951. });*/
  21952. }
  21953. function createExpressionAround(command, ref_object, dom_object, function_obj) {
  21954. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ( </span>').insertBefore(dom_object);
  21955. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span> ) </span>').insertAfter(dom_object);
  21956. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), dom_object, function_obj);
  21957. }
  21958. /***/ }),
  21959. /***/ "./js/visualUI/commands/break.js":
  21960. /*!***************************************!*\
  21961. !*** ./js/visualUI/commands/break.js ***!
  21962. \***************************************/
  21963. /*! exports provided: createFloatingCommand, renderCommand */
  21964. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  21965. "use strict";
  21966. __webpack_require__.r(__webpack_exports__);
  21967. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  21968. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  21969. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  21970. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  21971. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  21972. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  21973. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  21974. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  21975. function createFloatingCommand() {
  21976. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + ' </span></div>');
  21977. }
  21978. function renderCommand(command, function_obj) {
  21979. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left"></i> <i class="ui icon times red button_remove_command"></i> <span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_break') + '</span> </div>');
  21980. el.data('command', command);
  21981. addHandlers(command, function_obj, el);
  21982. return el;
  21983. }
  21984. function addHandlers(command, function_obj, break_dom) {
  21985. break_dom.find('.button_remove_command').on('click', function () {
  21986. if (_commands__WEBPACK_IMPORTED_MODULE_4__["removeCommand"](command, function_obj, break_dom)) {
  21987. break_dom.fadeOut(400, function () {
  21988. break_dom.remove();
  21989. });
  21990. }
  21991. });
  21992. }
  21993. /***/ }),
  21994. /***/ "./js/visualUI/commands/comment.js":
  21995. /*!*****************************************!*\
  21996. !*** ./js/visualUI/commands/comment.js ***!
  21997. \*****************************************/
  21998. /*! exports provided: createFloatingCommand, renderCommand */
  21999. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22000. "use strict";
  22001. __webpack_require__.r(__webpack_exports__);
  22002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22003. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22004. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22005. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22006. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22007. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22008. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22009. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22010. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22011. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22012. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22013. function createFloatingCommand() {
  22014. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment created_element"> <i class="ui icon small quote left"></i> <span class="span_comment_text" "> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + ' </span></div>');
  22015. }
  22016. function renderCommand(command, function_obj) {
  22017. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui comment command_container"> <i class="ui icon small quote left command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> <div class="div_comment_text">' + '</div> </div>');
  22018. el.data('command', command);
  22019. addHandlers(command, function_obj, el);
  22020. renderTextComment(command, function_obj, el);
  22021. return el;
  22022. }
  22023. function renderTextComment(command, function_obj, el) {
  22024. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.comment_text, el.find('.var_value_menu_div'), function_obj, 20);
  22025. }
  22026. function addHandlers(command, function_obj, comment_dom) {
  22027. comment_dom.find('.button_remove_command').on('click', function () {
  22028. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, comment_dom)) {
  22029. comment_dom.fadeOut(400, function () {
  22030. comment_dom.remove();
  22031. });
  22032. }
  22033. });
  22034. }
  22035. /***/ }),
  22036. /***/ "./js/visualUI/commands/conditional_expression.js":
  22037. /*!********************************************************!*\
  22038. !*** ./js/visualUI/commands/conditional_expression.js ***!
  22039. \********************************************************/
  22040. /*! exports provided: renderExpression */
  22041. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22042. "use strict";
  22043. __webpack_require__.r(__webpack_exports__);
  22044. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22045. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22046. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22047. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22048. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22049. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22050. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22051. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22052. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22053. function renderExpression(command, expression, function_obj, initial_el_to_render) {
  22054. expression.dom_object = initial_el_to_render;
  22055. if (expression.expression == null || expression.expression.length < 1) {
  22056. renderStartMenu(command, expression, function_obj, initial_el_to_render);
  22057. } else {
  22058. var main_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_elements"></div>');
  22059. switch (expression.expression.type) {
  22060. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22061. renderLogicExpression(command, expression, expression.expression, function_obj, main_div, initial_el_to_render);
  22062. break;
  22063. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22064. renderArithmeticExpression(command, expression, expression.expression, function_obj, main_div);
  22065. break;
  22066. }
  22067. initial_el_to_render.append(main_div);
  22068. var restartMenu = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui restart_expression"><i class="ui icon undo"></i></div>');
  22069. initial_el_to_render.append(restartMenu);
  22070. restartMenu.on('click', function (e) {
  22071. expression.expression = null;
  22072. initial_el_to_render.empty();
  22073. renderExpression(command, expression, function_obj, initial_el_to_render);
  22074. });
  22075. }
  22076. }
  22077. function renderArithmeticOperator(command, all_expression, expression_arithmetic, arithmetic_operator, function_obj, element_to_append) {
  22078. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22079. menu_operator.dropdown({
  22080. values: [{
  22081. name: '>',
  22082. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than,
  22083. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than
  22084. }, {
  22085. name: '<',
  22086. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than,
  22087. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than
  22088. }, {
  22089. name: '==',
  22090. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to,
  22091. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to
  22092. }, {
  22093. name: '!=',
  22094. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to,
  22095. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to
  22096. }, {
  22097. name: '>=',
  22098. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to,
  22099. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to
  22100. }, {
  22101. name: '<=',
  22102. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to,
  22103. selected: arithmetic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to
  22104. }],
  22105. onChange: function onChange(value, text, $selectedItem) {
  22106. expression_arithmetic.operator = value;
  22107. }
  22108. });
  22109. element_to_append.append(menu_operator);
  22110. }
  22111. function renderLogicOperator(command, all_expression, expression_logic, logic_operator, function_obj, element_to_append, initial_el_to_render) {
  22112. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div><i class="dropdown icon"></i></div>');
  22113. menu_operator.dropdown({
  22114. values: [{
  22115. name: '==',
  22116. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to,
  22117. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to
  22118. }, {
  22119. name: '!=',
  22120. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to,
  22121. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to
  22122. }, {
  22123. name: '&&',
  22124. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and,
  22125. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and
  22126. }, {
  22127. name: '||',
  22128. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or,
  22129. selected: logic_operator == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or
  22130. }],
  22131. onChange: function onChange(value, text, $selectedItem) {
  22132. if ($selectedItem) {
  22133. expression_logic.operator = value;
  22134. if (expression_logic.second_operand == null) {
  22135. expression_logic.second_operand = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  22136. initial_el_to_render.empty();
  22137. renderExpression(command, all_expression, function_obj, initial_el_to_render);
  22138. }
  22139. }
  22140. }
  22141. });
  22142. element_to_append.append(menu_operator);
  22143. }
  22144. function renderLogicExpression(command, all_expression, expression_logic, function_obj, element_to_append, initial_el_to_render) {
  22145. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22146. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22147. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22148. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22149. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22150. if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22151. renderLogicExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22152. } else if (expression_logic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22153. renderArithmeticExpression(command, all_expression, expression_logic.first_operand, function_obj, exp_el_expr_el_1);
  22154. } else {
  22155. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.first_operand, exp_el_expr_el_1, function_obj);
  22156. }
  22157. element_to_append.append(exp_el_par_1);
  22158. element_to_append.append(exp_el_expr_el_1);
  22159. renderLogicOperator(command, all_expression, expression_logic, expression_logic.operator, function_obj, exp_el_expr_operand, initial_el_to_render);
  22160. element_to_append.append(exp_el_expr_operand);
  22161. if (expression_logic.second_operand) {
  22162. if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22163. renderLogicExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22164. } else if (expression_logic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22165. renderArithmeticExpression(command, all_expression, expression_logic.second_operand, function_obj, exp_el_expr_el_2);
  22166. } else {
  22167. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_logic.second_operand, exp_el_expr_el_2, function_obj);
  22168. }
  22169. element_to_append.append(exp_el_expr_el_2);
  22170. }
  22171. element_to_append.append(exp_el_par_2);
  22172. }
  22173. function renderArithmeticExpression(command, all_expression, expression_arithmetic, function_obj, element_to_append) {
  22174. var exp_el_par_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22175. var exp_el_expr_el_1 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22176. var exp_el_expr_operand = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22177. var exp_el_expr_el_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="expression_element"></div>');
  22178. var exp_el_par_2 = jquery__WEBPACK_IMPORTED_MODULE_0___default()(' <span class="span_command_spec"> </span> ');
  22179. if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22180. renderLogicExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22181. } else if (expression_arithmetic.first_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22182. renderArithmeticExpression(command, all_expression, expression_arithmetic.first_operand, function_obj, exp_el_expr_el_1);
  22183. } else {
  22184. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.first_operand, exp_el_expr_el_1, function_obj);
  22185. }
  22186. if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) {
  22187. renderLogicExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22188. } else if (expression_arithmetic.second_operand.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) {
  22189. renderArithmeticExpression(command, all_expression, expression_arithmetic.second_operand, function_obj, exp_el_expr_el_2);
  22190. } else {
  22191. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_arithmetic.second_operand, exp_el_expr_el_2, function_obj);
  22192. }
  22193. renderArithmeticOperator(command, all_expression, expression_arithmetic, expression_arithmetic.operator, function_obj, exp_el_expr_operand);
  22194. element_to_append.append(exp_el_par_1);
  22195. element_to_append.append(exp_el_expr_el_1);
  22196. element_to_append.append(exp_el_expr_operand);
  22197. element_to_append.append(exp_el_expr_el_2);
  22198. element_to_append.append(exp_el_par_2);
  22199. }
  22200. function renderStartMenu(command, expression, function_obj, initial_el_to_render) {
  22201. var start_menu = '';
  22202. start_menu += '<div class="ui dropdown menu_start_rendered"><div class="text"><i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('expression_menu_select') + '</i></div><i class="dropdown icon"></i><div class="menu">';
  22203. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_logic_expression') + ' (EL == EL and EL)</div>';
  22204. start_menu += '<div class="item" data-exp="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_arithmetic_expression') + ' (EA < EA)</div>';
  22205. start_menu += '</div></div>';
  22206. start_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(start_menu);
  22207. start_menu.dropdown({
  22208. onChange: function onChange(value, text, $selectedItem) {
  22209. switch ($selectedItem.data('exp')) {
  22210. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic:
  22211. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LogicExpression"](false, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22212. break;
  22213. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic:
  22214. expression.expression = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  22215. break;
  22216. }
  22217. initial_el_to_render.html('');
  22218. renderExpression(command, expression, function_obj, initial_el_to_render);
  22219. },
  22220. selectOnKeydown: false
  22221. });
  22222. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22223. initial_el_to_render.append(start_menu);
  22224. initial_el_to_render.append(' <span class="span_command_spec"> </span> ');
  22225. }
  22226. /***/ }),
  22227. /***/ "./js/visualUI/commands/contextualized_menu.js":
  22228. /*!*****************************************************!*\
  22229. !*** ./js/visualUI/commands/contextualized_menu.js ***!
  22230. \*****************************************************/
  22231. /*! exports provided: renderMenu */
  22232. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22233. "use strict";
  22234. __webpack_require__.r(__webpack_exports__);
  22235. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  22236. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22237. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22238. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22239. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22240. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22241. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22242. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22243. /* harmony import */ var _switch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./switch */ "./js/visualUI/commands/switch.js");
  22244. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  22245. function renderMenu(command, dom_where_render, function_obj, dom_command) {
  22246. var menu_div = '<div class="ui dropdown menu_commands" ><i class="icon code"></i> <div class="menu"> ';
  22247. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22248. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22249. } else {
  22250. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_break') + ' </a>';
  22251. menu_div += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_case') + ' </a>';
  22252. }
  22253. menu_div += '</div></div>';
  22254. menu_div = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_div);
  22255. dom_where_render.append(menu_div);
  22256. addHandlers(command, dom_where_render, function_obj, dom_command);
  22257. }
  22258. function addHandlers(command, dom_where_render, function_obj, dom_command) {
  22259. dom_where_render.find('.menu_commands').dropdown({
  22260. on: 'hover'
  22261. });
  22262. dom_where_render.find('.menu_commands a').on('click', function (evt) {
  22263. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue || command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue) {
  22264. if (command.commands_block == null || command.commands_block.length == 0) {
  22265. command.commands_block = [];
  22266. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_4__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  22267. command.commands_block.push(new_cmd);
  22268. _commands__WEBPACK_IMPORTED_MODULE_4__["renderCommand"](new_cmd, dom_command.find('.block_commands'), 3, function_obj);
  22269. } else {
  22270. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22271. }
  22272. } else {
  22273. switch (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command')) {
  22274. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].break:
  22275. _commands__WEBPACK_IMPORTED_MODULE_4__["createFloatingCommand"](function_obj, dom_command.find('.block_commands'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  22276. break;
  22277. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switchcase:
  22278. addCaseToSwitch(command, dom_where_render, function_obj, dom_command);
  22279. break;
  22280. }
  22281. }
  22282. });
  22283. }
  22284. function addCaseToSwitch(command, dom_where_render, function_obj, dom_command) {
  22285. if (command.cases == null) {
  22286. command.cases = [];
  22287. }
  22288. var sc = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SwitchCase"](new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_5__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22289. command.cases.push(sc);
  22290. _switch__WEBPACK_IMPORTED_MODULE_6__["renderCase"](sc, command, function_obj, dom_command.find('.all_cases_div'));
  22291. }
  22292. /***/ }),
  22293. /***/ "./js/visualUI/commands/dowhiletrue.js":
  22294. /*!*********************************************!*\
  22295. !*** ./js/visualUI/commands/dowhiletrue.js ***!
  22296. \*********************************************/
  22297. /*! exports provided: createFloatingCommand, renderCommand */
  22298. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22299. "use strict";
  22300. __webpack_require__.r(__webpack_exports__);
  22301. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22302. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22303. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22304. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22305. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22306. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22307. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22308. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22309. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22310. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22311. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22312. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  22313. function createFloatingCommand() {
  22314. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dowhiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + '(x < 10) </span></div>');
  22315. }
  22316. function renderCommand(command, function_obj) {
  22317. var ret = '';
  22318. ret += '<div class="ui dowhiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_do') + ' </span>';
  22319. ret += '<div class="ui block_commands" data-subblock="" data-idcommand="">';
  22320. ret += '</div>';
  22321. ret += ' <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span> <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22322. ret += '</div>';
  22323. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22324. el.data('command', command);
  22325. el.find('.block_commands').data('command', command);
  22326. addHandlers(command, function_obj, el);
  22327. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  22328. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22329. if (command.commands_block) {
  22330. for (var j = 0; j < command.commands_block.length; j++) {
  22331. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  22332. }
  22333. }
  22334. return el;
  22335. }
  22336. function addHandlers(command, function_obj, dowhiletrue_dom) {
  22337. dowhiletrue_dom.find('.button_remove_command').on('click', function () {
  22338. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, dowhiletrue_dom)) {
  22339. dowhiletrue_dom.fadeOut(400, function () {
  22340. dowhiletrue_dom.remove();
  22341. });
  22342. }
  22343. });
  22344. }
  22345. /***/ }),
  22346. /***/ "./js/visualUI/commands/functioncall.js":
  22347. /*!**********************************************!*\
  22348. !*** ./js/visualUI/commands/functioncall.js ***!
  22349. \**********************************************/
  22350. /*! exports provided: createFloatingCommand, renderCommand */
  22351. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22352. "use strict";
  22353. __webpack_require__.r(__webpack_exports__);
  22354. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22355. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22356. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22357. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22358. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22359. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22360. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22361. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22362. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22363. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22364. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22365. function createFloatingCommand() {
  22366. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall created_element"> <i class="hand point right icon"></i> <span> funcao() </span></div>');
  22367. }
  22368. function renderCommand(command, function_obj) {
  22369. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui functioncall command_container"> <i class="hand point right icon command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="var_value_menu_div"></div> </div>');
  22370. el.data('command', command);
  22371. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.function_called, el.find('.var_value_menu_div'), function_obj);
  22372. addHandlers(command, function_obj, el);
  22373. return el;
  22374. }
  22375. function addHandlers(command, function_obj, functioncall_dom) {
  22376. functioncall_dom.find('.button_remove_command').on('click', function () {
  22377. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, functioncall_dom)) {
  22378. functioncall_dom.fadeOut(400, function () {
  22379. functioncall_dom.remove();
  22380. });
  22381. }
  22382. });
  22383. }
  22384. /***/ }),
  22385. /***/ "./js/visualUI/commands/generic_expression.js":
  22386. /*!****************************************************!*\
  22387. !*** ./js/visualUI/commands/generic_expression.js ***!
  22388. \****************************************************/
  22389. /*! exports provided: renderExpression */
  22390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22391. "use strict";
  22392. __webpack_require__.r(__webpack_exports__);
  22393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderExpression", function() { return renderExpression; });
  22394. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22395. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22396. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22397. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22398. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22399. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22400. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22401. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22402. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  22403. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_7__);
  22404. function renderExpression(command, function_obj, div_to_render, expression_array) {
  22405. div_to_render.empty();
  22406. if (command.type === _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution) {
  22407. melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default.a.unwatch(command.variable);
  22408. melanke_watchjs__WEBPACK_IMPORTED_MODULE_7___default.a.watch(command.variable, function () {
  22409. renderExpression(command, function_obj, div_to_render, expression_array);
  22410. }, 0);
  22411. if (command.variable.content) {
  22412. var types_included = [];
  22413. if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER || command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  22414. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22415. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  22416. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional);
  22417. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic);
  22418. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22419. } else if (command.variable.content.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  22420. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional);
  22421. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic);
  22422. types_included.push(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic);
  22423. } else {
  22424. console.log('NÃO RECONHECI! VEJA: ', command.variable.content.type);
  22425. }
  22426. renderElements(command, function_obj, div_to_render, expression_array, types_included);
  22427. } else {
  22428. div_to_render.text('selecione uma variável');
  22429. }
  22430. }
  22431. }
  22432. function renderElements(command, function_obj, div_to_render, expression_array, types_included) {
  22433. /*if (expression_array.length > 0) {
  22434. if (!expression_array[0].type_op) {
  22435. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, 0);
  22436. }
  22437. }*/
  22438. var i = 0;
  22439. for (i = 0; i < expression_array.length; i++) {
  22440. if (expression_array[i].type == "var_value") {
  22441. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + i + '"></div>');
  22442. if (i == 0) {
  22443. if (expression_array.length > 0 && !expression_array[1].type_op) {
  22444. renderStartAddOperator(div_temp, types_included, expression_array, command, function_obj, 0);
  22445. }
  22446. }
  22447. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, expression_array[i], div_temp, function_obj);
  22448. div_to_render.append(div_temp);
  22449. } else if (expression_array[i] == '(' || expression_array[i] == ')') {
  22450. if (expression_array[i] == ')') {
  22451. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  22452. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22453. } else if (expression_array[i] == '(' && !expression_array[i + 1].type_op) {
  22454. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22455. renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, i + 1);
  22456. } else {
  22457. renderParenthesis(div_to_render, expression_array[i], command, function_obj, i, expression_array);
  22458. }
  22459. } else {
  22460. renderOperatorMenu(command, function_obj, div_to_render, expression_array[i], types_included, i, expression_array);
  22461. }
  22462. }
  22463. renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, i);
  22464. renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included);
  22465. }
  22466. window.parentheses_activate = false;
  22467. window.open_or_close = null;
  22468. function renderAddParenthesis(command, function_obj, div_to_render, expression_array, types_included) {
  22469. var addParentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression add_parentheses"><i class="icons"><b style="font-style: normal;">( )</b><i class="corner add icon blue" style="font-size: .6em;right: -3px;bottom: -2px;"></i></i></div>');
  22470. div_to_render.append(addParentheses);
  22471. addParentheses.popup({
  22472. content: "Adicionar parênteses",
  22473. delay: {
  22474. show: 750,
  22475. hide: 0
  22476. }
  22477. });
  22478. addParentheses.on('click', function (mouse_event) {
  22479. // verificar se já está ativado
  22480. if (window.parentheses_activate) {
  22481. return;
  22482. }
  22483. div_to_render.find('.usepointer').off('click');
  22484. window.parentheses_activate = true;
  22485. window.open_or_close = "open";
  22486. div_to_render.find('.dropdown').addClass('disabled');
  22487. div_to_render.find('.ghost_element').addClass('temp_class');
  22488. div_to_render.find('.ghost_element').removeClass('ghost_element');
  22489. var floatingObject = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="floating_parenthesis"> ( </div>');
  22490. floatingObject.draggable().appendTo("body");
  22491. floatingObject.css("position", "absolute");
  22492. mouse_event.type = "mousedown.draggable";
  22493. mouse_event.target = floatingObject[0];
  22494. floatingObject.css("left", mouse_event.pageX + 10);
  22495. floatingObject.css("top", mouse_event.pageY + 10);
  22496. floatingObject.trigger(mouse_event);
  22497. div_to_render.on('mousemove', function (evt) {
  22498. var actual_target = null;
  22499. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('single_element_expression')) {
  22500. actual_target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target);
  22501. } else {
  22502. actual_target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.single_element_expression');
  22503. }
  22504. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('temp_class') || actual_target.length < 1 || actual_target.hasClass('add_parentheses') || actual_target.hasClass('rendered_parentheses') || jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).hasClass('expression_elements')) {
  22505. return;
  22506. }
  22507. renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array);
  22508. });
  22509. div_to_render.on('mouseleave', function (evt) {
  22510. /*window.open_parentheses.remove();
  22511. window.close_parentheses.remove();*/
  22512. });
  22513. var floating;
  22514. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').on('mouseup', function (evt) {
  22515. if (window.open_or_close == "open") {
  22516. window.open_or_close = "close";
  22517. floatingObject.remove();
  22518. var comando_que_esta = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.command_container');
  22519. var comando_certo = div_to_render.closest('.command_container');
  22520. if (!comando_que_esta.is(comando_certo)) {
  22521. window.parentheses_activate = false;
  22522. div_to_render.find('.temp_class').addClass('ghost_element');
  22523. div_to_render.find('.temp_class').removeClass('temp_class');
  22524. div_to_render.off('mousemove');
  22525. div_to_render.off('mouseleave');
  22526. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  22527. window.open_parentheses.remove();
  22528. window.close_parentheses.remove();
  22529. window.inserir_open = -1;
  22530. window.inserir_close = -1;
  22531. window.open_or_close = null;
  22532. renderExpression(command, function_obj, div_to_render, expression_array);
  22533. return;
  22534. }
  22535. floating = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="floating_parenthesis"> ) </div>');
  22536. floating.draggable().appendTo("body");
  22537. floating.css("position", "absolute");
  22538. floating.css("left", evt.pageX + 10);
  22539. floating.css("top", evt.pageY + 10);
  22540. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').on('mousemove', function (evts) {
  22541. floating.css("left", evts.pageX + 10);
  22542. floating.css("top", evts.pageY + 10);
  22543. });
  22544. } else {
  22545. floating.remove();
  22546. div_to_render.off('mousemove');
  22547. div_to_render.off('mouseleave');
  22548. jquery__WEBPACK_IMPORTED_MODULE_0___default()('body').off('mouseup');
  22549. setTimeout(function () {
  22550. window.parentheses_activate = false;
  22551. }, 50);
  22552. var comando_que_esta = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.target).closest('.command_container');
  22553. var comando_certo = div_to_render.closest('.command_container');
  22554. var is_correct = false;
  22555. if (comando_que_esta.is(comando_certo)) {
  22556. is_correct = true;
  22557. }
  22558. if (is_correct) {
  22559. expression_array.splice(window.inserir_open, 0, '(');
  22560. expression_array.splice(window.inserir_close, 0, ')');
  22561. }
  22562. window.inserir_open = -1;
  22563. window.inserir_close = -1;
  22564. window.open_or_close = null;
  22565. renderExpression(command, function_obj, div_to_render, expression_array);
  22566. }
  22567. });
  22568. });
  22569. }
  22570. window.open_parentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="parentheses_ghost">(</div>');
  22571. window.close_parentheses = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="parentheses_ghost">)</div>');
  22572. window.inserir_open = -1;
  22573. window.inserir_close = -1;
  22574. function renderGhostParentheses(actual_target, command, function_obj, div_to_render, expression_array) {
  22575. /*window.open_parentheses.remove();
  22576. window.close_parentheses.remove();*/
  22577. var index_in_array = actual_target.data('index');
  22578. if (expression_array[index_in_array] == '(' || expression_array[index_in_array] == ')') {
  22579. return;
  22580. }
  22581. if (window.open_or_close == "close") {
  22582. if (index_in_array < window.inserir_open) {
  22583. return;
  22584. }
  22585. } // Tratando a situação quando é na primeira posição:
  22586. if (index_in_array == 0) {
  22587. if (expression_array[index_in_array].type == "var_value") {
  22588. if (window.open_or_close == "open") {
  22589. window.open_parentheses.insertBefore(actual_target);
  22590. window.inserir_open = index_in_array;
  22591. }
  22592. /*if (expression_array.length == 1) {
  22593. if (window.open_or_close == "close") {
  22594. window.close_parentheses.insertAfter(actual_target);
  22595. window.inserir_close = index_in_array + 2;
  22596. }*/
  22597. //} else {
  22598. var count_opened = 0;
  22599. var count_closed = 0;
  22600. for (var i = 0; i < expression_array.length; i++) {
  22601. if (expression_array[i] == '(') {
  22602. count_opened++;
  22603. }
  22604. if (expression_array[i] == ')') {
  22605. count_closed++;
  22606. }
  22607. if (count_opened != count_closed) {} else {
  22608. if (count_opened > 0) {
  22609. if (window.open_or_close == "close") {
  22610. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22611. window.inserir_close = i + 2;
  22612. }
  22613. break;
  22614. } else {
  22615. if (expression_array[i].type == "var_value") {
  22616. if (window.open_or_close == "close") {
  22617. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22618. window.inserir_close = i + 2;
  22619. }
  22620. break;
  22621. }
  22622. }
  22623. }
  22624. } //}
  22625. } else if (expression_array[index_in_array].type_op) {
  22626. if (window.open_or_close == "open") {
  22627. window.open_parentheses.insertBefore(actual_target);
  22628. window.inserir_open = index_in_array;
  22629. }
  22630. var count_opened = 0;
  22631. var count_closed = 0;
  22632. for (var i = 1; i < expression_array.length; i++) {
  22633. // $('.slide-link[data-slide="0"]')
  22634. if (expression_array[i] == '(') {
  22635. count_opened++;
  22636. }
  22637. if (expression_array[i] == ')') {
  22638. count_closed++;
  22639. }
  22640. if (count_opened != count_closed) {} else {
  22641. if (count_opened > 0) {
  22642. if (expression_array[i].type == "var_value") {
  22643. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22644. window.inserir_close = i + 2;
  22645. }
  22646. break;
  22647. } else {
  22648. if (expression_array[i].type == "var_value") {
  22649. if (expression_array[i].type == "var_value") {
  22650. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + i + '"]'));
  22651. window.inserir_close = i + 2;
  22652. }
  22653. break;
  22654. }
  22655. }
  22656. }
  22657. }
  22658. }
  22659. return;
  22660. } // Tratando quando não é no índice 0:
  22661. if (expression_array[index_in_array].type == "var_value") {
  22662. if (window.open_or_close == "open") {
  22663. window.open_parentheses.insertBefore(actual_target);
  22664. window.inserir_open = index_in_array;
  22665. }
  22666. if (window.open_or_close == "close") {
  22667. window.close_parentheses.insertAfter(actual_target);
  22668. window.inserir_close = index_in_array + 2;
  22669. }
  22670. return;
  22671. }
  22672. if (expression_array[index_in_array].type_op) {
  22673. // buscar para a esquerda primeiro:
  22674. if (expression_array[index_in_array - 1] == '(') {
  22675. if (window.open_or_close == "open") {
  22676. window.open_parentheses.insertBefore(actual_target);
  22677. window.inserir_open = index_in_array;
  22678. }
  22679. } else if (expression_array[index_in_array - 1] == ')') {
  22680. // buscar a abertura
  22681. var count_opened = 0;
  22682. var count_closed = 0;
  22683. for (var j = index_in_array - 1; j >= 0; j--) {
  22684. if (expression_array[j] == '(') {
  22685. count_opened++;
  22686. }
  22687. if (expression_array[j] == ')') {
  22688. count_closed++;
  22689. }
  22690. if (count_opened != count_closed) {} else {
  22691. if (count_closed > 0) {
  22692. if (window.open_or_close == "open") {
  22693. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  22694. window.inserir_open = j;
  22695. }
  22696. break;
  22697. }
  22698. }
  22699. }
  22700. } else if (expression_array[index_in_array - 1].type == "var_value") {
  22701. if (window.open_or_close == "open") {
  22702. window.open_parentheses.insertBefore(div_to_render.find('.single_element_expression[data-index="' + (index_in_array - 1) + '"]'));
  22703. window.inserir_open = index_in_array - 1;
  22704. }
  22705. } // buscar para a direita agora:
  22706. if (expression_array[index_in_array + 1] == '(') {
  22707. // buscar o fechamento:
  22708. var count_opened = 0;
  22709. var count_closed = 0;
  22710. for (var j = index_in_array + 1; j < expression_array.length; j++) {
  22711. if (expression_array[j] == '(') {
  22712. count_opened++;
  22713. }
  22714. if (expression_array[j] == ')') {
  22715. count_closed++;
  22716. }
  22717. if (count_opened != count_closed) {} else {
  22718. if (count_opened > 0) {
  22719. if (window.open_or_close == "close") {
  22720. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + j + '"]'));
  22721. window.inserir_close = j + 2;
  22722. }
  22723. break;
  22724. }
  22725. }
  22726. }
  22727. } else if (expression_array[index_in_array + 1].type == "var_value") {
  22728. if (window.open_or_close == "close") {
  22729. window.close_parentheses.insertAfter(div_to_render.find('.single_element_expression[data-index="' + (index_in_array + 1) + '"]'));
  22730. window.inserir_close = index_in_array + 3;
  22731. }
  22732. }
  22733. }
  22734. }
  22735. function renderParenthesis(div_to_render, expression_content, command, function_obj, position, expression_array) {
  22736. var ghost_parenthesis = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + position + '">' + expression_content + '</div>');
  22737. div_to_render.append(ghost_parenthesis);
  22738. }
  22739. function renderStartAddOperator(div_to_render, types_included, expression_array, command, function_obj, position) {
  22740. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22741. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22742. if (types_included.length > 1) {
  22743. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22744. menu_final += getArithmeticOperators();
  22745. menu_final += '</div></div>';
  22746. } else {
  22747. menu_final += getArithmeticOperators();
  22748. }
  22749. }
  22750. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22751. if (types_included.length > 1) {
  22752. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22753. menu_final += getLogicOperators();
  22754. menu_final += '</div></div>';
  22755. } else {
  22756. menu_final += getLogicOperators();
  22757. }
  22758. }
  22759. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22760. if (types_included.length > 1) {
  22761. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22762. menu_final += getRelationalOperators();
  22763. menu_final += '</div></div>';
  22764. } else {
  22765. menu_final += getRelationalOperators();
  22766. }
  22767. }
  22768. menu_final += '</div></div>';
  22769. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22770. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression ghost_element"></div>');
  22771. div_temp.append(menu_final);
  22772. div_to_render.append(div_temp);
  22773. menu_final.dropdown('set selected', _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus);
  22774. div_temp.on('click', function () {
  22775. var sera = position;
  22776. console.log('será inserido em: ', sera);
  22777. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22778. console.log('p1');
  22779. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus));
  22780. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22781. console.log('p2');
  22782. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to));
  22783. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22784. console.log('p3');
  22785. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than));
  22786. }
  22787. renderExpression(command, function_obj, div_to_render, expression_array);
  22788. });
  22789. }
  22790. function renderFinalAddElements(div_to_render, types_included, expression_array, command, function_obj, position) {
  22791. var menu_final = '<div class="ui dropdown disabled usepointer"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22792. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22793. if (types_included.length > 1) {
  22794. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22795. menu_final += getArithmeticOperators();
  22796. menu_final += '</div></div>';
  22797. } else {
  22798. menu_final += getArithmeticOperators();
  22799. }
  22800. }
  22801. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22802. if (types_included.length > 1) {
  22803. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22804. menu_final += getLogicOperators();
  22805. menu_final += '</div></div>';
  22806. } else {
  22807. menu_final += getLogicOperators();
  22808. }
  22809. }
  22810. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22811. if (types_included.length > 1) {
  22812. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22813. menu_final += getRelationalOperators();
  22814. menu_final += '</div></div>';
  22815. } else {
  22816. menu_final += getRelationalOperators();
  22817. }
  22818. }
  22819. menu_final += '</div></div>';
  22820. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22821. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression ghost_element"></div>');
  22822. div_temp.append(menu_final);
  22823. div_to_render.append(div_temp);
  22824. menu_final.dropdown('set selected', _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus);
  22825. div_temp.on('click', function () {
  22826. var sera = position;
  22827. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22828. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus));
  22829. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22830. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to));
  22831. } else if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22832. expression_array.splice(sera, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionOperator"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than));
  22833. }
  22834. expression_array.splice(sera + 1, 0, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true));
  22835. renderExpression(command, function_obj, div_to_render, expression_array);
  22836. });
  22837. }
  22838. function renderOperatorMenu(command, function_obj, div_to_render, expression_element, types_included, position, expression_array) {
  22839. var menu_final = '<div class="ui dropdown"><div class="text"> + </div><i class="dropdown icon"></i><div class="menu">';
  22840. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic) >= 0) {
  22841. if (types_included.length > 1) {
  22842. menu_final += '<div class="item"><i class="dropdown icon"></i>Aritméticos<div class="menu">';
  22843. menu_final += getArithmeticOperators();
  22844. menu_final += '</div></div>';
  22845. } else {
  22846. menu_final += getArithmeticOperators();
  22847. }
  22848. }
  22849. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic) >= 0) {
  22850. if (types_included.length > 1) {
  22851. menu_final += '<div class="item"><i class="dropdown icon"></i>Lógicos<div class="menu">';
  22852. menu_final += getLogicOperators();
  22853. menu_final += '</div></div>';
  22854. } else {
  22855. menu_final += getLogicOperators();
  22856. }
  22857. }
  22858. if (types_included.indexOf(_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional) >= 0) {
  22859. if (types_included.length > 1) {
  22860. menu_final += '<div class="item"><i class="dropdown icon"></i>Relacionais<div class="menu">';
  22861. menu_final += getRelationalOperators();
  22862. menu_final += '</div></div>';
  22863. } else {
  22864. menu_final += getRelationalOperators();
  22865. }
  22866. }
  22867. menu_final += '</div></div>';
  22868. menu_final = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_final);
  22869. var div_temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="single_element_expression" data-index="' + position + '"></div>');
  22870. div_temp.append(menu_final);
  22871. div_to_render.append(div_temp);
  22872. menu_final.dropdown({
  22873. onChange: function onChange(value, text, $selectedItem) {
  22874. expression_element.item = $selectedItem.data('value');
  22875. expression_element.type_op = $selectedItem.data('type');
  22876. }
  22877. });
  22878. menu_final.dropdown('set selected', expression_element.item);
  22879. }
  22880. function getArithmeticOperators() {
  22881. var arithmetic_operators;
  22882. arithmetic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus + '">+</div>';
  22883. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus + '">-</div>';
  22884. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication + '">*</div>';
  22885. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division + '">/</div>';
  22886. arithmetic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_arithmetic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module + '">%</div>';
  22887. return arithmetic_operators;
  22888. }
  22889. function getLogicOperators() {
  22890. var logic_operators;
  22891. logic_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].equals_to + '">==</div>';
  22892. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].not_equals_to + '">!=</div>';
  22893. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].and + '">&&</div>';
  22894. logic_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_logic + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["LOGIC_COMPARISON"].or + '">||</div>';
  22895. return logic_operators;
  22896. }
  22897. function getRelationalOperators() {
  22898. var relational_operators;
  22899. relational_operators = '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than + '">></div>';
  22900. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than + '"><</div>';
  22901. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].equals_to + '">==</div>';
  22902. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].not_equals_to + '">!=</div>';
  22903. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].greater_than_or_equals_to + '">>=</div>';
  22904. relational_operators += '<div class="item" data-type="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_TYPES"].exp_conditional + '" data-value="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than_or_equals_to + '"><=</div>';
  22905. return relational_operators;
  22906. }
  22907. /***/ }),
  22908. /***/ "./js/visualUI/commands/iftrue.js":
  22909. /*!****************************************!*\
  22910. !*** ./js/visualUI/commands/iftrue.js ***!
  22911. \****************************************/
  22912. /*! exports provided: createFloatingCommand, renderCommand */
  22913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22914. "use strict";
  22915. __webpack_require__.r(__webpack_exports__);
  22916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22918. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22919. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22920. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22921. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22922. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22923. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22924. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22925. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22926. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  22927. function createFloatingCommand() {
  22928. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui iftrue created_element"> <i class="ui icon small random"></i> <span> if (x < 1) { } </span></div>');
  22929. }
  22930. function renderCommand(command, function_obj) {
  22931. var ret = '';
  22932. 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>';
  22933. ret += '<span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_if') + '</span>';
  22934. ret += ' <span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  22935. ret += '<span> </span> ';
  22936. ret += '<div class="ui block_commands commands_if conditional_comands_block" data-if="true">';
  22937. ret += '</div></div>';
  22938. ret += '<div class="ui data_block_else" data-else="true"> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_else') + ' </span>';
  22939. ret += '<div class="ui block_commands commands_else conditional_comands_block" data-else="true">';
  22940. ret += '</div>';
  22941. ret += '<span></span></div>';
  22942. ret += '</div>';
  22943. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  22944. el.data('command', command);
  22945. el.find('.block_commands').data('command', command);
  22946. el.find('.data_block_if').data('command', command);
  22947. el.find('.data_block_else').data('command', command);
  22948. el.find('.commands_if').data('command', command);
  22949. addHandlers(command, function_obj, el);
  22950. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  22951. if (command.commands_block) {
  22952. for (var j = 0; j < command.commands_block.length; j++) {
  22953. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_if')[0]), 3, function_obj);
  22954. }
  22955. }
  22956. if (command.commands_else) {
  22957. for (var j = 0; j < command.commands_else.length; j++) {
  22958. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_else[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.commands_else')[0]), 3, function_obj);
  22959. }
  22960. }
  22961. return el;
  22962. }
  22963. function addHandlers(command, function_obj, iftrue_dom) {
  22964. iftrue_dom.find('.button_remove_command').on('click', function () {
  22965. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, iftrue_dom)) {
  22966. iftrue_dom.fadeOut(400, function () {
  22967. iftrue_dom.remove();
  22968. });
  22969. }
  22970. });
  22971. }
  22972. /***/ }),
  22973. /***/ "./js/visualUI/commands/reader.js":
  22974. /*!****************************************!*\
  22975. !*** ./js/visualUI/commands/reader.js ***!
  22976. \****************************************/
  22977. /*! exports provided: createFloatingCommand, renderCommand */
  22978. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  22979. "use strict";
  22980. __webpack_require__.r(__webpack_exports__);
  22981. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  22982. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  22983. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  22984. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  22985. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  22986. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  22987. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  22988. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  22989. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  22990. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  22991. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  22992. function createFloatingCommand() {
  22993. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui reader created_element"> <i class="ui icon small download"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' var </span></div>');
  22994. }
  22995. function renderCommand(command, function_obj) {
  22996. var el = '<div class="ui reader command_container"> <i class="ui icon small download command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_read') + ' ( </span> <div class="var_value_menu_div"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  22997. el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(el);
  22998. el.data('command', command);
  22999. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  23000. addHandlers(command, function_obj, el);
  23001. return el;
  23002. }
  23003. function addHandlers(command, function_obj, reader_dom) {
  23004. reader_dom.find('.button_remove_command').on('click', function () {
  23005. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, reader_dom)) {
  23006. reader_dom.fadeOut(400, function () {
  23007. reader_dom.remove();
  23008. });
  23009. }
  23010. });
  23011. }
  23012. /***/ }),
  23013. /***/ "./js/visualUI/commands/repeatNtimes.js":
  23014. /*!**********************************************!*\
  23015. !*** ./js/visualUI/commands/repeatNtimes.js ***!
  23016. \**********************************************/
  23017. /*! exports provided: createFloatingCommand, renderCommand, manageExpressionElements, manageClearExpressionElements */
  23018. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23019. "use strict";
  23020. __webpack_require__.r(__webpack_exports__);
  23021. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23022. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23023. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageExpressionElements", function() { return manageExpressionElements; });
  23024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "manageClearExpressionElements", function() { return manageClearExpressionElements; });
  23025. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23026. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23027. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23028. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23029. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23030. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23031. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23032. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23033. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  23034. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23035. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23036. function createFloatingCommand() {
  23037. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui repeatNtimes created_element"> <i class="ui icon small sync"></i> <span> para (x = 0; x < 10; x ++) <br> </span></div>');
  23038. }
  23039. function renderCommand(command, function_obj) {
  23040. var ret = '<div class="ui repeatNtimes command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_for') + ' ( </span> <div class="ui attribution_expression"><div class="ui variable_attribution"></div> <span class="text_receives span_command_spec"></span> <div class="ui var_value_expression div_expression_st"></div> </div> <span class="span_command_spec separator_character">;</span> <div class="conditional_expression"></div> <span class="span_command_spec separator_character">;</span> <div class="ui incrementation_field"><div class="ui incrementation_variable"></div> <span class="text_inc_receives span_command_spec"></span> <div class="ui first_operand"></div><div class="ui operator"></div><div class="ui second_operand"></div></div> <span class="span_command_spec"> ) </span>';
  23041. ret += '<div class="ui block_commands">';
  23042. ret += '</div>';
  23043. ret += '<span> </span>';
  23044. ret += '</div>';
  23045. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23046. el.data('command', command);
  23047. el.find('.block_commands').data('command', command);
  23048. addHandlers(command, function_obj, el);
  23049. _contextualized_menu__WEBPACK_IMPORTED_MODULE_9__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23050. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_attribution, el.find('.variable_attribution'), function_obj);
  23051. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression2, function_obj, el.find('.conditional_expression'));
  23052. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.var_incrementation, el.find('.incrementation_variable'), function_obj);
  23053. if (command.expression1) {
  23054. el.find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23055. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, el.find('.var_value_expression'), function_obj);
  23056. }
  23057. if (command.expression3) {
  23058. el.find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23059. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], el.find('.first_operand'), function_obj);
  23060. renderOperator(command, function_obj, el.find('.operator'), command.expression3, 1);
  23061. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], el.find('.second_operand'), function_obj);
  23062. }
  23063. if (command.commands_block) {
  23064. for (var j = 0; j < command.commands_block.length; j++) {
  23065. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  23066. }
  23067. }
  23068. return el;
  23069. }
  23070. function manageExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  23071. if (dom_object.hasClass('variable_attribution')) {
  23072. if (!command.expression3) {
  23073. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [command.var_attribution, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "1", null, null, true)]);
  23074. command.expression3 = exp;
  23075. command.var_incrementation = command.var_attribution;
  23076. var cond_exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ArithmeticExpression"](command.var_attribution, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_COMPARISON"].less_than);
  23077. command.expression2.expression = cond_exp;
  23078. }
  23079. dom_object.parent().find('.text_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23080. command.expression1 = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, "0", null, null, true);
  23081. dom_object.parent().find('.var_value_expression').empty();
  23082. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression1, dom_object.parent().find('.var_value_expression'), function_obj);
  23083. renderAlgorithm();
  23084. }
  23085. if (dom_object.hasClass('incrementation_variable')) {
  23086. dom_object.parent().find('.text_inc_receives').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_receives'));
  23087. var exp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ExpressionElement"](_ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["EXPRESSION_ELEMENTS"].exp_op_exp, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus, new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)]);
  23088. command.expression3 = exp;
  23089. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[0], dom_object.parent().find('.first_operand'), function_obj);
  23090. renderOperator(command, function_obj, dom_object.parent().find('.operator'), command.expression3, 1);
  23091. _variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, command.expression3.itens[2], dom_object.parent().find('.second_operand'), function_obj);
  23092. }
  23093. }
  23094. function manageClearExpressionElements(command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element) {
  23095. if (dom_object.hasClass('variable_attribution')) {
  23096. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_receives').text('');
  23097. command.expression1 = null;
  23098. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.var_value_expression').empty();
  23099. }
  23100. if (dom_object.hasClass('incrementation_variable')) {
  23101. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.text_inc_receives').text('');
  23102. command.expression3 = null;
  23103. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.first_operand').empty();
  23104. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.operator').empty();
  23105. jquery__WEBPACK_IMPORTED_MODULE_0___default()(dom_object).parent().find('.second_operand').empty();
  23106. }
  23107. }
  23108. function addHandlers(command, function_obj, repeatNtimes_dom) {
  23109. repeatNtimes_dom.find('.button_remove_command').on('click', function () {
  23110. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, repeatNtimes_dom)) {
  23111. repeatNtimes_dom.fadeOut(400, function () {
  23112. repeatNtimes_dom.remove();
  23113. });
  23114. }
  23115. });
  23116. }
  23117. function renderOperator(command, function_obj, temp_op, expression_element, index_op) {
  23118. var menu_operator = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui dropdown"><div class="text"></div></div>');
  23119. menu_operator.dropdown({
  23120. values: [{
  23121. name: '+',
  23122. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus,
  23123. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].plus
  23124. }, {
  23125. name: '-',
  23126. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus,
  23127. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].minus
  23128. }, {
  23129. name: '*',
  23130. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication,
  23131. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].multiplication
  23132. }, {
  23133. name: '/',
  23134. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division,
  23135. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].division
  23136. }, {
  23137. name: '%',
  23138. value: _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module,
  23139. selected: expression_element.itens[index_op] == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["ARITHMETIC_TYPES"].module
  23140. }],
  23141. onChange: function onChange(value, text, $selectedItem) {
  23142. expression_element.itens[index_op] = value;
  23143. }
  23144. });
  23145. temp_op.append(menu_operator);
  23146. }
  23147. /***/ }),
  23148. /***/ "./js/visualUI/commands/return.js":
  23149. /*!****************************************!*\
  23150. !*** ./js/visualUI/commands/return.js ***!
  23151. \****************************************/
  23152. /*! exports provided: createFloatingCommand, renderCommand */
  23153. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23154. "use strict";
  23155. __webpack_require__.r(__webpack_exports__);
  23156. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23157. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23158. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23159. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23160. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23161. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23162. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23163. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23164. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23165. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23166. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23167. function createFloatingCommand() {
  23168. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return created_element"> <i class="ui icon small reply"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span></div>');
  23169. }
  23170. function renderCommand(command, function_obj) {
  23171. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui return command_container"> <i class="ui icon small reply command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_return') + ' </span> <div class="var_value_menu_div"></div></div>');
  23172. el.data('command', command);
  23173. addHandlers(command, function_obj, el);
  23174. if (function_obj.return_type != _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID) {
  23175. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.variable_value_menu, el.find('.var_value_menu_div'), function_obj);
  23176. } else {
  23177. el.find('.var_value_menu_div').remove();
  23178. command.variable_value_menu = null;
  23179. }
  23180. return el;
  23181. }
  23182. function addHandlers(command, function_obj, return_dom) {
  23183. return_dom.find('.button_remove_command').on('click', function () {
  23184. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, return_dom)) {
  23185. return_dom.fadeOut(400, function () {
  23186. return_dom.remove();
  23187. });
  23188. }
  23189. });
  23190. }
  23191. /***/ }),
  23192. /***/ "./js/visualUI/commands/switch.js":
  23193. /*!****************************************!*\
  23194. !*** ./js/visualUI/commands/switch.js ***!
  23195. \****************************************/
  23196. /*! exports provided: createFloatingCommand, renderCommand, renderCase */
  23197. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23198. "use strict";
  23199. __webpack_require__.r(__webpack_exports__);
  23200. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  23201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  23202. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCase", function() { return renderCase; });
  23203. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23204. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23205. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23206. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23207. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23208. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23209. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23210. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  23211. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  23212. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  23213. function createFloatingCommand() {
  23214. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui switch created_element"> <i class="ui icon small random"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( x ) { <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 1: <br> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + ' 2: <br> } </span></div>');
  23215. }
  23216. function renderCommand(command, function_obj) {
  23217. var ret = '';
  23218. ret += '<div class="ui switch command_container"> <i class="ui icon small random command_drag" ></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_switch') + ' ( <div class="ui variable_to_switch"></div> ) <div class="ui all_cases_div"></div></span>';
  23219. ret += '</div>';
  23220. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  23221. el.data('command', command);
  23222. addHandlers(command, function_obj, el);
  23223. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  23224. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, command.variable, el.find('.variable_to_switch'), function_obj);
  23225. if (command.cases) {
  23226. for (var i = 0; i < command.cases.length; i++) {
  23227. renderCase(command.cases[i], command, function_obj, el.find('.all_cases_div'));
  23228. }
  23229. }
  23230. return el;
  23231. }
  23232. function renderCase(switchcase, command, function_obj, el) {
  23233. var casediv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui case_div"><i class="ui icon times red button_remove_command"></i><span>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_case') + '</span> <div class="ui variable_case"></div>: <div class="case_commands_block"></div></div>');
  23234. _variable_value_menu__WEBPACK_IMPORTED_MODULE_7__["renderMenu"](command, switchcase.variable_value_menu, casediv.find('.variable_case'), function_obj);
  23235. casediv.data('switchcase', switchcase);
  23236. casediv.find('.case_commands_block').data('switchcase', switchcase);
  23237. el.append(casediv);
  23238. if (switchcase.commands_block) {
  23239. for (var j = 0; j < switchcase.commands_block.length; j++) {
  23240. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](switchcase.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(casediv.find('.case_commands_block')[0]), 3, function_obj);
  23241. }
  23242. }
  23243. casediv.find('.button_remove_command').on('click', function () {
  23244. for (var i = 0; i < command.cases.length; i++) {
  23245. if (switchcase == command.cases[i]) {
  23246. delete command.cases[i];
  23247. command.cases.splice(i, 1);
  23248. casediv.remove();
  23249. break;
  23250. }
  23251. }
  23252. });
  23253. }
  23254. function addHandlers(command, function_obj, switch_dom) {
  23255. switch_dom.find('.button_remove_command').on('click', function () {
  23256. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, switch_dom)) {
  23257. switch_dom.fadeOut(400, function () {
  23258. switch_dom.remove();
  23259. });
  23260. }
  23261. });
  23262. }
  23263. /***/ }),
  23264. /***/ "./js/visualUI/commands/variable_value_menu.js":
  23265. /*!*****************************************************!*\
  23266. !*** ./js/visualUI/commands/variable_value_menu.js ***!
  23267. \*****************************************************/
  23268. /*! exports provided: VAR_OR_VALUE_TYPES, renderMenu */
  23269. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  23270. "use strict";
  23271. __webpack_require__.r(__webpack_exports__);
  23272. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VAR_OR_VALUE_TYPES", function() { return VAR_OR_VALUE_TYPES; });
  23273. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderMenu", function() { return renderMenu; });
  23274. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  23275. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  23276. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  23277. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  23278. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  23279. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  23280. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  23281. /* harmony import */ var _attribution__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./attribution */ "./js/visualUI/commands/attribution.js");
  23282. /* harmony import */ var _writer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./writer */ "./js/visualUI/commands/writer.js");
  23283. /* harmony import */ var _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./repeatNtimes */ "./js/visualUI/commands/repeatNtimes.js");
  23284. var VAR_OR_VALUE_TYPES = Object.freeze({
  23285. only_variable: 1,
  23286. only_value: 2,
  23287. only_function: 3,
  23288. variable_and_function: 4,
  23289. variable_and_value_opt: 5,
  23290. value_and_function: 6,
  23291. all: 7
  23292. });
  23293. function renderMenu(command, ref_object, dom_object, function_obj) {
  23294. var size_field = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 2;
  23295. var expression_element = arguments.length > 5 ? arguments[5] : undefined;
  23296. // Verificar se o objeto atual trata-se de uma chamada de função e conferir se possui a quantidade correta de parâmetros
  23297. // Caso não possua, tem que adicionar as variáveis que servirão de parâmetros:
  23298. if (ref_object.function_called) {
  23299. if (ref_object.function_called.parameters_list) {
  23300. while (ref_object.function_called.parameters_list.length != ref_object.parameters_list.length) {
  23301. if (ref_object.parameters_list.length > ref_object.function_called.parameters_list.length) {
  23302. ref_object.parameters_list.pop();
  23303. } else {
  23304. ref_object.parameters_list.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true));
  23305. }
  23306. }
  23307. }
  23308. }
  23309. var menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23310. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_variable) {
  23311. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_vars">';
  23312. menu_var_or_value += '</div>';
  23313. }
  23314. 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) {
  23315. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('variable');
  23316. menu_var_or_value += '<div class="menu menu_only_vars">';
  23317. menu_var_or_value += '</div></div>';
  23318. }
  23319. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_value) {
  23320. menu_var_or_value = '<input type="text" class="width-dynamic" size="' + size_field + '" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />';
  23321. }
  23322. 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) {
  23323. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_value + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_value') + '</div>';
  23324. }
  23325. if (ref_object.variable_and_value == VAR_OR_VALUE_TYPES.only_function) {
  23326. menu_var_or_value = '<div class="ui dropdown menu_var_or_value_dom" data-varmenu="true"><div class="text"></div><i class="dropdown icon"></i><div class="menu menu_only_functions">';
  23327. menu_var_or_value += '</div>';
  23328. }
  23329. 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) {
  23330. menu_var_or_value += '<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_function');
  23331. menu_var_or_value += '<div class="menu menu_only_functions">';
  23332. menu_var_or_value += '</div></div>';
  23333. /* if (command.type == Models.COMMAND_TYPES.attribution) {
  23334. menu_var_or_value += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23335. menu_var_or_value += '<div class="menu">';
  23336. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23337. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23338. menu_var_or_value += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23339. menu_var_or_value += '</div></div>';
  23340. }*/
  23341. }
  23342. menu_var_or_value += '</div></div>';
  23343. menu_var_or_value = jquery__WEBPACK_IMPORTED_MODULE_0___default()(menu_var_or_value);
  23344. dom_object.append(menu_var_or_value);
  23345. ref_object.dom_object = menu_var_or_value;
  23346. addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23347. addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23348. addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23349. addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element);
  23350. if (ref_object.content || ref_object.function_called) {
  23351. if (ref_object.content) {
  23352. // Verificar se a variável ainda existe:
  23353. var variable_fun = isVarInProgram(ref_object.content, function_obj);
  23354. if (variable_fun) {
  23355. ref_object.content = variable_fun;
  23356. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23357. } else {
  23358. if (ref_object.content && ref_object.content.type) {
  23359. ref_object.content = null;
  23360. appendSelectText(ref_object, menu_var_or_value);
  23361. } else {
  23362. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23363. }
  23364. }
  23365. } else if (ref_object.function_called) {
  23366. // Verificar se a função ainda existe:
  23367. var ret_function = isFunctionInProgram(ref_object.function_called);
  23368. if (ret_function) {
  23369. ref_object.function_called = ret_function;
  23370. renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element);
  23371. } else {
  23372. ref_object.content = null;
  23373. ref_object.row = null;
  23374. ref_object.column = null;
  23375. delete ref_object.function_called;
  23376. delete ref_object.parameters_list;
  23377. appendSelectText(ref_object, menu_var_or_value);
  23378. }
  23379. }
  23380. } else {
  23381. appendSelectText(ref_object, menu_var_or_value);
  23382. }
  23383. }
  23384. function appendSelectText(ref_object, menu_var_or_value) {
  23385. switch (ref_object.variable_and_value) {
  23386. case VAR_OR_VALUE_TYPES.only_variable:
  23387. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_var') + '</i>');
  23388. break;
  23389. case VAR_OR_VALUE_TYPES.all:
  23390. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  23391. break;
  23392. case VAR_OR_VALUE_TYPES.variable_and_function:
  23393. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_all') + '</i>');
  23394. break;
  23395. case VAR_OR_VALUE_TYPES.only_function:
  23396. menu_var_or_value.find('.text').append('<i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('var_menu_select_function') + '</i>');
  23397. break;
  23398. }
  23399. }
  23400. function isFunctionInProgram(function_called_obj) {
  23401. if (function_called_obj.name) {
  23402. if (window.program_obj.functions) {
  23403. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23404. if (window.program_obj.functions[i] == function_called_obj) {
  23405. return window.program_obj.functions[i];
  23406. }
  23407. }
  23408. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23409. if (window.program_obj.functions[i].name == function_called_obj.name) {
  23410. return window.program_obj.functions[i];
  23411. }
  23412. }
  23413. }
  23414. } else if (function_called_obj.identifier) {
  23415. for (var i = 0; i < window.system_functions.length; i++) {
  23416. if (window.system_functions[i].identifier == function_called_obj.identifier) {
  23417. return window.system_functions[i];
  23418. }
  23419. }
  23420. }
  23421. return null;
  23422. }
  23423. function isVarInProgram(var_obj, function_obj) {
  23424. // Verify in locals:
  23425. if (function_obj.variables_list) {
  23426. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23427. if (function_obj.variables_list[i] == var_obj) {
  23428. return function_obj.variables_list[i];
  23429. }
  23430. }
  23431. } // Verify in parameters:
  23432. if (function_obj.parameters_list) {
  23433. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23434. if (function_obj.parameters_list[i] == var_obj) {
  23435. return function_obj.parameters_list[i];
  23436. }
  23437. }
  23438. } // Verify in globals:
  23439. if (window.program_obj.globals) {
  23440. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23441. if (window.program_obj.globals[i] == var_obj) {
  23442. return window.program_obj.globals[i];
  23443. }
  23444. }
  23445. } // If not found, verify if the reference was lost
  23446. if (var_obj) {
  23447. if (function_obj.variables_list) {
  23448. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23449. if (function_obj.variables_list[i].name == var_obj.name) {
  23450. return function_obj.variables_list[i];
  23451. }
  23452. }
  23453. }
  23454. if (function_obj.parameters_list) {
  23455. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23456. if (function_obj.parameters_list[i].name == var_obj.name) {
  23457. return function_obj.parameters_list[i];
  23458. }
  23459. }
  23460. }
  23461. if (window.program_obj.globals) {
  23462. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23463. if (window.program_obj.globals[i].name == var_obj.name) {
  23464. return window.program_obj.globals[i];
  23465. }
  23466. }
  23467. }
  23468. }
  23469. return null;
  23470. }
  23471. function renderPreviousContent(function_obj, menu_var_or_value, ref_object, dom_object, command, expression_element) {
  23472. if (ref_object.function_called) {
  23473. menu_var_or_value.remove();
  23474. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23475. } else if (ref_object.content.type) {
  23476. menu_var_or_value.remove();
  23477. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23478. } else {
  23479. menu_var_or_value.remove();
  23480. variableValueMenuCode(command, ref_object, dom_object, function_obj, menu_var_or_value, expression_element);
  23481. }
  23482. }
  23483. function variableValueMenuCode(command, variable_obj, dom_object, function_obj, menu_var_or_value, expression_element) {
  23484. if (variable_obj.content || variable_obj.function_called) {
  23485. // Verificar se a variável ainda existe:
  23486. var var_fun = isVarInProgram(variable_obj.content, function_obj);
  23487. if (var_fun) {
  23488. variable_obj.content = var_fun;
  23489. } else {
  23490. if (variable_obj.content && variable_obj.content.type) {
  23491. variable_obj.content = null;
  23492. appendSelectText(variable_obj, menu_var_or_value);
  23493. }
  23494. }
  23495. } else {
  23496. appendSelectText(variable_obj, menu_var_or_value);
  23497. }
  23498. if (variable_obj.content == null && variable_obj.function_called == null) {
  23499. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23500. return;
  23501. }
  23502. var ret = '';
  23503. if (variable_obj.function_called) {
  23504. if (variable_obj.function_called.parameters_list == null || variable_obj.function_called.length == 0) {
  23505. menu_var_or_value.find('.text').text(' ');
  23506. dom_object.find('.menu_var_or_value_dom').remove();
  23507. var parameters_menu;
  23508. if (variable_obj.function_called.name) {
  23509. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23510. } else {
  23511. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23512. }
  23513. parameters_menu += '<span> ) </span></div>';
  23514. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23515. dom_object.append(parameters_menu);
  23516. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23517. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23518. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23519. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23520. context_menu += '<div class="menu">';
  23521. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23522. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23523. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23524. context_menu += '</div></div>';
  23525. }*/
  23526. context_menu += '</div></div>';
  23527. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23528. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23529. context_menu.dropdown({
  23530. onChange: function onChange(value, text, $selectedItem) {
  23531. console.log('S1');
  23532. if ($selectedItem.data('clear')) {
  23533. console.log('PP1');
  23534. dom_object.text('');
  23535. variable_obj.content = null;
  23536. variable_obj.row = null;
  23537. variable_obj.column = null;
  23538. delete variable_obj.function_called;
  23539. delete variable_obj.parameters_list;
  23540. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23541. }
  23542. if ($selectedItem.data('exp')) {
  23543. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23544. }
  23545. },
  23546. selectOnKeydown: false
  23547. });
  23548. } else {
  23549. menu_var_or_value.find('.text').text(' ');
  23550. dom_object.find('.menu_var_or_value_dom').remove();
  23551. var parameters_menu;
  23552. if (variable_obj.function_called.name) {
  23553. parameters_menu = '<div class="parameters_function_called"> ' + variable_obj.function_called.name + ' <span> ( </span>';
  23554. } else {
  23555. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(variable_obj.function_called.identifier) + '</i> <span> ( </span>';
  23556. }
  23557. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23558. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23559. if (j + 1 != variable_obj.function_called.parameters_list.length) {
  23560. parameters_menu += ' , ';
  23561. }
  23562. }
  23563. parameters_menu += '<span> ) </span></div>';
  23564. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23565. dom_object.append(parameters_menu);
  23566. for (var j = 0; j < variable_obj.function_called.parameters_list.length; j++) {
  23567. renderMenu(command, variable_obj.parameters_list[j], parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23568. }
  23569. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23570. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23571. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23572. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23573. context_menu += '<div class="menu">';
  23574. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23575. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23576. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23577. context_menu += '</div></div>';
  23578. }*/
  23579. context_menu += '</div></div>';
  23580. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23581. context_menu.insertAfter(parameters_menu);
  23582. context_menu.dropdown({
  23583. onChange: function onChange(value, text, $selectedItem) {
  23584. console.log('S2');
  23585. if ($selectedItem.data('clear')) {
  23586. console.log('PP2');
  23587. dom_object.text('');
  23588. variable_obj.content = null;
  23589. variable_obj.row = null;
  23590. variable_obj.column = null;
  23591. delete variable_obj.function_called;
  23592. delete variable_obj.parameters_list;
  23593. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23594. }
  23595. if ($selectedItem.data('exp')) {
  23596. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23597. }
  23598. },
  23599. selectOnKeydown: false
  23600. });
  23601. }
  23602. } else if (variable_obj.content.type) {
  23603. var variable_render = "";
  23604. if (variable_obj.content.dimensions == 1 && variable_obj.dimensions != 1) {
  23605. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23606. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  23607. variable_render += '</div>';
  23608. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23609. dom_object.append(variable_render);
  23610. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23611. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23612. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23613. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23614. context_menu += '<div class="menu">';
  23615. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23616. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23617. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23618. context_menu += '</div></div>';
  23619. }*/
  23620. context_menu += '</div></div>';
  23621. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23622. variable_render.append(context_menu);
  23623. context_menu.dropdown({
  23624. onChange: function onChange(value, text, $selectedItem) {
  23625. console.log('S3');
  23626. if ($selectedItem.data('clear')) {
  23627. console.log('PP3');
  23628. dom_object.text('');
  23629. variable_obj.content = null;
  23630. variable_obj.row = null;
  23631. variable_obj.column = null;
  23632. delete variable_obj.function_called;
  23633. delete variable_obj.parameters_list;
  23634. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23635. }
  23636. if ($selectedItem.data('exp')) {
  23637. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23638. }
  23639. },
  23640. selectOnKeydown: false
  23641. });
  23642. if (!variable_obj.column) {
  23643. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23644. }
  23645. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23646. } else if (variable_obj.content.dimensions == 2 && variable_obj.dimensions != 2) {
  23647. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23648. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span>';
  23649. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ] </span>';
  23650. variable_render += '</div>';
  23651. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23652. dom_object.append(variable_render);
  23653. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23654. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23655. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23656. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23657. context_menu += '<div class="menu">';
  23658. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23659. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23660. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23661. context_menu += '</div></div>';
  23662. }*/
  23663. context_menu += '</div></div>';
  23664. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23665. variable_render.append(context_menu);
  23666. context_menu.dropdown({
  23667. onChange: function onChange(value, text, $selectedItem) {
  23668. console.log('S4');
  23669. if ($selectedItem.data('clear')) {
  23670. console.log('PP4');
  23671. dom_object.text('');
  23672. variable_obj.content = null;
  23673. variable_obj.row = null;
  23674. variable_obj.column = null;
  23675. delete variable_obj.function_called;
  23676. delete variable_obj.parameters_list;
  23677. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23678. }
  23679. if ($selectedItem.data('exp')) {
  23680. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23681. }
  23682. },
  23683. selectOnKeydown: false
  23684. });
  23685. if (!variable_obj.column) {
  23686. variable_obj.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23687. }
  23688. if (!variable_obj.row) {
  23689. variable_obj.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23690. }
  23691. variableValueMenuCode(command, variable_obj.row, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.row_container')), function_obj, menu_var_or_value, expression_element);
  23692. variableValueMenuCode(command, variable_obj.column, jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render.find('.column_container')), function_obj, menu_var_or_value, expression_element);
  23693. } else {
  23694. variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content.name + '</span>';
  23695. variable_render += '</div>';
  23696. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23697. dom_object.append(variable_render);
  23698. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23699. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23700. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  23701. console.log('dom_object6');
  23702. console.log(dom_object);
  23703. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23704. context_menu += '<div class="menu">';
  23705. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23706. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23707. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23708. context_menu += '</div></div>';
  23709. }*/
  23710. context_menu += '</div></div>';
  23711. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23712. variable_render.append(context_menu);
  23713. context_menu.dropdown({
  23714. onChange: function onChange(value, text, $selectedItem) {
  23715. console.log('S5');
  23716. if ($selectedItem.data('clear')) {
  23717. console.log('PP5');
  23718. dom_object.text('');
  23719. variable_obj.content = null;
  23720. variable_obj.row = null;
  23721. variable_obj.column = null;
  23722. delete variable_obj.function_called;
  23723. delete variable_obj.parameters_list;
  23724. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23725. }
  23726. if ($selectedItem.data('exp')) {
  23727. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23728. }
  23729. },
  23730. selectOnKeydown: false
  23731. });
  23732. }
  23733. } else {
  23734. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_obj.content + '</span>';
  23735. variable_render += '</div>';
  23736. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  23737. dom_object.append(variable_render);
  23738. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23739. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23740. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23741. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23742. context_menu += '<div class="menu">';
  23743. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23744. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23745. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23746. context_menu += '</div></div>';
  23747. }*/
  23748. context_menu += '</div></div>';
  23749. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23750. if (variable_obj.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23751. context_menu.insertAfter(variable_render);
  23752. }
  23753. context_menu.dropdown({
  23754. onChange: function onChange(value, text, $selectedItem) {
  23755. console.log('S6');
  23756. if ($selectedItem.data('clear')) {
  23757. console.log('PP6');
  23758. dom_object.text('');
  23759. variable_obj.content = null;
  23760. variable_obj.row = null;
  23761. variable_obj.column = null;
  23762. delete variable_obj.function_called;
  23763. delete variable_obj.parameters_list;
  23764. dom_object.find('.value_rendered').remove();
  23765. dom_object.find('.context_menu_clear').remove();
  23766. dom_object.find('.width-dynamic-minus').remove();
  23767. renderMenu(command, variable_obj, dom_object, function_obj, 2, expression_element);
  23768. }
  23769. if ($selectedItem.data('exp')) {
  23770. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, variable_obj, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23771. }
  23772. },
  23773. selectOnKeydown: false
  23774. });
  23775. variable_render.on('click', function (e) {
  23776. variable_render.remove();
  23777. variable_render.empty();
  23778. variable_render.remove();
  23779. dom_object.empty();
  23780. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23781. openInputToValue(command, variable_obj, dom_object, menu_var_or_value, function_obj, expression_element);
  23782. });
  23783. }
  23784. }
  23785. function addIVProgFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23786. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23787. sub_menu.append('<div class="divider"></div><div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_header_ivprog_functions') + '</div>');
  23788. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_math') + '<div class="menu menu_math_functions"></div></div>');
  23789. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_text') + '<div class="menu menu_text_functions"></div></div>');
  23790. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_arrangement') + '<div class="menu menu_arrangement_functions"></div></div>');
  23791. sub_menu.append('<div class="item"><i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_menu_functions_conversion') + '<div class="menu menu_conversion_functions"></div></div>'); // Insert Math functions:
  23792. for (var i = 0; i < window.system_functions.length; i++) {
  23793. var t = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item"></div>');
  23794. t.data('function_reference', window.system_functions[i]);
  23795. t.data('option', VAR_OR_VALUE_TYPES.only_function);
  23796. t.text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(window.system_functions[i].identifier));
  23797. switch (window.system_functions[i].category) {
  23798. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math:
  23799. sub_menu.find('.menu_math_functions').append(t);
  23800. break;
  23801. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text:
  23802. sub_menu.find('.menu_text_functions').append(t);
  23803. break;
  23804. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement:
  23805. sub_menu.find('.menu_arrangement_functions').append(t);
  23806. break;
  23807. case _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion:
  23808. sub_menu.find('.menu_conversion_functions').append(t);
  23809. break;
  23810. }
  23811. }
  23812. }
  23813. function addFunctionsToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23814. var sub_menu = menu_var_or_value.find('.menu_only_functions');
  23815. sub_menu.text('');
  23816. for (var i = 0; i < window.program_obj.functions.length; i++) {
  23817. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_function + '">' + window.program_obj.functions[i].name + ' </div>');
  23818. temp.data('function_reference', window.program_obj.functions[i]);
  23819. sub_menu.append(temp);
  23820. }
  23821. }
  23822. function addVariablesToMenu(function_obj, menu_var_or_value, ref_object, expression_element) {
  23823. var sub_menu = menu_var_or_value.find('.menu_only_vars');
  23824. sub_menu.text('');
  23825. var is_there = false;
  23826. if (window.program_obj.globals) {
  23827. if (ref_object.include_constant) {
  23828. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23829. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23830. temp.data('variable_reference', window.program_obj.globals[i]);
  23831. sub_menu.append(temp);
  23832. is_there = true;
  23833. }
  23834. } else {
  23835. for (var i = 0; i < window.program_obj.globals.length; i++) {
  23836. if (!window.program_obj.globals[i].is_constant) {
  23837. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + window.program_obj.globals[i].name + ' </div>');
  23838. temp.data('variable_reference', window.program_obj.globals[i]);
  23839. sub_menu.append(temp);
  23840. is_there = true;
  23841. }
  23842. }
  23843. }
  23844. }
  23845. if (function_obj.parameters_list) {
  23846. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  23847. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.parameters_list[i].name + ' </div>');
  23848. temp.data('variable_reference', function_obj.parameters_list[i]);
  23849. sub_menu.append(temp);
  23850. is_there = true;
  23851. }
  23852. }
  23853. if (function_obj.variables_list) {
  23854. for (var i = 0; i < function_obj.variables_list.length; i++) {
  23855. var temp = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item" data-option="' + VAR_OR_VALUE_TYPES.only_variable + '">' + function_obj.variables_list[i].name + ' </div>');
  23856. temp.data('variable_reference', function_obj.variables_list[i]);
  23857. sub_menu.append(temp);
  23858. is_there = true;
  23859. }
  23860. }
  23861. if (!is_there) {
  23862. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="header">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable') + '</div>'));
  23863. sub_menu.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="item disabled">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_none_variable_instruction') + '</div>'));
  23864. }
  23865. }
  23866. function addHandlers(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  23867. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  23868. menu_var_or_value.dropdown({
  23869. onChange: function onChange(value, text, $selectedItem) {
  23870. console.log('S7');
  23871. dom_object.find('.var_name').remove();
  23872. switch ($selectedItem.data('option')) {
  23873. case VAR_OR_VALUE_TYPES.only_function:
  23874. openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('function_reference'), expression_element);
  23875. break;
  23876. case VAR_OR_VALUE_TYPES.only_value:
  23877. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23878. break;
  23879. case VAR_OR_VALUE_TYPES.only_variable:
  23880. openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, jquery__WEBPACK_IMPORTED_MODULE_0___default()($selectedItem).data('variable_reference'), expression_element);
  23881. break;
  23882. }
  23883. if ($selectedItem.data('exp')) {
  23884. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23885. }
  23886. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  23887. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23888. }
  23889. },
  23890. selectOnKeydown: false
  23891. });
  23892. }
  23893. dom_object.find('.width-dynamic').on('input', function () {
  23894. var inputWidth = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).textWidth() + 10;
  23895. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).focus();
  23896. var tmpStr = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val();
  23897. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val('');
  23898. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val(tmpStr);
  23899. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
  23900. width: inputWidth
  23901. });
  23902. }).trigger('input');
  23903. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  23904. dom_object.parent().on('click', function (e) {
  23905. dom_object.find('.value_rendered').remove();
  23906. dom_object.find('.value_rendered').empty();
  23907. dom_object.find('.value_rendered').remove();
  23908. dom_object.empty();
  23909. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  23910. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  23911. });
  23912. }
  23913. }
  23914. function openInputToFunction(command, ref_object, dom_object, menu_var_or_value, function_obj, function_selected, expression_element) {
  23915. ref_object.function_called = function_selected;
  23916. ref_object.parameters_list = [];
  23917. if (function_selected.parameters_list != null && function_selected.parameters_list.length > 0) {
  23918. menu_var_or_value.find('.text').text(' ');
  23919. dom_object.find('.menu_var_or_value_dom').remove();
  23920. var parameters_menu;
  23921. if (function_selected.name) {
  23922. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23923. } else {
  23924. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23925. }
  23926. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23927. parameters_menu += '<div class="render_style_param parameter_' + j + '"></div>';
  23928. if (j + 1 != function_selected.parameters_list.length) {
  23929. parameters_menu += ' , ';
  23930. }
  23931. }
  23932. parameters_menu += '<span> ) </span></div>';
  23933. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23934. dom_object.append(parameters_menu);
  23935. for (var j = 0; j < function_selected.parameters_list.length; j++) {
  23936. var temp;
  23937. if (function_selected.parameters_list[j].dimensions > 0) {
  23938. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.variable_and_function, null, null, null, true, function_selected.parameters_list[j].dimensions);
  23939. } else {
  23940. temp = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  23941. }
  23942. ref_object.parameters_list.push(temp);
  23943. renderMenu(command, temp, parameters_menu.find('.parameter_' + j), function_obj, 2, expression_element);
  23944. }
  23945. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23946. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23947. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23948. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23949. context_menu += '<div class="menu">';
  23950. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23951. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23952. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23953. context_menu += '</div></div>';
  23954. }*/
  23955. context_menu += '</div></div>';
  23956. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  23957. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  23958. context_menu.dropdown({
  23959. onChange: function onChange(value, text, $selectedItem) {
  23960. console.log('S8');
  23961. if ($selectedItem.data('clear')) {
  23962. console.log('PP7');
  23963. dom_object.text('');
  23964. ref_object.content = null;
  23965. ref_object.row = null;
  23966. ref_object.column = null;
  23967. delete ref_object.function_called;
  23968. delete ref_object.parameters_list;
  23969. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  23970. }
  23971. if ($selectedItem.data('exp')) {
  23972. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  23973. }
  23974. },
  23975. selectOnKeydown: false
  23976. });
  23977. } else {
  23978. menu_var_or_value.find('.text').text(' ');
  23979. dom_object.find('.menu_var_or_value_dom').remove();
  23980. var parameters_menu;
  23981. if (function_selected.name) {
  23982. parameters_menu = '<div class="parameters_function_called"> ' + function_selected.name + ' <span> ( </span>';
  23983. } else {
  23984. parameters_menu = '<div class="parameters_function_called"> <i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.category) + '.' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_selected.identifier) + '</i> <span> ( </span>';
  23985. }
  23986. parameters_menu += '<span> ) </span></div>';
  23987. parameters_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameters_menu);
  23988. dom_object.append(parameters_menu);
  23989. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  23990. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  23991. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  23992. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  23993. context_menu += '<div class="menu">';
  23994. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  23995. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  23996. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  23997. context_menu += '</div></div>';
  23998. }*/
  23999. context_menu += '</div></div>';
  24000. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24001. context_menu.insertAfter(dom_object.find('.parameters_function_called'));
  24002. context_menu.dropdown({
  24003. onChange: function onChange(value, text, $selectedItem) {
  24004. console.log('S9');
  24005. if ($selectedItem.data('clear')) {
  24006. console.log('PP8');
  24007. dom_object.text('');
  24008. ref_object.content = null;
  24009. ref_object.row = null;
  24010. ref_object.column = null;
  24011. delete ref_object.function_called;
  24012. delete ref_object.parameters_list;
  24013. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24014. }
  24015. if ($selectedItem.data('exp')) {
  24016. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24017. }
  24018. },
  24019. selectOnKeydown: false
  24020. });
  24021. }
  24022. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24023. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  24024. }*/
  24025. }
  24026. function openInputToVariable(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected, expression_element) {
  24027. ref_object.content = variable_selected;
  24028. menu_var_or_value.find('.text').text(' ');
  24029. dom_object.find('.menu_var_or_value_dom').remove();
  24030. var variable_render = '<div class="variable_rendered"> <span class="var_name">' + variable_selected.name + '</span>';
  24031. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  24032. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  24033. }
  24034. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  24035. variable_render += ' <span>[ </span> <div class="row_container"></div> <span> ]</span> ';
  24036. variable_render += ' <span>[ </span> <div class="column_container"></div> <span> ]</span>';
  24037. }
  24038. variable_render += '</div>';
  24039. variable_render = jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_render);
  24040. dom_object.append(variable_render);
  24041. if (variable_selected.dimensions == 1 && ref_object.dimensions != 1) {
  24042. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24043. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  24044. }
  24045. if (variable_selected.dimensions == 2 && ref_object.dimensions != 2) {
  24046. ref_object.row = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24047. renderMenu(command, ref_object.row, variable_render.find('.row_container'), function_obj, 2, expression_element);
  24048. ref_object.column = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](VAR_OR_VALUE_TYPES.all, null, null, null, true);
  24049. renderMenu(command, ref_object.column, variable_render.find('.column_container'), function_obj, 2, expression_element);
  24050. }
  24051. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24052. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24053. /*if (command.type == Models.COMMAND_TYPES.attribution && !dom_object.hasClass('var_attributed')) {
  24054. console.log("dom_object 10: ");
  24055. console.log(dom_object);
  24056. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24057. context_menu += '<div class="menu">';
  24058. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24059. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24060. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24061. context_menu += '</div></div>';
  24062. }*/
  24063. context_menu += '</div></div>';
  24064. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24065. context_menu.insertAfter(dom_object.find('.variable_rendered'));
  24066. context_menu.dropdown({
  24067. onChange: function onChange(value, text, $selectedItem) {
  24068. console.log('S10');
  24069. if ($selectedItem.data('clear')) {
  24070. console.log('PP9');
  24071. dom_object.text('');
  24072. ref_object.content = null;
  24073. ref_object.row = null;
  24074. ref_object.column = null;
  24075. delete ref_object.function_called;
  24076. delete ref_object.parameters_list;
  24077. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24078. }
  24079. if ($selectedItem.data('exp')) {
  24080. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24081. }
  24082. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes) {
  24083. _repeatNtimes__WEBPACK_IMPORTED_MODULE_8__["manageClearExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24084. }
  24085. },
  24086. selectOnKeydown: false
  24087. });
  24088. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24089. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj, variable_selected);
  24090. }*/
  24091. }
  24092. function openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element) {
  24093. if (ref_object.content == null) {
  24094. ref_object.content = "";
  24095. }
  24096. menu_var_or_value.find('.text').text(' ');
  24097. var field = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<input type="text" size="2" class="width-dynamic-minus" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" />');
  24098. field.insertBefore(dom_object.find('.menu_var_or_value_dom'));
  24099. var rendered = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="value_rendered"></div>');
  24100. rendered.insertBefore(field);
  24101. field.focus();
  24102. field.val(ref_object.content);
  24103. var context_menu = '<div class="ui dropdown context_menu_clear"><div class="text"></div><i class="dropdown icon"></i><div class="menu">';
  24104. context_menu += '<div class="item" data-clear="true">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('btn_clear') + '</div>';
  24105. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24106. context_menu += '<div class="item"><i class="dropdown icon"></i>' + LocalizedStrings.getUI('text_change');
  24107. context_menu += '<div class="menu">';
  24108. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.exp_op_exp+'">EXP OP EXP</div>';
  24109. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.op_exp+'">OP EXP</div>';
  24110. context_menu += '<div class="item" data-exp="'+Models.EXPRESSION_ELEMENTS.par_exp_par+'">( EXP )</div>';
  24111. context_menu += '</div></div>';
  24112. }*/
  24113. context_menu += '</div></div>';
  24114. context_menu = jquery__WEBPACK_IMPORTED_MODULE_0___default()(context_menu);
  24115. dom_object.find('.menu_var_or_value_dom').remove();
  24116. if (ref_object.variable_and_value != VAR_OR_VALUE_TYPES.only_value) {
  24117. context_menu.insertAfter(field);
  24118. }
  24119. context_menu.dropdown({
  24120. onChange: function onChange(value, text, $selectedItem) {
  24121. console.log('S11');
  24122. if ($selectedItem.data('clear')) {
  24123. console.log('PP10');
  24124. dom_object.text('');
  24125. dom_object.find('.value_rendered').remove();
  24126. dom_object.find('.context_menu_clear').remove();
  24127. dom_object.find('.width-dynamic-minus').remove();
  24128. ref_object.content = null;
  24129. ref_object.row = null;
  24130. ref_object.column = null;
  24131. delete ref_object.function_called;
  24132. delete ref_object.parameters_list;
  24133. renderMenu(command, ref_object, dom_object, function_obj, 2, expression_element);
  24134. }
  24135. if ($selectedItem.data('exp')) {
  24136. _attribution__WEBPACK_IMPORTED_MODULE_6__["manageExpressionElements"](command, ref_object, dom_object, menu_var_or_value, function_obj, $selectedItem, expression_element);
  24137. }
  24138. },
  24139. selectOnKeydown: false
  24140. });
  24141. dom_object.find('.width-dynamic-minus').focusout(function () {
  24142. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  24143. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  24144. }
  24145. rendered.text(ref_object.content);
  24146. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24147. });
  24148. dom_object.find('.width-dynamic-minus').on('keydown', function (e) {
  24149. var code = e.keyCode || e.which;
  24150. if (code == 13) {
  24151. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim()) {
  24152. ref_object.content = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).val().trim();
  24153. }
  24154. rendered.text(ref_object.content);
  24155. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24156. }
  24157. if (code == 27) {
  24158. rendered.text(ref_object.content);
  24159. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).remove();
  24160. }
  24161. });
  24162. if (command.type == _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment) {
  24163. /*rendered.parent().on('click', function(e) {
  24164. rendered.parent().off();
  24165. console.log("TTT14");
  24166. rendered.remove();
  24167. rendered.empty();
  24168. rendered.remove();
  24169. dom_object.empty();
  24170. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  24171. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element)
  24172. });*/
  24173. }
  24174. rendered.on('click', function (e) {
  24175. console.log("TTT2");
  24176. rendered.remove();
  24177. rendered.empty();
  24178. rendered.remove();
  24179. dom_object.empty();
  24180. dom_object.append('<span class="menu_var_or_value_dom"> </span>');
  24181. openInputToValue(command, ref_object, dom_object, menu_var_or_value, function_obj, expression_element);
  24182. });
  24183. /*if (command.type == Models.COMMAND_TYPES.attribution) {
  24184. AttribuitionsManagement.renderMenuOperations(command, ref_object, dom_object, menu_var_or_value, function_obj);
  24185. }*/
  24186. }
  24187. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  24188. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  24189. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  24190. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  24191. };
  24192. /***/ }),
  24193. /***/ "./js/visualUI/commands/whiletrue.js":
  24194. /*!*******************************************!*\
  24195. !*** ./js/visualUI/commands/whiletrue.js ***!
  24196. \*******************************************/
  24197. /*! exports provided: createFloatingCommand, renderCommand */
  24198. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24199. "use strict";
  24200. __webpack_require__.r(__webpack_exports__);
  24201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  24202. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  24203. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24204. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24205. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  24206. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24207. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24208. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  24209. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  24210. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  24211. /* harmony import */ var _conditional_expression__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./conditional_expression */ "./js/visualUI/commands/conditional_expression.js");
  24212. /* harmony import */ var _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./contextualized_menu */ "./js/visualUI/commands/contextualized_menu.js");
  24213. function createFloatingCommand() {
  24214. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui whiletrue created_element"> <i class="ui icon small sync"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' ( x < 10 ) <br> </span></div>');
  24215. }
  24216. function renderCommand(command, function_obj) {
  24217. var ret = '';
  24218. ret += '<div class="ui whiletrue command_container"> <i class="ui icon small sync command_drag"></i> <i class="ui icon times red button_remove_command"></i> <div class="ui context_menu"></div> <span class="span_command_spec"> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_code_while') + ' </span>';
  24219. ret += '<span class="span_command_spec"> ( </span> <div class="conditional_expression"></div> <span class="span_command_spec"> ) </span>';
  24220. ret += ' </span>';
  24221. ret += '<div class="ui block_commands">';
  24222. ret += '</div>';
  24223. ret += '<span> </span>';
  24224. ret += '</div>';
  24225. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24226. el.data('command', command);
  24227. el.find('.block_commands').data('command', command);
  24228. addHandlers(command, function_obj, el);
  24229. _contextualized_menu__WEBPACK_IMPORTED_MODULE_8__["renderMenu"](command, el.find('.context_menu'), function_obj, el);
  24230. _conditional_expression__WEBPACK_IMPORTED_MODULE_7__["renderExpression"](command, command.expression, function_obj, el.find('.conditional_expression'));
  24231. if (command.commands_block) {
  24232. for (var j = 0; j < command.commands_block.length; j++) {
  24233. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](command.commands_block[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(el.find('.block_commands')[0]), 3, function_obj);
  24234. }
  24235. }
  24236. return el;
  24237. }
  24238. function addHandlers(command, function_obj, whiletrue_dom) {
  24239. whiletrue_dom.find('.button_remove_command').on('click', function () {
  24240. if (_commands__WEBPACK_IMPORTED_MODULE_6__["removeCommand"](command, function_obj, whiletrue_dom)) {
  24241. whiletrue_dom.fadeOut(400, function () {
  24242. whiletrue_dom.remove();
  24243. });
  24244. }
  24245. });
  24246. }
  24247. /***/ }),
  24248. /***/ "./js/visualUI/commands/writer.js":
  24249. /*!****************************************!*\
  24250. !*** ./js/visualUI/commands/writer.js ***!
  24251. \****************************************/
  24252. /*! exports provided: createFloatingCommand, renderCommand, addContent */
  24253. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24254. "use strict";
  24255. __webpack_require__.r(__webpack_exports__);
  24256. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createFloatingCommand", function() { return createFloatingCommand; });
  24257. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderCommand", function() { return renderCommand; });
  24258. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addContent", function() { return addContent; });
  24259. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24260. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24261. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../types */ "./js/visualUI/types.js");
  24262. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24263. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24264. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../globals */ "./js/visualUI/globals.js");
  24265. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../variables */ "./js/visualUI/variables.js");
  24266. /* harmony import */ var _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  24267. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../commands */ "./js/visualUI/commands.js");
  24268. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../Sortable.js */ "./js/Sortable.js");
  24269. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_8___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_8__);
  24270. function createFloatingCommand() {
  24271. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="ui writer created_element"> <i class="ui icon small upload"></i> <span> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' var </span></div>');
  24272. }
  24273. function renderCommand(command, function_obj) {
  24274. var ret = '';
  24275. ret += '<div class="ui writer command_container"> <i class="ui icon small upload command_drag"></i> <i class="ui icon times red button_remove_command"></i> <span class="span_command_spec">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_command_write') + ' ( </span><div class="all_elements_write"></div> <span class="close_parentheses span_command_spec">)</span> </div>';
  24276. var el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24277. el.data('command', command);
  24278. for (var i = 0; i < command.content.length; i++) {
  24279. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  24280. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  24281. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24282. div_parent_with_handler.append(new_div_item);
  24283. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24284. el.find('.all_elements_write').append(div_parent_with_handler);
  24285. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, command.content[i], new_div_item, function_obj);
  24286. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  24287. addHandlersManager(command, function_obj, el, div_parent_with_handler, command.content[i]);
  24288. }
  24289. if (command.content.length == 0) {
  24290. addHandlerIconAdd(el.find('.all_elements_write'), command, function_obj);
  24291. }
  24292. addHandlers(command, function_obj, el);
  24293. return el;
  24294. }
  24295. function addHandlersManager(command, function_obj, writer_dom, item_div, content_element) {
  24296. item_div.find('.times').on('click', function () {
  24297. for (var i = 0; i < command.content.length; i++) {
  24298. if (command.content[i] == content_element) {
  24299. delete command.content[i];
  24300. command.content.splice(i, 1);
  24301. item_div.children().off();
  24302. item_div.off();
  24303. item_div.fadeOut();
  24304. if (command.content.length > 0) {
  24305. item_div.next('.icon_add_item_to_writer').fadeOut();
  24306. }
  24307. break;
  24308. }
  24309. }
  24310. });
  24311. }
  24312. function addHandlers(command, function_obj, writer_dom) {
  24313. writer_dom.find('.button_remove_command').on('click', function () {
  24314. if (_commands__WEBPACK_IMPORTED_MODULE_7__["removeCommand"](command, function_obj, writer_dom)) {
  24315. writer_dom.fadeOut(400, function () {
  24316. writer_dom.remove();
  24317. });
  24318. }
  24319. });
  24320. Sortable.create(writer_dom.find(".all_elements_write")[0], {
  24321. handle: '.ellipsis',
  24322. animation: 100,
  24323. ghostClass: 'ghost',
  24324. group: 'writer_' + Math.floor(Math.random() * 10000000),
  24325. draggable: '.div_parent_handler',
  24326. onEnd: function onEnd(evt) {
  24327. command.content.splice(evt.newIndex, 0, command.content.splice(evt.oldIndex, 1)[0]);
  24328. writer_dom.empty();
  24329. writer_dom.replaceWith(renderCommand(command, function_obj));
  24330. }
  24331. });
  24332. }
  24333. function addHandlerIconAdd(dom_object, command, function_obj) {
  24334. var insert_after = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
  24335. var after_which = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  24336. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  24337. if (!insert_after) {
  24338. dom_object.append(icon_add_item);
  24339. } else {
  24340. icon_add_item.insertAfter(after_which);
  24341. }
  24342. icon_add_item.on('click', function (e) {
  24343. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler" style="display:none;"></div>');
  24344. var new_div_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="var_value_menu_div"></div>');
  24345. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24346. div_parent_with_handler.append(new_div_item);
  24347. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24348. div_parent_with_handler.insertAfter(icon_add_item);
  24349. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  24350. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  24351. addHandlerIconAdd(dom_object, command, function_obj, true, div_parent_with_handler);
  24352. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  24353. var pos = 1;
  24354. dom_object.find('.icon_add_item_to_writer').each(function () {
  24355. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).get(0) === icon_add_item.get(0)) {
  24356. command.content.splice(pos, 0, new_related_menu);
  24357. } else {
  24358. pos++;
  24359. }
  24360. });
  24361. if (command.content.length == 1) {
  24362. icon_add_item.remove();
  24363. }
  24364. div_parent_with_handler.fadeIn();
  24365. });
  24366. }
  24367. function addContent(command, ref_object, dom_object, menu_var_or_value, function_obj, ref_object_content) {
  24368. if (dom_object.hasClass('var_value_menu_div')) {
  24369. var icon_add_item = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon plus square outline icon_add_item_to_writer"></i> ');
  24370. icon_add_item.insertAfter(dom_object);
  24371. icon_add_item.on('click', function (e) {
  24372. var div_parent_with_handler = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<div class="div_parent_handler"></div>');
  24373. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="ui icon ellipsis vertical inverted handler"></i>'));
  24374. div_parent_with_handler.append(new_div_item);
  24375. div_parent_with_handler.append(jquery__WEBPACK_IMPORTED_MODULE_0___default()('<i class="white inverted icon times handler"></i>'));
  24376. div_parent_with_handler.insertAfter(icon_add_item);
  24377. var new_related_menu = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["VAR_OR_VALUE_TYPES"].all, null, null, null, true);
  24378. _variable_value_menu__WEBPACK_IMPORTED_MODULE_6__["renderMenu"](command, new_related_menu, new_div_item, function_obj);
  24379. addHandlersManager(command, function_obj, dom_object, div_parent_with_handler, new_related_menu);
  24380. command.content.push(new_related_menu);
  24381. if (command.content.length == 1) {
  24382. icon_add_item.remove();
  24383. }
  24384. });
  24385. }
  24386. }
  24387. /***/ }),
  24388. /***/ "./js/visualUI/functions.js":
  24389. /*!**********************************!*\
  24390. !*** ./js/visualUI/functions.js ***!
  24391. \**********************************/
  24392. /*! exports provided: renderFunction, initVisualUI, addFunctionChangeListener, addGlobalChangeListener, removeGlobalListener, removeFunctionListener */
  24393. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  24394. "use strict";
  24395. __webpack_require__.r(__webpack_exports__);
  24396. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderFunction", function() { return renderFunction; });
  24397. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "initVisualUI", function() { return initVisualUI; });
  24398. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addFunctionChangeListener", function() { return addFunctionChangeListener; });
  24399. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobalChangeListener", function() { return addGlobalChangeListener; });
  24400. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeGlobalListener", function() { return removeGlobalListener; });
  24401. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeFunctionListener", function() { return removeFunctionListener; });
  24402. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  24403. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  24404. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  24405. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  24406. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  24407. /* harmony import */ var _globals__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./globals */ "./js/visualUI/globals.js");
  24408. /* harmony import */ var _variables__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./variables */ "./js/visualUI/variables.js");
  24409. /* harmony import */ var _commands__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./commands */ "./js/visualUI/commands.js");
  24410. /* harmony import */ var _code_generator__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./code_generator */ "./js/visualUI/code_generator.js");
  24411. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  24412. /* harmony import */ var _io_domConsole__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./../io/domConsole */ "./js/io/domConsole.js");
  24413. /* harmony import */ var _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./../ast/ivprogParser */ "./js/ast/ivprogParser.js");
  24414. /* harmony import */ var _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./../processor/ivprogProcessor */ "./js/processor/ivprogProcessor.js");
  24415. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  24416. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_12__);
  24417. /* harmony import */ var _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../processor/semantic/semanticAnalyser */ "./js/processor/semantic/semanticAnalyser.js");
  24418. /* harmony import */ var _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../assessment/ivprogAssessment */ "./js/assessment/ivprogAssessment.js");
  24419. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  24420. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  24421. /* harmony import */ var _ima_version_json__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./../../.ima_version.json */ "./.ima_version.json");
  24422. var _ima_version_json__WEBPACK_IMPORTED_MODULE_17___namespace = /*#__PURE__*/__webpack_require__.t(/*! ./../../.ima_version.json */ "./.ima_version.json", 1);
  24423. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../Sortable.js */ "./js/Sortable.js");
  24424. /* harmony import */ var _Sortable_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(_Sortable_js__WEBPACK_IMPORTED_MODULE_18__);
  24425. var counter_new_functions = 0;
  24426. var counter_new_parameters = 0;
  24427. var ivprog_version = _ima_version_json__WEBPACK_IMPORTED_MODULE_17__.version;
  24428. var globalChangeListeners = [];
  24429. var functionsChangeListeners = [];
  24430. var domConsole = null;
  24431. window.studentGrade = null;
  24432. window.LocalizedStrings = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"];
  24433. var program = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Program"]();
  24434. window.system_functions = []; // Adding math functions:
  24435. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sin', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24436. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$cos', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24437. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$tan', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24438. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$sqrt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24439. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$pow', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24440. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$log', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24441. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$abs', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24442. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$negate', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24443. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$invert', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24444. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$max', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math));
  24445. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$min', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].math)); // Adding text functions:
  24446. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$substring', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  24447. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$length', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  24448. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$uppercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  24449. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$lowercase', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text));
  24450. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$charAt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true), new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].text)); // Adding arrangement functions:
  24451. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$numElements', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 1)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  24452. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixLines', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement));
  24453. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$matrixColumns', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].variable_and_function, null, null, null, true, 2)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].arrangement)); // Adding conversion functions:
  24454. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24455. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24456. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$isBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24457. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castReal', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24458. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castInt', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24459. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castBool', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24460. window.system_functions.push(new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SystemFunction"]('$castString', _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT, 0, [new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["VariableValueMenu"](_commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_8__["VAR_OR_VALUE_TYPES"].all, null, null, null, true)], null, _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["SYSTEM_FUNCTIONS_CATEGORIES"].conversion));
  24461. console.log(' ___ ___ ________ \n / / / / / ____/ \n / / / / / / \n / / / / ______ ___ / /__ \n / / / / / \\ / / / ___/ \n / /______ / / / /\\ \\/ / / / \n / / / / / / \\ / / /____ \n/__________/ /___/ /___/ \\___/ /________/ \n\n Laboratório de Informática na Educação\n http://line.ime.usp.br');
  24462. var mainFunction = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("start"), _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], true, false);
  24463. mainFunction.function_comment = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_main'));
  24464. program.addFunction(mainFunction);
  24465. window.program_obj = program;
  24466. window.generator = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"];
  24467. window.runCodeAssessment = runCodeAssessment;
  24468. window.renderAlgorithm = _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"];
  24469. window.insertContext = false;
  24470. window.watchW = melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a;
  24471. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.globals, function () {
  24472. if (window.insertContext) {
  24473. setTimeout(function () {
  24474. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24475. globalChangeListeners.forEach(function (x) {
  24476. return x();
  24477. });
  24478. }, 300);
  24479. window.insertContext = false;
  24480. } else {
  24481. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24482. globalChangeListeners.forEach(function (x) {
  24483. return x();
  24484. });
  24485. }
  24486. }, 1);
  24487. melanke_watchjs__WEBPACK_IMPORTED_MODULE_12___default.a.watch(window.program_obj.functions, function () {
  24488. if (window.insertContext) {
  24489. setTimeout(function () {
  24490. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24491. functionsChangeListeners.forEach(function (x) {
  24492. return x();
  24493. });
  24494. }, 300);
  24495. window.insertContext = false;
  24496. } else {
  24497. _algorithm__WEBPACK_IMPORTED_MODULE_15__["renderAlgorithm"]();
  24498. functionsChangeListeners.forEach(function (x) {
  24499. return x();
  24500. });
  24501. }
  24502. }, 1);
  24503. function addFunctionHandler() {
  24504. var new_function = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Function"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_function") + "_" + counter_new_functions, _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID, 0, [], false, false, [], new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Comment"](_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment_start')));
  24505. program.addFunction(new_function);
  24506. counter_new_functions++;
  24507. window.insertContext = true;
  24508. var newe = renderFunction(new_function);
  24509. /*newe.css('display', 'none');
  24510. newe.fadeIn();*/
  24511. }
  24512. function addParameter(function_obj, function_container) {
  24513. var is_from_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  24514. if (function_obj.parameters_list == null) {
  24515. function_obj.parameters_list = [];
  24516. }
  24517. var new_parameter = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("new_parameter") + "_" + counter_new_parameters);
  24518. function_obj.parameters_list.push(new_parameter);
  24519. counter_new_parameters++;
  24520. var newe = renderParameter(function_obj, new_parameter, function_container);
  24521. if (is_from_click) {
  24522. /*newe.css('display', 'none');
  24523. newe.fadeIn();*/
  24524. }
  24525. }
  24526. function updateReturnType(function_obj, new_type) {
  24527. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  24528. function_obj.return_type = new_type;
  24529. function_obj.return_dimensions = new_dimensions;
  24530. }
  24531. function removeFunction(function_obj) {
  24532. var index = program.functions.indexOf(function_obj);
  24533. if (index > -1) {
  24534. program.functions.splice(index, 1);
  24535. }
  24536. }
  24537. function minimizeFunction(function_obj) {
  24538. function_obj.is_hidden = !function_obj.is_hidden;
  24539. }
  24540. function addHandlers(function_obj, function_container) {
  24541. function_container.find('.ui.dropdown.function_return').dropdown({
  24542. onChange: function onChange(value, text, $selectedItem) {
  24543. if ($selectedItem.data('dimensions')) {
  24544. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  24545. } else {
  24546. updateReturnType(function_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  24547. }
  24548. },
  24549. selectOnKeydown: false
  24550. });
  24551. function_container.find(".name_function_updated").on('click', function (e) {
  24552. enableNameFunctionUpdate(function_obj, function_container);
  24553. });
  24554. function_container.find(".add_parameter_button").on('click', function (e) {
  24555. window.insertContext = true;
  24556. addParameter(function_obj, function_container, true);
  24557. });
  24558. function_container.find('.menu_commands').dropdown({
  24559. on: 'hover'
  24560. });
  24561. function_container.find('.menu_commands a').on('click', function (evt) {
  24562. if (function_obj.commands == null || function_obj.commands.length == 0) {
  24563. function_obj.commands = [];
  24564. var new_cmd = _commands__WEBPACK_IMPORTED_MODULE_6__["genericCreateCommand"](jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'));
  24565. function_obj.commands.push(new_cmd);
  24566. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](new_cmd, function_container.find('.commands_list_div'), 3, function_obj);
  24567. } else {
  24568. _commands__WEBPACK_IMPORTED_MODULE_6__["createFloatingCommand"](function_obj, function_container, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('command'), evt);
  24569. }
  24570. });
  24571. function_container.find('.add_var_button_function').on('click', function (e) {
  24572. window.insertContext = true;
  24573. _variables__WEBPACK_IMPORTED_MODULE_5__["addVariable"](function_obj, function_container, true);
  24574. });
  24575. function_container.find('.remove_function_button').on('click', function (e) {
  24576. removeFunction(function_obj);
  24577. function_container.fadeOut();
  24578. });
  24579. function_container.find('.minimize_function_button').on('click', function (e) {
  24580. minimizeFunction(function_obj);
  24581. if (function_obj.is_hidden) {
  24582. function_container.find(".add_var_button_function").toggle();
  24583. function_container.find(".inline_add_command").toggle();
  24584. function_container.find(".function_area").slideToggle();
  24585. } else {
  24586. function_container.find(".function_area").slideToggle(function () {
  24587. function_container.find(".add_var_button_function").toggle();
  24588. function_container.find(".inline_add_command").toggle();
  24589. });
  24590. }
  24591. });
  24592. } // Essa função imprime o tipo de retorno da função e cria o menu do tipo 'select' para alteração
  24593. function renderFunctionReturn(function_obj, function_element) {
  24594. var ret = '<div class="ui dropdown function_return">';
  24595. if (function_obj.return_dimensions > 0) {
  24596. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("vector") + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type);
  24597. if (function_obj.return_dimensions == 1) {
  24598. ret += ' [ ] ';
  24599. } else {
  24600. ret += ' [ ] [ ] ';
  24601. }
  24602. ret += '</div>';
  24603. } else {
  24604. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(function_obj.return_type) + '</div>';
  24605. }
  24606. ret += '<div class="menu">';
  24607. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24608. ret += '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions < 1 ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  24609. }
  24610. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  24611. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  24612. continue;
  24613. }
  24614. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item ' + (function_obj.return_type == tm.toLowerCase() && function_obj.return_dimensions > 0 ? ' selected ' : '') + '" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  24615. }
  24616. ret += '</div></div>';
  24617. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  24618. function_element.find('.function_return').append(ret);
  24619. }
  24620. var cont = 0;
  24621. function renderFunction(function_obj) {
  24622. var appender = '<div class="ui secondary segment function_div list-group-item function_cont_' + cont + '">';
  24623. if (function_obj.function_comment) {//appender += renderComment(function_obj.function_comment, sequence, true, -1);
  24624. }
  24625. appender += '<span class="glyphicon glyphicon-move move_function" aria-hidden="true"><i class="icon sort alternate vertical"></i></span>';
  24626. 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>';
  24627. appender += '<div class="function_signature_div">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("function") + ' ';
  24628. if (function_obj.is_main) {
  24629. appender += '<div class="function_name_div"> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('void') + ' &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span class="span_name_function" >' + function_obj.name + '</span> </div> ' + ' <span class="parethesis_function">( </span> <div class="ui large labels parameters_list">';
  24630. } else {
  24631. appender += '<div class="ui function_return"></div>';
  24632. 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">';
  24633. }
  24634. appender += '</div> <span class="parethesis_function"> ) </span> </div>' + (function_obj.is_hidden ? ' <div class="function_area" style="display: none;"> ' : ' <div class="function_area"> ');
  24635. 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>';
  24636. appender += '<div class="ui top attached segment variables_list_div"></div>';
  24637. appender += '<div class="ui bottom attached segment commands_list_div commands_cont_' + cont + '">' + '<div class="ui rail" style="width: 35px; margin-left: -36px;"><div class="ui sticky sticky_cont_' + cont + '" style="top: 50px !important;">';
  24638. appender += '<i class="icon plus circle purple"></i><i class="icon circle white back"></i><div class="ui icon button dropdown menu_commands orange" ><i class="icon code"></i> <div class="menu"> ';
  24639. appender += '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].reader + '"><i class="download icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_read_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].writer + '"><i class="upload icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_write_var') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].comment + '"><i class="quote left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_comment') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].attribution + '"><i class="arrow left icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_attribution') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].functioncall + '"><i class="hand point right icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_functioncall') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].iftrue + '" ><i class="random icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_iftrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].repeatNtimes + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_repeatNtimes') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].whiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_whiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].dowhiletrue + '"><i class="sync icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_dowhiletrue') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].switch + '"><i class="list icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_switch') + '</a>' + '<a class="item" data-command="' + _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["COMMAND_TYPES"].return + '"><i class="reply icon"></i> ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_btn_return') + '</a>' + '</div></div>';
  24640. appender += '</div></div>' + '</div>';
  24641. appender += '</div></div>';
  24642. appender = jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender);
  24643. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').append(appender);
  24644. appender.data('fun', function_obj);
  24645. appender.find('.commands_list_div').data('fun', function_obj);
  24646. renderFunctionReturn(function_obj, appender);
  24647. addHandlers(function_obj, appender); // Rendering parameters:
  24648. for (var j = 0; j < function_obj.parameters_list.length; j++) {
  24649. renderParameter(function_obj, function_obj.parameters_list[j], appender);
  24650. } // Rendering variables:
  24651. for (var j = 0; j < function_obj.variables_list.length; j++) {
  24652. _variables__WEBPACK_IMPORTED_MODULE_5__["renderVariable"](appender, function_obj.variables_list[j], function_obj);
  24653. } // Rendering commands:
  24654. for (var j = 0; j < function_obj.commands.length; j++) {
  24655. _commands__WEBPACK_IMPORTED_MODULE_6__["renderCommand"](function_obj.commands[j], jquery__WEBPACK_IMPORTED_MODULE_0___default()(appender.find('.commands_list_div')[0]), 3, function_obj);
  24656. }
  24657. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.minimize_function_button').popup({
  24658. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_minimize"),
  24659. delay: {
  24660. show: 750,
  24661. hide: 0
  24662. }
  24663. });
  24664. var function_index = program.functions.indexOf(function_obj);
  24665. Sortable.create(appender.find(".variables_list_div")[0], {
  24666. handle: '.ellipsis',
  24667. animation: 100,
  24668. ghostClass: 'ghost',
  24669. group: 'local_vars_drag_' + function_index,
  24670. onEnd: function onEnd(evt) {
  24671. updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24672. }
  24673. });
  24674. addSortableHandler(appender.find(".commands_list_div")[0], function_index);
  24675. if (!function_obj.is_main) {
  24676. Sortable.create(appender.find(".container_parameters_list")[0], {
  24677. handle: '.ellipsis',
  24678. animation: 100,
  24679. ghostClass: 'ghost',
  24680. group: 'parameters_drag_' + program.functions.indexOf(function_obj),
  24681. onEnd: function onEnd(evt) {
  24682. updateSequenceParameters(evt.oldIndex, evt.newIndex, function_obj);
  24683. }
  24684. });
  24685. }
  24686. if (function_obj.commands.length > 0) {
  24687. var teste = '.ui.sticky.sticky_cont_' + cont;
  24688. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).sticky({
  24689. context: '.ui.bottom.attached.segment.commands_list_div.commands_cont_' + cont,
  24690. scrollContext: '.ivprog_visual_panel',
  24691. observeChanges: true,
  24692. offset: 40,
  24693. onStick: function onStick(evt) {
  24694. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24695. },
  24696. onBottom: function onBottom(evt) {
  24697. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24698. },
  24699. onUnstick: function onUnstick(evt) {
  24700. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24701. },
  24702. onReposition: function onReposition(evt) {
  24703. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24704. },
  24705. onScroll: function onScroll(evt) {
  24706. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24707. if (!isVisible(jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste), jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).parent())) {
  24708. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).removeClass('fixed');
  24709. }
  24710. },
  24711. onTop: function onTop(evt) {
  24712. jquery__WEBPACK_IMPORTED_MODULE_0___default()(teste).css('top', '20px', 'important');
  24713. }
  24714. });
  24715. }
  24716. cont++;
  24717. return appender;
  24718. }
  24719. function isVisible(element, container) {
  24720. var elementTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).offset().top,
  24721. elementHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element).height(),
  24722. containerTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).offset().top,
  24723. containerHeight = jquery__WEBPACK_IMPORTED_MODULE_0___default()(container).height() - 30;
  24724. return elementTop - containerTop + elementHeight > 0 && elementTop - containerTop < containerHeight;
  24725. }
  24726. window.evento_drag;
  24727. function updateProgramObjDrag() {
  24728. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24729. var function_index;
  24730. var start_index;
  24731. var function_obj;
  24732. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24733. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24734. function_index = nodes.indexOf(this);
  24735. start_index = index;
  24736. function_obj = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this);
  24737. }
  24738. });
  24739. console.log(function_index);
  24740. var path_target = [];
  24741. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parentsUntil(".all_functions").each(function (index) {
  24742. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('command_container')) {
  24743. path_target.push(this);
  24744. }
  24745. });
  24746. if (path_target.length == 0) {//console.log('soltou na raiz, na posição: ' + evento_drag.newIndex + ' mas ainda não sei de onde saiu ');
  24747. } else {//console.log('soltou dentro de algum bloco, sequência vem logo abaixo (de baixo pra cima): ');
  24748. //console.log(path_target);
  24749. }
  24750. var index_each = [];
  24751. var path_relative = [];
  24752. for (var i = path_target.length - 1; i >= 0; i--) {
  24753. console.log('da vez', jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]));
  24754. if (i == path_target.length - 1) {
  24755. // está na raiz
  24756. var indice_na_raiz = function_obj.find('.command_container').index(path_target[i]);
  24757. console.log('índice na raiz: ', indice_na_raiz);
  24758. } else {
  24759. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('iftrue')) {
  24760. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().hasClass('commands_if')) {
  24761. path_relative.push('if');
  24762. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24763. } else {
  24764. path_relative.push('else');
  24765. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i]).parent().find('.command_container').index(path_target[i]));
  24766. }
  24767. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('dowhiletrue')) {
  24768. path_relative.push('dowhiletrue');
  24769. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24770. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('repeatNtimes')) {
  24771. path_relative.push('repeatNtimes');
  24772. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24773. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('whiletrue')) {
  24774. path_relative.push('whiletrue');
  24775. index_each.push(jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24776. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(path_target[i + 1]).hasClass('switch')) {
  24777. path_relative.push('switch'); //index_each.push($(path_target[i + 1]).find('.command_container').index(path_target[i]));
  24778. }
  24779. }
  24780. }
  24781. var index_in_block = -1;
  24782. var is_in_else = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('commands_else');
  24783. index_in_block = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().find('.command_container').index(evento_drag.item);
  24784. var is_in_case_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().hasClass('case_commands_block');
  24785. var index_case_of_switch = -1;
  24786. if (is_in_case_switch) {
  24787. index_case_of_switch = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent().parent().find('.case_div').index(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evento_drag.item).parent().parent());
  24788. }
  24789. /*console.log('path_relative:');
  24790. console.log(path_relative);
  24791. console.log('index_each:');
  24792. console.log(index_each);
  24793. console.log('index_in_block:');
  24794. console.log(index_in_block);
  24795. console.log('ele está em algum bloco de senão? ');
  24796. console.log(is_in_else);
  24797. console.log('ele está dentro de um case de switch?');
  24798. console.log(is_in_case_switch);
  24799. console.log('qual é o índice do case: ');
  24800. console.log(index_case_of_switch);*/
  24801. // encontrar o elemento na árvore:
  24802. var command_start_point = window.program_obj.functions[function_index].commands[indice_na_raiz];
  24803. var block_to_insert = command_start_point;
  24804. for (var i = 0; i < index_each.length; i++) {
  24805. if (path_relative[i] == "else") {
  24806. block_to_insert = block_to_insert.commands_else[index_each[i]];
  24807. } else if (path_relative[i] == "switch") {} else {
  24808. block_to_insert = block_to_insert.commands_block[index_each[i]];
  24809. }
  24810. } //console.log('command_start_point', command_start_point);
  24811. //console.log('block_to_insert', block_to_insert);
  24812. // agora tem que alocar o comando na árvore, mas considerar as quatro situações:
  24813. // (1) se está em um else ou (2) se está em switch ou (3) será um caso padrão ou (4) se será na raiz.
  24814. if (path_target.length == 0) {
  24815. // soltou na raiz:
  24816. window.program_obj.functions[function_index].commands.splice(evento_drag.newIndex, 0, command_in_drag);
  24817. } else if (is_in_else) {
  24818. if (block_to_insert.commands_else) {
  24819. block_to_insert.commands_else.splice(evento_drag.newIndex, 0, command_in_drag);
  24820. } else {
  24821. block_to_insert.commands_else = [];
  24822. block_to_insert.commands_else.push(command_in_drag);
  24823. }
  24824. } else if (is_in_case_switch) {} else {
  24825. // verificar se tem alguma coisa no bloco:
  24826. if (block_to_insert.commands_block) {
  24827. block_to_insert.commands_block.splice(evento_drag.newIndex, 0, command_in_drag);
  24828. } else {
  24829. block_to_insert.commands_block = [];
  24830. block_to_insert.commands_block.push(command_in_drag);
  24831. }
  24832. }
  24833. window.draging = false;
  24834. renderAlgorithm();
  24835. }
  24836. function prepareDragHandler(evt) {
  24837. window.draging = true;
  24838. var nodes = Array.prototype.slice.call(jquery__WEBPACK_IMPORTED_MODULE_0___default()('.all_functions').children());
  24839. var function_index;
  24840. var function_obj;
  24841. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parentsUntil(".all_functions").each(function (index) {
  24842. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass('function_div')) {
  24843. function_index = nodes.indexOf(this);
  24844. function_obj = window.program_obj.functions[function_index];
  24845. }
  24846. });
  24847. command_in_drag = jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).data("command"); //console.log('$(evt.item).parent(): ');
  24848. //console.log($(evt.item).parent());
  24849. // descobrir qual das quatro situações:
  24850. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_list_div')) {
  24851. // está na raiz:
  24852. if (function_obj.commands.indexOf(command_in_drag) > -1) {
  24853. function_obj.commands.splice(function_obj.commands.indexOf(command_in_drag), 1);
  24854. }
  24855. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('commands_else')) {
  24856. // está no else:
  24857. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag) > -1) {
  24858. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_else.indexOf(command_in_drag), 1);
  24859. }
  24860. } else if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().hasClass('case_commands_block')) {// está em um switch:
  24861. } else {
  24862. // caso padrão:
  24863. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag) > -1) {
  24864. jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.splice(jquery__WEBPACK_IMPORTED_MODULE_0___default()(evt.item).parent().data('command').commands_block.indexOf(command_in_drag), 1);
  24865. }
  24866. }
  24867. }
  24868. var command_in_drag;
  24869. function addSortableHandler(element, id_function) {
  24870. var n_group = 'commands_drag_' + id_function;
  24871. Sortable.create(element, {
  24872. handle: '.command_drag',
  24873. ghostClass: 'ghost',
  24874. animation: 300,
  24875. group: {
  24876. name: n_group
  24877. },
  24878. onEnd: function onEnd(evt) {
  24879. //updateSequenceLocals(evt.oldIndex, evt.newIndex, function_obj);
  24880. var itemEl = evt.item; // dragged HTMLElement
  24881. evt.to; // target list
  24882. evt.from; // previous list
  24883. evt.oldIndex; // element's old index within old parent
  24884. evt.newIndex; // element's new index within new parent
  24885. //console.log('::EVT::');
  24886. //console.log(evt);
  24887. window.evento_drag = evt;
  24888. try {
  24889. updateProgramObjDrag();
  24890. } catch (e) {
  24891. window.draging = false;
  24892. }
  24893. },
  24894. onStart: function onStart(evt) {
  24895. //console.log("START::EVT::");
  24896. //console.log(evt);
  24897. //console.log("\n\ncommand_in_drag");
  24898. try {
  24899. prepareDragHandler(evt);
  24900. } catch (e) {
  24901. window.draging = false;
  24902. }
  24903. }
  24904. });
  24905. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  24906. element.find(".iftrue").each(function (index) {
  24907. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24908. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[1], id_function);
  24909. });
  24910. element.find(".repeatNtimes").each(function (index) {
  24911. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24912. });
  24913. element.find(".dowhiletrue").each(function (index) {
  24914. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24915. });
  24916. element.find(".whiletrue").each(function (index) {
  24917. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".block_commands")[0], id_function);
  24918. });
  24919. element.find(".switch").each(function (index) {
  24920. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_div").each(function (index) {
  24921. addSortableHandler(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).find(".case_commands_block")[0], id_function);
  24922. });
  24923. });
  24924. }
  24925. function initVisualUI() {
  24926. // MUST USE CONST, LET, OR VAR !!!!!!
  24927. var mainDiv = jquery__WEBPACK_IMPORTED_MODULE_0___default()('#visual-main-div'); // fill mainDiv with functions and globals...
  24928. // renderAlgorithm()...
  24929. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_function_button').on('click', function () {
  24930. addFunctionHandler();
  24931. });
  24932. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').on('click', function () {
  24933. window.insertContext = true;
  24934. _globals__WEBPACK_IMPORTED_MODULE_4__["addGlobal"](program, true);
  24935. });
  24936. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').on('click', function () {
  24937. runCode();
  24938. });
  24939. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').on('click', function () {
  24940. toggleVisualCoding();
  24941. });
  24942. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').on('click', function () {
  24943. toggleTextualCoding();
  24944. });
  24945. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment').on('click', function () {
  24946. runCodeAssessment();
  24947. is_iassign = true;
  24948. });
  24949. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').on('click', function () {
  24950. toggleConsole();
  24951. });
  24952. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.expand_button').on('click', function () {
  24953. full_screen();
  24954. });
  24955. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').on('click', function () {
  24956. window.open('https://www.usp.br/line/ivprog/', '_blank');
  24957. });
  24958. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.main_title h2').prop('title', _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_ivprog_description'));
  24959. }
  24960. var is_iassign = false;
  24961. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).ready(function () {
  24962. var time_show = 750;
  24963. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').popup({
  24964. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_visual"),
  24965. delay: {
  24966. show: time_show,
  24967. hide: 0
  24968. }
  24969. });
  24970. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').popup({
  24971. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_textual"),
  24972. delay: {
  24973. show: time_show,
  24974. hide: 0
  24975. }
  24976. });
  24977. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.upload_file_button').popup({
  24978. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_upload"),
  24979. delay: {
  24980. show: time_show,
  24981. hide: 0
  24982. }
  24983. });
  24984. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.download_file_button').popup({
  24985. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_download"),
  24986. delay: {
  24987. show: time_show,
  24988. hide: 0
  24989. }
  24990. });
  24991. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.undo_button').popup({
  24992. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_undo"),
  24993. delay: {
  24994. show: time_show,
  24995. hide: 0
  24996. }
  24997. });
  24998. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.redo_button').popup({
  24999. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_redo"),
  25000. delay: {
  25001. show: time_show,
  25002. hide: 0
  25003. }
  25004. });
  25005. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.run_button').popup({
  25006. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_run"),
  25007. delay: {
  25008. show: time_show,
  25009. hide: 0
  25010. }
  25011. });
  25012. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.assessment_button').popup({
  25013. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_evaluate"),
  25014. delay: {
  25015. show: time_show,
  25016. hide: 0
  25017. }
  25018. });
  25019. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.help_button').popup({
  25020. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_help") + ' - ' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("text_ivprog_version") + ' ' + ivprog_version,
  25021. delay: {
  25022. show: time_show,
  25023. hide: 0
  25024. }
  25025. });
  25026. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.add_global_button').popup({
  25027. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_add_global"),
  25028. delay: {
  25029. show: time_show,
  25030. hide: 0
  25031. }
  25032. });
  25033. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.div_toggle_console').popup({
  25034. content: _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI("tooltip_console"),
  25035. delay: {
  25036. show: time_show,
  25037. hide: 0
  25038. }
  25039. });
  25040. Sortable.create(listWithHandle, {
  25041. handle: '.glyphicon-move',
  25042. animation: 100,
  25043. ghostClass: 'ghost',
  25044. group: 'functions_divs_drag',
  25045. onEnd: function onEnd(evt) {
  25046. updateSequenceFunction(evt.oldIndex, evt.newIndex);
  25047. }
  25048. });
  25049. var listGlobalsHandle = document.getElementById("listGlobalsHandle");
  25050. Sortable.create(listGlobalsHandle, {
  25051. handle: '.ellipsis',
  25052. animation: 100,
  25053. ghostClass: 'ghost',
  25054. group: 'globals_divs_drag',
  25055. onEnd: function onEnd(evt) {
  25056. updateSequenceGlobals(evt.oldIndex, evt.newIndex);
  25057. }
  25058. });
  25059. });
  25060. function updateSequenceParameters(oldIndex, newIndex, function_obj) {
  25061. function_obj.parameters_list.splice(newIndex, 0, function_obj.parameters_list.splice(oldIndex, 1)[0]);
  25062. }
  25063. function updateSequenceLocals(oldIndex, newIndex, function_obj) {
  25064. function_obj.variables_list.splice(newIndex, 0, function_obj.variables_list.splice(oldIndex, 1)[0]);
  25065. }
  25066. function updateSequenceGlobals(oldIndex, newIndex) {
  25067. program_obj.globals.splice(newIndex, 0, program_obj.globals.splice(oldIndex, 1)[0]);
  25068. }
  25069. function updateSequenceFunction(oldIndex, newIndex) {
  25070. program_obj.functions.splice(newIndex, 0, program_obj.functions.splice(oldIndex, 1)[0]);
  25071. }
  25072. function runCodeAssessment() {
  25073. window.studentGrade = null;
  25074. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25075. if (strCode == null) {
  25076. return;
  25077. }
  25078. toggleConsole(true);
  25079. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  25080. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  25081. var runner = new _assessment_ivprogAssessment__WEBPACK_IMPORTED_MODULE_14__["IVProgAssessment"](strCode, testCases, domConsole);
  25082. runner.runTest().then(function (grade) {
  25083. if (!is_iassign) {
  25084. parent.getEvaluationCallback(grade);
  25085. } else {
  25086. is_iassign = false;
  25087. }
  25088. }).catch(function (err) {
  25089. return console.log(err);
  25090. });
  25091. }
  25092. function runCode() {
  25093. var strCode = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25094. if (strCode == null) {
  25095. return;
  25096. }
  25097. toggleConsole(true);
  25098. if (domConsole == null) domConsole = new _io_domConsole__WEBPACK_IMPORTED_MODULE_9__["DOMConsole"]("#ivprog-term");
  25099. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").slideDown(500);
  25100. try {
  25101. var parser = _ast_ivprogParser__WEBPACK_IMPORTED_MODULE_10__["IVProgParser"].createParser(strCode);
  25102. var analyser = new _processor_semantic_semanticAnalyser__WEBPACK_IMPORTED_MODULE_13__["SemanticAnalyser"](parser.parseTree());
  25103. var data = analyser.analyseTree();
  25104. var proc = new _processor_ivprogProcessor__WEBPACK_IMPORTED_MODULE_11__["IVProgProcessor"](data);
  25105. proc.registerInput(domConsole);
  25106. proc.registerOutput(domConsole);
  25107. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").addClass('ivprog-term-active');
  25108. proc.interpretAST().then(function (_) {
  25109. domConsole.info("Programa executado com sucesso!");
  25110. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  25111. }).catch(function (err) {
  25112. domConsole.err(err.message);
  25113. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").removeClass('ivprog-term-active');
  25114. });
  25115. } catch (error) {
  25116. domConsole.err(error.message);
  25117. console.log(error);
  25118. }
  25119. }
  25120. function toggleConsole(is_running) {
  25121. if (is_running) {
  25122. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  25123. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  25124. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  25125. return;
  25126. }
  25127. if (jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height') == '160px') {
  25128. // esconder
  25129. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'none');
  25130. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '0');
  25131. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-30px');
  25132. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('padding', '5px');
  25133. } else {
  25134. // mostrar
  25135. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog-term-div').css('display', 'block');
  25136. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('min-height', '160px');
  25137. jquery__WEBPACK_IMPORTED_MODULE_0___default()('#ivprog-term').css('margin-top', '-170px');
  25138. }
  25139. }
  25140. function waitToCloseConsole() {
  25141. domConsole.info("Aperte qualquer tecla para fechar...");
  25142. var p = new Promise(function (resolve, _) {
  25143. domConsole.requestInput(resolve, true);
  25144. });
  25145. p.then(function (_) {
  25146. domConsole.dispose();
  25147. domConsole = null;
  25148. jquery__WEBPACK_IMPORTED_MODULE_0___default()("#ivprog-term").hide();
  25149. });
  25150. }
  25151. function toggleTextualCoding() {
  25152. var code = _code_generator__WEBPACK_IMPORTED_MODULE_7__["generate"]();
  25153. if (code == null) {
  25154. return;
  25155. }
  25156. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'none');
  25157. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'block');
  25158. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').removeClass('loading');
  25159. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_code').text(code);
  25160. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').removeClass('active');
  25161. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').addClass('active');
  25162. }
  25163. function toggleVisualCoding() {
  25164. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').addClass('loading');
  25165. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_textual_panel').css('display', 'none');
  25166. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.ivprog_visual_panel').css('display', 'block');
  25167. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.textual_coding_button').removeClass('active');
  25168. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.visual_coding_button').addClass('active');
  25169. }
  25170. function removeParameter(function_obj, parameter_obj, parameter_container) {
  25171. var index = function_obj.parameters_list.indexOf(parameter_obj);
  25172. if (index > -1) {
  25173. window.insertContext = true;
  25174. function_obj.parameters_list.splice(index, 1);
  25175. }
  25176. jquery__WEBPACK_IMPORTED_MODULE_0___default()(parameter_container).fadeOut();
  25177. }
  25178. function updateParameterType(parameter_obj, new_type) {
  25179. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25180. parameter_obj.type = new_type;
  25181. parameter_obj.dimensions = new_dimensions;
  25182. if (new_dimensions > 0) {
  25183. parameter_obj.rows = new_dimensions;
  25184. parameter_obj.columns = 2;
  25185. }
  25186. }
  25187. function renderParameter(function_obj, parameter_obj, function_container) {
  25188. var ret = "";
  25189. ret += '<div class="ui label function_name_parameter pink"><i class="ui icon ellipsis vertical inverted"></i>';
  25190. ret += '<div class="ui dropdown parameter_type">';
  25191. if (parameter_obj.dimensions > 0) {
  25192. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type);
  25193. if (parameter_obj.dimensions == 1) {
  25194. ret += ' [ ] ';
  25195. } else {
  25196. ret += ' [ ] [ ] ';
  25197. }
  25198. ret += '</div>';
  25199. } else {
  25200. ret += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(parameter_obj.type) + '</div>';
  25201. }
  25202. ret += '<div class="menu">';
  25203. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25204. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25205. continue;
  25206. }
  25207. ret += '<div class="item ' + (parameter_obj.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25208. }
  25209. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25210. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25211. continue;
  25212. }
  25213. ret += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  25214. }
  25215. ret += '</div></div>';
  25216. ret += '<div class="parameter_div_edit"><span class="span_name_parameter label_enable_name_parameter">' + parameter_obj.name + '</span></div> ';
  25217. ret += ' <i class="yellow inverted icon times remove_parameter"></i></div>';
  25218. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25219. function_container.find('.container_parameters_list').append(ret);
  25220. ret.find('.remove_parameter').on('click', function (e) {
  25221. removeParameter(function_obj, parameter_obj, ret);
  25222. });
  25223. ret.find('.ui.dropdown.parameter_type').dropdown({
  25224. onChange: function onChange(value, text, $selectedItem) {
  25225. if ($selectedItem.data('dimensions')) {
  25226. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25227. } else {
  25228. updateParameterType(parameter_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25229. }
  25230. },
  25231. selectOnKeydown: false
  25232. });
  25233. ret.find('.label_enable_name_parameter').on('click', function (e) {
  25234. enableNameParameterUpdate(parameter_obj, ret, function_obj);
  25235. });
  25236. return ret;
  25237. }
  25238. function updateParameterName(parameter_var, new_name, parameter_obj_dom, function_obj) {
  25239. if (parameter_var.name == new_name) {
  25240. return;
  25241. }
  25242. if (isValidIdentifier(new_name)) {
  25243. if (variableNameAlreadyExists(new_name, function_obj)) {
  25244. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  25245. } else {
  25246. parameter_var.name = new_name;
  25247. }
  25248. } else {
  25249. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](parameter_obj_dom.find('.parameter_div_edit'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25250. }
  25251. }
  25252. function variableNameAlreadyExists(name_var, function_obj) {
  25253. if (function_obj.parameters_list) {
  25254. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  25255. if (function_obj.parameters_list[i].name == name_var) {
  25256. return true;
  25257. }
  25258. }
  25259. }
  25260. if (function_obj.variables_list) {
  25261. for (var i = 0; i < function_obj.variables_list.length; i++) {
  25262. if (function_obj.variables_list[i].name == name_var) {
  25263. return true;
  25264. }
  25265. }
  25266. }
  25267. return false;
  25268. }
  25269. function updateFunctionName(function_var, new_name, function_obj_dom) {
  25270. if (function_var.name == new_name) {
  25271. return;
  25272. }
  25273. if (isValidIdentifier(new_name)) {
  25274. if (functionNameAlreadyExists(new_name)) {
  25275. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name_duplicated'));
  25276. } else {
  25277. function_var.name = new_name;
  25278. }
  25279. } else {
  25280. _utils__WEBPACK_IMPORTED_MODULE_16__["renderErrorMessage"](function_obj_dom.find('.function_name_div'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25281. }
  25282. }
  25283. function functionNameAlreadyExists(function_name) {
  25284. for (var i = 0; i < window.program_obj.functions.length; i++) {
  25285. if (window.program_obj.functions[i].name == function_name) {
  25286. return true;
  25287. }
  25288. }
  25289. return false;
  25290. }
  25291. function isValidIdentifier(identifier_str) {
  25292. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  25293. }
  25294. var opened_name_parameter = false;
  25295. var opened_input_parameter = null;
  25296. function enableNameParameterUpdate(parameter_obj, parent_node, function_obj) {
  25297. if (opened_name_parameter) {
  25298. opened_input_parameter.focus();
  25299. return;
  25300. }
  25301. opened_name_parameter = true;
  25302. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25303. var input_field;
  25304. parent_node.find('.span_name_parameter').text('');
  25305. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + parameter_obj.name + "' />");
  25306. input_field.insertBefore(parent_node.find('.span_name_parameter'));
  25307. input_field.on('input', function () {
  25308. var inputWidth = input_field.textWidth() + 10;
  25309. opened_input_parameter = input_field;
  25310. input_field.focus();
  25311. var tmpStr = input_field.val();
  25312. input_field.val('');
  25313. input_field.val(tmpStr);
  25314. input_field.css({
  25315. width: inputWidth
  25316. });
  25317. }).trigger('input');
  25318. input_field.focusout(function () {
  25319. /// update array:
  25320. if (input_field.val().trim()) {
  25321. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  25322. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25323. }
  25324. input_field.off();
  25325. input_field.remove(); /// update elements:
  25326. opened_name_parameter = false;
  25327. opened_input_parameter = false;
  25328. });
  25329. input_field.on('keydown', function (e) {
  25330. var code = e.keyCode || e.which;
  25331. if (code == 13) {
  25332. if (input_field.val().trim()) {
  25333. updateParameterName(parameter_obj, input_field.val().trim(), parent_node, function_obj);
  25334. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25335. }
  25336. input_field.off();
  25337. input_field.remove(); /// update elements:
  25338. opened_name_parameter = false;
  25339. opened_input_parameter = false;
  25340. }
  25341. if (code == 27) {
  25342. parent_node.find('.span_name_parameter').text(parameter_obj.name);
  25343. input_field.off();
  25344. input_field.remove(); /// update elements:
  25345. opened_name_parameter = false;
  25346. opened_input_parameter = false;
  25347. }
  25348. });
  25349. input_field.select();
  25350. }
  25351. var opened_name_function = false;
  25352. var opened_input = null;
  25353. var previousPadding = null;
  25354. function enableNameFunctionUpdate(function_obj, parent_node) {
  25355. if (opened_name_function) {
  25356. opened_input.focus();
  25357. return;
  25358. }
  25359. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25360. parent_node.find('.span_name_function').text('');
  25361. var input_field;
  25362. if (!previousPadding) {
  25363. previousPadding = parent_node.find('.span_name_function').css('padding-left');
  25364. }
  25365. parent_node.find('.span_name_function').css('padding-left', '0');
  25366. parent_node.find('.span_name_function').css('padding-right', '0');
  25367. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + function_obj.name + "' />");
  25368. input_field.insertBefore(parent_node.find('.span_name_function'));
  25369. input_field.on('input', function () {
  25370. var inputWidth = input_field.textWidth() + 10;
  25371. opened_input = input_field;
  25372. input_field.focus();
  25373. var tmpStr = input_field.val();
  25374. input_field.val('');
  25375. input_field.val(tmpStr);
  25376. input_field.css({
  25377. width: inputWidth
  25378. });
  25379. }).trigger('input');
  25380. input_field.focusout(function () {
  25381. /// update array:
  25382. if (input_field.val().trim()) {
  25383. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  25384. }
  25385. input_field.off();
  25386. input_field.remove();
  25387. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25388. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25389. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25390. opened_name_function = false;
  25391. opened_input = false;
  25392. });
  25393. input_field.on('keydown', function (e) {
  25394. var code = e.keyCode || e.which;
  25395. if (code == 13) {
  25396. if (input_field.val().trim()) {
  25397. updateFunctionName(function_obj, input_field.val().trim(), parent_node);
  25398. }
  25399. input_field.off();
  25400. input_field.remove();
  25401. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25402. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25403. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25404. opened_name_function = false;
  25405. opened_input = false;
  25406. }
  25407. if (code == 27) {
  25408. input_field.off();
  25409. input_field.remove();
  25410. parent_node.find('.span_name_function').css('padding-left', previousPadding);
  25411. parent_node.find('.span_name_function').css('padding-right', previousPadding);
  25412. parent_node.find('.span_name_function').text(function_obj.name); /// update elements:
  25413. opened_name_function = false;
  25414. opened_input = false;
  25415. }
  25416. });
  25417. input_field.select();
  25418. }
  25419. function addFunctionChangeListener(callback) {
  25420. functionsChangeListeners.push(callback);
  25421. return functionsChangeListeners.length - 1;
  25422. }
  25423. function addGlobalChangeListener(callback) {
  25424. globalChangeListeners.push(callback);
  25425. return globalChangeListeners.length - 1;
  25426. }
  25427. function removeGlobalListener(index) {
  25428. globalChangeListeners.splice(index, 1);
  25429. }
  25430. function removeFunctionListener(index) {
  25431. functionsChangeListeners.splice(index);
  25432. }
  25433. /***/ }),
  25434. /***/ "./js/visualUI/globals.js":
  25435. /*!********************************!*\
  25436. !*** ./js/visualUI/globals.js ***!
  25437. \********************************/
  25438. /*! exports provided: addGlobal, renderGlobal */
  25439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  25440. "use strict";
  25441. __webpack_require__.r(__webpack_exports__);
  25442. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addGlobal", function() { return addGlobal; });
  25443. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderGlobal", function() { return renderGlobal; });
  25444. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  25445. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  25446. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  25447. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  25448. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  25449. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  25450. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  25451. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  25452. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  25453. var counter_new_globals = 0;
  25454. function addGlobal(program) {
  25455. var is_from_click = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  25456. var new_global = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_global') + '_' + counter_new_globals, 1);
  25457. counter_new_globals++;
  25458. program.addGlobal(new_global);
  25459. var newe = renderGlobal(new_global);
  25460. if (is_from_click) {
  25461. newe.css('display', 'none');
  25462. newe.fadeIn();
  25463. }
  25464. }
  25465. function toggleConstant(global_var) {
  25466. global_var.is_constant = !global_var.is_constant;
  25467. }
  25468. function updateName(global_var, new_name, global_obj_dom) {
  25469. if (global_var.name == new_name) {
  25470. return;
  25471. }
  25472. if (isValidIdentifier(new_name)) {
  25473. if (globalNameAlreadyExists(new_name)) {
  25474. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_global_duplicated'));
  25475. } else {
  25476. global_var.name = new_name;
  25477. }
  25478. } else {
  25479. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](global_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  25480. }
  25481. }
  25482. function globalNameAlreadyExists(global_name) {
  25483. for (var i = 0; i < window.program_obj.globals.length; i++) {
  25484. if (window.program_obj.globals[i].name == global_name) {
  25485. return true;
  25486. }
  25487. }
  25488. return false;
  25489. }
  25490. function isValidIdentifier(identifier_str) {
  25491. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  25492. }
  25493. function updateType(global_var, new_type) {
  25494. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  25495. global_var.type = new_type;
  25496. global_var.dimensions = new_dimensions;
  25497. if (new_dimensions > 0) {
  25498. global_var.rows = new_dimensions;
  25499. global_var.columns = 2;
  25500. }
  25501. updateInitialValues(global_var);
  25502. }
  25503. function removeGlobal(global_var, global_container) {
  25504. var index = window.program_obj.globals.indexOf(global_var);
  25505. if (index > -1) {
  25506. window.insertContext = true;
  25507. window.program_obj.globals.splice(index, 1);
  25508. }
  25509. global_container.children().off();
  25510. global_container.off();
  25511. global_container.fadeOut();
  25512. }
  25513. function updateInitialValues(global_var) {
  25514. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25515. if (global_var.dimensions == 0) {
  25516. global_var.value = 1;
  25517. }
  25518. if (global_var.dimensions == 1) {
  25519. global_var.value = [1, 1];
  25520. }
  25521. if (global_var.dimensions == 2) {
  25522. global_var.value = [[1, 1], [1, 1]];
  25523. }
  25524. }
  25525. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25526. if (global_var.dimensions == 0) {
  25527. global_var.value = 1.0;
  25528. }
  25529. if (global_var.dimensions == 1) {
  25530. global_var.value = [1.0, 1.0];
  25531. }
  25532. if (global_var.dimensions == 2) {
  25533. global_var.value = [[1.0, 1.0], [1.0, 1.0]];
  25534. }
  25535. }
  25536. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25537. if (global_var.dimensions == 0) {
  25538. global_var.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  25539. }
  25540. if (global_var.dimensions == 1) {
  25541. global_var.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  25542. }
  25543. if (global_var.dimensions == 2) {
  25544. global_var.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  25545. }
  25546. }
  25547. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25548. if (global_var.dimensions == 0) {
  25549. global_var.value = true;
  25550. }
  25551. if (global_var.dimensions == 1) {
  25552. global_var.value = [true, true];
  25553. }
  25554. if (global_var.dimensions == 2) {
  25555. global_var.value = [[true, true], [true, true]];
  25556. }
  25557. }
  25558. }
  25559. function alternateBooleanGlobalValue(global_var, value_container) {
  25560. global_var.value = !global_var.value;
  25561. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value));
  25562. }
  25563. function alternateBooleanGlobalVectorValue(global_var, index, value_container) {
  25564. global_var.value[index] = !global_var.value[index];
  25565. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[index]));
  25566. }
  25567. function removeGlobalColumnVector(global_var) {
  25568. if (global_var.columns == 0) {
  25569. return;
  25570. }
  25571. global_var.columns--;
  25572. global_var.value.splice(global_var.value.length - 1, 1);
  25573. }
  25574. function addGlobalColumnVector(global_var) {
  25575. global_var.columns++;
  25576. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25577. global_var.value.push(1);
  25578. }
  25579. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25580. global_var.value.push(1.0);
  25581. }
  25582. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25583. global_var.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25584. }
  25585. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25586. global_var.value.push(true);
  25587. }
  25588. }
  25589. function removeColumnGlobalMatrix(global_var) {
  25590. if (global_var.columns == 0) {
  25591. return;
  25592. }
  25593. global_var.columns--;
  25594. for (var i = 0; i < global_var.rows; i++) {
  25595. global_var.value[i].splice(global_var.value[i].length - 1, 1);
  25596. }
  25597. }
  25598. function addColumnGlobalMatrix(global_var) {
  25599. global_var.columns++;
  25600. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25601. for (var i = 0; i < global_var.rows; i++) {
  25602. global_var.value[i].push(1);
  25603. }
  25604. }
  25605. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25606. for (var i = 0; i < global_var.rows; i++) {
  25607. global_var.value[i].push(1.0);
  25608. }
  25609. }
  25610. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25611. for (var i = 0; i < global_var.rows; i++) {
  25612. global_var.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25613. }
  25614. }
  25615. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25616. for (var i = 0; i < global_var.rows; i++) {
  25617. global_var.value[i].push(true);
  25618. }
  25619. }
  25620. }
  25621. function removeLineGlobalMatrix(global_var) {
  25622. if (global_var.rows == 0) {
  25623. return;
  25624. }
  25625. global_var.rows--;
  25626. global_var.value.splice(global_var.value.length - 1, 1);
  25627. }
  25628. function addLineGlobalMatrix(global_var) {
  25629. global_var.rows++;
  25630. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25631. var n_l = [];
  25632. for (var i = 0; i < global_var.columns; i++) {
  25633. n_l.push(1);
  25634. }
  25635. global_var.value.push(n_l);
  25636. }
  25637. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25638. var n_l = [];
  25639. for (i = 0; i < global_var.columns; i++) {
  25640. n_l.push(1.0);
  25641. }
  25642. global_var.value.push(n_l);
  25643. }
  25644. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25645. var n_l = [];
  25646. for (i = 0; i < global_var.columns; i++) {
  25647. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  25648. }
  25649. global_var.value.push(n_l);
  25650. }
  25651. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25652. var n_l = [];
  25653. for (i = 0; i < global_var.columns; i++) {
  25654. n_l.push(true);
  25655. }
  25656. global_var.value.push(n_l);
  25657. }
  25658. }
  25659. function alternateBooleanGlobalMatrixValue(global_var, row, index, value_container) {
  25660. global_var.value[row][index] = !global_var.value[row][index];
  25661. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[row][index]));
  25662. }
  25663. function renderValues(global_var, global_container) {
  25664. var ret = "";
  25665. var j = 0;
  25666. if (global_var.dimensions == 0) {
  25667. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25668. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value.toFixed(1) + '</span> </div> ';
  25669. } else {
  25670. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25671. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value) + '</span> </div> ';
  25672. } else {
  25673. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + global_var.value + '</span> </div> ';
  25674. }
  25675. }
  25676. } else {
  25677. ret += '<table class="tabela_var">';
  25678. if (global_var.dimensions == 1) {
  25679. ret += '<tr>';
  25680. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25681. for (var k = 0; k < global_var.columns; k++) {
  25682. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k].toFixed(1) + '</span></td>';
  25683. }
  25684. } else {
  25685. for (var k = 0; k < global_var.columns; k++) {
  25686. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25687. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[k]) + '</span></td>';
  25688. } else {
  25689. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + global_var.value[k] + '</span>' + '</td>';
  25690. }
  25691. }
  25692. }
  25693. ret += '</tr>';
  25694. ret += '</table>';
  25695. 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>';
  25696. }
  25697. if (global_var.dimensions == 2) {
  25698. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25699. for (var l = 0; l < global_var.rows; l++) {
  25700. ret += '<tr>';
  25701. for (var k = 0; k < global_var.columns; k++) {
  25702. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  25703. }
  25704. ret += '</tr>';
  25705. }
  25706. } else {
  25707. for (var l = 0; l < global_var.rows; l++) {
  25708. ret += '<tr>';
  25709. for (var k = 0; k < global_var.columns; k++) {
  25710. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  25711. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.value[l][k]) + '</span></td>';
  25712. } else {
  25713. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + global_var.value[l][k] + '</span></td>';
  25714. }
  25715. }
  25716. ret += '</tr>';
  25717. }
  25718. }
  25719. if (global_var.rows == 0) {
  25720. ret += '<tr><td></td></tr>';
  25721. }
  25722. 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>';
  25723. ret += '</table>';
  25724. 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>';
  25725. }
  25726. }
  25727. global_container.find(".div_valor_var").html('');
  25728. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  25729. ret.find('.span_value_variable').data('associatedOject', global_var);
  25730. ret.find(".boolean_simple_type").on('click', function (e) {
  25731. alternateBooleanGlobalValue(global_var, this.parentNode);
  25732. });
  25733. ret.find(".simple_var").on('click', function (e) {
  25734. enableGlobalValueUpdate(global_var, this.parentNode);
  25735. });
  25736. ret.find(".boolean_vector_var").on('click', function (e) {
  25737. alternateBooleanGlobalVectorValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25738. });
  25739. ret.find(".vector_var").on('click', function (e) {
  25740. enableGlobalVectorValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25741. });
  25742. ret.find(".remove_global_vector_column").on('click', function (e) {
  25743. removeGlobalColumnVector(global_var);
  25744. global_container.find(".div_valor_var").html('');
  25745. renderValues(global_var, global_container);
  25746. });
  25747. ret.find(".add_global_vector_column").on('click', function (e) {
  25748. addGlobalColumnVector(global_var);
  25749. global_container.find(".div_valor_var").html('');
  25750. renderValues(global_var, global_container);
  25751. });
  25752. ret.find(".remove_global_matrix_column").on('click', function (e) {
  25753. removeColumnGlobalMatrix(global_var);
  25754. global_container.find(".div_valor_var").html('');
  25755. renderValues(global_var, global_container);
  25756. });
  25757. ret.find(".add_global_matrix_column").on('click', function (e) {
  25758. addColumnGlobalMatrix(global_var);
  25759. global_container.find(".div_valor_var").html('');
  25760. renderValues(global_var, global_container);
  25761. });
  25762. ret.find(".remove_global_matrix_line").on('click', function (e) {
  25763. removeLineGlobalMatrix(global_var);
  25764. global_container.find(".div_valor_var").html('');
  25765. renderValues(global_var, global_container);
  25766. });
  25767. ret.find(".add_global_matrix_line").on('click', function (e) {
  25768. addLineGlobalMatrix(global_var);
  25769. global_container.find(".div_valor_var").html('');
  25770. renderValues(global_var, global_container);
  25771. });
  25772. ret.find(".boolean_matrix_var").on('click', function (e) {
  25773. alternateBooleanGlobalMatrixValue(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25774. });
  25775. ret.find(".matrix_var").on('click', function (e) {
  25776. enableGlobalMatrixValueUpdate(global_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  25777. });
  25778. global_container.find(".div_valor_var").append(ret);
  25779. updateColumnsAndRowsText(global_container, global_var);
  25780. }
  25781. function addHandlers(global_container) {
  25782. var global_var = global_container.data('associatedOject'); // Manage constant option:
  25783. global_container.find(".alternate_constant").on('click', function (e) {
  25784. toggleConstant(global_var);
  25785. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).removeClass("on off");
  25786. if (global_var.is_constant) {
  25787. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("on");
  25788. } else {
  25789. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).addClass("off");
  25790. }
  25791. }); // Manage global name:
  25792. global_container.find(".enable_edit_name_parameter").on('click', function (e) {
  25793. enableNameUpdate(global_container);
  25794. }); // Menu to change type:
  25795. global_container.find('.ui.dropdown.global_type').dropdown({
  25796. onChange: function onChange(value, text, $selectedItem) {
  25797. if ($selectedItem.data('dimensions')) {
  25798. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  25799. } else {
  25800. updateType(global_var, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  25801. }
  25802. renderValues(global_var, global_container);
  25803. },
  25804. selectOnKeydown: false
  25805. }); // Remove global:
  25806. global_container.find(".remove_global").on('click', function (e) {
  25807. removeGlobal(global_var, global_container);
  25808. });
  25809. }
  25810. function updateColumnsAndRowsText(global_container, global_var) {
  25811. var prev = global_container.find('.text').text().split('[');
  25812. if (prev.length == 2) {
  25813. var ff = prev[0] + '[ ' + global_var.columns + ' ] ';
  25814. global_container.find('.text').empty();
  25815. global_container.find('.text').text(ff);
  25816. }
  25817. if (prev.length == 3) {
  25818. var ff = prev[0] + '[ ' + global_var.columns + ' ] [ ' + global_var.rows + ' ] ';
  25819. global_container.find('.text').empty();
  25820. global_container.find('.text').text(ff);
  25821. }
  25822. }
  25823. function renderGlobal(global_var) {
  25824. var element = '<div class="ui label global_container pink"><i class="ui icon ellipsis vertical inverted"></i><div class="global_const">const: ';
  25825. element += '<i class="ui icon toggle ' + (global_var.is_constant ? "on" : "off") + ' alternate_constant"></i></div>';
  25826. element += '<div class="ui dropdown global_type">';
  25827. if (global_var.dimensions > 0) {
  25828. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type);
  25829. for (var i = 0; i < global_var.dimensions; i++) {
  25830. element += ' [ <span class="dimensions_' + i + '"></span> ] ';
  25831. }
  25832. element += '</div>';
  25833. } else {
  25834. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(global_var.type.toLowerCase()) + '</div>';
  25835. }
  25836. element += '<div class="menu">';
  25837. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25838. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25839. continue;
  25840. }
  25841. element += '<div class="item ' + (global_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  25842. }
  25843. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  25844. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  25845. continue;
  25846. }
  25847. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  25848. }
  25849. 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> ';
  25850. element += '<div class="ui div_valor_var">' + global_var.value + '</div>';
  25851. element += ' <i class="yellow inverted icon times remove_global"></i></div>';
  25852. var complete_element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  25853. complete_element.data('associatedOject', global_var);
  25854. jquery__WEBPACK_IMPORTED_MODULE_0___default()('.list_globals').append(complete_element);
  25855. addHandlers(complete_element);
  25856. renderValues(global_var, complete_element);
  25857. if (global_var.dimensions == 1) {
  25858. complete_element.find('.dimensions_0').text(global_var.columns);
  25859. }
  25860. if (global_var.dimensions == 2) {
  25861. complete_element.find('.dimensions_0').text(global_var.columns);
  25862. complete_element.find('.dimensions_1').text(global_var.rows);
  25863. }
  25864. return complete_element;
  25865. }
  25866. var opened_name_value_matrix_global_v = false;
  25867. var opened_input_value_matrix_global_v = null;
  25868. function enableGlobalMatrixValueUpdate(global_var, row, index, parent_node) {
  25869. if (opened_name_value_matrix_global_v) {
  25870. opened_input_value_matrix_global_v.focus();
  25871. return;
  25872. }
  25873. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25874. opened_name_value_matrix_global_v = true;
  25875. parent_node.find('.span_value_variable').text('');
  25876. var input_field;
  25877. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25878. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index].toFixed(1) + "' />");
  25879. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25880. } else {
  25881. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[row][index] + "' />");
  25882. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25883. }
  25884. input_field.on('input', function () {
  25885. var inputWidth = input_field.textWidth() + 10;
  25886. opened_input_value_matrix_global_v = input_field;
  25887. input_field.focus();
  25888. var tmpStr = input_field.val();
  25889. input_field.val('');
  25890. input_field.val(tmpStr);
  25891. input_field.css({
  25892. width: inputWidth
  25893. });
  25894. }).trigger('input');
  25895. input_field.focusout(function () {
  25896. /// update array:
  25897. if (input_field.val().trim()) {
  25898. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25899. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25900. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25901. } else {
  25902. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25903. global_var.value[row][index] = parseInt(input_field.val().trim());
  25904. } else {
  25905. global_var.value[row][index] = input_field.val().trim();
  25906. }
  25907. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25908. }
  25909. } else {
  25910. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25911. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25912. } else {
  25913. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25914. }
  25915. }
  25916. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25917. global_var.value[row][index] = input_field.val();
  25918. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25919. }
  25920. input_field.off();
  25921. input_field.remove(); /// update elements:
  25922. opened_name_value_matrix_global_v = false;
  25923. opened_input_value_matrix_global_v = false;
  25924. });
  25925. input_field.on('keydown', function (e) {
  25926. var code = e.keyCode || e.which;
  25927. if (code == 13) {
  25928. if (input_field.val().trim()) {
  25929. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25930. global_var.value[row][index] = parseFloat(input_field.val().trim());
  25931. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25932. } else {
  25933. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  25934. global_var.value[row][index] = parseInt(input_field.val().trim());
  25935. } else {
  25936. global_var.value[row][index] = input_field.val().trim();
  25937. }
  25938. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25939. }
  25940. } else {
  25941. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25942. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25943. } else {
  25944. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25945. }
  25946. }
  25947. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  25948. global_var.value[row][index] = input_field.val();
  25949. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25950. }
  25951. input_field.off();
  25952. input_field.remove(); /// update elements:
  25953. opened_name_value_matrix_global_v = false;
  25954. opened_input_value_matrix_global_v = false;
  25955. }
  25956. if (code == 27) {
  25957. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25958. parent_node.find('.span_value_variable').text(global_var.value[row][index].toFixed(1));
  25959. } else {
  25960. parent_node.find('.span_value_variable').text(global_var.value[row][index]);
  25961. }
  25962. input_field.off();
  25963. input_field.remove(); /// update elements:
  25964. opened_name_value_matrix_global_v = false;
  25965. opened_input_value_matrix_global_v = false;
  25966. }
  25967. });
  25968. input_field.select();
  25969. }
  25970. var opened_name_value_global_var = false;
  25971. var opened_input_value_global_ar = null;
  25972. function enableGlobalValueUpdate(global_var, parent_node) {
  25973. if (opened_name_value_global_var) {
  25974. opened_input_value_global_ar.focus();
  25975. return;
  25976. }
  25977. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  25978. opened_name_value_global_var = true;
  25979. parent_node.find('.span_value_variable').text('');
  25980. var input_field;
  25981. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  25982. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value.toFixed(1) + "' />");
  25983. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25984. } else {
  25985. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value + "' />");
  25986. input_field.insertBefore(parent_node.find('.span_value_variable'));
  25987. }
  25988. input_field.on('input', function () {
  25989. var inputWidth = input_field.textWidth() + 10;
  25990. opened_input_value_global_ar = input_field;
  25991. input_field.focus();
  25992. var tmpStr = input_field.val();
  25993. input_field.val('');
  25994. input_field.val(tmpStr);
  25995. input_field.css({
  25996. width: inputWidth
  25997. });
  25998. }).trigger('input');
  25999. input_field.focusout(function () {
  26000. /// update array:
  26001. if (input_field.val().trim()) {
  26002. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26003. global_var.value = parseFloat(input_field.val().trim());
  26004. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26005. } else {
  26006. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26007. global_var.value = parseInt(input_field.val().trim());
  26008. } else {
  26009. global_var.value = input_field.val().trim();
  26010. }
  26011. parent_node.find('.span_value_variable').text(global_var.value);
  26012. }
  26013. } else {
  26014. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26015. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26016. } else {
  26017. parent_node.find('.span_value_variable').text(global_var.value);
  26018. }
  26019. }
  26020. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26021. global_var.value = input_field.val();
  26022. parent_node.find('.span_value_variable').text(global_var.value);
  26023. }
  26024. input_field.off();
  26025. input_field.remove(); /// update elements:
  26026. opened_name_value_global_var = false;
  26027. opened_input_value_global_ar = false;
  26028. });
  26029. input_field.on('keydown', function (e) {
  26030. var code = e.keyCode || e.which;
  26031. if (code == 13) {
  26032. if (input_field.val().trim()) {
  26033. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26034. global_var.value = parseFloat(input_field.val().trim());
  26035. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26036. } else {
  26037. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26038. global_var.value = parseInt(input_field.val().trim());
  26039. } else {
  26040. global_var.value = input_field.val().trim();
  26041. }
  26042. parent_node.find('.span_value_variable').text(global_var.value);
  26043. }
  26044. } else {
  26045. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26046. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26047. } else {
  26048. parent_node.find('.span_value_variable').text(global_var.value);
  26049. }
  26050. }
  26051. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26052. global_var.value = input_field.val();
  26053. parent_node.find('.span_value_variable').text(global_var.value);
  26054. }
  26055. input_field.off();
  26056. input_field.remove(); /// update elements:
  26057. opened_name_value_global_var = false;
  26058. opened_input_value_global_ar = false;
  26059. }
  26060. if (code == 27) {
  26061. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26062. parent_node.find('.span_value_variable').text(global_var.value.toFixed(1));
  26063. } else {
  26064. parent_node.find('.span_value_variable').text(global_var.value);
  26065. }
  26066. input_field.off();
  26067. input_field.remove(); /// update elements:
  26068. opened_name_value_global_var = false;
  26069. opened_input_value_global_ar = false;
  26070. }
  26071. });
  26072. input_field.select();
  26073. }
  26074. var opened_name_global = false;
  26075. var opened_input_global = null;
  26076. function enableNameUpdate(global_container) {
  26077. var global_var = global_container.data('associatedOject');
  26078. if (opened_name_global) {
  26079. opened_input_global.focus();
  26080. return;
  26081. }
  26082. opened_name_global = true;
  26083. global_container.find('.span_name_variable').text('');
  26084. var input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.name + "' />");
  26085. input_name.insertBefore(global_container.find('.span_name_variable'));
  26086. input_name.on('input', function () {
  26087. var inputWidth = input_name.textWidth() + 10;
  26088. opened_input_global = input_name;
  26089. opened_input_global.focus();
  26090. opened_input_global.css({
  26091. width: inputWidth
  26092. });
  26093. }).trigger('input');
  26094. input_name.focusout(function () {
  26095. /// update array:
  26096. if (input_name.val().trim().length > 0) {
  26097. updateName(global_var, input_name.val().trim(), global_container);
  26098. global_container.find('.span_name_variable').text(global_var.name);
  26099. } else {
  26100. global_container.find('.span_name_variable').text(global_var.name);
  26101. }
  26102. input_name.off();
  26103. input_name.remove(); /// update elements:
  26104. opened_name_global = false;
  26105. opened_input_global = false;
  26106. });
  26107. input_name.on('keydown', function (e) {
  26108. var code = e.keyCode || e.which;
  26109. if (code == 13) {
  26110. if (input_name.val().trim()) {
  26111. updateName(global_var, input_name.val().trim(), global_container);
  26112. global_container.find('.span_name_variable').text(global_var.name);
  26113. } else {
  26114. global_container.find('.span_name_variable').text(global_var.name);
  26115. }
  26116. input_name.off();
  26117. input_name.remove(); /// update elements:
  26118. opened_name_global = false;
  26119. opened_input_global = false;
  26120. }
  26121. if (code == 27) {
  26122. global_container.find('.span_name_variable').text(global_var.name);
  26123. input_name.off();
  26124. input_name.remove(); /// update elements:
  26125. opened_name_global = false;
  26126. opened_input_global = false;
  26127. }
  26128. });
  26129. input_name.select();
  26130. }
  26131. var opened_name_value_vector_global_ = false;
  26132. var opened_input_value_vector_global_ = null;
  26133. function enableGlobalVectorValueUpdate(global_var, index, parent_node) {
  26134. if (opened_name_value_vector_global_) {
  26135. opened_input_value_vector_global_.focus();
  26136. return;
  26137. }
  26138. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  26139. opened_name_value_vector_global_ = true;
  26140. parent_node.find('.span_value_variable').text('');
  26141. var input_field;
  26142. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26143. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index].toFixed(1) + "' />");
  26144. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26145. } else {
  26146. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + global_var.value[index] + "' />");
  26147. input_field.insertBefore(parent_node.find('.span_value_variable'));
  26148. }
  26149. input_field.on('input', function () {
  26150. var inputWidth = input_field.textWidth() + 10;
  26151. opened_input_value_vector_global_ = input_field;
  26152. input_field.focus();
  26153. var tmpStr = input_field.val();
  26154. input_field.val('');
  26155. input_field.val(tmpStr);
  26156. input_field.css({
  26157. width: inputWidth
  26158. });
  26159. }).trigger('input');
  26160. input_field.focusout(function () {
  26161. /// update array:
  26162. if (input_field.val().trim()) {
  26163. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26164. global_var.value[index] = parseFloat(input_field.val().trim());
  26165. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26166. } else {
  26167. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26168. global_var.value[index] = parseInt(input_field.val().trim());
  26169. } else {
  26170. global_var.value[index] = input_field.val().trim();
  26171. }
  26172. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26173. }
  26174. } else {
  26175. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26176. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26177. } else {
  26178. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26179. }
  26180. }
  26181. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26182. global_var.value[index] = input_field.val();
  26183. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26184. }
  26185. input_field.off();
  26186. input_field.remove(); /// update elements:
  26187. opened_name_value_vector_global_ = false;
  26188. opened_input_value_vector_global_ = false;
  26189. });
  26190. input_field.on('keydown', function (e) {
  26191. var code = e.keyCode || e.which;
  26192. if (code == 13) {
  26193. if (input_field.val().trim()) {
  26194. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26195. global_var.value[index] = parseFloat(input_field.val().trim());
  26196. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26197. } else {
  26198. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26199. global_var.value[index] = parseInt(input_field.val().trim());
  26200. } else {
  26201. global_var.value[index] = input_field.val().trim();
  26202. }
  26203. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26204. }
  26205. } else {
  26206. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26207. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26208. } else {
  26209. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26210. }
  26211. }
  26212. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26213. global_var.value[index] = input_field.val();
  26214. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26215. }
  26216. input_field.off();
  26217. input_field.remove(); /// update elements:
  26218. opened_name_value_vector_global_ = false;
  26219. opened_input_value_vector_global_ = false;
  26220. }
  26221. if (code == 27) {
  26222. if (global_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26223. parent_node.find('.span_value_variable').text(global_var.value[index].toFixed(1));
  26224. } else {
  26225. parent_node.find('.span_value_variable').text(global_var.value[index]);
  26226. }
  26227. input_field.off();
  26228. input_field.remove(); /// update elements:
  26229. opened_name_value_vector_global_ = false;
  26230. opened_input_value_vector_global_ = false;
  26231. }
  26232. });
  26233. input_field.select();
  26234. }
  26235. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth = function (text, font) {
  26236. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl) jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl = jquery__WEBPACK_IMPORTED_MODULE_0___default()('<span>').hide().appendTo(document.body);
  26237. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.text(text || this.val() || this.text() || this.attr('placeholder')).css('font', font || this.css('font'));
  26238. return jquery__WEBPACK_IMPORTED_MODULE_0___default.a.fn.textWidth.fakeEl.width();
  26239. };
  26240. /***/ }),
  26241. /***/ "./js/visualUI/ivprog_elements.js":
  26242. /*!****************************************!*\
  26243. !*** ./js/visualUI/ivprog_elements.js ***!
  26244. \****************************************/
  26245. /*! exports provided: COMMAND_TYPES, ARITHMETIC_TYPES, EXPRESSION_ELEMENTS, EXPRESSION_TYPES, ARITHMETIC_COMPARISON, LOGIC_COMPARISON, SYSTEM_FUNCTIONS_CATEGORIES, Variable, Function, SystemFunction, Comment, Break, Reader, Writer, Attribution, ExpressionOperator, ExpressionElement, ConditionalExpression, LogicExpression, ArithmeticExpression, IfTrue, RepeatNTimes, WhileTrue, DoWhileTrue, Switch, Return, SwitchCase, FunctionCall, VariableValueMenu, FunctionCallMenu, Program */
  26246. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26247. "use strict";
  26248. __webpack_require__.r(__webpack_exports__);
  26249. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMMAND_TYPES", function() { return COMMAND_TYPES; });
  26250. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_TYPES", function() { return ARITHMETIC_TYPES; });
  26251. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_ELEMENTS", function() { return EXPRESSION_ELEMENTS; });
  26252. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EXPRESSION_TYPES", function() { return EXPRESSION_TYPES; });
  26253. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ARITHMETIC_COMPARISON", function() { return ARITHMETIC_COMPARISON; });
  26254. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOGIC_COMPARISON", function() { return LOGIC_COMPARISON; });
  26255. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SYSTEM_FUNCTIONS_CATEGORIES", function() { return SYSTEM_FUNCTIONS_CATEGORIES; });
  26256. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Variable", function() { return Variable; });
  26257. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Function", function() { return Function; });
  26258. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemFunction", function() { return SystemFunction; });
  26259. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  26260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Break", function() { return Break; });
  26261. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Reader", function() { return Reader; });
  26262. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Writer", function() { return Writer; });
  26263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribution", function() { return Attribution; });
  26264. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionOperator", function() { return ExpressionOperator; });
  26265. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionElement", function() { return ExpressionElement; });
  26266. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpression", function() { return ConditionalExpression; });
  26267. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogicExpression", function() { return LogicExpression; });
  26268. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArithmeticExpression", function() { return ArithmeticExpression; });
  26269. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfTrue", function() { return IfTrue; });
  26270. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RepeatNTimes", function() { return RepeatNTimes; });
  26271. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WhileTrue", function() { return WhileTrue; });
  26272. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DoWhileTrue", function() { return DoWhileTrue; });
  26273. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Switch", function() { return Switch; });
  26274. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Return", function() { return Return; });
  26275. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SwitchCase", function() { return SwitchCase; });
  26276. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  26277. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableValueMenu", function() { return VariableValueMenu; });
  26278. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCallMenu", function() { return FunctionCallMenu; });
  26279. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Program", function() { return Program; });
  26280. /* harmony import */ var _commands_variable_value_menu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./commands/variable_value_menu */ "./js/visualUI/commands/variable_value_menu.js");
  26281. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26282. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! melanke-watchjs */ "./node_modules/melanke-watchjs/src/watch.js");
  26283. /* harmony import */ var melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(melanke_watchjs__WEBPACK_IMPORTED_MODULE_2__);
  26284. /* harmony import */ var _algorithm__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./algorithm */ "./js/visualUI/algorithm.js");
  26285. 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); } }
  26286. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  26287. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  26288. var COMMAND_TYPES = Object.freeze({
  26289. function: "function",
  26290. comment: "comment",
  26291. reader: "reader",
  26292. writer: "writer",
  26293. attribution: "attribution",
  26294. iftrue: "iftrue",
  26295. repeatNtimes: "repeatNtimes",
  26296. whiletrue: "whiletrue",
  26297. dowhiletrue: "dowhiletrue",
  26298. switch: "switch",
  26299. switchcase: "switchcase",
  26300. functioncall: "functioncall",
  26301. break: "break",
  26302. return: "return"
  26303. });
  26304. var ARITHMETIC_TYPES = Object.freeze({
  26305. plus: "plus",
  26306. minus: "minus",
  26307. multiplication: "multiplication",
  26308. division: "division",
  26309. module: "module",
  26310. none: "none"
  26311. });
  26312. var EXPRESSION_ELEMENTS = Object.freeze({
  26313. exp_op_exp: "exp_op_exp",
  26314. op_exp: "op_exp",
  26315. par_exp_par: "par_exp_par",
  26316. start_point: "start_point"
  26317. });
  26318. var EXPRESSION_TYPES = Object.freeze({
  26319. exp_conditional: "exp_conditional",
  26320. exp_logic: "exp_logic",
  26321. exp_arithmetic: "exp_arithmetic"
  26322. });
  26323. var ARITHMETIC_COMPARISON = Object.freeze({
  26324. greater_than: "greater_than",
  26325. less_than: "less_than",
  26326. equals_to: "equals_to",
  26327. not_equals_to: "not_equals_to",
  26328. greater_than_or_equals_to: "greater_than_or_equals_to",
  26329. less_than_or_equals_to: "less_than_or_equals_to"
  26330. });
  26331. var LOGIC_COMPARISON = Object.freeze({
  26332. equals_to: "equals_to",
  26333. not_equals_to: "not_equals_to",
  26334. and: "and",
  26335. or: "or",
  26336. not: "not"
  26337. });
  26338. var SYSTEM_FUNCTIONS_CATEGORIES = Object.freeze({
  26339. math: "math",
  26340. text: "text_t",
  26341. arrangement: "arrangement",
  26342. conversion: "conversion"
  26343. });
  26344. var Variable = function Variable(type, name, value) {
  26345. var dimensions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
  26346. var is_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  26347. var rows = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  26348. var columns = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 0;
  26349. _classCallCheck(this, Variable);
  26350. this.type = type;
  26351. this.name = name;
  26352. this.value = value;
  26353. this.dimensions = dimensions;
  26354. this.is_constant = is_constant;
  26355. this.rows = rows;
  26356. this.columns = columns;
  26357. };
  26358. var Function = function Function(name) {
  26359. var return_type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID;
  26360. var return_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26361. var parameters_list = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];
  26362. var is_main = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  26363. var is_hidden = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
  26364. var variables_list = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : [];
  26365. var function_comment = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : null;
  26366. var commands = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : [];
  26367. _classCallCheck(this, Function);
  26368. this.type = COMMAND_TYPES.function;
  26369. this.name = name;
  26370. this.return_type = return_type;
  26371. this.return_dimensions = return_dimensions;
  26372. this.parameters_list = parameters_list;
  26373. this.is_main = is_main;
  26374. this.is_hidden = is_hidden;
  26375. this.variables_list = variables_list;
  26376. this.function_comment = function_comment;
  26377. this.commands = commands;
  26378. };
  26379. var SystemFunction = function SystemFunction(identifier, return_type, return_dimensions, parameters_list) {
  26380. var function_comment = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
  26381. var category = arguments.length > 5 ? arguments[5] : undefined;
  26382. _classCallCheck(this, SystemFunction);
  26383. this.type = COMMAND_TYPES.function;
  26384. this.identifier = identifier;
  26385. this.return_type = return_type;
  26386. this.return_dimensions = return_dimensions;
  26387. this.parameters_list = parameters_list;
  26388. this.function_comment = function_comment;
  26389. this.category = category;
  26390. };
  26391. var Comment = function Comment(comment_text) {
  26392. _classCallCheck(this, Comment);
  26393. this.type = COMMAND_TYPES.comment;
  26394. this.comment_text = comment_text;
  26395. };
  26396. var Break = function Break() {
  26397. _classCallCheck(this, Break);
  26398. this.type = COMMAND_TYPES.break;
  26399. };
  26400. var Reader = function Reader() {
  26401. var variable_value_menu = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new VariableValueMenu();
  26402. _classCallCheck(this, Reader);
  26403. this.type = COMMAND_TYPES.reader;
  26404. this.variable_value_menu = variable_value_menu;
  26405. };
  26406. var Writer = function Writer(content) {
  26407. _classCallCheck(this, Writer);
  26408. this.type = COMMAND_TYPES.writer;
  26409. this.content = content;
  26410. };
  26411. var Attribution = function Attribution(variable) {
  26412. var expression = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26413. _classCallCheck(this, Attribution);
  26414. this.type = COMMAND_TYPES.attribution;
  26415. this.variable = variable;
  26416. this.expression = expression;
  26417. };
  26418. var ExpressionOperator = function ExpressionOperator(type_op, item) {
  26419. _classCallCheck(this, ExpressionOperator);
  26420. this.type_op = type_op; // Logic, Arithmetic OR Relational
  26421. this.item = item;
  26422. };
  26423. var ExpressionElement = function ExpressionElement(type_exp) {
  26424. var itens = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26425. _classCallCheck(this, ExpressionElement);
  26426. this.type_exp = type_exp;
  26427. this.itens = itens;
  26428. };
  26429. var ConditionalExpression = function ConditionalExpression(expression) {
  26430. _classCallCheck(this, ConditionalExpression);
  26431. this.type = EXPRESSION_TYPES.exp_conditional;
  26432. this.expression = expression;
  26433. };
  26434. var LogicExpression = function LogicExpression(has_neg, first_operand, second_operand, operator) {
  26435. _classCallCheck(this, LogicExpression);
  26436. this.type = EXPRESSION_TYPES.exp_logic;
  26437. this.has_neg = has_neg;
  26438. this.first_operand = first_operand;
  26439. this.second_operand = second_operand;
  26440. this.operator = operator;
  26441. };
  26442. var ArithmeticExpression = function ArithmeticExpression(first_operand, second_operand, operator) {
  26443. _classCallCheck(this, ArithmeticExpression);
  26444. this.type = EXPRESSION_TYPES.exp_arithmetic;
  26445. this.first_operand = first_operand;
  26446. this.second_operand = second_operand;
  26447. this.operator = operator;
  26448. };
  26449. var IfTrue = function IfTrue(expression, commands_block, commands_else) {
  26450. _classCallCheck(this, IfTrue);
  26451. this.type = COMMAND_TYPES.iftrue;
  26452. this.expression = expression;
  26453. this.commands_block = commands_block;
  26454. this.commands_else = commands_else;
  26455. };
  26456. var RepeatNTimes = function RepeatNTimes(var_attribution, var_incrementation, expression1, expression2, expression3, commands_block) {
  26457. _classCallCheck(this, RepeatNTimes);
  26458. this.type = COMMAND_TYPES.repeatNtimes;
  26459. this.var_attribution = var_attribution;
  26460. this.var_incrementation = var_incrementation;
  26461. this.expression1 = expression1;
  26462. this.expression2 = expression2;
  26463. this.expression3 = expression3;
  26464. this.commands_block = commands_block;
  26465. };
  26466. var WhileTrue = function WhileTrue(expression, commands_block) {
  26467. _classCallCheck(this, WhileTrue);
  26468. this.type = COMMAND_TYPES.whiletrue;
  26469. this.expression = expression;
  26470. this.commands_block = commands_block;
  26471. };
  26472. var DoWhileTrue = function DoWhileTrue(expression, commands_block) {
  26473. _classCallCheck(this, DoWhileTrue);
  26474. this.type = COMMAND_TYPES.dowhiletrue;
  26475. this.expression = expression;
  26476. this.commands_block = commands_block;
  26477. };
  26478. var Switch = function Switch(variable) {
  26479. var cases = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26480. _classCallCheck(this, Switch);
  26481. this.type = COMMAND_TYPES.switch;
  26482. this.variable = variable;
  26483. this.cases = cases;
  26484. };
  26485. var Return = function Return(variable_value_menu) {
  26486. _classCallCheck(this, Return);
  26487. this.type = COMMAND_TYPES.return;
  26488. this.variable_value_menu = variable_value_menu;
  26489. };
  26490. var SwitchCase = function SwitchCase(variable_value_menu) {
  26491. var commands_block = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26492. _classCallCheck(this, SwitchCase);
  26493. this.type = COMMAND_TYPES.switchcase;
  26494. this.variable_value_menu = variable_value_menu;
  26495. this.commands_block = commands_block;
  26496. };
  26497. var FunctionCall = function FunctionCall(function_called, parameters_list) {
  26498. _classCallCheck(this, FunctionCall);
  26499. this.type = COMMAND_TYPES.functioncall;
  26500. this.function_called = function_called;
  26501. this.parameters_list = parameters_list;
  26502. };
  26503. var VariableValueMenu = function VariableValueMenu() {
  26504. var variable_and_value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 7;
  26505. var content = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  26506. var row = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
  26507. var column = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  26508. var include_constant = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
  26509. var dimensions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  26510. _classCallCheck(this, VariableValueMenu);
  26511. this.type = "var_value";
  26512. this.variable_and_value = variable_and_value;
  26513. this.content = content;
  26514. this.row = row;
  26515. this.column = column;
  26516. this.include_constant = include_constant;
  26517. this.dimensions = dimensions;
  26518. };
  26519. var FunctionCallMenu = function FunctionCallMenu() {
  26520. var function_called = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
  26521. var parameters_list = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  26522. _classCallCheck(this, FunctionCallMenu);
  26523. this.type = "function_call";
  26524. this.function_called = function_called;
  26525. this.parameters_list = parameters_list;
  26526. };
  26527. var Program =
  26528. /*#__PURE__*/
  26529. function () {
  26530. function Program() {
  26531. _classCallCheck(this, Program);
  26532. this.functions = [];
  26533. this.globals = [];
  26534. }
  26535. _createClass(Program, [{
  26536. key: "addFunction",
  26537. value: function addFunction(function_to_add) {
  26538. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.parameters_list, function () {
  26539. if (window.insertContext) {
  26540. setTimeout(function () {
  26541. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26542. }, 300);
  26543. window.insertContext = false;
  26544. } else {
  26545. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26546. }
  26547. }, 1);
  26548. melanke_watchjs__WEBPACK_IMPORTED_MODULE_2___default.a.watch(function_to_add.variables_list, function () {
  26549. if (window.insertContext) {
  26550. setTimeout(function () {
  26551. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26552. }, 300);
  26553. window.insertContext = false;
  26554. } else {
  26555. _algorithm__WEBPACK_IMPORTED_MODULE_3__["renderAlgorithm"]();
  26556. }
  26557. }, 1);
  26558. this.functions.push(function_to_add);
  26559. }
  26560. }, {
  26561. key: "addVariable",
  26562. value: function addVariable(function_to_receive, variable) {
  26563. if (this.functions[function_to_receive].variable === null) {
  26564. this.functions[function_to_receive].variables_list = [];
  26565. }
  26566. this.functions[function_to_receive].variables_list.push(variable);
  26567. }
  26568. }, {
  26569. key: "addGlobal",
  26570. value: function addGlobal(variable) {
  26571. this.globals.push(variable);
  26572. }
  26573. }]);
  26574. return Program;
  26575. }();
  26576. /***/ }),
  26577. /***/ "./js/visualUI/types.js":
  26578. /*!******************************!*\
  26579. !*** ./js/visualUI/types.js ***!
  26580. \******************************/
  26581. /*! exports provided: Types */
  26582. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26583. "use strict";
  26584. __webpack_require__.r(__webpack_exports__);
  26585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Types", function() { return Types; });
  26586. var Types = Object.freeze({
  26587. INTEGER: "integer",
  26588. REAL: "real",
  26589. TEXT: "text",
  26590. BOOLEAN: "boolean",
  26591. VOID: "void"
  26592. });
  26593. /***/ }),
  26594. /***/ "./js/visualUI/utils.js":
  26595. /*!******************************!*\
  26596. !*** ./js/visualUI/utils.js ***!
  26597. \******************************/
  26598. /*! exports provided: renderErrorMessage */
  26599. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26600. "use strict";
  26601. __webpack_require__.r(__webpack_exports__);
  26602. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderErrorMessage", function() { return renderErrorMessage; });
  26603. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26604. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26605. function renderErrorMessage(dom_obj_target, message_text) {
  26606. dom_obj_target.popup({
  26607. html: '<i class="ui icon inverted exclamation triangle yellow"></i>' + message_text,
  26608. transition: "fade up",
  26609. on: 'click',
  26610. closable: true,
  26611. movePopup: true,
  26612. boundary: window,
  26613. preserve: false,
  26614. target: false,
  26615. className: {
  26616. popup: 'ui popup invalid-identifier'
  26617. },
  26618. onHidden: function onHidden($module) {
  26619. dom_obj_target.popup('destroy');
  26620. }
  26621. }).popup('toggle');
  26622. }
  26623. /***/ }),
  26624. /***/ "./js/visualUI/variables.js":
  26625. /*!**********************************!*\
  26626. !*** ./js/visualUI/variables.js ***!
  26627. \**********************************/
  26628. /*! exports provided: addVariable, renderVariable */
  26629. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  26630. "use strict";
  26631. __webpack_require__.r(__webpack_exports__);
  26632. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addVariable", function() { return addVariable; });
  26633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "renderVariable", function() { return renderVariable; });
  26634. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "./node_modules/jquery/dist/jquery.js");
  26635. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  26636. /* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./types */ "./js/visualUI/types.js");
  26637. /* harmony import */ var _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ivprog_elements */ "./js/visualUI/ivprog_elements.js");
  26638. /* harmony import */ var _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./../services/localizedStringsService */ "./js/services/localizedStringsService.js");
  26639. /* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./utils */ "./js/visualUI/utils.js");
  26640. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../semantic/semantic.min.js */ "./js/semantic/semantic.min.js");
  26641. /* harmony import */ var _semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_semantic_semantic_min_js__WEBPACK_IMPORTED_MODULE_5__);
  26642. window.jQuery = jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  26643. var counter_new_variables = 0;
  26644. function addVariable(function_obj, function_container) {
  26645. var is_in_click = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  26646. var new_var = new _ivprog_elements__WEBPACK_IMPORTED_MODULE_2__["Variable"](_types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER, _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('new_variable') + '_' + counter_new_variables, 1);
  26647. if (function_obj.variables_list == null) {
  26648. function_obj.variables_list = [];
  26649. }
  26650. function_obj.variables_list.push(new_var);
  26651. counter_new_variables++;
  26652. var newe = renderVariable(function_container, new_var, function_obj);
  26653. if (is_in_click) {
  26654. newe.css('display', 'none');
  26655. newe.fadeIn();
  26656. }
  26657. }
  26658. function updateName(variable_obj, new_name, variable_obj_dom, function_obj) {
  26659. if (variable_obj.name == new_name) {
  26660. return;
  26661. }
  26662. if (isValidIdentifier(new_name)) {
  26663. if (variableNameAlreadyExists(new_name, function_obj)) {
  26664. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_variable_duplicated'));
  26665. } else {
  26666. variable_obj.name = new_name;
  26667. }
  26668. } else {
  26669. _utils__WEBPACK_IMPORTED_MODULE_4__["renderErrorMessage"](variable_obj_dom.find('.editing_name_var'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('inform_valid_name'));
  26670. }
  26671. }
  26672. function variableNameAlreadyExists(name_var, function_obj) {
  26673. if (function_obj.parameters_list) {
  26674. for (var i = 0; i < function_obj.parameters_list.length; i++) {
  26675. if (function_obj.parameters_list[i].name == name_var) {
  26676. return true;
  26677. }
  26678. }
  26679. }
  26680. if (function_obj.variables_list) {
  26681. for (var i = 0; i < function_obj.variables_list.length; i++) {
  26682. if (function_obj.variables_list[i].name == name_var) {
  26683. return true;
  26684. }
  26685. }
  26686. }
  26687. return false;
  26688. }
  26689. function isValidIdentifier(identifier_str) {
  26690. return /^[a-zA-Z_][a-zA-Z0-9_]*$/.test(identifier_str);
  26691. }
  26692. function removeVariable(variable_obj, variable_container) {
  26693. var function_associated = variable_container.data('associatedFunction');
  26694. var index = function_associated.variables_list.indexOf(variable_obj);
  26695. if (index > -1) {
  26696. window.insertContext = true;
  26697. delete function_associated.variables_list[index];
  26698. function_associated.variables_list.splice(index, 1);
  26699. }
  26700. variable_container.children().off();
  26701. variable_container.off();
  26702. variable_container.fadeOut();
  26703. }
  26704. function updateType(variable_obj, new_type) {
  26705. var new_dimensions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  26706. variable_obj.type = new_type;
  26707. variable_obj.dimensions = new_dimensions;
  26708. if (new_dimensions > 0) {
  26709. variable_obj.rows = new_dimensions;
  26710. variable_obj.columns = 2;
  26711. }
  26712. updateInitialValues(variable_obj);
  26713. }
  26714. function addHandlers(variable_obj, variable_container, function_obj) {
  26715. // Manage variable name:
  26716. variable_container.find(".enable_edit_name_variable").on('click', function (e) {
  26717. enableNameUpdate(variable_obj, variable_container, function_obj);
  26718. }); // Menu to change type:
  26719. variable_container.find('.ui.dropdown.variable_type').dropdown({
  26720. onChange: function onChange(value, text, $selectedItem) {
  26721. if ($selectedItem.data('dimensions')) {
  26722. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')], $selectedItem.data('dimensions'));
  26723. } else {
  26724. updateType(variable_obj, _types__WEBPACK_IMPORTED_MODULE_1__["Types"][$selectedItem.data('type')]);
  26725. }
  26726. renderValues(variable_obj, variable_container);
  26727. },
  26728. selectOnKeydown: false
  26729. }); // Remove variable:
  26730. variable_container.find(".remove_variable").on('click', function (e) {
  26731. removeVariable(variable_obj, variable_container);
  26732. });
  26733. }
  26734. function renderVariable(function_container, new_var, function_obj) {
  26735. var element = '<div class="ui label variable_container pink"><i class="ui icon ellipsis vertical inverted"></i>';
  26736. element += '<div class="ui dropdown variable_type">';
  26737. if (new_var.dimensions > 0) {
  26738. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase());
  26739. for (var i = 0; i < new_var.dimensions; i++) {
  26740. element += ' [ ] ';
  26741. }
  26742. element += '</div>';
  26743. } else {
  26744. element += '<div class="text">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.type.toLowerCase()) + '</div>';
  26745. }
  26746. element += '<div class="menu">';
  26747. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26748. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26749. continue;
  26750. }
  26751. element += '<div class="item ' + (new_var.type == tm.toLowerCase() ? ' selected ' : '') + '" data-type="' + tm + '" >' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '</div>';
  26752. }
  26753. for (var tm in _types__WEBPACK_IMPORTED_MODULE_1__["Types"]) {
  26754. if (tm == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].VOID.toUpperCase()) {
  26755. continue;
  26756. }
  26757. element += '<div class="item">' + '<i class="dropdown icon"></i>' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + '<div class="menu">' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] " data-type="' + tm + '" data-dimensions="1">[ ]</div>' + '<div class="item" data-text="' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('vector') + ':' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(tm.toLowerCase()) + ' [ ] [ ] " data-type="' + tm + '" data-dimensions="2">[ ] [ ] </div>' + '</div>' + '</div>';
  26758. }
  26759. element += '</div></div> ';
  26760. element += '<div class="editing_name_var"><span class="span_name_variable enable_edit_name_variable">' + new_var.name + '</span> </div>';
  26761. element += ' <span class="character_equals"> = </span> <div class="ui div_valor_var">' + new_var.value + '</div>';
  26762. element += ' <i class="yellow inverted icon times remove_variable"></i></div>';
  26763. element = jquery__WEBPACK_IMPORTED_MODULE_0___default()(element);
  26764. element.data('associatedFunction', function_obj);
  26765. function_container.find('.variables_list_div').append(element);
  26766. addHandlers(new_var, element, function_obj);
  26767. renderValues(new_var, element);
  26768. return element;
  26769. }
  26770. function updateColumnsAndRowsText(variable_container, variable_var) {
  26771. var prev = variable_container.find('.text').text().split('[');
  26772. if (prev.length == 2) {
  26773. var ff = prev[0] + '[ ' + variable_var.columns + ' ] ';
  26774. variable_container.find('.text').empty();
  26775. variable_container.find('.text').text(ff);
  26776. }
  26777. if (prev.length == 3) {
  26778. var ff = prev[0] + '[ ' + variable_var.columns + ' ] [ ' + variable_var.rows + ' ] ';
  26779. variable_container.find('.text').empty();
  26780. variable_container.find('.text').text(ff);
  26781. }
  26782. }
  26783. function renderValues(new_var, variable_container) {
  26784. var ret = "";
  26785. var j = 0;
  26786. if (new_var.dimensions == 0) {
  26787. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26788. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value.toFixed(1) + '</span> </div> ';
  26789. } else {
  26790. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26791. ret += '<div class="created_div_valor_var"><span class="span_value_variable boolean_simple_type">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value) + '</span> </div> ';
  26792. } else {
  26793. ret += '<div class="created_div_valor_var"><span class="span_value_variable simple_var">' + new_var.value + '</span> </div> ';
  26794. }
  26795. }
  26796. } else {
  26797. ret += '<table class="tabela_var">';
  26798. if (new_var.dimensions == 1) {
  26799. ret += '<tr>';
  26800. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26801. for (var k = 0; k < new_var.columns; k++) {
  26802. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k].toFixed(1) + '</span></td>';
  26803. }
  26804. } else {
  26805. for (var k = 0; k < new_var.columns; k++) {
  26806. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26807. ret += '<td><span class="span_value_variable boolean_vector_var" data-index="' + k + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[k]) + '</span></td>';
  26808. } else {
  26809. ret += '<td><span class="span_value_variable vector_var" data-index="' + k + '">' + new_var.value[k] + '</span>' + '</td>';
  26810. }
  26811. }
  26812. }
  26813. ret += '</tr>';
  26814. ret += '</table>';
  26815. 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>';
  26816. }
  26817. if (new_var.dimensions == 2) {
  26818. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26819. for (var l = 0; l < new_var.rows; l++) {
  26820. ret += '<tr>';
  26821. for (var k = 0; k < new_var.columns; k++) {
  26822. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k].toFixed(1) + '</span>' + '</td>';
  26823. }
  26824. ret += '</tr>';
  26825. }
  26826. } else {
  26827. for (var l = 0; l < new_var.rows; l++) {
  26828. ret += '<tr>';
  26829. for (var k = 0; k < new_var.columns; k++) {
  26830. if (new_var.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26831. ret += '<td><span class="span_value_variable boolean_matrix_var" data-index="' + k + '" data-row="' + l + '">' + _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(new_var.value[l][k]) + '</span></td>';
  26832. } else {
  26833. ret += '<td><span class="span_value_variable matrix_var" data-index="' + k + '" data-row="' + l + '">' + new_var.value[l][k] + '</span></td>';
  26834. }
  26835. }
  26836. ret += '</tr>';
  26837. }
  26838. }
  26839. if (new_var.rows == 0) {
  26840. ret += '<tr><td></td></tr>';
  26841. }
  26842. 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>';
  26843. ret += '</table>';
  26844. 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>';
  26845. }
  26846. }
  26847. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26848. ret = jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret);
  26849. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find('.span_value_variable').data('associatedOject', new_var);
  26850. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_simple_type").on('click', function (e) {
  26851. alternateBooleanValue(new_var, this.parentNode);
  26852. });
  26853. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".simple_var").on('click', function (e) {
  26854. enableValueUpdate(new_var, this.parentNode);
  26855. });
  26856. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_vector_var").on('click', function (e) {
  26857. alternateBooleanVectorValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26858. });
  26859. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".vector_var").on('click', function (e) {
  26860. enableVectorValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26861. });
  26862. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_vector_column").on('click', function (e) {
  26863. removeColumnVector(new_var);
  26864. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26865. renderValues(new_var, variable_container);
  26866. });
  26867. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_vector_column").on('click', function (e) {
  26868. addColumnVector(new_var);
  26869. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26870. renderValues(new_var, variable_container);
  26871. });
  26872. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_column").on('click', function (e) {
  26873. removeColumnMatrix(new_var);
  26874. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26875. renderValues(new_var, variable_container);
  26876. });
  26877. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_column").on('click', function (e) {
  26878. addColumnMatrix(new_var);
  26879. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26880. renderValues(new_var, variable_container);
  26881. });
  26882. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".remove_global_matrix_line").on('click', function (e) {
  26883. removeLineMatrix(new_var);
  26884. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26885. renderValues(new_var, variable_container);
  26886. });
  26887. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".add_global_matrix_line").on('click', function (e) {
  26888. addLineMatrix(new_var);
  26889. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").html('');
  26890. renderValues(new_var, variable_container);
  26891. });
  26892. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".boolean_matrix_var").on('click', function (e) {
  26893. alternateBooleanMatrixValue(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26894. });
  26895. jquery__WEBPACK_IMPORTED_MODULE_0___default()(ret).find(".matrix_var").on('click', function (e) {
  26896. enableMatrixValueUpdate(new_var, jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('row'), jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('index'), this.parentNode);
  26897. });
  26898. jquery__WEBPACK_IMPORTED_MODULE_0___default()(variable_container).find(".div_valor_var").append(ret);
  26899. updateColumnsAndRowsText(variable_container, new_var);
  26900. }
  26901. function alternateBooleanMatrixValue(var_obj, row, index, value_container) {
  26902. var_obj.value[row][index] = !var_obj.value[row][index];
  26903. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[row][index]));
  26904. }
  26905. function addLineMatrix(var_obj) {
  26906. var_obj.rows++;
  26907. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26908. var n_l = [];
  26909. for (var i = 0; i < var_obj.columns; i++) {
  26910. n_l.push(1);
  26911. }
  26912. var_obj.value.push(n_l);
  26913. }
  26914. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26915. var n_l = [];
  26916. for (i = 0; i < var_obj.columns; i++) {
  26917. n_l.push(1.0);
  26918. }
  26919. var_obj.value.push(n_l);
  26920. }
  26921. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26922. var n_l = [];
  26923. for (i = 0; i < var_obj.columns; i++) {
  26924. n_l.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26925. }
  26926. var_obj.value.push(n_l);
  26927. }
  26928. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26929. var n_l = [];
  26930. for (i = 0; i < var_obj.columns; i++) {
  26931. n_l.push(true);
  26932. }
  26933. var_obj.value.push(n_l);
  26934. }
  26935. }
  26936. function removeLineMatrix(var_obj) {
  26937. if (var_obj.rows == 0) {
  26938. return;
  26939. }
  26940. var_obj.rows--;
  26941. var_obj.value.splice(var_obj.value.length - 1, 1);
  26942. }
  26943. function addColumnMatrix(var_obj) {
  26944. var_obj.columns++;
  26945. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26946. for (var i = 0; i < var_obj.rows; i++) {
  26947. var_obj.value[i].push(1);
  26948. }
  26949. }
  26950. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26951. for (var i = 0; i < var_obj.rows; i++) {
  26952. var_obj.value[i].push(1.0);
  26953. }
  26954. }
  26955. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26956. for (var i = 0; i < var_obj.rows; i++) {
  26957. var_obj.value[i].push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26958. }
  26959. }
  26960. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26961. for (var i = 0; i < var_obj.rows; i++) {
  26962. var_obj.value[i].push(true);
  26963. }
  26964. }
  26965. }
  26966. function removeColumnMatrix(var_obj) {
  26967. if (var_obj.columns == 0) {
  26968. return;
  26969. }
  26970. var_obj.columns--;
  26971. for (var i = 0; i < var_obj.rows; i++) {
  26972. var_obj.value[i].splice(var_obj.value[i].length - 1, 1);
  26973. }
  26974. }
  26975. function addColumnVector(var_obj) {
  26976. var_obj.columns++;
  26977. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  26978. var_obj.value.push(1);
  26979. }
  26980. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  26981. var_obj.value.push(1.0);
  26982. }
  26983. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  26984. var_obj.value.push(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'));
  26985. }
  26986. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  26987. var_obj.value.push(true);
  26988. }
  26989. }
  26990. function removeColumnVector(var_obj) {
  26991. if (var_obj.columns == 0) {
  26992. return;
  26993. }
  26994. var_obj.columns--;
  26995. var_obj.value.splice(var_obj.value.length - 1, 1);
  26996. }
  26997. function alternateBooleanValue(var_obj, value_container) {
  26998. var_obj.value = !var_obj.value;
  26999. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value));
  27000. }
  27001. function alternateBooleanVectorValue(var_obj, index, value_container) {
  27002. var_obj.value[index] = !var_obj.value[index];
  27003. jquery__WEBPACK_IMPORTED_MODULE_0___default()(value_container).find('.span_value_variable').text(_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI(var_obj.value[index]));
  27004. }
  27005. function updateInitialValues(variable_obj) {
  27006. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27007. if (variable_obj.dimensions == 0) {
  27008. variable_obj.value = 1;
  27009. }
  27010. if (variable_obj.dimensions == 1) {
  27011. variable_obj.value = [1, 1];
  27012. }
  27013. if (variable_obj.dimensions == 2) {
  27014. variable_obj.value = [[1, 1], [1, 1]];
  27015. }
  27016. }
  27017. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27018. if (variable_obj.dimensions == 0) {
  27019. variable_obj.value = 1.0;
  27020. }
  27021. if (variable_obj.dimensions == 1) {
  27022. variable_obj.value = [1.0, 1.0];
  27023. }
  27024. if (variable_obj.dimensions == 2) {
  27025. variable_obj.value = [[1.0, 1.0], [1.0, 1.0]];
  27026. }
  27027. }
  27028. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27029. if (variable_obj.dimensions == 0) {
  27030. variable_obj.value = _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start');
  27031. }
  27032. if (variable_obj.dimensions == 1) {
  27033. variable_obj.value = [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')];
  27034. }
  27035. if (variable_obj.dimensions == 2) {
  27036. variable_obj.value = [[_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')], [_services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start'), _services_localizedStringsService__WEBPACK_IMPORTED_MODULE_3__["LocalizedStrings"].getUI('text_start')]];
  27037. }
  27038. }
  27039. if (variable_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].BOOLEAN) {
  27040. if (variable_obj.dimensions == 0) {
  27041. variable_obj.value = true;
  27042. }
  27043. if (variable_obj.dimensions == 1) {
  27044. variable_obj.value = [true, true];
  27045. }
  27046. if (variable_obj.dimensions == 2) {
  27047. variable_obj.value = [[true, true], [true, true]];
  27048. }
  27049. }
  27050. }
  27051. var opened_name_value_vector_global_ = false;
  27052. var opened_input_value_vector_global_ = null;
  27053. function enableVectorValueUpdate(var_obj, index, parent_node) {
  27054. if (opened_name_value_vector_global_) {
  27055. opened_input_value_vector_global_.focus();
  27056. return;
  27057. }
  27058. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27059. opened_name_value_vector_global_ = true;
  27060. parent_node.find('.span_value_variable').text('');
  27061. var input_field;
  27062. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27063. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index].toFixed(1) + "' />");
  27064. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27065. } else {
  27066. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[index] + "' />");
  27067. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27068. }
  27069. input_field.on('input', function () {
  27070. var inputWidth = input_field.textWidth() + 10;
  27071. opened_input_value_vector_global_ = input_field;
  27072. input_field.focus();
  27073. var tmpStr = input_field.val();
  27074. input_field.val('');
  27075. input_field.val(tmpStr);
  27076. input_field.css({
  27077. width: inputWidth
  27078. });
  27079. }).trigger('input');
  27080. input_field.focusout(function () {
  27081. /// update array:
  27082. if (input_field.val().trim()) {
  27083. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27084. var_obj.value[index] = parseFloat(input_field.val().trim());
  27085. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27086. } else {
  27087. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27088. var_obj.value[index] = parseInt(input_field.val().trim());
  27089. } else {
  27090. var_obj.value[index] = input_field.val().trim();
  27091. }
  27092. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27093. }
  27094. } else {
  27095. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27096. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27097. } else {
  27098. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27099. }
  27100. }
  27101. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27102. var_obj.value[index] = input_field.val();
  27103. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27104. }
  27105. input_field.off();
  27106. input_field.remove(); /// update elements:
  27107. opened_name_value_vector_global_ = false;
  27108. opened_input_value_vector_global_ = false;
  27109. });
  27110. input_field.on('keydown', function (e) {
  27111. var code = e.keyCode || e.which;
  27112. if (code == 13) {
  27113. if (input_field.val().trim()) {
  27114. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27115. var_obj.value[index] = parseFloat(input_field.val().trim());
  27116. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27117. } else {
  27118. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27119. var_obj.value[index] = parseInt(input_field.val().trim());
  27120. } else {
  27121. var_obj.value[index] = input_field.val().trim();
  27122. }
  27123. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27124. }
  27125. } else {
  27126. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27127. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27128. } else {
  27129. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27130. }
  27131. }
  27132. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27133. var_obj.value[index] = input_field.val();
  27134. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27135. }
  27136. input_field.off();
  27137. input_field.remove(); /// update elements:
  27138. opened_name_value_vector_global_ = false;
  27139. opened_input_value_vector_global_ = false;
  27140. }
  27141. if (code == 27) {
  27142. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27143. parent_node.find('.span_value_variable').text(var_obj.value[index].toFixed(1));
  27144. } else {
  27145. parent_node.find('.span_value_variable').text(var_obj.value[index]);
  27146. }
  27147. input_field.off();
  27148. input_field.remove(); /// update elements:
  27149. opened_name_value_vector_global_ = false;
  27150. opened_input_value_vector_global_ = false;
  27151. }
  27152. });
  27153. input_field.select();
  27154. }
  27155. var opened_name_value_global_var = false;
  27156. var opened_input_value_global_ar = null;
  27157. function enableValueUpdate(var_obj, parent_node) {
  27158. if (opened_name_value_global_var) {
  27159. opened_input_value_global_ar.focus();
  27160. return;
  27161. }
  27162. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27163. opened_name_value_global_var = true;
  27164. var input_field;
  27165. parent_node.find('.span_value_variable').text('');
  27166. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27167. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value.toFixed(1) + "' />");
  27168. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27169. } else {
  27170. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value + "' />");
  27171. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27172. }
  27173. input_field.on('input', function () {
  27174. var inputWidth = input_field.textWidth() + 10;
  27175. opened_input_value_global_ar = input_field;
  27176. input_field.focus();
  27177. var tmpStr = input_field.val();
  27178. input_field.val('');
  27179. input_field.val(tmpStr);
  27180. input_field.css({
  27181. width: inputWidth
  27182. });
  27183. }).trigger('input');
  27184. input_field.focusout(function () {
  27185. /// update array:
  27186. if (input_field.val().trim()) {
  27187. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27188. var_obj.value = parseFloat(input_field.val().trim());
  27189. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27190. } else {
  27191. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27192. var_obj.value = parseInt(input_field.val().trim());
  27193. } else {
  27194. var_obj.value = input_field.val().trim();
  27195. }
  27196. parent_node.find('.span_value_variable').text(var_obj.value);
  27197. }
  27198. } else {
  27199. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27200. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27201. } else {
  27202. parent_node.find('.span_value_variable').text(var_obj.value);
  27203. }
  27204. }
  27205. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27206. var_obj.value = input_field.val();
  27207. parent_node.find('.span_value_variable').text(var_obj.value);
  27208. }
  27209. input_field.off();
  27210. input_field.remove(); /// update elements:
  27211. opened_name_value_global_var = false;
  27212. opened_input_value_global_ar = false;
  27213. });
  27214. input_field.on('keydown', function (e) {
  27215. var code = e.keyCode || e.which;
  27216. if (code == 13) {
  27217. if (input_field.val().trim()) {
  27218. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27219. var_obj.value = parseFloat(input_field.val().trim());
  27220. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27221. } else {
  27222. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27223. var_obj.value = parseInt(input_field.val().trim());
  27224. } else {
  27225. var_obj.value = input_field.val().trim();
  27226. }
  27227. parent_node.find('.span_value_variable').text(var_obj.value);
  27228. }
  27229. } else {
  27230. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27231. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27232. } else {
  27233. parent_node.find('.span_value_variable').text(var_obj.value);
  27234. }
  27235. }
  27236. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27237. var_obj.value = input_field.val();
  27238. parent_node.find('.span_value_variable').text(var_obj.value);
  27239. }
  27240. input_field.off();
  27241. input_field.remove(); /// update elements:
  27242. opened_name_value_global_var = false;
  27243. opened_input_value_global_ar = false;
  27244. }
  27245. if (code == 27) {
  27246. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27247. parent_node.find('.span_value_variable').text(var_obj.value.toFixed(1));
  27248. } else {
  27249. parent_node.find('.span_value_variable').text(var_obj.value);
  27250. }
  27251. input_field.off();
  27252. input_field.remove(); /// update elements:
  27253. opened_name_value_global_var = false;
  27254. opened_input_value_global_ar = false;
  27255. }
  27256. });
  27257. input_field.select();
  27258. }
  27259. var opened_name_global = false;
  27260. var opened_input_global = null;
  27261. function enableNameUpdate(variable_obj, variable_container, function_obj) {
  27262. if (opened_name_global) {
  27263. opened_input_global.focus();
  27264. return;
  27265. }
  27266. opened_name_global = true;
  27267. variable_container.find('.span_name_variable').text('');
  27268. var input_name;
  27269. input_name = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + variable_obj.name + "' />");
  27270. input_name.insertBefore(variable_container.find('.span_name_variable'));
  27271. input_name.on('input', function () {
  27272. var inputWidth = input_name.textWidth() + 10;
  27273. opened_input_global = input_name;
  27274. input_name.focus();
  27275. var tmpStr = input_name.val();
  27276. input_name.val('');
  27277. input_name.val(tmpStr);
  27278. input_name.css({
  27279. width: inputWidth
  27280. });
  27281. }).trigger('input');
  27282. input_name.focusout(function () {
  27283. /// update array:
  27284. if (input_name.val().trim().length > 0) {
  27285. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  27286. variable_container.find('.span_name_variable').text(variable_obj.name);
  27287. } else {
  27288. variable_container.find('.span_name_variable').text(variable_obj.name);
  27289. }
  27290. input_name.off();
  27291. input_name.remove(); /// update elements:
  27292. opened_name_global = false;
  27293. opened_input_global = false;
  27294. });
  27295. input_name.on('keydown', function (e) {
  27296. var code = e.keyCode || e.which;
  27297. if (code == 13) {
  27298. if (input_name.val().trim().length > 0) {
  27299. updateName(variable_obj, input_name.val().trim(), variable_container, function_obj);
  27300. variable_container.find('.span_name_variable').text(variable_obj.name);
  27301. } else {
  27302. variable_container.find('.span_name_variable').text(variable_obj.name);
  27303. }
  27304. input_name.off();
  27305. input_name.remove(); /// update elements:
  27306. opened_name_global = false;
  27307. opened_input_global = false;
  27308. }
  27309. if (code == 27) {
  27310. variable_container.find('.span_name_variable').text(variable_obj.name);
  27311. input_name.off();
  27312. input_name.remove(); /// update elements:
  27313. opened_name_global = false;
  27314. opened_input_global = false;
  27315. }
  27316. });
  27317. input_name.select();
  27318. }
  27319. var opened_name_value_matrix_global_v = false;
  27320. var opened_input_value_matrix_global_v = null;
  27321. function enableMatrixValueUpdate(var_obj, row, index, parent_node) {
  27322. if (opened_name_value_matrix_global_v) {
  27323. opened_input_value_matrix_global_v.focus();
  27324. return;
  27325. }
  27326. parent_node = jquery__WEBPACK_IMPORTED_MODULE_0___default()(parent_node);
  27327. opened_name_value_matrix_global_v = true;
  27328. parent_node.find('.span_value_variable').text('');
  27329. var input_field;
  27330. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27331. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index].toFixed(1) + "' />");
  27332. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27333. } else {
  27334. input_field = jquery__WEBPACK_IMPORTED_MODULE_0___default()("<input type='text' class='width-dynamic input_name_function' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' value='" + var_obj.value[row][index] + "' />");
  27335. input_field.insertBefore(parent_node.find('.span_value_variable'));
  27336. }
  27337. input_field.on('input', function () {
  27338. var inputWidth = input_field.textWidth() + 10;
  27339. opened_input_value_matrix_global_v = input_field;
  27340. input_field.focus();
  27341. var tmpStr = input_field.val();
  27342. input_field.val('');
  27343. input_field.val(tmpStr);
  27344. input_field.css({
  27345. width: inputWidth
  27346. });
  27347. }).trigger('input');
  27348. input_field.focusout(function () {
  27349. /// update array:
  27350. if (input_field.val().trim()) {
  27351. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27352. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  27353. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27354. } else {
  27355. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27356. var_obj.value[row][index] = parseInt(input_field.val().trim());
  27357. } else {
  27358. var_obj.value[row][index] = input_field.val().trim();
  27359. }
  27360. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27361. }
  27362. } else {
  27363. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27364. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27365. } else {
  27366. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27367. }
  27368. }
  27369. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27370. var_obj.value[row][index] = input_field.val();
  27371. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27372. }
  27373. input_field.off();
  27374. input_field.remove(); /// update elements:
  27375. opened_name_value_matrix_global_v = false;
  27376. opened_input_value_matrix_global_v = false;
  27377. });
  27378. input_field.on('keydown', function (e) {
  27379. var code = e.keyCode || e.which;
  27380. if (code == 13) {
  27381. if (input_field.val().trim()) {
  27382. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27383. var_obj.value[row][index] = parseFloat(input_field.val().trim());
  27384. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27385. } else {
  27386. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].INTEGER) {
  27387. var_obj.value[row][index] = parseInt(input_field.val().trim());
  27388. } else {
  27389. var_obj.value[row][index] = input_field.val().trim();
  27390. }
  27391. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27392. }
  27393. } else {
  27394. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27395. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27396. } else {
  27397. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27398. }
  27399. }
  27400. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].TEXT) {
  27401. var_obj.value[row][index] = input_field.val();
  27402. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27403. }
  27404. input_field.off();
  27405. input_field.remove(); /// update elements:
  27406. opened_name_value_matrix_global_v = false;
  27407. opened_input_value_matrix_global_v = false;
  27408. }
  27409. if (code == 27) {
  27410. if (var_obj.type == _types__WEBPACK_IMPORTED_MODULE_1__["Types"].REAL) {
  27411. parent_node.find('.span_value_variable').text(var_obj.value[row][index].toFixed(1));
  27412. } else {
  27413. parent_node.find('.span_value_variable').text(var_obj.value[row][index]);
  27414. }
  27415. input_field.off();
  27416. input_field.remove(); /// update elements:
  27417. opened_name_value_matrix_global_v = false;
  27418. opened_input_value_matrix_global_v = false;
  27419. }
  27420. });
  27421. input_field.select();
  27422. }
  27423. /***/ }),
  27424. /***/ "./node_modules/antlr4/BufferedTokenStream.js":
  27425. /*!****************************************************!*\
  27426. !*** ./node_modules/antlr4/BufferedTokenStream.js ***!
  27427. \****************************************************/
  27428. /*! no static exports found */
  27429. /***/ (function(module, exports, __webpack_require__) {
  27430. //
  27431. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27432. * Use of this file is governed by the BSD 3-clause license that
  27433. * can be found in the LICENSE.txt file in the project root.
  27434. */
  27435. // This implementation of {@link TokenStream} loads tokens from a
  27436. // {@link TokenSource} on-demand, and places the tokens in a buffer to provide
  27437. // access to any previous token by index.
  27438. //
  27439. // <p>
  27440. // This token stream ignores the value of {@link Token//getChannel}. If your
  27441. // parser requires the token stream filter tokens to only those on a particular
  27442. // channel, such as {@link Token//DEFAULT_CHANNEL} or
  27443. // {@link Token//HIDDEN_CHANNEL}, use a filtering token stream such a
  27444. // {@link CommonTokenStream}.</p>
  27445. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27446. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  27447. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  27448. // this is just to keep meaningful parameter types to Parser
  27449. function TokenStream() {
  27450. return this;
  27451. }
  27452. function BufferedTokenStream(tokenSource) {
  27453. TokenStream.call(this);
  27454. // The {@link TokenSource} from which tokens for this stream are fetched.
  27455. this.tokenSource = tokenSource;
  27456. // A collection of all tokens fetched from the token source. The list is
  27457. // considered a complete view of the input once {@link //fetchedEOF} is set
  27458. // to {@code true}.
  27459. this.tokens = [];
  27460. // The index into {@link //tokens} of the current token (next token to
  27461. // {@link //consume}). {@link //tokens}{@code [}{@link //p}{@code ]} should
  27462. // be
  27463. // {@link //LT LT(1)}.
  27464. //
  27465. // <p>This field is set to -1 when the stream is first constructed or when
  27466. // {@link //setTokenSource} is called, indicating that the first token has
  27467. // not yet been fetched from the token source. For additional information,
  27468. // see the documentation of {@link IntStream} for a description of
  27469. // Initializing Methods.</p>
  27470. this.index = -1;
  27471. // Indicates whether the {@link Token//EOF} token has been fetched from
  27472. // {@link //tokenSource} and added to {@link //tokens}. This field improves
  27473. // performance for the following cases:
  27474. //
  27475. // <ul>
  27476. // <li>{@link //consume}: The lookahead check in {@link //consume} to
  27477. // prevent
  27478. // consuming the EOF symbol is optimized by checking the values of
  27479. // {@link //fetchedEOF} and {@link //p} instead of calling {@link
  27480. // //LA}.</li>
  27481. // <li>{@link //fetch}: The check to prevent adding multiple EOF symbols
  27482. // into
  27483. // {@link //tokens} is trivial with this field.</li>
  27484. // <ul>
  27485. this.fetchedEOF = false;
  27486. return this;
  27487. }
  27488. BufferedTokenStream.prototype = Object.create(TokenStream.prototype);
  27489. BufferedTokenStream.prototype.constructor = BufferedTokenStream;
  27490. BufferedTokenStream.prototype.mark = function() {
  27491. return 0;
  27492. };
  27493. BufferedTokenStream.prototype.release = function(marker) {
  27494. // no resources to release
  27495. };
  27496. BufferedTokenStream.prototype.reset = function() {
  27497. this.seek(0);
  27498. };
  27499. BufferedTokenStream.prototype.seek = function(index) {
  27500. this.lazyInit();
  27501. this.index = this.adjustSeekIndex(index);
  27502. };
  27503. BufferedTokenStream.prototype.get = function(index) {
  27504. this.lazyInit();
  27505. return this.tokens[index];
  27506. };
  27507. BufferedTokenStream.prototype.consume = function() {
  27508. var skipEofCheck = false;
  27509. if (this.index >= 0) {
  27510. if (this.fetchedEOF) {
  27511. // the last token in tokens is EOF. skip check if p indexes any
  27512. // fetched token except the last.
  27513. skipEofCheck = this.index < this.tokens.length - 1;
  27514. } else {
  27515. // no EOF token in tokens. skip check if p indexes a fetched token.
  27516. skipEofCheck = this.index < this.tokens.length;
  27517. }
  27518. } else {
  27519. // not yet initialized
  27520. skipEofCheck = false;
  27521. }
  27522. if (!skipEofCheck && this.LA(1) === Token.EOF) {
  27523. throw "cannot consume EOF";
  27524. }
  27525. if (this.sync(this.index + 1)) {
  27526. this.index = this.adjustSeekIndex(this.index + 1);
  27527. }
  27528. };
  27529. // Make sure index {@code i} in tokens has a token.
  27530. //
  27531. // @return {@code true} if a token is located at index {@code i}, otherwise
  27532. // {@code false}.
  27533. // @see //get(int i)
  27534. // /
  27535. BufferedTokenStream.prototype.sync = function(i) {
  27536. var n = i - this.tokens.length + 1; // how many more elements we need?
  27537. if (n > 0) {
  27538. var fetched = this.fetch(n);
  27539. return fetched >= n;
  27540. }
  27541. return true;
  27542. };
  27543. // Add {@code n} elements to buffer.
  27544. //
  27545. // @return The actual number of elements added to the buffer.
  27546. // /
  27547. BufferedTokenStream.prototype.fetch = function(n) {
  27548. if (this.fetchedEOF) {
  27549. return 0;
  27550. }
  27551. for (var i = 0; i < n; i++) {
  27552. var t = this.tokenSource.nextToken();
  27553. t.tokenIndex = this.tokens.length;
  27554. this.tokens.push(t);
  27555. if (t.type === Token.EOF) {
  27556. this.fetchedEOF = true;
  27557. return i + 1;
  27558. }
  27559. }
  27560. return n;
  27561. };
  27562. // Get all tokens from start..stop inclusively///
  27563. BufferedTokenStream.prototype.getTokens = function(start, stop, types) {
  27564. if (types === undefined) {
  27565. types = null;
  27566. }
  27567. if (start < 0 || stop < 0) {
  27568. return null;
  27569. }
  27570. this.lazyInit();
  27571. var subset = [];
  27572. if (stop >= this.tokens.length) {
  27573. stop = this.tokens.length - 1;
  27574. }
  27575. for (var i = start; i < stop; i++) {
  27576. var t = this.tokens[i];
  27577. if (t.type === Token.EOF) {
  27578. break;
  27579. }
  27580. if (types === null || types.contains(t.type)) {
  27581. subset.push(t);
  27582. }
  27583. }
  27584. return subset;
  27585. };
  27586. BufferedTokenStream.prototype.LA = function(i) {
  27587. return this.LT(i).type;
  27588. };
  27589. BufferedTokenStream.prototype.LB = function(k) {
  27590. if (this.index - k < 0) {
  27591. return null;
  27592. }
  27593. return this.tokens[this.index - k];
  27594. };
  27595. BufferedTokenStream.prototype.LT = function(k) {
  27596. this.lazyInit();
  27597. if (k === 0) {
  27598. return null;
  27599. }
  27600. if (k < 0) {
  27601. return this.LB(-k);
  27602. }
  27603. var i = this.index + k - 1;
  27604. this.sync(i);
  27605. if (i >= this.tokens.length) { // return EOF token
  27606. // EOF must be last token
  27607. return this.tokens[this.tokens.length - 1];
  27608. }
  27609. return this.tokens[i];
  27610. };
  27611. // Allowed derived classes to modify the behavior of operations which change
  27612. // the current stream position by adjusting the target token index of a seek
  27613. // operation. The default implementation simply returns {@code i}. If an
  27614. // exception is thrown in this method, the current stream index should not be
  27615. // changed.
  27616. //
  27617. // <p>For example, {@link CommonTokenStream} overrides this method to ensure
  27618. // that
  27619. // the seek target is always an on-channel token.</p>
  27620. //
  27621. // @param i The target token index.
  27622. // @return The adjusted target token index.
  27623. BufferedTokenStream.prototype.adjustSeekIndex = function(i) {
  27624. return i;
  27625. };
  27626. BufferedTokenStream.prototype.lazyInit = function() {
  27627. if (this.index === -1) {
  27628. this.setup();
  27629. }
  27630. };
  27631. BufferedTokenStream.prototype.setup = function() {
  27632. this.sync(0);
  27633. this.index = this.adjustSeekIndex(0);
  27634. };
  27635. // Reset this token stream by setting its token source.///
  27636. BufferedTokenStream.prototype.setTokenSource = function(tokenSource) {
  27637. this.tokenSource = tokenSource;
  27638. this.tokens = [];
  27639. this.index = -1;
  27640. this.fetchedEOF = false;
  27641. };
  27642. // Given a starting index, return the index of the next token on channel.
  27643. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27644. // on channel between i and EOF.
  27645. // /
  27646. BufferedTokenStream.prototype.nextTokenOnChannel = function(i, channel) {
  27647. this.sync(i);
  27648. if (i >= this.tokens.length) {
  27649. return -1;
  27650. }
  27651. var token = this.tokens[i];
  27652. while (token.channel !== this.channel) {
  27653. if (token.type === Token.EOF) {
  27654. return -1;
  27655. }
  27656. i += 1;
  27657. this.sync(i);
  27658. token = this.tokens[i];
  27659. }
  27660. return i;
  27661. };
  27662. // Given a starting index, return the index of the previous token on channel.
  27663. // Return i if tokens[i] is on channel. Return -1 if there are no tokens
  27664. // on channel between i and 0.
  27665. BufferedTokenStream.prototype.previousTokenOnChannel = function(i, channel) {
  27666. while (i >= 0 && this.tokens[i].channel !== channel) {
  27667. i -= 1;
  27668. }
  27669. return i;
  27670. };
  27671. // Collect all tokens on specified channel to the right of
  27672. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL or
  27673. // EOF. If channel is -1, find any non default channel token.
  27674. BufferedTokenStream.prototype.getHiddenTokensToRight = function(tokenIndex,
  27675. channel) {
  27676. if (channel === undefined) {
  27677. channel = -1;
  27678. }
  27679. this.lazyInit();
  27680. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27681. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27682. }
  27683. var nextOnChannel = this.nextTokenOnChannel(tokenIndex + 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27684. var from_ = tokenIndex + 1;
  27685. // if none onchannel to right, nextOnChannel=-1 so set to = last token
  27686. var to = nextOnChannel === -1 ? this.tokens.length - 1 : nextOnChannel;
  27687. return this.filterForChannel(from_, to, channel);
  27688. };
  27689. // Collect all tokens on specified channel to the left of
  27690. // the current token up until we see a token on DEFAULT_TOKEN_CHANNEL.
  27691. // If channel is -1, find any non default channel token.
  27692. BufferedTokenStream.prototype.getHiddenTokensToLeft = function(tokenIndex,
  27693. channel) {
  27694. if (channel === undefined) {
  27695. channel = -1;
  27696. }
  27697. this.lazyInit();
  27698. if (tokenIndex < 0 || tokenIndex >= this.tokens.length) {
  27699. throw "" + tokenIndex + " not in 0.." + this.tokens.length - 1;
  27700. }
  27701. var prevOnChannel = this.previousTokenOnChannel(tokenIndex - 1, Lexer.DEFAULT_TOKEN_CHANNEL);
  27702. if (prevOnChannel === tokenIndex - 1) {
  27703. return null;
  27704. }
  27705. // if none on channel to left, prevOnChannel=-1 then from=0
  27706. var from_ = prevOnChannel + 1;
  27707. var to = tokenIndex - 1;
  27708. return this.filterForChannel(from_, to, channel);
  27709. };
  27710. BufferedTokenStream.prototype.filterForChannel = function(left, right, channel) {
  27711. var hidden = [];
  27712. for (var i = left; i < right + 1; i++) {
  27713. var t = this.tokens[i];
  27714. if (channel === -1) {
  27715. if (t.channel !== Lexer.DEFAULT_TOKEN_CHANNEL) {
  27716. hidden.push(t);
  27717. }
  27718. } else if (t.channel === channel) {
  27719. hidden.push(t);
  27720. }
  27721. }
  27722. if (hidden.length === 0) {
  27723. return null;
  27724. }
  27725. return hidden;
  27726. };
  27727. BufferedTokenStream.prototype.getSourceName = function() {
  27728. return this.tokenSource.getSourceName();
  27729. };
  27730. // Get the text of all tokens in this buffer.///
  27731. BufferedTokenStream.prototype.getText = function(interval) {
  27732. this.lazyInit();
  27733. this.fill();
  27734. if (interval === undefined || interval === null) {
  27735. interval = new Interval(0, this.tokens.length - 1);
  27736. }
  27737. var start = interval.start;
  27738. if (start instanceof Token) {
  27739. start = start.tokenIndex;
  27740. }
  27741. var stop = interval.stop;
  27742. if (stop instanceof Token) {
  27743. stop = stop.tokenIndex;
  27744. }
  27745. if (start === null || stop === null || start < 0 || stop < 0) {
  27746. return "";
  27747. }
  27748. if (stop >= this.tokens.length) {
  27749. stop = this.tokens.length - 1;
  27750. }
  27751. var s = "";
  27752. for (var i = start; i < stop + 1; i++) {
  27753. var t = this.tokens[i];
  27754. if (t.type === Token.EOF) {
  27755. break;
  27756. }
  27757. s = s + t.text;
  27758. }
  27759. return s;
  27760. };
  27761. // Get all tokens from lexer until EOF///
  27762. BufferedTokenStream.prototype.fill = function() {
  27763. this.lazyInit();
  27764. while (this.fetch(1000) === 1000) {
  27765. continue;
  27766. }
  27767. };
  27768. exports.BufferedTokenStream = BufferedTokenStream;
  27769. /***/ }),
  27770. /***/ "./node_modules/antlr4/CharStreams.js":
  27771. /*!********************************************!*\
  27772. !*** ./node_modules/antlr4/CharStreams.js ***!
  27773. \********************************************/
  27774. /*! no static exports found */
  27775. /***/ (function(module, exports, __webpack_require__) {
  27776. //
  27777. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27778. * Use of this file is governed by the BSD 3-clause license that
  27779. * can be found in the LICENSE.txt file in the project root.
  27780. */
  27781. //
  27782. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  27783. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  27784. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  27785. // Utility functions to create InputStreams from various sources.
  27786. //
  27787. // All returned InputStreams support the full range of Unicode
  27788. // up to U+10FFFF (the default behavior of InputStream only supports
  27789. // code points up to U+FFFF).
  27790. var CharStreams = {
  27791. // Creates an InputStream from a string.
  27792. fromString: function(str) {
  27793. return new InputStream(str, true);
  27794. },
  27795. // Asynchronously creates an InputStream from a blob given the
  27796. // encoding of the bytes in that blob (defaults to 'utf8' if
  27797. // encoding is null).
  27798. //
  27799. // Invokes onLoad(result) on success, onError(error) on
  27800. // failure.
  27801. fromBlob: function(blob, encoding, onLoad, onError) {
  27802. var reader = FileReader();
  27803. reader.onload = function(e) {
  27804. var is = new InputStream(e.target.result, true);
  27805. onLoad(is);
  27806. };
  27807. reader.onerror = onError;
  27808. reader.readAsText(blob, encoding);
  27809. },
  27810. // Creates an InputStream from a Buffer given the
  27811. // encoding of the bytes in that buffer (defaults to 'utf8' if
  27812. // encoding is null).
  27813. fromBuffer: function(buffer, encoding) {
  27814. return new InputStream(buffer.toString(encoding), true);
  27815. },
  27816. // Asynchronously creates an InputStream from a file on disk given
  27817. // the encoding of the bytes in that file (defaults to 'utf8' if
  27818. // encoding is null).
  27819. //
  27820. // Invokes callback(error, result) on completion.
  27821. fromPath: function(path, encoding, callback) {
  27822. fs.readFile(path, encoding, function(err, data) {
  27823. var is = null;
  27824. if (data !== null) {
  27825. is = new InputStream(data, true);
  27826. }
  27827. callback(err, is);
  27828. });
  27829. },
  27830. // Synchronously creates an InputStream given a path to a file
  27831. // on disk and the encoding of the bytes in that file (defaults to
  27832. // 'utf8' if encoding is null).
  27833. fromPathSync: function(path, encoding) {
  27834. var data = fs.readFileSync(path, encoding);
  27835. return new InputStream(data, true);
  27836. }
  27837. };
  27838. exports.CharStreams = CharStreams;
  27839. /***/ }),
  27840. /***/ "./node_modules/antlr4/CommonTokenFactory.js":
  27841. /*!***************************************************!*\
  27842. !*** ./node_modules/antlr4/CommonTokenFactory.js ***!
  27843. \***************************************************/
  27844. /*! no static exports found */
  27845. /***/ (function(module, exports, __webpack_require__) {
  27846. //
  27847. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27848. * Use of this file is governed by the BSD 3-clause license that
  27849. * can be found in the LICENSE.txt file in the project root.
  27850. */
  27851. //
  27852. //
  27853. // This default implementation of {@link TokenFactory} creates
  27854. // {@link CommonToken} objects.
  27855. //
  27856. var CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  27857. function TokenFactory() {
  27858. return this;
  27859. }
  27860. function CommonTokenFactory(copyText) {
  27861. TokenFactory.call(this);
  27862. // Indicates whether {@link CommonToken//setText} should be called after
  27863. // constructing tokens to explicitly set the text. This is useful for cases
  27864. // where the input stream might not be able to provide arbitrary substrings
  27865. // of text from the input after the lexer creates a token (e.g. the
  27866. // implementation of {@link CharStream//getText} in
  27867. // {@link UnbufferedCharStream} throws an
  27868. // {@link UnsupportedOperationException}). Explicitly setting the token text
  27869. // allows {@link Token//getText} to be called at any time regardless of the
  27870. // input stream implementation.
  27871. //
  27872. // <p>
  27873. // The default value is {@code false} to avoid the performance and memory
  27874. // overhead of copying text for every token unless explicitly requested.</p>
  27875. //
  27876. this.copyText = copyText===undefined ? false : copyText;
  27877. return this;
  27878. }
  27879. CommonTokenFactory.prototype = Object.create(TokenFactory.prototype);
  27880. CommonTokenFactory.prototype.constructor = CommonTokenFactory;
  27881. //
  27882. // The default {@link CommonTokenFactory} instance.
  27883. //
  27884. // <p>
  27885. // This token factory does not explicitly copy token text when constructing
  27886. // tokens.</p>
  27887. //
  27888. CommonTokenFactory.DEFAULT = new CommonTokenFactory();
  27889. CommonTokenFactory.prototype.create = function(source, type, text, channel, start, stop, line, column) {
  27890. var t = new CommonToken(source, type, channel, start, stop);
  27891. t.line = line;
  27892. t.column = column;
  27893. if (text !==null) {
  27894. t.text = text;
  27895. } else if (this.copyText && source[1] !==null) {
  27896. t.text = source[1].getText(start,stop);
  27897. }
  27898. return t;
  27899. };
  27900. CommonTokenFactory.prototype.createThin = function(type, text) {
  27901. var t = new CommonToken(null, type);
  27902. t.text = text;
  27903. return t;
  27904. };
  27905. exports.CommonTokenFactory = CommonTokenFactory;
  27906. /***/ }),
  27907. /***/ "./node_modules/antlr4/CommonTokenStream.js":
  27908. /*!**************************************************!*\
  27909. !*** ./node_modules/antlr4/CommonTokenStream.js ***!
  27910. \**************************************************/
  27911. /*! no static exports found */
  27912. /***/ (function(module, exports, __webpack_require__) {
  27913. //
  27914. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  27915. * Use of this file is governed by the BSD 3-clause license that
  27916. * can be found in the LICENSE.txt file in the project root.
  27917. */
  27918. ///
  27919. //
  27920. // This class extends {@link BufferedTokenStream} with functionality to filter
  27921. // token streams to tokens on a particular channel (tokens where
  27922. // {@link Token//getChannel} returns a particular value).
  27923. //
  27924. // <p>
  27925. // This token stream provides access to all tokens by index or when calling
  27926. // methods like {@link //getText}. The channel filtering is only used for code
  27927. // accessing tokens via the lookahead methods {@link //LA}, {@link //LT}, and
  27928. // {@link //LB}.</p>
  27929. //
  27930. // <p>
  27931. // By default, tokens are placed on the default channel
  27932. // ({@link Token//DEFAULT_CHANNEL}), but may be reassigned by using the
  27933. // {@code ->channel(HIDDEN)} lexer command, or by using an embedded action to
  27934. // call {@link Lexer//setChannel}.
  27935. // </p>
  27936. //
  27937. // <p>
  27938. // Note: lexer rules which use the {@code ->skip} lexer command or call
  27939. // {@link Lexer//skip} do not produce tokens at all, so input text matched by
  27940. // such a rule will not be available as part of the token stream, regardless of
  27941. // channel.</p>
  27942. ///
  27943. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  27944. var BufferedTokenStream = __webpack_require__(/*! ./BufferedTokenStream */ "./node_modules/antlr4/BufferedTokenStream.js").BufferedTokenStream;
  27945. function CommonTokenStream(lexer, channel) {
  27946. BufferedTokenStream.call(this, lexer);
  27947. this.channel = channel===undefined ? Token.DEFAULT_CHANNEL : channel;
  27948. return this;
  27949. }
  27950. CommonTokenStream.prototype = Object.create(BufferedTokenStream.prototype);
  27951. CommonTokenStream.prototype.constructor = CommonTokenStream;
  27952. CommonTokenStream.prototype.adjustSeekIndex = function(i) {
  27953. return this.nextTokenOnChannel(i, this.channel);
  27954. };
  27955. CommonTokenStream.prototype.LB = function(k) {
  27956. if (k===0 || this.index-k<0) {
  27957. return null;
  27958. }
  27959. var i = this.index;
  27960. var n = 1;
  27961. // find k good tokens looking backwards
  27962. while (n <= k) {
  27963. // skip off-channel tokens
  27964. i = this.previousTokenOnChannel(i - 1, this.channel);
  27965. n += 1;
  27966. }
  27967. if (i < 0) {
  27968. return null;
  27969. }
  27970. return this.tokens[i];
  27971. };
  27972. CommonTokenStream.prototype.LT = function(k) {
  27973. this.lazyInit();
  27974. if (k === 0) {
  27975. return null;
  27976. }
  27977. if (k < 0) {
  27978. return this.LB(-k);
  27979. }
  27980. var i = this.index;
  27981. var n = 1; // we know tokens[pos] is a good one
  27982. // find k good tokens
  27983. while (n < k) {
  27984. // skip off-channel tokens, but make sure to not look past EOF
  27985. if (this.sync(i + 1)) {
  27986. i = this.nextTokenOnChannel(i + 1, this.channel);
  27987. }
  27988. n += 1;
  27989. }
  27990. return this.tokens[i];
  27991. };
  27992. // Count EOF just once.///
  27993. CommonTokenStream.prototype.getNumberOfOnChannelTokens = function() {
  27994. var n = 0;
  27995. this.fill();
  27996. for (var i =0; i< this.tokens.length;i++) {
  27997. var t = this.tokens[i];
  27998. if( t.channel===this.channel) {
  27999. n += 1;
  28000. }
  28001. if( t.type===Token.EOF) {
  28002. break;
  28003. }
  28004. }
  28005. return n;
  28006. };
  28007. exports.CommonTokenStream = CommonTokenStream;
  28008. /***/ }),
  28009. /***/ "./node_modules/antlr4/FileStream.js":
  28010. /*!*******************************************!*\
  28011. !*** ./node_modules/antlr4/FileStream.js ***!
  28012. \*******************************************/
  28013. /*! no static exports found */
  28014. /***/ (function(module, exports, __webpack_require__) {
  28015. //
  28016. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28017. * Use of this file is governed by the BSD 3-clause license that
  28018. * can be found in the LICENSE.txt file in the project root.
  28019. */
  28020. //
  28021. //
  28022. // This is an InputStream that is loaded from a file all at once
  28023. // when you construct the object.
  28024. //
  28025. var InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  28026. var isNodeJs = typeof window === 'undefined' && typeof importScripts === 'undefined';
  28027. var fs = isNodeJs ? __webpack_require__(/*! fs */ "./node_modules/node-libs-browser/mock/empty.js") : null;
  28028. function FileStream(fileName, decodeToUnicodeCodePoints) {
  28029. var data = fs.readFileSync(fileName, "utf8");
  28030. InputStream.call(this, data, decodeToUnicodeCodePoints);
  28031. this.fileName = fileName;
  28032. return this;
  28033. }
  28034. FileStream.prototype = Object.create(InputStream.prototype);
  28035. FileStream.prototype.constructor = FileStream;
  28036. exports.FileStream = FileStream;
  28037. /***/ }),
  28038. /***/ "./node_modules/antlr4/InputStream.js":
  28039. /*!********************************************!*\
  28040. !*** ./node_modules/antlr4/InputStream.js ***!
  28041. \********************************************/
  28042. /*! no static exports found */
  28043. /***/ (function(module, exports, __webpack_require__) {
  28044. //
  28045. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28046. * Use of this file is governed by the BSD 3-clause license that
  28047. * can be found in the LICENSE.txt file in the project root.
  28048. */
  28049. //
  28050. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28051. __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  28052. __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  28053. // Vacuum all input from a string and then treat it like a buffer.
  28054. function _loadString(stream) {
  28055. stream._index = 0;
  28056. stream.data = [];
  28057. if (stream.decodeToUnicodeCodePoints) {
  28058. for (var i = 0; i < stream.strdata.length; ) {
  28059. var codePoint = stream.strdata.codePointAt(i);
  28060. stream.data.push(codePoint);
  28061. i += codePoint <= 0xFFFF ? 1 : 2;
  28062. }
  28063. } else {
  28064. for (var i = 0; i < stream.strdata.length; i++) {
  28065. var codeUnit = stream.strdata.charCodeAt(i);
  28066. stream.data.push(codeUnit);
  28067. }
  28068. }
  28069. stream._size = stream.data.length;
  28070. }
  28071. // If decodeToUnicodeCodePoints is true, the input is treated
  28072. // as a series of Unicode code points.
  28073. //
  28074. // Otherwise, the input is treated as a series of 16-bit UTF-16 code
  28075. // units.
  28076. function InputStream(data, decodeToUnicodeCodePoints) {
  28077. this.name = "<empty>";
  28078. this.strdata = data;
  28079. this.decodeToUnicodeCodePoints = decodeToUnicodeCodePoints || false;
  28080. _loadString(this);
  28081. return this;
  28082. }
  28083. Object.defineProperty(InputStream.prototype, "index", {
  28084. get : function() {
  28085. return this._index;
  28086. }
  28087. });
  28088. Object.defineProperty(InputStream.prototype, "size", {
  28089. get : function() {
  28090. return this._size;
  28091. }
  28092. });
  28093. // Reset the stream so that it's in the same state it was
  28094. // when the object was created *except* the data array is not
  28095. // touched.
  28096. //
  28097. InputStream.prototype.reset = function() {
  28098. this._index = 0;
  28099. };
  28100. InputStream.prototype.consume = function() {
  28101. if (this._index >= this._size) {
  28102. // assert this.LA(1) == Token.EOF
  28103. throw ("cannot consume EOF");
  28104. }
  28105. this._index += 1;
  28106. };
  28107. InputStream.prototype.LA = function(offset) {
  28108. if (offset === 0) {
  28109. return 0; // undefined
  28110. }
  28111. if (offset < 0) {
  28112. offset += 1; // e.g., translate LA(-1) to use offset=0
  28113. }
  28114. var pos = this._index + offset - 1;
  28115. if (pos < 0 || pos >= this._size) { // invalid
  28116. return Token.EOF;
  28117. }
  28118. return this.data[pos];
  28119. };
  28120. InputStream.prototype.LT = function(offset) {
  28121. return this.LA(offset);
  28122. };
  28123. // mark/release do nothing; we have entire buffer
  28124. InputStream.prototype.mark = function() {
  28125. return -1;
  28126. };
  28127. InputStream.prototype.release = function(marker) {
  28128. };
  28129. // consume() ahead until p==_index; can't just set p=_index as we must
  28130. // update line and column. If we seek backwards, just set p
  28131. //
  28132. InputStream.prototype.seek = function(_index) {
  28133. if (_index <= this._index) {
  28134. this._index = _index; // just jump; don't update stream state (line,
  28135. // ...)
  28136. return;
  28137. }
  28138. // seek forward
  28139. this._index = Math.min(_index, this._size);
  28140. };
  28141. InputStream.prototype.getText = function(start, stop) {
  28142. if (stop >= this._size) {
  28143. stop = this._size - 1;
  28144. }
  28145. if (start >= this._size) {
  28146. return "";
  28147. } else {
  28148. if (this.decodeToUnicodeCodePoints) {
  28149. var result = "";
  28150. for (var i = start; i <= stop; i++) {
  28151. result += String.fromCodePoint(this.data[i]);
  28152. }
  28153. return result;
  28154. } else {
  28155. return this.strdata.slice(start, stop + 1);
  28156. }
  28157. }
  28158. };
  28159. InputStream.prototype.toString = function() {
  28160. return this.strdata;
  28161. };
  28162. exports.InputStream = InputStream;
  28163. /***/ }),
  28164. /***/ "./node_modules/antlr4/IntervalSet.js":
  28165. /*!********************************************!*\
  28166. !*** ./node_modules/antlr4/IntervalSet.js ***!
  28167. \********************************************/
  28168. /*! no static exports found */
  28169. /***/ (function(module, exports, __webpack_require__) {
  28170. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28171. * Use of this file is governed by the BSD 3-clause license that
  28172. * can be found in the LICENSE.txt file in the project root.
  28173. */
  28174. /*jslint smarttabs:true */
  28175. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28176. /* stop is not included! */
  28177. function Interval(start, stop) {
  28178. this.start = start;
  28179. this.stop = stop;
  28180. return this;
  28181. }
  28182. Interval.prototype.contains = function(item) {
  28183. return item >= this.start && item < this.stop;
  28184. };
  28185. Interval.prototype.toString = function() {
  28186. if(this.start===this.stop-1) {
  28187. return this.start.toString();
  28188. } else {
  28189. return this.start.toString() + ".." + (this.stop-1).toString();
  28190. }
  28191. };
  28192. Object.defineProperty(Interval.prototype, "length", {
  28193. get : function() {
  28194. return this.stop - this.start;
  28195. }
  28196. });
  28197. function IntervalSet() {
  28198. this.intervals = null;
  28199. this.readOnly = false;
  28200. }
  28201. IntervalSet.prototype.first = function(v) {
  28202. if (this.intervals === null || this.intervals.length===0) {
  28203. return Token.INVALID_TYPE;
  28204. } else {
  28205. return this.intervals[0].start;
  28206. }
  28207. };
  28208. IntervalSet.prototype.addOne = function(v) {
  28209. this.addInterval(new Interval(v, v + 1));
  28210. };
  28211. IntervalSet.prototype.addRange = function(l, h) {
  28212. this.addInterval(new Interval(l, h + 1));
  28213. };
  28214. IntervalSet.prototype.addInterval = function(v) {
  28215. if (this.intervals === null) {
  28216. this.intervals = [];
  28217. this.intervals.push(v);
  28218. } else {
  28219. // find insert pos
  28220. for (var k = 0; k < this.intervals.length; k++) {
  28221. var i = this.intervals[k];
  28222. // distinct range -> insert
  28223. if (v.stop < i.start) {
  28224. this.intervals.splice(k, 0, v);
  28225. return;
  28226. }
  28227. // contiguous range -> adjust
  28228. else if (v.stop === i.start) {
  28229. this.intervals[k].start = v.start;
  28230. return;
  28231. }
  28232. // overlapping range -> adjust and reduce
  28233. else if (v.start <= i.stop) {
  28234. this.intervals[k] = new Interval(Math.min(i.start, v.start), Math.max(i.stop, v.stop));
  28235. this.reduce(k);
  28236. return;
  28237. }
  28238. }
  28239. // greater than any existing
  28240. this.intervals.push(v);
  28241. }
  28242. };
  28243. IntervalSet.prototype.addSet = function(other) {
  28244. if (other.intervals !== null) {
  28245. for (var k = 0; k < other.intervals.length; k++) {
  28246. var i = other.intervals[k];
  28247. this.addInterval(new Interval(i.start, i.stop));
  28248. }
  28249. }
  28250. return this;
  28251. };
  28252. IntervalSet.prototype.reduce = function(k) {
  28253. // only need to reduce if k is not the last
  28254. if (k < this.intervalslength - 1) {
  28255. var l = this.intervals[k];
  28256. var r = this.intervals[k + 1];
  28257. // if r contained in l
  28258. if (l.stop >= r.stop) {
  28259. this.intervals.pop(k + 1);
  28260. this.reduce(k);
  28261. } else if (l.stop >= r.start) {
  28262. this.intervals[k] = new Interval(l.start, r.stop);
  28263. this.intervals.pop(k + 1);
  28264. }
  28265. }
  28266. };
  28267. IntervalSet.prototype.complement = function(start, stop) {
  28268. var result = new IntervalSet();
  28269. result.addInterval(new Interval(start,stop+1));
  28270. for(var i=0; i<this.intervals.length; i++) {
  28271. result.removeRange(this.intervals[i]);
  28272. }
  28273. return result;
  28274. };
  28275. IntervalSet.prototype.contains = function(item) {
  28276. if (this.intervals === null) {
  28277. return false;
  28278. } else {
  28279. for (var k = 0; k < this.intervals.length; k++) {
  28280. if(this.intervals[k].contains(item)) {
  28281. return true;
  28282. }
  28283. }
  28284. return false;
  28285. }
  28286. };
  28287. Object.defineProperty(IntervalSet.prototype, "length", {
  28288. get : function() {
  28289. var len = 0;
  28290. this.intervals.map(function(i) {len += i.length;});
  28291. return len;
  28292. }
  28293. });
  28294. IntervalSet.prototype.removeRange = function(v) {
  28295. if(v.start===v.stop-1) {
  28296. this.removeOne(v.start);
  28297. } else if (this.intervals!==null) {
  28298. var k = 0;
  28299. for(var n=0; n<this.intervals.length; n++) {
  28300. var i = this.intervals[k];
  28301. // intervals are ordered
  28302. if (v.stop<=i.start) {
  28303. return;
  28304. }
  28305. // check for including range, split it
  28306. else if(v.start>i.start && v.stop<i.stop) {
  28307. this.intervals[k] = new Interval(i.start, v.start);
  28308. var x = new Interval(v.stop, i.stop);
  28309. this.intervals.splice(k, 0, x);
  28310. return;
  28311. }
  28312. // check for included range, remove it
  28313. else if(v.start<=i.start && v.stop>=i.stop) {
  28314. this.intervals.splice(k, 1);
  28315. k = k - 1; // need another pass
  28316. }
  28317. // check for lower boundary
  28318. else if(v.start<i.stop) {
  28319. this.intervals[k] = new Interval(i.start, v.start);
  28320. }
  28321. // check for upper boundary
  28322. else if(v.stop<i.stop) {
  28323. this.intervals[k] = new Interval(v.stop, i.stop);
  28324. }
  28325. k += 1;
  28326. }
  28327. }
  28328. };
  28329. IntervalSet.prototype.removeOne = function(v) {
  28330. if (this.intervals !== null) {
  28331. for (var k = 0; k < this.intervals.length; k++) {
  28332. var i = this.intervals[k];
  28333. // intervals is ordered
  28334. if (v < i.start) {
  28335. return;
  28336. }
  28337. // check for single value range
  28338. else if (v === i.start && v === i.stop - 1) {
  28339. this.intervals.splice(k, 1);
  28340. return;
  28341. }
  28342. // check for lower boundary
  28343. else if (v === i.start) {
  28344. this.intervals[k] = new Interval(i.start + 1, i.stop);
  28345. return;
  28346. }
  28347. // check for upper boundary
  28348. else if (v === i.stop - 1) {
  28349. this.intervals[k] = new Interval(i.start, i.stop - 1);
  28350. return;
  28351. }
  28352. // split existing range
  28353. else if (v < i.stop - 1) {
  28354. var x = new Interval(i.start, v);
  28355. i.start = v + 1;
  28356. this.intervals.splice(k, 0, x);
  28357. return;
  28358. }
  28359. }
  28360. }
  28361. };
  28362. IntervalSet.prototype.toString = function(literalNames, symbolicNames, elemsAreChar) {
  28363. literalNames = literalNames || null;
  28364. symbolicNames = symbolicNames || null;
  28365. elemsAreChar = elemsAreChar || false;
  28366. if (this.intervals === null) {
  28367. return "{}";
  28368. } else if(literalNames!==null || symbolicNames!==null) {
  28369. return this.toTokenString(literalNames, symbolicNames);
  28370. } else if(elemsAreChar) {
  28371. return this.toCharString();
  28372. } else {
  28373. return this.toIndexString();
  28374. }
  28375. };
  28376. IntervalSet.prototype.toCharString = function() {
  28377. var names = [];
  28378. for (var i = 0; i < this.intervals.length; i++) {
  28379. var v = this.intervals[i];
  28380. if(v.stop===v.start+1) {
  28381. if ( v.start===Token.EOF ) {
  28382. names.push("<EOF>");
  28383. } else {
  28384. names.push("'" + String.fromCharCode(v.start) + "'");
  28385. }
  28386. } else {
  28387. names.push("'" + String.fromCharCode(v.start) + "'..'" + String.fromCharCode(v.stop-1) + "'");
  28388. }
  28389. }
  28390. if (names.length > 1) {
  28391. return "{" + names.join(", ") + "}";
  28392. } else {
  28393. return names[0];
  28394. }
  28395. };
  28396. IntervalSet.prototype.toIndexString = function() {
  28397. var names = [];
  28398. for (var i = 0; i < this.intervals.length; i++) {
  28399. var v = this.intervals[i];
  28400. if(v.stop===v.start+1) {
  28401. if ( v.start===Token.EOF ) {
  28402. names.push("<EOF>");
  28403. } else {
  28404. names.push(v.start.toString());
  28405. }
  28406. } else {
  28407. names.push(v.start.toString() + ".." + (v.stop-1).toString());
  28408. }
  28409. }
  28410. if (names.length > 1) {
  28411. return "{" + names.join(", ") + "}";
  28412. } else {
  28413. return names[0];
  28414. }
  28415. };
  28416. IntervalSet.prototype.toTokenString = function(literalNames, symbolicNames) {
  28417. var names = [];
  28418. for (var i = 0; i < this.intervals.length; i++) {
  28419. var v = this.intervals[i];
  28420. for (var j = v.start; j < v.stop; j++) {
  28421. names.push(this.elementName(literalNames, symbolicNames, j));
  28422. }
  28423. }
  28424. if (names.length > 1) {
  28425. return "{" + names.join(", ") + "}";
  28426. } else {
  28427. return names[0];
  28428. }
  28429. };
  28430. IntervalSet.prototype.elementName = function(literalNames, symbolicNames, a) {
  28431. if (a === Token.EOF) {
  28432. return "<EOF>";
  28433. } else if (a === Token.EPSILON) {
  28434. return "<EPSILON>";
  28435. } else {
  28436. return literalNames[a] || symbolicNames[a];
  28437. }
  28438. };
  28439. exports.Interval = Interval;
  28440. exports.IntervalSet = IntervalSet;
  28441. /***/ }),
  28442. /***/ "./node_modules/antlr4/LL1Analyzer.js":
  28443. /*!********************************************!*\
  28444. !*** ./node_modules/antlr4/LL1Analyzer.js ***!
  28445. \********************************************/
  28446. /*! no static exports found */
  28447. /***/ (function(module, exports, __webpack_require__) {
  28448. //
  28449. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28450. * Use of this file is governed by the BSD 3-clause license that
  28451. * can be found in the LICENSE.txt file in the project root.
  28452. */
  28453. ///
  28454. var Set = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Set;
  28455. var BitSet = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  28456. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28457. var ATNConfig = __webpack_require__(/*! ./atn/ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  28458. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  28459. var IntervalSet = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  28460. var RuleStopState = __webpack_require__(/*! ./atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  28461. var RuleTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").RuleTransition;
  28462. var NotSetTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").NotSetTransition;
  28463. var WildcardTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").WildcardTransition;
  28464. var AbstractPredicateTransition = __webpack_require__(/*! ./atn/Transition */ "./node_modules/antlr4/atn/Transition.js").AbstractPredicateTransition;
  28465. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  28466. var predictionContextFromRuleContext = pc.predictionContextFromRuleContext;
  28467. var PredictionContext = pc.PredictionContext;
  28468. var SingletonPredictionContext = pc.SingletonPredictionContext;
  28469. function LL1Analyzer (atn) {
  28470. this.atn = atn;
  28471. }
  28472. //* Special value added to the lookahead sets to indicate that we hit
  28473. // a predicate during analysis if {@code seeThruPreds==false}.
  28474. ///
  28475. LL1Analyzer.HIT_PRED = Token.INVALID_TYPE;
  28476. //*
  28477. // Calculates the SLL(1) expected lookahead set for each outgoing transition
  28478. // of an {@link ATNState}. The returned array has one element for each
  28479. // outgoing transition in {@code s}. If the closure from transition
  28480. // <em>i</em> leads to a semantic predicate before matching a symbol, the
  28481. // element at index <em>i</em> of the result will be {@code null}.
  28482. //
  28483. // @param s the ATN state
  28484. // @return the expected symbols for each outgoing transition of {@code s}.
  28485. ///
  28486. LL1Analyzer.prototype.getDecisionLookahead = function(s) {
  28487. if (s === null) {
  28488. return null;
  28489. }
  28490. var count = s.transitions.length;
  28491. var look = [];
  28492. for(var alt=0; alt< count; alt++) {
  28493. look[alt] = new IntervalSet();
  28494. var lookBusy = new Set();
  28495. var seeThruPreds = false; // fail to get lookahead upon pred
  28496. this._LOOK(s.transition(alt).target, null, PredictionContext.EMPTY,
  28497. look[alt], lookBusy, new BitSet(), seeThruPreds, false);
  28498. // Wipe out lookahead for this alternative if we found nothing
  28499. // or we had a predicate when we !seeThruPreds
  28500. if (look[alt].length===0 || look[alt].contains(LL1Analyzer.HIT_PRED)) {
  28501. look[alt] = null;
  28502. }
  28503. }
  28504. return look;
  28505. };
  28506. //*
  28507. // Compute set of tokens that can follow {@code s} in the ATN in the
  28508. // specified {@code ctx}.
  28509. //
  28510. // <p>If {@code ctx} is {@code null} and the end of the rule containing
  28511. // {@code s} is reached, {@link Token//EPSILON} is added to the result set.
  28512. // If {@code ctx} is not {@code null} and the end of the outermost rule is
  28513. // reached, {@link Token//EOF} is added to the result set.</p>
  28514. //
  28515. // @param s the ATN state
  28516. // @param stopState the ATN state to stop at. This can be a
  28517. // {@link BlockEndState} to detect epsilon paths through a closure.
  28518. // @param ctx the complete parser context, or {@code null} if the context
  28519. // should be ignored
  28520. //
  28521. // @return The set of tokens that can follow {@code s} in the ATN in the
  28522. // specified {@code ctx}.
  28523. ///
  28524. LL1Analyzer.prototype.LOOK = function(s, stopState, ctx) {
  28525. var r = new IntervalSet();
  28526. var seeThruPreds = true; // ignore preds; get all lookahead
  28527. ctx = ctx || null;
  28528. var lookContext = ctx!==null ? predictionContextFromRuleContext(s.atn, ctx) : null;
  28529. this._LOOK(s, stopState, lookContext, r, new Set(), new BitSet(), seeThruPreds, true);
  28530. return r;
  28531. };
  28532. //*
  28533. // Compute set of tokens that can follow {@code s} in the ATN in the
  28534. // specified {@code ctx}.
  28535. //
  28536. // <p>If {@code ctx} is {@code null} and {@code stopState} or the end of the
  28537. // rule containing {@code s} is reached, {@link Token//EPSILON} is added to
  28538. // the result set. If {@code ctx} is not {@code null} and {@code addEOF} is
  28539. // {@code true} and {@code stopState} or the end of the outermost rule is
  28540. // reached, {@link Token//EOF} is added to the result set.</p>
  28541. //
  28542. // @param s the ATN state.
  28543. // @param stopState the ATN state to stop at. This can be a
  28544. // {@link BlockEndState} to detect epsilon paths through a closure.
  28545. // @param ctx The outer context, or {@code null} if the outer context should
  28546. // not be used.
  28547. // @param look The result lookahead set.
  28548. // @param lookBusy A set used for preventing epsilon closures in the ATN
  28549. // from causing a stack overflow. Outside code should pass
  28550. // {@code new Set<ATNConfig>} for this argument.
  28551. // @param calledRuleStack A set used for preventing left recursion in the
  28552. // ATN from causing a stack overflow. Outside code should pass
  28553. // {@code new BitSet()} for this argument.
  28554. // @param seeThruPreds {@code true} to true semantic predicates as
  28555. // implicitly {@code true} and "see through them", otherwise {@code false}
  28556. // to treat semantic predicates as opaque and add {@link //HIT_PRED} to the
  28557. // result if one is encountered.
  28558. // @param addEOF Add {@link Token//EOF} to the result if the end of the
  28559. // outermost context is reached. This parameter has no effect if {@code ctx}
  28560. // is {@code null}.
  28561. ///
  28562. LL1Analyzer.prototype._LOOK = function(s, stopState , ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF) {
  28563. var c = new ATNConfig({state:s, alt:0, context: ctx}, null);
  28564. if (lookBusy.contains(c)) {
  28565. return;
  28566. }
  28567. lookBusy.add(c);
  28568. if (s === stopState) {
  28569. if (ctx ===null) {
  28570. look.addOne(Token.EPSILON);
  28571. return;
  28572. } else if (ctx.isEmpty() && addEOF) {
  28573. look.addOne(Token.EOF);
  28574. return;
  28575. }
  28576. }
  28577. if (s instanceof RuleStopState ) {
  28578. if (ctx ===null) {
  28579. look.addOne(Token.EPSILON);
  28580. return;
  28581. } else if (ctx.isEmpty() && addEOF) {
  28582. look.addOne(Token.EOF);
  28583. return;
  28584. }
  28585. if (ctx !== PredictionContext.EMPTY) {
  28586. // run thru all possible stack tops in ctx
  28587. for(var i=0; i<ctx.length; i++) {
  28588. var returnState = this.atn.states[ctx.getReturnState(i)];
  28589. var removed = calledRuleStack.contains(returnState.ruleIndex);
  28590. try {
  28591. calledRuleStack.remove(returnState.ruleIndex);
  28592. this._LOOK(returnState, stopState, ctx.getParent(i), look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28593. } finally {
  28594. if (removed) {
  28595. calledRuleStack.add(returnState.ruleIndex);
  28596. }
  28597. }
  28598. }
  28599. return;
  28600. }
  28601. }
  28602. for(var j=0; j<s.transitions.length; j++) {
  28603. var t = s.transitions[j];
  28604. if (t.constructor === RuleTransition) {
  28605. if (calledRuleStack.contains(t.target.ruleIndex)) {
  28606. continue;
  28607. }
  28608. var newContext = SingletonPredictionContext.create(ctx, t.followState.stateNumber);
  28609. try {
  28610. calledRuleStack.add(t.target.ruleIndex);
  28611. this._LOOK(t.target, stopState, newContext, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28612. } finally {
  28613. calledRuleStack.remove(t.target.ruleIndex);
  28614. }
  28615. } else if (t instanceof AbstractPredicateTransition ) {
  28616. if (seeThruPreds) {
  28617. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28618. } else {
  28619. look.addOne(LL1Analyzer.HIT_PRED);
  28620. }
  28621. } else if( t.isEpsilon) {
  28622. this._LOOK(t.target, stopState, ctx, look, lookBusy, calledRuleStack, seeThruPreds, addEOF);
  28623. } else if (t.constructor === WildcardTransition) {
  28624. look.addRange( Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType );
  28625. } else {
  28626. var set = t.label;
  28627. if (set !== null) {
  28628. if (t instanceof NotSetTransition) {
  28629. set = set.complement(Token.MIN_USER_TOKEN_TYPE, this.atn.maxTokenType);
  28630. }
  28631. look.addSet(set);
  28632. }
  28633. }
  28634. }
  28635. };
  28636. exports.LL1Analyzer = LL1Analyzer;
  28637. /***/ }),
  28638. /***/ "./node_modules/antlr4/Lexer.js":
  28639. /*!**************************************!*\
  28640. !*** ./node_modules/antlr4/Lexer.js ***!
  28641. \**************************************/
  28642. /*! no static exports found */
  28643. /***/ (function(module, exports, __webpack_require__) {
  28644. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28645. * Use of this file is governed by the BSD 3-clause license that
  28646. * can be found in the LICENSE.txt file in the project root.
  28647. */
  28648. ///
  28649. // A lexer is recognizer that draws input symbols from a character stream.
  28650. // lexer grammars result in a subclass of this object. A Lexer object
  28651. // uses simplified match() and error recovery mechanisms in the interest of speed.
  28652. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28653. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28654. var CommonTokenFactory = __webpack_require__(/*! ./CommonTokenFactory */ "./node_modules/antlr4/CommonTokenFactory.js").CommonTokenFactory;
  28655. var RecognitionException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  28656. var LexerNoViableAltException = __webpack_require__(/*! ./error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  28657. function TokenSource() {
  28658. return this;
  28659. }
  28660. function Lexer(input) {
  28661. Recognizer.call(this);
  28662. this._input = input;
  28663. this._factory = CommonTokenFactory.DEFAULT;
  28664. this._tokenFactorySourcePair = [ this, input ];
  28665. this._interp = null; // child classes must populate this
  28666. // The goal of all lexer rules/methods is to create a token object.
  28667. // this is an instance variable as multiple rules may collaborate to
  28668. // create a single token. nextToken will return this object after
  28669. // matching lexer rule(s). If you subclass to allow multiple token
  28670. // emissions, then set this to the last token to be matched or
  28671. // something nonnull so that the auto token emit mechanism will not
  28672. // emit another token.
  28673. this._token = null;
  28674. // What character index in the stream did the current token start at?
  28675. // Needed, for example, to get the text for current token. Set at
  28676. // the start of nextToken.
  28677. this._tokenStartCharIndex = -1;
  28678. // The line on which the first character of the token resides///
  28679. this._tokenStartLine = -1;
  28680. // The character position of first character within the line///
  28681. this._tokenStartColumn = -1;
  28682. // Once we see EOF on char stream, next token will be EOF.
  28683. // If you have DONE : EOF ; then you see DONE EOF.
  28684. this._hitEOF = false;
  28685. // The channel number for the current token///
  28686. this._channel = Token.DEFAULT_CHANNEL;
  28687. // The token type for the current token///
  28688. this._type = Token.INVALID_TYPE;
  28689. this._modeStack = [];
  28690. this._mode = Lexer.DEFAULT_MODE;
  28691. // You can set the text for the current token to override what is in
  28692. // the input char buffer. Use setText() or can set this instance var.
  28693. // /
  28694. this._text = null;
  28695. return this;
  28696. }
  28697. Lexer.prototype = Object.create(Recognizer.prototype);
  28698. Lexer.prototype.constructor = Lexer;
  28699. Lexer.DEFAULT_MODE = 0;
  28700. Lexer.MORE = -2;
  28701. Lexer.SKIP = -3;
  28702. Lexer.DEFAULT_TOKEN_CHANNEL = Token.DEFAULT_CHANNEL;
  28703. Lexer.HIDDEN = Token.HIDDEN_CHANNEL;
  28704. Lexer.MIN_CHAR_VALUE = 0x0000;
  28705. Lexer.MAX_CHAR_VALUE = 0x10FFFF;
  28706. Lexer.prototype.reset = function() {
  28707. // wack Lexer state variables
  28708. if (this._input !== null) {
  28709. this._input.seek(0); // rewind the input
  28710. }
  28711. this._token = null;
  28712. this._type = Token.INVALID_TYPE;
  28713. this._channel = Token.DEFAULT_CHANNEL;
  28714. this._tokenStartCharIndex = -1;
  28715. this._tokenStartColumn = -1;
  28716. this._tokenStartLine = -1;
  28717. this._text = null;
  28718. this._hitEOF = false;
  28719. this._mode = Lexer.DEFAULT_MODE;
  28720. this._modeStack = [];
  28721. this._interp.reset();
  28722. };
  28723. // Return a token from this source; i.e., match a token on the char stream.
  28724. Lexer.prototype.nextToken = function() {
  28725. if (this._input === null) {
  28726. throw "nextToken requires a non-null input stream.";
  28727. }
  28728. // Mark start location in char stream so unbuffered streams are
  28729. // guaranteed at least have text of current token
  28730. var tokenStartMarker = this._input.mark();
  28731. try {
  28732. while (true) {
  28733. if (this._hitEOF) {
  28734. this.emitEOF();
  28735. return this._token;
  28736. }
  28737. this._token = null;
  28738. this._channel = Token.DEFAULT_CHANNEL;
  28739. this._tokenStartCharIndex = this._input.index;
  28740. this._tokenStartColumn = this._interp.column;
  28741. this._tokenStartLine = this._interp.line;
  28742. this._text = null;
  28743. var continueOuter = false;
  28744. while (true) {
  28745. this._type = Token.INVALID_TYPE;
  28746. var ttype = Lexer.SKIP;
  28747. try {
  28748. ttype = this._interp.match(this._input, this._mode);
  28749. } catch (e) {
  28750. if(e instanceof RecognitionException) {
  28751. this.notifyListeners(e); // report error
  28752. this.recover(e);
  28753. } else {
  28754. console.log(e.stack);
  28755. throw e;
  28756. }
  28757. }
  28758. if (this._input.LA(1) === Token.EOF) {
  28759. this._hitEOF = true;
  28760. }
  28761. if (this._type === Token.INVALID_TYPE) {
  28762. this._type = ttype;
  28763. }
  28764. if (this._type === Lexer.SKIP) {
  28765. continueOuter = true;
  28766. break;
  28767. }
  28768. if (this._type !== Lexer.MORE) {
  28769. break;
  28770. }
  28771. }
  28772. if (continueOuter) {
  28773. continue;
  28774. }
  28775. if (this._token === null) {
  28776. this.emit();
  28777. }
  28778. return this._token;
  28779. }
  28780. } finally {
  28781. // make sure we release marker after match or
  28782. // unbuffered char stream will keep buffering
  28783. this._input.release(tokenStartMarker);
  28784. }
  28785. };
  28786. // Instruct the lexer to skip creating a token for current lexer rule
  28787. // and look for another token. nextToken() knows to keep looking when
  28788. // a lexer rule finishes with token set to SKIP_TOKEN. Recall that
  28789. // if token==null at end of any token rule, it creates one for you
  28790. // and emits it.
  28791. // /
  28792. Lexer.prototype.skip = function() {
  28793. this._type = Lexer.SKIP;
  28794. };
  28795. Lexer.prototype.more = function() {
  28796. this._type = Lexer.MORE;
  28797. };
  28798. Lexer.prototype.mode = function(m) {
  28799. this._mode = m;
  28800. };
  28801. Lexer.prototype.pushMode = function(m) {
  28802. if (this._interp.debug) {
  28803. console.log("pushMode " + m);
  28804. }
  28805. this._modeStack.push(this._mode);
  28806. this.mode(m);
  28807. };
  28808. Lexer.prototype.popMode = function() {
  28809. if (this._modeStack.length === 0) {
  28810. throw "Empty Stack";
  28811. }
  28812. if (this._interp.debug) {
  28813. console.log("popMode back to " + this._modeStack.slice(0, -1));
  28814. }
  28815. this.mode(this._modeStack.pop());
  28816. return this._mode;
  28817. };
  28818. // Set the char stream and reset the lexer
  28819. Object.defineProperty(Lexer.prototype, "inputStream", {
  28820. get : function() {
  28821. return this._input;
  28822. },
  28823. set : function(input) {
  28824. this._input = null;
  28825. this._tokenFactorySourcePair = [ this, this._input ];
  28826. this.reset();
  28827. this._input = input;
  28828. this._tokenFactorySourcePair = [ this, this._input ];
  28829. }
  28830. });
  28831. Object.defineProperty(Lexer.prototype, "sourceName", {
  28832. get : function sourceName() {
  28833. return this._input.sourceName;
  28834. }
  28835. });
  28836. // By default does not support multiple emits per nextToken invocation
  28837. // for efficiency reasons. Subclass and override this method, nextToken,
  28838. // and getToken (to push tokens into a list and pull from that list
  28839. // rather than a single variable as this implementation does).
  28840. // /
  28841. Lexer.prototype.emitToken = function(token) {
  28842. this._token = token;
  28843. };
  28844. // The standard method called to automatically emit a token at the
  28845. // outermost lexical rule. The token object should point into the
  28846. // char buffer start..stop. If there is a text override in 'text',
  28847. // use that to set the token's text. Override this method to emit
  28848. // custom Token objects or provide a new factory.
  28849. // /
  28850. Lexer.prototype.emit = function() {
  28851. var t = this._factory.create(this._tokenFactorySourcePair, this._type,
  28852. this._text, this._channel, this._tokenStartCharIndex, this
  28853. .getCharIndex() - 1, this._tokenStartLine,
  28854. this._tokenStartColumn);
  28855. this.emitToken(t);
  28856. return t;
  28857. };
  28858. Lexer.prototype.emitEOF = function() {
  28859. var cpos = this.column;
  28860. var lpos = this.line;
  28861. var eof = this._factory.create(this._tokenFactorySourcePair, Token.EOF,
  28862. null, Token.DEFAULT_CHANNEL, this._input.index,
  28863. this._input.index - 1, lpos, cpos);
  28864. this.emitToken(eof);
  28865. return eof;
  28866. };
  28867. Object.defineProperty(Lexer.prototype, "type", {
  28868. get : function() {
  28869. return this.type;
  28870. },
  28871. set : function(type) {
  28872. this._type = type;
  28873. }
  28874. });
  28875. Object.defineProperty(Lexer.prototype, "line", {
  28876. get : function() {
  28877. return this._interp.line;
  28878. },
  28879. set : function(line) {
  28880. this._interp.line = line;
  28881. }
  28882. });
  28883. Object.defineProperty(Lexer.prototype, "column", {
  28884. get : function() {
  28885. return this._interp.column;
  28886. },
  28887. set : function(column) {
  28888. this._interp.column = column;
  28889. }
  28890. });
  28891. // What is the index of the current character of lookahead?///
  28892. Lexer.prototype.getCharIndex = function() {
  28893. return this._input.index;
  28894. };
  28895. // Return the text matched so far for the current token or any text override.
  28896. //Set the complete text of this token; it wipes any previous changes to the text.
  28897. Object.defineProperty(Lexer.prototype, "text", {
  28898. get : function() {
  28899. if (this._text !== null) {
  28900. return this._text;
  28901. } else {
  28902. return this._interp.getText(this._input);
  28903. }
  28904. },
  28905. set : function(text) {
  28906. this._text = text;
  28907. }
  28908. });
  28909. // Return a list of all Token objects in input char stream.
  28910. // Forces load of all tokens. Does not include EOF token.
  28911. // /
  28912. Lexer.prototype.getAllTokens = function() {
  28913. var tokens = [];
  28914. var t = this.nextToken();
  28915. while (t.type !== Token.EOF) {
  28916. tokens.push(t);
  28917. t = this.nextToken();
  28918. }
  28919. return tokens;
  28920. };
  28921. Lexer.prototype.notifyListeners = function(e) {
  28922. var start = this._tokenStartCharIndex;
  28923. var stop = this._input.index;
  28924. var text = this._input.getText(start, stop);
  28925. var msg = "token recognition error at: '" + this.getErrorDisplay(text) + "'";
  28926. var listener = this.getErrorListenerDispatch();
  28927. listener.syntaxError(this, null, this._tokenStartLine,
  28928. this._tokenStartColumn, msg, e);
  28929. };
  28930. Lexer.prototype.getErrorDisplay = function(s) {
  28931. var d = [];
  28932. for (var i = 0; i < s.length; i++) {
  28933. d.push(s[i]);
  28934. }
  28935. return d.join('');
  28936. };
  28937. Lexer.prototype.getErrorDisplayForChar = function(c) {
  28938. if (c.charCodeAt(0) === Token.EOF) {
  28939. return "<EOF>";
  28940. } else if (c === '\n') {
  28941. return "\\n";
  28942. } else if (c === '\t') {
  28943. return "\\t";
  28944. } else if (c === '\r') {
  28945. return "\\r";
  28946. } else {
  28947. return c;
  28948. }
  28949. };
  28950. Lexer.prototype.getCharErrorDisplay = function(c) {
  28951. return "'" + this.getErrorDisplayForChar(c) + "'";
  28952. };
  28953. // Lexers can normally match any char in it's vocabulary after matching
  28954. // a token, so do the easy thing and just kill a character and hope
  28955. // it all works out. You can instead use the rule invocation stack
  28956. // to do sophisticated error recovery if you are in a fragment rule.
  28957. // /
  28958. Lexer.prototype.recover = function(re) {
  28959. if (this._input.LA(1) !== Token.EOF) {
  28960. if (re instanceof LexerNoViableAltException) {
  28961. // skip a char and try again
  28962. this._interp.consume(this._input);
  28963. } else {
  28964. // TODO: Do we lose character or line position information?
  28965. this._input.consume();
  28966. }
  28967. }
  28968. };
  28969. exports.Lexer = Lexer;
  28970. /***/ }),
  28971. /***/ "./node_modules/antlr4/Parser.js":
  28972. /*!***************************************!*\
  28973. !*** ./node_modules/antlr4/Parser.js ***!
  28974. \***************************************/
  28975. /*! no static exports found */
  28976. /***/ (function(module, exports, __webpack_require__) {
  28977. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  28978. * Use of this file is governed by the BSD 3-clause license that
  28979. * can be found in the LICENSE.txt file in the project root.
  28980. */
  28981. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  28982. var ParseTreeListener = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ParseTreeListener;
  28983. var Recognizer = __webpack_require__(/*! ./Recognizer */ "./node_modules/antlr4/Recognizer.js").Recognizer;
  28984. var DefaultErrorStrategy = __webpack_require__(/*! ./error/ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").DefaultErrorStrategy;
  28985. var ATNDeserializer = __webpack_require__(/*! ./atn/ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  28986. var ATNDeserializationOptions = __webpack_require__(/*! ./atn/ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  28987. var TerminalNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  28988. var ErrorNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  28989. function TraceListener(parser) {
  28990. ParseTreeListener.call(this);
  28991. this.parser = parser;
  28992. return this;
  28993. }
  28994. TraceListener.prototype = Object.create(ParseTreeListener.prototype);
  28995. TraceListener.prototype.constructor = TraceListener;
  28996. TraceListener.prototype.enterEveryRule = function(ctx) {
  28997. console.log("enter " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  28998. };
  28999. TraceListener.prototype.visitTerminal = function( node) {
  29000. console.log("consume " + node.symbol + " rule " + this.parser.ruleNames[this.parser._ctx.ruleIndex]);
  29001. };
  29002. TraceListener.prototype.exitEveryRule = function(ctx) {
  29003. console.log("exit " + this.parser.ruleNames[ctx.ruleIndex] + ", LT(1)=" + this.parser._input.LT(1).text);
  29004. };
  29005. // this is all the parsing support code essentially; most of it is error
  29006. // recovery stuff.//
  29007. function Parser(input) {
  29008. Recognizer.call(this);
  29009. // The input stream.
  29010. this._input = null;
  29011. // The error handling strategy for the parser. The default value is a new
  29012. // instance of {@link DefaultErrorStrategy}.
  29013. this._errHandler = new DefaultErrorStrategy();
  29014. this._precedenceStack = [];
  29015. this._precedenceStack.push(0);
  29016. // The {@link ParserRuleContext} object for the currently executing rule.
  29017. // this is always non-null during the parsing process.
  29018. this._ctx = null;
  29019. // Specifies whether or not the parser should construct a parse tree during
  29020. // the parsing process. The default value is {@code true}.
  29021. this.buildParseTrees = true;
  29022. // When {@link //setTrace}{@code (true)} is called, a reference to the
  29023. // {@link TraceListener} is stored here so it can be easily removed in a
  29024. // later call to {@link //setTrace}{@code (false)}. The listener itself is
  29025. // implemented as a parser listener so this field is not directly used by
  29026. // other parser methods.
  29027. this._tracer = null;
  29028. // The list of {@link ParseTreeListener} listeners registered to receive
  29029. // events during the parse.
  29030. this._parseListeners = null;
  29031. // The number of syntax errors reported during parsing. this value is
  29032. // incremented each time {@link //notifyErrorListeners} is called.
  29033. this._syntaxErrors = 0;
  29034. this.setInputStream(input);
  29035. return this;
  29036. }
  29037. Parser.prototype = Object.create(Recognizer.prototype);
  29038. Parser.prototype.contructor = Parser;
  29039. // this field maps from the serialized ATN string to the deserialized {@link
  29040. // ATN} with
  29041. // bypass alternatives.
  29042. //
  29043. // @see ATNDeserializationOptions//isGenerateRuleBypassTransitions()
  29044. //
  29045. Parser.bypassAltsAtnCache = {};
  29046. // reset the parser's state//
  29047. Parser.prototype.reset = function() {
  29048. if (this._input !== null) {
  29049. this._input.seek(0);
  29050. }
  29051. this._errHandler.reset(this);
  29052. this._ctx = null;
  29053. this._syntaxErrors = 0;
  29054. this.setTrace(false);
  29055. this._precedenceStack = [];
  29056. this._precedenceStack.push(0);
  29057. if (this._interp !== null) {
  29058. this._interp.reset();
  29059. }
  29060. };
  29061. // Match current input symbol against {@code ttype}. If the symbol type
  29062. // matches, {@link ANTLRErrorStrategy//reportMatch} and {@link //consume} are
  29063. // called to complete the match process.
  29064. //
  29065. // <p>If the symbol type does not match,
  29066. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  29067. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  29068. // {@code true} and the token index of the symbol returned by
  29069. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  29070. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  29071. //
  29072. // @param ttype the token type to match
  29073. // @return the matched symbol
  29074. // @throws RecognitionException if the current input symbol did not match
  29075. // {@code ttype} and the error strategy could not recover from the
  29076. // mismatched symbol
  29077. Parser.prototype.match = function(ttype) {
  29078. var t = this.getCurrentToken();
  29079. if (t.type === ttype) {
  29080. this._errHandler.reportMatch(this);
  29081. this.consume();
  29082. } else {
  29083. t = this._errHandler.recoverInline(this);
  29084. if (this.buildParseTrees && t.tokenIndex === -1) {
  29085. // we must have conjured up a new token during single token
  29086. // insertion
  29087. // if it's not the current symbol
  29088. this._ctx.addErrorNode(t);
  29089. }
  29090. }
  29091. return t;
  29092. };
  29093. // Match current input symbol as a wildcard. If the symbol type matches
  29094. // (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}
  29095. // and {@link //consume} are called to complete the match process.
  29096. //
  29097. // <p>If the symbol type does not match,
  29098. // {@link ANTLRErrorStrategy//recoverInline} is called on the current error
  29099. // strategy to attempt recovery. If {@link //getBuildParseTree} is
  29100. // {@code true} and the token index of the symbol returned by
  29101. // {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to
  29102. // the parse tree by calling {@link ParserRuleContext//addErrorNode}.</p>
  29103. //
  29104. // @return the matched symbol
  29105. // @throws RecognitionException if the current input symbol did not match
  29106. // a wildcard and the error strategy could not recover from the mismatched
  29107. // symbol
  29108. Parser.prototype.matchWildcard = function() {
  29109. var t = this.getCurrentToken();
  29110. if (t.type > 0) {
  29111. this._errHandler.reportMatch(this);
  29112. this.consume();
  29113. } else {
  29114. t = this._errHandler.recoverInline(this);
  29115. if (this._buildParseTrees && t.tokenIndex === -1) {
  29116. // we must have conjured up a new token during single token
  29117. // insertion
  29118. // if it's not the current symbol
  29119. this._ctx.addErrorNode(t);
  29120. }
  29121. }
  29122. return t;
  29123. };
  29124. Parser.prototype.getParseListeners = function() {
  29125. return this._parseListeners || [];
  29126. };
  29127. // Registers {@code listener} to receive events during the parsing process.
  29128. //
  29129. // <p>To support output-preserving grammar transformations (including but not
  29130. // limited to left-recursion removal, automated left-factoring, and
  29131. // optimized code generation), calls to listener methods during the parse
  29132. // may differ substantially from calls made by
  29133. // {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In
  29134. // particular, rule entry and exit events may occur in a different order
  29135. // during the parse than after the parser. In addition, calls to certain
  29136. // rule entry methods may be omitted.</p>
  29137. //
  29138. // <p>With the following specific exceptions, calls to listener events are
  29139. // <em>deterministic</em>, i.e. for identical input the calls to listener
  29140. // methods will be the same.</p>
  29141. //
  29142. // <ul>
  29143. // <li>Alterations to the grammar used to generate code may change the
  29144. // behavior of the listener calls.</li>
  29145. // <li>Alterations to the command line options passed to ANTLR 4 when
  29146. // generating the parser may change the behavior of the listener calls.</li>
  29147. // <li>Changing the version of the ANTLR Tool used to generate the parser
  29148. // may change the behavior of the listener calls.</li>
  29149. // </ul>
  29150. //
  29151. // @param listener the listener to add
  29152. //
  29153. // @throws NullPointerException if {@code} listener is {@code null}
  29154. //
  29155. Parser.prototype.addParseListener = function(listener) {
  29156. if (listener === null) {
  29157. throw "listener";
  29158. }
  29159. if (this._parseListeners === null) {
  29160. this._parseListeners = [];
  29161. }
  29162. this._parseListeners.push(listener);
  29163. };
  29164. //
  29165. // Remove {@code listener} from the list of parse listeners.
  29166. //
  29167. // <p>If {@code listener} is {@code null} or has not been added as a parse
  29168. // listener, this method does nothing.</p>
  29169. // @param listener the listener to remove
  29170. //
  29171. Parser.prototype.removeParseListener = function(listener) {
  29172. if (this._parseListeners !== null) {
  29173. var idx = this._parseListeners.indexOf(listener);
  29174. if (idx >= 0) {
  29175. this._parseListeners.splice(idx, 1);
  29176. }
  29177. if (this._parseListeners.length === 0) {
  29178. this._parseListeners = null;
  29179. }
  29180. }
  29181. };
  29182. // Remove all parse listeners.
  29183. Parser.prototype.removeParseListeners = function() {
  29184. this._parseListeners = null;
  29185. };
  29186. // Notify any parse listeners of an enter rule event.
  29187. Parser.prototype.triggerEnterRuleEvent = function() {
  29188. if (this._parseListeners !== null) {
  29189. var ctx = this._ctx;
  29190. this._parseListeners.map(function(listener) {
  29191. listener.enterEveryRule(ctx);
  29192. ctx.enterRule(listener);
  29193. });
  29194. }
  29195. };
  29196. //
  29197. // Notify any parse listeners of an exit rule event.
  29198. //
  29199. // @see //addParseListener
  29200. //
  29201. Parser.prototype.triggerExitRuleEvent = function() {
  29202. if (this._parseListeners !== null) {
  29203. // reverse order walk of listeners
  29204. var ctx = this._ctx;
  29205. this._parseListeners.slice(0).reverse().map(function(listener) {
  29206. ctx.exitRule(listener);
  29207. listener.exitEveryRule(ctx);
  29208. });
  29209. }
  29210. };
  29211. Parser.prototype.getTokenFactory = function() {
  29212. return this._input.tokenSource._factory;
  29213. };
  29214. // Tell our token source and error strategy about a new way to create tokens.//
  29215. Parser.prototype.setTokenFactory = function(factory) {
  29216. this._input.tokenSource._factory = factory;
  29217. };
  29218. // The ATN with bypass alternatives is expensive to create so we create it
  29219. // lazily.
  29220. //
  29221. // @throws UnsupportedOperationException if the current parser does not
  29222. // implement the {@link //getSerializedATN()} method.
  29223. //
  29224. Parser.prototype.getATNWithBypassAlts = function() {
  29225. var serializedAtn = this.getSerializedATN();
  29226. if (serializedAtn === null) {
  29227. throw "The current parser does not support an ATN with bypass alternatives.";
  29228. }
  29229. var result = this.bypassAltsAtnCache[serializedAtn];
  29230. if (result === null) {
  29231. var deserializationOptions = new ATNDeserializationOptions();
  29232. deserializationOptions.generateRuleBypassTransitions = true;
  29233. result = new ATNDeserializer(deserializationOptions)
  29234. .deserialize(serializedAtn);
  29235. this.bypassAltsAtnCache[serializedAtn] = result;
  29236. }
  29237. return result;
  29238. };
  29239. // The preferred method of getting a tree pattern. For example, here's a
  29240. // sample use:
  29241. //
  29242. // <pre>
  29243. // ParseTree t = parser.expr();
  29244. // ParseTreePattern p = parser.compileParseTreePattern("&lt;ID&gt;+0",
  29245. // MyParser.RULE_expr);
  29246. // ParseTreeMatch m = p.match(t);
  29247. // String id = m.get("ID");
  29248. // </pre>
  29249. var Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  29250. Parser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {
  29251. lexer = lexer || null;
  29252. if (lexer === null) {
  29253. if (this.getTokenStream() !== null) {
  29254. var tokenSource = this.getTokenStream().tokenSource;
  29255. if (tokenSource instanceof Lexer) {
  29256. lexer = tokenSource;
  29257. }
  29258. }
  29259. }
  29260. if (lexer === null) {
  29261. throw "Parser can't discover a lexer to use";
  29262. }
  29263. var m = new ParseTreePatternMatcher(lexer, this);
  29264. return m.compile(pattern, patternRuleIndex);
  29265. };
  29266. Parser.prototype.getInputStream = function() {
  29267. return this.getTokenStream();
  29268. };
  29269. Parser.prototype.setInputStream = function(input) {
  29270. this.setTokenStream(input);
  29271. };
  29272. Parser.prototype.getTokenStream = function() {
  29273. return this._input;
  29274. };
  29275. // Set the token stream and reset the parser.//
  29276. Parser.prototype.setTokenStream = function(input) {
  29277. this._input = null;
  29278. this.reset();
  29279. this._input = input;
  29280. };
  29281. // Match needs to return the current input symbol, which gets put
  29282. // into the label for the associated token ref; e.g., x=ID.
  29283. //
  29284. Parser.prototype.getCurrentToken = function() {
  29285. return this._input.LT(1);
  29286. };
  29287. Parser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {
  29288. offendingToken = offendingToken || null;
  29289. err = err || null;
  29290. if (offendingToken === null) {
  29291. offendingToken = this.getCurrentToken();
  29292. }
  29293. this._syntaxErrors += 1;
  29294. var line = offendingToken.line;
  29295. var column = offendingToken.column;
  29296. var listener = this.getErrorListenerDispatch();
  29297. listener.syntaxError(this, offendingToken, line, column, msg, err);
  29298. };
  29299. //
  29300. // Consume and return the {@linkplain //getCurrentToken current symbol}.
  29301. //
  29302. // <p>E.g., given the following input with {@code A} being the current
  29303. // lookahead symbol, this function moves the cursor to {@code B} and returns
  29304. // {@code A}.</p>
  29305. //
  29306. // <pre>
  29307. // A B
  29308. // ^
  29309. // </pre>
  29310. //
  29311. // If the parser is not in error recovery mode, the consumed symbol is added
  29312. // to the parse tree using {@link ParserRuleContext//addChild(Token)}, and
  29313. // {@link ParseTreeListener//visitTerminal} is called on any parse listeners.
  29314. // If the parser <em>is</em> in error recovery mode, the consumed symbol is
  29315. // added to the parse tree using
  29316. // {@link ParserRuleContext//addErrorNode(Token)}, and
  29317. // {@link ParseTreeListener//visitErrorNode} is called on any parse
  29318. // listeners.
  29319. //
  29320. Parser.prototype.consume = function() {
  29321. var o = this.getCurrentToken();
  29322. if (o.type !== Token.EOF) {
  29323. this.getInputStream().consume();
  29324. }
  29325. var hasListener = this._parseListeners !== null && this._parseListeners.length > 0;
  29326. if (this.buildParseTrees || hasListener) {
  29327. var node;
  29328. if (this._errHandler.inErrorRecoveryMode(this)) {
  29329. node = this._ctx.addErrorNode(o);
  29330. } else {
  29331. node = this._ctx.addTokenNode(o);
  29332. }
  29333. node.invokingState = this.state;
  29334. if (hasListener) {
  29335. this._parseListeners.map(function(listener) {
  29336. if (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {
  29337. listener.visitErrorNode(node);
  29338. } else if (node instanceof TerminalNode) {
  29339. listener.visitTerminal(node);
  29340. }
  29341. });
  29342. }
  29343. }
  29344. return o;
  29345. };
  29346. Parser.prototype.addContextToParseTree = function() {
  29347. // add current context to parent if we have a parent
  29348. if (this._ctx.parentCtx !== null) {
  29349. this._ctx.parentCtx.addChild(this._ctx);
  29350. }
  29351. };
  29352. // Always called by generated parsers upon entry to a rule. Access field
  29353. // {@link //_ctx} get the current context.
  29354. Parser.prototype.enterRule = function(localctx, state, ruleIndex) {
  29355. this.state = state;
  29356. this._ctx = localctx;
  29357. this._ctx.start = this._input.LT(1);
  29358. if (this.buildParseTrees) {
  29359. this.addContextToParseTree();
  29360. }
  29361. if (this._parseListeners !== null) {
  29362. this.triggerEnterRuleEvent();
  29363. }
  29364. };
  29365. Parser.prototype.exitRule = function() {
  29366. this._ctx.stop = this._input.LT(-1);
  29367. // trigger event on _ctx, before it reverts to parent
  29368. if (this._parseListeners !== null) {
  29369. this.triggerExitRuleEvent();
  29370. }
  29371. this.state = this._ctx.invokingState;
  29372. this._ctx = this._ctx.parentCtx;
  29373. };
  29374. Parser.prototype.enterOuterAlt = function(localctx, altNum) {
  29375. localctx.setAltNumber(altNum);
  29376. // if we have new localctx, make sure we replace existing ctx
  29377. // that is previous child of parse tree
  29378. if (this.buildParseTrees && this._ctx !== localctx) {
  29379. if (this._ctx.parentCtx !== null) {
  29380. this._ctx.parentCtx.removeLastChild();
  29381. this._ctx.parentCtx.addChild(localctx);
  29382. }
  29383. }
  29384. this._ctx = localctx;
  29385. };
  29386. // Get the precedence level for the top-most precedence rule.
  29387. //
  29388. // @return The precedence level for the top-most precedence rule, or -1 if
  29389. // the parser context is not nested within a precedence rule.
  29390. Parser.prototype.getPrecedence = function() {
  29391. if (this._precedenceStack.length === 0) {
  29392. return -1;
  29393. } else {
  29394. return this._precedenceStack[this._precedenceStack.length-1];
  29395. }
  29396. };
  29397. Parser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,
  29398. precedence) {
  29399. this.state = state;
  29400. this._precedenceStack.push(precedence);
  29401. this._ctx = localctx;
  29402. this._ctx.start = this._input.LT(1);
  29403. if (this._parseListeners !== null) {
  29404. this.triggerEnterRuleEvent(); // simulates rule entry for
  29405. // left-recursive rules
  29406. }
  29407. };
  29408. //
  29409. // Like {@link //enterRule} but for recursive rules.
  29410. Parser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {
  29411. var previous = this._ctx;
  29412. previous.parentCtx = localctx;
  29413. previous.invokingState = state;
  29414. previous.stop = this._input.LT(-1);
  29415. this._ctx = localctx;
  29416. this._ctx.start = previous.start;
  29417. if (this.buildParseTrees) {
  29418. this._ctx.addChild(previous);
  29419. }
  29420. if (this._parseListeners !== null) {
  29421. this.triggerEnterRuleEvent(); // simulates rule entry for
  29422. // left-recursive rules
  29423. }
  29424. };
  29425. Parser.prototype.unrollRecursionContexts = function(parentCtx) {
  29426. this._precedenceStack.pop();
  29427. this._ctx.stop = this._input.LT(-1);
  29428. var retCtx = this._ctx; // save current ctx (return value)
  29429. // unroll so _ctx is as it was before call to recursive method
  29430. if (this._parseListeners !== null) {
  29431. while (this._ctx !== parentCtx) {
  29432. this.triggerExitRuleEvent();
  29433. this._ctx = this._ctx.parentCtx;
  29434. }
  29435. } else {
  29436. this._ctx = parentCtx;
  29437. }
  29438. // hook into tree
  29439. retCtx.parentCtx = parentCtx;
  29440. if (this.buildParseTrees && parentCtx !== null) {
  29441. // add return ctx into invoking rule's tree
  29442. parentCtx.addChild(retCtx);
  29443. }
  29444. };
  29445. Parser.prototype.getInvokingContext = function(ruleIndex) {
  29446. var ctx = this._ctx;
  29447. while (ctx !== null) {
  29448. if (ctx.ruleIndex === ruleIndex) {
  29449. return ctx;
  29450. }
  29451. ctx = ctx.parentCtx;
  29452. }
  29453. return null;
  29454. };
  29455. Parser.prototype.precpred = function(localctx, precedence) {
  29456. return precedence >= this._precedenceStack[this._precedenceStack.length-1];
  29457. };
  29458. Parser.prototype.inContext = function(context) {
  29459. // TODO: useful in parser?
  29460. return false;
  29461. };
  29462. //
  29463. // Checks whether or not {@code symbol} can follow the current state in the
  29464. // ATN. The behavior of this method is equivalent to the following, but is
  29465. // implemented such that the complete context-sensitive follow set does not
  29466. // need to be explicitly constructed.
  29467. //
  29468. // <pre>
  29469. // return getExpectedTokens().contains(symbol);
  29470. // </pre>
  29471. //
  29472. // @param symbol the symbol type to check
  29473. // @return {@code true} if {@code symbol} can follow the current state in
  29474. // the ATN, otherwise {@code false}.
  29475. Parser.prototype.isExpectedToken = function(symbol) {
  29476. var atn = this._interp.atn;
  29477. var ctx = this._ctx;
  29478. var s = atn.states[this.state];
  29479. var following = atn.nextTokens(s);
  29480. if (following.contains(symbol)) {
  29481. return true;
  29482. }
  29483. if (!following.contains(Token.EPSILON)) {
  29484. return false;
  29485. }
  29486. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  29487. var invokingState = atn.states[ctx.invokingState];
  29488. var rt = invokingState.transitions[0];
  29489. following = atn.nextTokens(rt.followState);
  29490. if (following.contains(symbol)) {
  29491. return true;
  29492. }
  29493. ctx = ctx.parentCtx;
  29494. }
  29495. if (following.contains(Token.EPSILON) && symbol === Token.EOF) {
  29496. return true;
  29497. } else {
  29498. return false;
  29499. }
  29500. };
  29501. // Computes the set of input symbols which could follow the current parser
  29502. // state and context, as given by {@link //getState} and {@link //getContext},
  29503. // respectively.
  29504. //
  29505. // @see ATN//getExpectedTokens(int, RuleContext)
  29506. //
  29507. Parser.prototype.getExpectedTokens = function() {
  29508. return this._interp.atn.getExpectedTokens(this.state, this._ctx);
  29509. };
  29510. Parser.prototype.getExpectedTokensWithinCurrentRule = function() {
  29511. var atn = this._interp.atn;
  29512. var s = atn.states[this.state];
  29513. return atn.nextTokens(s);
  29514. };
  29515. // Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//
  29516. Parser.prototype.getRuleIndex = function(ruleName) {
  29517. var ruleIndex = this.getRuleIndexMap()[ruleName];
  29518. if (ruleIndex !== null) {
  29519. return ruleIndex;
  29520. } else {
  29521. return -1;
  29522. }
  29523. };
  29524. // Return List&lt;String&gt; of the rule names in your parser instance
  29525. // leading up to a call to the current rule. You could override if
  29526. // you want more details such as the file/line info of where
  29527. // in the ATN a rule is invoked.
  29528. //
  29529. // this is very useful for error messages.
  29530. //
  29531. Parser.prototype.getRuleInvocationStack = function(p) {
  29532. p = p || null;
  29533. if (p === null) {
  29534. p = this._ctx;
  29535. }
  29536. var stack = [];
  29537. while (p !== null) {
  29538. // compute what follows who invoked us
  29539. var ruleIndex = p.ruleIndex;
  29540. if (ruleIndex < 0) {
  29541. stack.push("n/a");
  29542. } else {
  29543. stack.push(this.ruleNames[ruleIndex]);
  29544. }
  29545. p = p.parentCtx;
  29546. }
  29547. return stack;
  29548. };
  29549. // For debugging and other purposes.//
  29550. Parser.prototype.getDFAStrings = function() {
  29551. return this._interp.decisionToDFA.toString();
  29552. };
  29553. // For debugging and other purposes.//
  29554. Parser.prototype.dumpDFA = function() {
  29555. var seenOne = false;
  29556. for (var i = 0; i < this._interp.decisionToDFA.length; i++) {
  29557. var dfa = this._interp.decisionToDFA[i];
  29558. if (dfa.states.length > 0) {
  29559. if (seenOne) {
  29560. console.log();
  29561. }
  29562. this.printer.println("Decision " + dfa.decision + ":");
  29563. this.printer.print(dfa.toString(this.literalNames, this.symbolicNames));
  29564. seenOne = true;
  29565. }
  29566. }
  29567. };
  29568. /*
  29569. " printer = function() {\r\n" +
  29570. " this.println = function(s) { document.getElementById('output') += s + '\\n'; }\r\n" +
  29571. " this.print = function(s) { document.getElementById('output') += s; }\r\n" +
  29572. " };\r\n" +
  29573. */
  29574. Parser.prototype.getSourceName = function() {
  29575. return this._input.sourceName;
  29576. };
  29577. // During a parse is sometimes useful to listen in on the rule entry and exit
  29578. // events as well as token matches. this is for quick and dirty debugging.
  29579. //
  29580. Parser.prototype.setTrace = function(trace) {
  29581. if (!trace) {
  29582. this.removeParseListener(this._tracer);
  29583. this._tracer = null;
  29584. } else {
  29585. if (this._tracer !== null) {
  29586. this.removeParseListener(this._tracer);
  29587. }
  29588. this._tracer = new TraceListener(this);
  29589. this.addParseListener(this._tracer);
  29590. }
  29591. };
  29592. exports.Parser = Parser;
  29593. /***/ }),
  29594. /***/ "./node_modules/antlr4/ParserRuleContext.js":
  29595. /*!**************************************************!*\
  29596. !*** ./node_modules/antlr4/ParserRuleContext.js ***!
  29597. \**************************************************/
  29598. /*! no static exports found */
  29599. /***/ (function(module, exports, __webpack_require__) {
  29600. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29601. * Use of this file is governed by the BSD 3-clause license that
  29602. * can be found in the LICENSE.txt file in the project root.
  29603. */
  29604. //* A rule invocation record for parsing.
  29605. //
  29606. // Contains all of the information about the current rule not stored in the
  29607. // RuleContext. It handles parse tree children list, Any ATN state
  29608. // tracing, and the default values available for rule indications:
  29609. // start, stop, rule index, current alt number, current
  29610. // ATN state.
  29611. //
  29612. // Subclasses made for each rule and grammar track the parameters,
  29613. // return values, locals, and labels specific to that rule. These
  29614. // are the objects that are returned from rules.
  29615. //
  29616. // Note text is not an actual field of a rule return value; it is computed
  29617. // from start and stop using the input stream's toString() method. I
  29618. // could add a ctor to this so that we can pass in and store the input
  29619. // stream, but I'm not sure we want to do that. It would seem to be undefined
  29620. // to get the .text property anyway if the rule matches tokens from multiple
  29621. // input streams.
  29622. //
  29623. // I do not use getters for fields of objects that are used simply to
  29624. // group values such as this aggregate. The getters/setters are there to
  29625. // satisfy the superclass interface.
  29626. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29627. var Tree = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js");
  29628. var INVALID_INTERVAL = Tree.INVALID_INTERVAL;
  29629. var TerminalNode = Tree.TerminalNode;
  29630. var TerminalNodeImpl = Tree.TerminalNodeImpl;
  29631. var ErrorNodeImpl = Tree.ErrorNodeImpl;
  29632. var Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  29633. function ParserRuleContext(parent, invokingStateNumber) {
  29634. parent = parent || null;
  29635. invokingStateNumber = invokingStateNumber || null;
  29636. RuleContext.call(this, parent, invokingStateNumber);
  29637. this.ruleIndex = -1;
  29638. // * If we are debugging or building a parse tree for a visitor,
  29639. // we need to track all of the tokens and rule invocations associated
  29640. // with this rule's context. This is empty for parsing w/o tree constr.
  29641. // operation because we don't the need to track the details about
  29642. // how we parse this rule.
  29643. // /
  29644. this.children = null;
  29645. this.start = null;
  29646. this.stop = null;
  29647. // The exception that forced this rule to return. If the rule successfully
  29648. // completed, this is {@code null}.
  29649. this.exception = null;
  29650. }
  29651. ParserRuleContext.prototype = Object.create(RuleContext.prototype);
  29652. ParserRuleContext.prototype.constructor = ParserRuleContext;
  29653. // * COPY a ctx (I'm deliberately not using copy constructor)///
  29654. ParserRuleContext.prototype.copyFrom = function(ctx) {
  29655. // from RuleContext
  29656. this.parentCtx = ctx.parentCtx;
  29657. this.invokingState = ctx.invokingState;
  29658. this.children = null;
  29659. this.start = ctx.start;
  29660. this.stop = ctx.stop;
  29661. // copy any error nodes to alt label node
  29662. if(ctx.children) {
  29663. this.children = [];
  29664. // reset parent pointer for any error nodes
  29665. ctx.children.map(function(child) {
  29666. if (child instanceof ErrorNodeImpl) {
  29667. this.children.push(child);
  29668. child.parentCtx = this;
  29669. }
  29670. }, this);
  29671. }
  29672. };
  29673. // Double dispatch methods for listeners
  29674. ParserRuleContext.prototype.enterRule = function(listener) {
  29675. };
  29676. ParserRuleContext.prototype.exitRule = function(listener) {
  29677. };
  29678. // * Does not set parent link; other add methods do that///
  29679. ParserRuleContext.prototype.addChild = function(child) {
  29680. if (this.children === null) {
  29681. this.children = [];
  29682. }
  29683. this.children.push(child);
  29684. return child;
  29685. };
  29686. // * Used by enterOuterAlt to toss out a RuleContext previously added as
  29687. // we entered a rule. If we have // label, we will need to remove
  29688. // generic ruleContext object.
  29689. // /
  29690. ParserRuleContext.prototype.removeLastChild = function() {
  29691. if (this.children !== null) {
  29692. this.children.pop();
  29693. }
  29694. };
  29695. ParserRuleContext.prototype.addTokenNode = function(token) {
  29696. var node = new TerminalNodeImpl(token);
  29697. this.addChild(node);
  29698. node.parentCtx = this;
  29699. return node;
  29700. };
  29701. ParserRuleContext.prototype.addErrorNode = function(badToken) {
  29702. var node = new ErrorNodeImpl(badToken);
  29703. this.addChild(node);
  29704. node.parentCtx = this;
  29705. return node;
  29706. };
  29707. ParserRuleContext.prototype.getChild = function(i, type) {
  29708. type = type || null;
  29709. if (this.children === null || i < 0 || i >= this.children.length) {
  29710. return null;
  29711. }
  29712. if (type === null) {
  29713. return this.children[i];
  29714. } else {
  29715. for(var j=0; j<this.children.length; j++) {
  29716. var child = this.children[j];
  29717. if(child instanceof type) {
  29718. if(i===0) {
  29719. return child;
  29720. } else {
  29721. i -= 1;
  29722. }
  29723. }
  29724. }
  29725. return null;
  29726. }
  29727. };
  29728. ParserRuleContext.prototype.getToken = function(ttype, i) {
  29729. if (this.children === null || i < 0 || i >= this.children.length) {
  29730. return null;
  29731. }
  29732. for(var j=0; j<this.children.length; j++) {
  29733. var child = this.children[j];
  29734. if (child instanceof TerminalNode) {
  29735. if (child.symbol.type === ttype) {
  29736. if(i===0) {
  29737. return child;
  29738. } else {
  29739. i -= 1;
  29740. }
  29741. }
  29742. }
  29743. }
  29744. return null;
  29745. };
  29746. ParserRuleContext.prototype.getTokens = function(ttype ) {
  29747. if (this.children=== null) {
  29748. return [];
  29749. } else {
  29750. var tokens = [];
  29751. for(var j=0; j<this.children.length; j++) {
  29752. var child = this.children[j];
  29753. if (child instanceof TerminalNode) {
  29754. if (child.symbol.type === ttype) {
  29755. tokens.push(child);
  29756. }
  29757. }
  29758. }
  29759. return tokens;
  29760. }
  29761. };
  29762. ParserRuleContext.prototype.getTypedRuleContext = function(ctxType, i) {
  29763. return this.getChild(i, ctxType);
  29764. };
  29765. ParserRuleContext.prototype.getTypedRuleContexts = function(ctxType) {
  29766. if (this.children=== null) {
  29767. return [];
  29768. } else {
  29769. var contexts = [];
  29770. for(var j=0; j<this.children.length; j++) {
  29771. var child = this.children[j];
  29772. if (child instanceof ctxType) {
  29773. contexts.push(child);
  29774. }
  29775. }
  29776. return contexts;
  29777. }
  29778. };
  29779. ParserRuleContext.prototype.getChildCount = function() {
  29780. if (this.children=== null) {
  29781. return 0;
  29782. } else {
  29783. return this.children.length;
  29784. }
  29785. };
  29786. ParserRuleContext.prototype.getSourceInterval = function() {
  29787. if( this.start === null || this.stop === null) {
  29788. return INVALID_INTERVAL;
  29789. } else {
  29790. return new Interval(this.start.tokenIndex, this.stop.tokenIndex);
  29791. }
  29792. };
  29793. RuleContext.EMPTY = new ParserRuleContext();
  29794. function InterpreterRuleContext(parent, invokingStateNumber, ruleIndex) {
  29795. ParserRuleContext.call(parent, invokingStateNumber);
  29796. this.ruleIndex = ruleIndex;
  29797. return this;
  29798. }
  29799. InterpreterRuleContext.prototype = Object.create(ParserRuleContext.prototype);
  29800. InterpreterRuleContext.prototype.constructor = InterpreterRuleContext;
  29801. exports.ParserRuleContext = ParserRuleContext;
  29802. /***/ }),
  29803. /***/ "./node_modules/antlr4/PredictionContext.js":
  29804. /*!**************************************************!*\
  29805. !*** ./node_modules/antlr4/PredictionContext.js ***!
  29806. \**************************************************/
  29807. /*! no static exports found */
  29808. /***/ (function(module, exports, __webpack_require__) {
  29809. //
  29810. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  29811. * Use of this file is governed by the BSD 3-clause license that
  29812. * can be found in the LICENSE.txt file in the project root.
  29813. */
  29814. ///
  29815. var RuleContext = __webpack_require__(/*! ./RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  29816. var Hash = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js").Hash;
  29817. function PredictionContext(cachedHashCode) {
  29818. this.cachedHashCode = cachedHashCode;
  29819. }
  29820. // Represents {@code $} in local context prediction, which means wildcard.
  29821. // {@code//+x =//}.
  29822. // /
  29823. PredictionContext.EMPTY = null;
  29824. // Represents {@code $} in an array in full context mode, when {@code $}
  29825. // doesn't mean wildcard: {@code $ + x = [$,x]}. Here,
  29826. // {@code $} = {@link //EMPTY_RETURN_STATE}.
  29827. // /
  29828. PredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;
  29829. PredictionContext.globalNodeCount = 1;
  29830. PredictionContext.id = PredictionContext.globalNodeCount;
  29831. // Stores the computed hash code of this {@link PredictionContext}. The hash
  29832. // code is computed in parts to match the following reference algorithm.
  29833. //
  29834. // <pre>
  29835. // private int referenceHashCode() {
  29836. // int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link
  29837. // //INITIAL_HASH});
  29838. //
  29839. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29840. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent
  29841. // getParent}(i));
  29842. // }
  29843. //
  29844. // for (int i = 0; i &lt; {@link //size()}; i++) {
  29845. // hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link
  29846. // //getReturnState getReturnState}(i));
  29847. // }
  29848. //
  29849. // hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link
  29850. // //size()});
  29851. // return hash;
  29852. // }
  29853. // </pre>
  29854. // /
  29855. // This means only the {@link //EMPTY} context is in set.
  29856. PredictionContext.prototype.isEmpty = function() {
  29857. return this === PredictionContext.EMPTY;
  29858. };
  29859. PredictionContext.prototype.hasEmptyPath = function() {
  29860. return this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;
  29861. };
  29862. PredictionContext.prototype.hashCode = function() {
  29863. return this.cachedHashCode;
  29864. };
  29865. PredictionContext.prototype.updateHashCode = function(hash) {
  29866. hash.update(this.cachedHashCode);
  29867. };
  29868. /*
  29869. function calculateHashString(parent, returnState) {
  29870. return "" + parent + returnState;
  29871. }
  29872. */
  29873. // Used to cache {@link PredictionContext} objects. Its used for the shared
  29874. // context cash associated with contexts in DFA states. This cache
  29875. // can be used for both lexers and parsers.
  29876. function PredictionContextCache() {
  29877. this.cache = {};
  29878. return this;
  29879. }
  29880. // Add a context to the cache and return it. If the context already exists,
  29881. // return that one instead and do not add a new context to the cache.
  29882. // Protect shared cache from unsafe thread access.
  29883. //
  29884. PredictionContextCache.prototype.add = function(ctx) {
  29885. if (ctx === PredictionContext.EMPTY) {
  29886. return PredictionContext.EMPTY;
  29887. }
  29888. var existing = this.cache[ctx] || null;
  29889. if (existing !== null) {
  29890. return existing;
  29891. }
  29892. this.cache[ctx] = ctx;
  29893. return ctx;
  29894. };
  29895. PredictionContextCache.prototype.get = function(ctx) {
  29896. return this.cache[ctx] || null;
  29897. };
  29898. Object.defineProperty(PredictionContextCache.prototype, "length", {
  29899. get : function() {
  29900. return this.cache.length;
  29901. }
  29902. });
  29903. function SingletonPredictionContext(parent, returnState) {
  29904. var hashCode = 0;
  29905. if(parent !== null) {
  29906. var hash = new Hash();
  29907. hash.update(parent, returnState);
  29908. hashCode = hash.finish();
  29909. }
  29910. PredictionContext.call(this, hashCode);
  29911. this.parentCtx = parent;
  29912. this.returnState = returnState;
  29913. }
  29914. SingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29915. SingletonPredictionContext.prototype.contructor = SingletonPredictionContext;
  29916. SingletonPredictionContext.create = function(parent, returnState) {
  29917. if (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {
  29918. // someone can pass in the bits of an array ctx that mean $
  29919. return PredictionContext.EMPTY;
  29920. } else {
  29921. return new SingletonPredictionContext(parent, returnState);
  29922. }
  29923. };
  29924. Object.defineProperty(SingletonPredictionContext.prototype, "length", {
  29925. get : function() {
  29926. return 1;
  29927. }
  29928. });
  29929. SingletonPredictionContext.prototype.getParent = function(index) {
  29930. return this.parentCtx;
  29931. };
  29932. SingletonPredictionContext.prototype.getReturnState = function(index) {
  29933. return this.returnState;
  29934. };
  29935. SingletonPredictionContext.prototype.equals = function(other) {
  29936. if (this === other) {
  29937. return true;
  29938. } else if (!(other instanceof SingletonPredictionContext)) {
  29939. return false;
  29940. } else if (this.hashCode() !== other.hashCode()) {
  29941. return false; // can't be same if hash is different
  29942. } else {
  29943. if(this.returnState !== other.returnState)
  29944. return false;
  29945. else if(this.parentCtx==null)
  29946. return other.parentCtx==null
  29947. else
  29948. return this.parentCtx.equals(other.parentCtx);
  29949. }
  29950. };
  29951. SingletonPredictionContext.prototype.toString = function() {
  29952. var up = this.parentCtx === null ? "" : this.parentCtx.toString();
  29953. if (up.length === 0) {
  29954. if (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {
  29955. return "$";
  29956. } else {
  29957. return "" + this.returnState;
  29958. }
  29959. } else {
  29960. return "" + this.returnState + " " + up;
  29961. }
  29962. };
  29963. function EmptyPredictionContext() {
  29964. SingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);
  29965. return this;
  29966. }
  29967. EmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);
  29968. EmptyPredictionContext.prototype.constructor = EmptyPredictionContext;
  29969. EmptyPredictionContext.prototype.isEmpty = function() {
  29970. return true;
  29971. };
  29972. EmptyPredictionContext.prototype.getParent = function(index) {
  29973. return null;
  29974. };
  29975. EmptyPredictionContext.prototype.getReturnState = function(index) {
  29976. return this.returnState;
  29977. };
  29978. EmptyPredictionContext.prototype.equals = function(other) {
  29979. return this === other;
  29980. };
  29981. EmptyPredictionContext.prototype.toString = function() {
  29982. return "$";
  29983. };
  29984. PredictionContext.EMPTY = new EmptyPredictionContext();
  29985. function ArrayPredictionContext(parents, returnStates) {
  29986. // Parent can be null only if full ctx mode and we make an array
  29987. // from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using
  29988. // null parent and
  29989. // returnState == {@link //EMPTY_RETURN_STATE}.
  29990. var h = new Hash();
  29991. h.update(parents, returnStates);
  29992. var hashCode = h.finish();
  29993. PredictionContext.call(this, hashCode);
  29994. this.parents = parents;
  29995. this.returnStates = returnStates;
  29996. return this;
  29997. }
  29998. ArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);
  29999. ArrayPredictionContext.prototype.constructor = ArrayPredictionContext;
  30000. ArrayPredictionContext.prototype.isEmpty = function() {
  30001. // since EMPTY_RETURN_STATE can only appear in the last position, we
  30002. // don't need to verify that size==1
  30003. return this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;
  30004. };
  30005. Object.defineProperty(ArrayPredictionContext.prototype, "length", {
  30006. get : function() {
  30007. return this.returnStates.length;
  30008. }
  30009. });
  30010. ArrayPredictionContext.prototype.getParent = function(index) {
  30011. return this.parents[index];
  30012. };
  30013. ArrayPredictionContext.prototype.getReturnState = function(index) {
  30014. return this.returnStates[index];
  30015. };
  30016. ArrayPredictionContext.prototype.equals = function(other) {
  30017. if (this === other) {
  30018. return true;
  30019. } else if (!(other instanceof ArrayPredictionContext)) {
  30020. return false;
  30021. } else if (this.hashCode() !== other.hashCode()) {
  30022. return false; // can't be same if hash is different
  30023. } else {
  30024. return this.returnStates === other.returnStates &&
  30025. this.parents === other.parents;
  30026. }
  30027. };
  30028. ArrayPredictionContext.prototype.toString = function() {
  30029. if (this.isEmpty()) {
  30030. return "[]";
  30031. } else {
  30032. var s = "[";
  30033. for (var i = 0; i < this.returnStates.length; i++) {
  30034. if (i > 0) {
  30035. s = s + ", ";
  30036. }
  30037. if (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {
  30038. s = s + "$";
  30039. continue;
  30040. }
  30041. s = s + this.returnStates[i];
  30042. if (this.parents[i] !== null) {
  30043. s = s + " " + this.parents[i];
  30044. } else {
  30045. s = s + "null";
  30046. }
  30047. }
  30048. return s + "]";
  30049. }
  30050. };
  30051. // Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.
  30052. // Return {@link //EMPTY} if {@code outerContext} is empty or null.
  30053. // /
  30054. function predictionContextFromRuleContext(atn, outerContext) {
  30055. if (outerContext === undefined || outerContext === null) {
  30056. outerContext = RuleContext.EMPTY;
  30057. }
  30058. // if we are in RuleContext of start rule, s, then PredictionContext
  30059. // is EMPTY. Nobody called us. (if we are empty, return empty)
  30060. if (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {
  30061. return PredictionContext.EMPTY;
  30062. }
  30063. // If we have a parent, convert it to a PredictionContext graph
  30064. var parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);
  30065. var state = atn.states[outerContext.invokingState];
  30066. var transition = state.transitions[0];
  30067. return SingletonPredictionContext.create(parent, transition.followState.stateNumber);
  30068. }
  30069. /*
  30070. function calculateListsHashString(parents, returnStates) {
  30071. var s = "";
  30072. parents.map(function(p) {
  30073. s = s + p;
  30074. });
  30075. returnStates.map(function(r) {
  30076. s = s + r;
  30077. });
  30078. return s;
  30079. }
  30080. */
  30081. function merge(a, b, rootIsWildcard, mergeCache) {
  30082. // share same graph if both same
  30083. if (a === b) {
  30084. return a;
  30085. }
  30086. if (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {
  30087. return mergeSingletons(a, b, rootIsWildcard, mergeCache);
  30088. }
  30089. // At least one of a or b is array
  30090. // If one is $ and rootIsWildcard, return $ as// wildcard
  30091. if (rootIsWildcard) {
  30092. if (a instanceof EmptyPredictionContext) {
  30093. return a;
  30094. }
  30095. if (b instanceof EmptyPredictionContext) {
  30096. return b;
  30097. }
  30098. }
  30099. // convert singleton so both are arrays to normalize
  30100. if (a instanceof SingletonPredictionContext) {
  30101. a = new ArrayPredictionContext([a.getParent()], [a.returnState]);
  30102. }
  30103. if (b instanceof SingletonPredictionContext) {
  30104. b = new ArrayPredictionContext([b.getParent()], [b.returnState]);
  30105. }
  30106. return mergeArrays(a, b, rootIsWildcard, mergeCache);
  30107. }
  30108. //
  30109. // Merge two {@link SingletonPredictionContext} instances.
  30110. //
  30111. // <p>Stack tops equal, parents merge is same; return left graph.<br>
  30112. // <embed src="images/SingletonMerge_SameRootSamePar.svg"
  30113. // type="image/svg+xml"/></p>
  30114. //
  30115. // <p>Same stack top, parents differ; merge parents giving array node, then
  30116. // remainders of those graphs. A new root node is created to point to the
  30117. // merged parents.<br>
  30118. // <embed src="images/SingletonMerge_SameRootDiffPar.svg"
  30119. // type="image/svg+xml"/></p>
  30120. //
  30121. // <p>Different stack tops pointing to same parent. Make array node for the
  30122. // root where both element in the root point to the same (original)
  30123. // parent.<br>
  30124. // <embed src="images/SingletonMerge_DiffRootSamePar.svg"
  30125. // type="image/svg+xml"/></p>
  30126. //
  30127. // <p>Different stack tops pointing to different parents. Make array node for
  30128. // the root where each element points to the corresponding original
  30129. // parent.<br>
  30130. // <embed src="images/SingletonMerge_DiffRootDiffPar.svg"
  30131. // type="image/svg+xml"/></p>
  30132. //
  30133. // @param a the first {@link SingletonPredictionContext}
  30134. // @param b the second {@link SingletonPredictionContext}
  30135. // @param rootIsWildcard {@code true} if this is a local-context merge,
  30136. // otherwise false to indicate a full-context merge
  30137. // @param mergeCache
  30138. // /
  30139. function mergeSingletons(a, b, rootIsWildcard, mergeCache) {
  30140. if (mergeCache !== null) {
  30141. var previous = mergeCache.get(a, b);
  30142. if (previous !== null) {
  30143. return previous;
  30144. }
  30145. previous = mergeCache.get(b, a);
  30146. if (previous !== null) {
  30147. return previous;
  30148. }
  30149. }
  30150. var rootMerge = mergeRoot(a, b, rootIsWildcard);
  30151. if (rootMerge !== null) {
  30152. if (mergeCache !== null) {
  30153. mergeCache.set(a, b, rootMerge);
  30154. }
  30155. return rootMerge;
  30156. }
  30157. if (a.returnState === b.returnState) {
  30158. var parent = merge(a.parentCtx, b.parentCtx, rootIsWildcard, mergeCache);
  30159. // if parent is same as existing a or b parent or reduced to a parent,
  30160. // return it
  30161. if (parent === a.parentCtx) {
  30162. return a; // ax + bx = ax, if a=b
  30163. }
  30164. if (parent === b.parentCtx) {
  30165. return b; // ax + bx = bx, if a=b
  30166. }
  30167. // else: ax + ay = a'[x,y]
  30168. // merge parents x and y, giving array node with x,y then remainders
  30169. // of those graphs. dup a, a' points at merged array
  30170. // new joined parent so create new singleton pointing to it, a'
  30171. var spc = SingletonPredictionContext.create(parent, a.returnState);
  30172. if (mergeCache !== null) {
  30173. mergeCache.set(a, b, spc);
  30174. }
  30175. return spc;
  30176. } else { // a != b payloads differ
  30177. // see if we can collapse parents due to $+x parents if local ctx
  30178. var singleParent = null;
  30179. if (a === b || (a.parentCtx !== null && a.parentCtx === b.parentCtx)) { // ax +
  30180. // bx =
  30181. // [a,b]x
  30182. singleParent = a.parentCtx;
  30183. }
  30184. if (singleParent !== null) { // parents are same
  30185. // sort payloads and use same parent
  30186. var payloads = [ a.returnState, b.returnState ];
  30187. if (a.returnState > b.returnState) {
  30188. payloads[0] = b.returnState;
  30189. payloads[1] = a.returnState;
  30190. }
  30191. var parents = [ singleParent, singleParent ];
  30192. var apc = new ArrayPredictionContext(parents, payloads);
  30193. if (mergeCache !== null) {
  30194. mergeCache.set(a, b, apc);
  30195. }
  30196. return apc;
  30197. }
  30198. // parents differ and can't merge them. Just pack together
  30199. // into array; can't merge.
  30200. // ax + by = [ax,by]
  30201. var payloads = [ a.returnState, b.returnState ];
  30202. var parents = [ a.parentCtx, b.parentCtx ];
  30203. if (a.returnState > b.returnState) { // sort by payload
  30204. payloads[0] = b.returnState;
  30205. payloads[1] = a.returnState;
  30206. parents = [ b.parentCtx, a.parentCtx ];
  30207. }
  30208. var a_ = new ArrayPredictionContext(parents, payloads);
  30209. if (mergeCache !== null) {
  30210. mergeCache.set(a, b, a_);
  30211. }
  30212. return a_;
  30213. }
  30214. }
  30215. //
  30216. // Handle case where at least one of {@code a} or {@code b} is
  30217. // {@link //EMPTY}. In the following diagrams, the symbol {@code $} is used
  30218. // to represent {@link //EMPTY}.
  30219. //
  30220. // <h2>Local-Context Merges</h2>
  30221. //
  30222. // <p>These local-context merge operations are used when {@code rootIsWildcard}
  30223. // is true.</p>
  30224. //
  30225. // <p>{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.<br>
  30226. // <embed src="images/LocalMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  30227. //
  30228. // <p>{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is
  30229. // {@code //EMPTY}; return left graph.<br>
  30230. // <embed src="images/LocalMerge_EmptyParent.svg" type="image/svg+xml"/></p>
  30231. //
  30232. // <p>Special case of last merge if local context.<br>
  30233. // <embed src="images/LocalMerge_DiffRoots.svg" type="image/svg+xml"/></p>
  30234. //
  30235. // <h2>Full-Context Merges</h2>
  30236. //
  30237. // <p>These full-context merge operations are used when {@code rootIsWildcard}
  30238. // is false.</p>
  30239. //
  30240. // <p><embed src="images/FullMerge_EmptyRoots.svg" type="image/svg+xml"/></p>
  30241. //
  30242. // <p>Must keep all contexts; {@link //EMPTY} in array is a special value (and
  30243. // null parent).<br>
  30244. // <embed src="images/FullMerge_EmptyRoot.svg" type="image/svg+xml"/></p>
  30245. //
  30246. // <p><embed src="images/FullMerge_SameRoot.svg" type="image/svg+xml"/></p>
  30247. //
  30248. // @param a the first {@link SingletonPredictionContext}
  30249. // @param b the second {@link SingletonPredictionContext}
  30250. // @param rootIsWildcard {@code true} if this is a local-context merge,
  30251. // otherwise false to indicate a full-context merge
  30252. // /
  30253. function mergeRoot(a, b, rootIsWildcard) {
  30254. if (rootIsWildcard) {
  30255. if (a === PredictionContext.EMPTY) {
  30256. return PredictionContext.EMPTY; // // + b =//
  30257. }
  30258. if (b === PredictionContext.EMPTY) {
  30259. return PredictionContext.EMPTY; // a +// =//
  30260. }
  30261. } else {
  30262. if (a === PredictionContext.EMPTY && b === PredictionContext.EMPTY) {
  30263. return PredictionContext.EMPTY; // $ + $ = $
  30264. } else if (a === PredictionContext.EMPTY) { // $ + x = [$,x]
  30265. var payloads = [ b.returnState,
  30266. PredictionContext.EMPTY_RETURN_STATE ];
  30267. var parents = [ b.parentCtx, null ];
  30268. return new ArrayPredictionContext(parents, payloads);
  30269. } else if (b === PredictionContext.EMPTY) { // x + $ = [$,x] ($ is always first if present)
  30270. var payloads = [ a.returnState, PredictionContext.EMPTY_RETURN_STATE ];
  30271. var parents = [ a.parentCtx, null ];
  30272. return new ArrayPredictionContext(parents, payloads);
  30273. }
  30274. }
  30275. return null;
  30276. }
  30277. //
  30278. // Merge two {@link ArrayPredictionContext} instances.
  30279. //
  30280. // <p>Different tops, different parents.<br>
  30281. // <embed src="images/ArrayMerge_DiffTopDiffPar.svg" type="image/svg+xml"/></p>
  30282. //
  30283. // <p>Shared top, same parents.<br>
  30284. // <embed src="images/ArrayMerge_ShareTopSamePar.svg" type="image/svg+xml"/></p>
  30285. //
  30286. // <p>Shared top, different parents.<br>
  30287. // <embed src="images/ArrayMerge_ShareTopDiffPar.svg" type="image/svg+xml"/></p>
  30288. //
  30289. // <p>Shared top, all shared parents.<br>
  30290. // <embed src="images/ArrayMerge_ShareTopSharePar.svg"
  30291. // type="image/svg+xml"/></p>
  30292. //
  30293. // <p>Equal tops, merge parents and reduce top to
  30294. // {@link SingletonPredictionContext}.<br>
  30295. // <embed src="images/ArrayMerge_EqualTop.svg" type="image/svg+xml"/></p>
  30296. // /
  30297. function mergeArrays(a, b, rootIsWildcard, mergeCache) {
  30298. if (mergeCache !== null) {
  30299. var previous = mergeCache.get(a, b);
  30300. if (previous !== null) {
  30301. return previous;
  30302. }
  30303. previous = mergeCache.get(b, a);
  30304. if (previous !== null) {
  30305. return previous;
  30306. }
  30307. }
  30308. // merge sorted payloads a + b => M
  30309. var i = 0; // walks a
  30310. var j = 0; // walks b
  30311. var k = 0; // walks target M array
  30312. var mergedReturnStates = [];
  30313. var mergedParents = [];
  30314. // walk and merge to yield mergedParents, mergedReturnStates
  30315. while (i < a.returnStates.length && j < b.returnStates.length) {
  30316. var a_parent = a.parents[i];
  30317. var b_parent = b.parents[j];
  30318. if (a.returnStates[i] === b.returnStates[j]) {
  30319. // same payload (stack tops are equal), must yield merged singleton
  30320. var payload = a.returnStates[i];
  30321. // $+$ = $
  30322. var bothDollars = payload === PredictionContext.EMPTY_RETURN_STATE &&
  30323. a_parent === null && b_parent === null;
  30324. var ax_ax = (a_parent !== null && b_parent !== null && a_parent === b_parent); // ax+ax
  30325. // ->
  30326. // ax
  30327. if (bothDollars || ax_ax) {
  30328. mergedParents[k] = a_parent; // choose left
  30329. mergedReturnStates[k] = payload;
  30330. } else { // ax+ay -> a'[x,y]
  30331. var mergedParent = merge(a_parent, b_parent, rootIsWildcard, mergeCache);
  30332. mergedParents[k] = mergedParent;
  30333. mergedReturnStates[k] = payload;
  30334. }
  30335. i += 1; // hop over left one as usual
  30336. j += 1; // but also skip one in right side since we merge
  30337. } else if (a.returnStates[i] < b.returnStates[j]) { // copy a[i] to M
  30338. mergedParents[k] = a_parent;
  30339. mergedReturnStates[k] = a.returnStates[i];
  30340. i += 1;
  30341. } else { // b > a, copy b[j] to M
  30342. mergedParents[k] = b_parent;
  30343. mergedReturnStates[k] = b.returnStates[j];
  30344. j += 1;
  30345. }
  30346. k += 1;
  30347. }
  30348. // copy over any payloads remaining in either array
  30349. if (i < a.returnStates.length) {
  30350. for (var p = i; p < a.returnStates.length; p++) {
  30351. mergedParents[k] = a.parents[p];
  30352. mergedReturnStates[k] = a.returnStates[p];
  30353. k += 1;
  30354. }
  30355. } else {
  30356. for (var p = j; p < b.returnStates.length; p++) {
  30357. mergedParents[k] = b.parents[p];
  30358. mergedReturnStates[k] = b.returnStates[p];
  30359. k += 1;
  30360. }
  30361. }
  30362. // trim merged if we combined a few that had same stack tops
  30363. if (k < mergedParents.length) { // write index < last position; trim
  30364. if (k === 1) { // for just one merged element, return singleton top
  30365. var a_ = SingletonPredictionContext.create(mergedParents[0],
  30366. mergedReturnStates[0]);
  30367. if (mergeCache !== null) {
  30368. mergeCache.set(a, b, a_);
  30369. }
  30370. return a_;
  30371. }
  30372. mergedParents = mergedParents.slice(0, k);
  30373. mergedReturnStates = mergedReturnStates.slice(0, k);
  30374. }
  30375. var M = new ArrayPredictionContext(mergedParents, mergedReturnStates);
  30376. // if we created same array as a or b, return that instead
  30377. // TODO: track whether this is possible above during merge sort for speed
  30378. if (M === a) {
  30379. if (mergeCache !== null) {
  30380. mergeCache.set(a, b, a);
  30381. }
  30382. return a;
  30383. }
  30384. if (M === b) {
  30385. if (mergeCache !== null) {
  30386. mergeCache.set(a, b, b);
  30387. }
  30388. return b;
  30389. }
  30390. combineCommonParents(mergedParents);
  30391. if (mergeCache !== null) {
  30392. mergeCache.set(a, b, M);
  30393. }
  30394. return M;
  30395. }
  30396. //
  30397. // Make pass over all <em>M</em> {@code parents}; merge any {@code equals()}
  30398. // ones.
  30399. // /
  30400. function combineCommonParents(parents) {
  30401. var uniqueParents = {};
  30402. for (var p = 0; p < parents.length; p++) {
  30403. var parent = parents[p];
  30404. if (!(parent in uniqueParents)) {
  30405. uniqueParents[parent] = parent;
  30406. }
  30407. }
  30408. for (var q = 0; q < parents.length; q++) {
  30409. parents[q] = uniqueParents[parents[q]];
  30410. }
  30411. }
  30412. function getCachedPredictionContext(context, contextCache, visited) {
  30413. if (context.isEmpty()) {
  30414. return context;
  30415. }
  30416. var existing = visited[context] || null;
  30417. if (existing !== null) {
  30418. return existing;
  30419. }
  30420. existing = contextCache.get(context);
  30421. if (existing !== null) {
  30422. visited[context] = existing;
  30423. return existing;
  30424. }
  30425. var changed = false;
  30426. var parents = [];
  30427. for (var i = 0; i < parents.length; i++) {
  30428. var parent = getCachedPredictionContext(context.getParent(i), contextCache, visited);
  30429. if (changed || parent !== context.getParent(i)) {
  30430. if (!changed) {
  30431. parents = [];
  30432. for (var j = 0; j < context.length; j++) {
  30433. parents[j] = context.getParent(j);
  30434. }
  30435. changed = true;
  30436. }
  30437. parents[i] = parent;
  30438. }
  30439. }
  30440. if (!changed) {
  30441. contextCache.add(context);
  30442. visited[context] = context;
  30443. return context;
  30444. }
  30445. var updated = null;
  30446. if (parents.length === 0) {
  30447. updated = PredictionContext.EMPTY;
  30448. } else if (parents.length === 1) {
  30449. updated = SingletonPredictionContext.create(parents[0], context
  30450. .getReturnState(0));
  30451. } else {
  30452. updated = new ArrayPredictionContext(parents, context.returnStates);
  30453. }
  30454. contextCache.add(updated);
  30455. visited[updated] = updated;
  30456. visited[context] = updated;
  30457. return updated;
  30458. }
  30459. // ter's recursive version of Sam's getAllNodes()
  30460. function getAllContextNodes(context, nodes, visited) {
  30461. if (nodes === null) {
  30462. nodes = [];
  30463. return getAllContextNodes(context, nodes, visited);
  30464. } else if (visited === null) {
  30465. visited = {};
  30466. return getAllContextNodes(context, nodes, visited);
  30467. } else {
  30468. if (context === null || visited[context] !== null) {
  30469. return nodes;
  30470. }
  30471. visited[context] = context;
  30472. nodes.push(context);
  30473. for (var i = 0; i < context.length; i++) {
  30474. getAllContextNodes(context.getParent(i), nodes, visited);
  30475. }
  30476. return nodes;
  30477. }
  30478. }
  30479. exports.merge = merge;
  30480. exports.PredictionContext = PredictionContext;
  30481. exports.PredictionContextCache = PredictionContextCache;
  30482. exports.SingletonPredictionContext = SingletonPredictionContext;
  30483. exports.predictionContextFromRuleContext = predictionContextFromRuleContext;
  30484. exports.getCachedPredictionContext = getCachedPredictionContext;
  30485. /***/ }),
  30486. /***/ "./node_modules/antlr4/Recognizer.js":
  30487. /*!*******************************************!*\
  30488. !*** ./node_modules/antlr4/Recognizer.js ***!
  30489. \*******************************************/
  30490. /*! no static exports found */
  30491. /***/ (function(module, exports, __webpack_require__) {
  30492. //
  30493. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30494. * Use of this file is governed by the BSD 3-clause license that
  30495. * can be found in the LICENSE.txt file in the project root.
  30496. */
  30497. //
  30498. var Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  30499. var ConsoleErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ConsoleErrorListener;
  30500. var ProxyErrorListener = __webpack_require__(/*! ./error/ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ProxyErrorListener;
  30501. function Recognizer() {
  30502. this._listeners = [ ConsoleErrorListener.INSTANCE ];
  30503. this._interp = null;
  30504. this._stateNumber = -1;
  30505. return this;
  30506. }
  30507. Recognizer.tokenTypeMapCache = {};
  30508. Recognizer.ruleIndexMapCache = {};
  30509. Recognizer.prototype.checkVersion = function(toolVersion) {
  30510. var runtimeVersion = "4.7.2";
  30511. if (runtimeVersion!==toolVersion) {
  30512. console.log("ANTLR runtime and generated code versions disagree: "+runtimeVersion+"!="+toolVersion);
  30513. }
  30514. };
  30515. Recognizer.prototype.addErrorListener = function(listener) {
  30516. this._listeners.push(listener);
  30517. };
  30518. Recognizer.prototype.removeErrorListeners = function() {
  30519. this._listeners = [];
  30520. };
  30521. Recognizer.prototype.getTokenTypeMap = function() {
  30522. var tokenNames = this.getTokenNames();
  30523. if (tokenNames===null) {
  30524. throw("The current recognizer does not provide a list of token names.");
  30525. }
  30526. var result = this.tokenTypeMapCache[tokenNames];
  30527. if(result===undefined) {
  30528. result = tokenNames.reduce(function(o, k, i) { o[k] = i; });
  30529. result.EOF = Token.EOF;
  30530. this.tokenTypeMapCache[tokenNames] = result;
  30531. }
  30532. return result;
  30533. };
  30534. // Get a map from rule names to rule indexes.
  30535. //
  30536. // <p>Used for XPath and tree pattern compilation.</p>
  30537. //
  30538. Recognizer.prototype.getRuleIndexMap = function() {
  30539. var ruleNames = this.ruleNames;
  30540. if (ruleNames===null) {
  30541. throw("The current recognizer does not provide a list of rule names.");
  30542. }
  30543. var result = this.ruleIndexMapCache[ruleNames];
  30544. if(result===undefined) {
  30545. result = ruleNames.reduce(function(o, k, i) { o[k] = i; });
  30546. this.ruleIndexMapCache[ruleNames] = result;
  30547. }
  30548. return result;
  30549. };
  30550. Recognizer.prototype.getTokenType = function(tokenName) {
  30551. var ttype = this.getTokenTypeMap()[tokenName];
  30552. if (ttype !==undefined) {
  30553. return ttype;
  30554. } else {
  30555. return Token.INVALID_TYPE;
  30556. }
  30557. };
  30558. // What is the error header, normally line/character position information?//
  30559. Recognizer.prototype.getErrorHeader = function(e) {
  30560. var line = e.getOffendingToken().line;
  30561. var column = e.getOffendingToken().column;
  30562. return "line " + line + ":" + column;
  30563. };
  30564. // How should a token be displayed in an error message? The default
  30565. // is to display just the text, but during development you might
  30566. // want to have a lot of information spit out. Override in that case
  30567. // to use t.toString() (which, for CommonToken, dumps everything about
  30568. // the token). This is better than forcing you to override a method in
  30569. // your token objects because you don't have to go modify your lexer
  30570. // so that it creates a new Java type.
  30571. //
  30572. // @deprecated This method is not called by the ANTLR 4 Runtime. Specific
  30573. // implementations of {@link ANTLRErrorStrategy} may provide a similar
  30574. // feature when necessary. For example, see
  30575. // {@link DefaultErrorStrategy//getTokenErrorDisplay}.
  30576. //
  30577. Recognizer.prototype.getTokenErrorDisplay = function(t) {
  30578. if (t===null) {
  30579. return "<no token>";
  30580. }
  30581. var s = t.text;
  30582. if (s===null) {
  30583. if (t.type===Token.EOF) {
  30584. s = "<EOF>";
  30585. } else {
  30586. s = "<" + t.type + ">";
  30587. }
  30588. }
  30589. s = s.replace("\n","\\n").replace("\r","\\r").replace("\t","\\t");
  30590. return "'" + s + "'";
  30591. };
  30592. Recognizer.prototype.getErrorListenerDispatch = function() {
  30593. return new ProxyErrorListener(this._listeners);
  30594. };
  30595. // subclass needs to override these if there are sempreds or actions
  30596. // that the ATN interp needs to execute
  30597. Recognizer.prototype.sempred = function(localctx, ruleIndex, actionIndex) {
  30598. return true;
  30599. };
  30600. Recognizer.prototype.precpred = function(localctx , precedence) {
  30601. return true;
  30602. };
  30603. //Indicate that the recognizer has changed internal state that is
  30604. //consistent with the ATN state passed in. This way we always know
  30605. //where we are in the ATN as the parser goes along. The rule
  30606. //context objects form a stack that lets us see the stack of
  30607. //invoking rules. Combine this and we have complete ATN
  30608. //configuration information.
  30609. Object.defineProperty(Recognizer.prototype, "state", {
  30610. get : function() {
  30611. return this._stateNumber;
  30612. },
  30613. set : function(state) {
  30614. this._stateNumber = state;
  30615. }
  30616. });
  30617. exports.Recognizer = Recognizer;
  30618. /***/ }),
  30619. /***/ "./node_modules/antlr4/RuleContext.js":
  30620. /*!********************************************!*\
  30621. !*** ./node_modules/antlr4/RuleContext.js ***!
  30622. \********************************************/
  30623. /*! no static exports found */
  30624. /***/ (function(module, exports, __webpack_require__) {
  30625. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30626. * Use of this file is governed by the BSD 3-clause license that
  30627. * can be found in the LICENSE.txt file in the project root.
  30628. */
  30629. ///
  30630. // A rule context is a record of a single rule invocation. It knows
  30631. // which context invoked it, if any. If there is no parent context, then
  30632. // naturally the invoking state is not valid. The parent link
  30633. // provides a chain upwards from the current rule invocation to the root
  30634. // of the invocation tree, forming a stack. We actually carry no
  30635. // information about the rule associated with this context (except
  30636. // when parsing). We keep only the state number of the invoking state from
  30637. // the ATN submachine that invoked this. Contrast this with the s
  30638. // pointer inside ParserRuleContext that tracks the current state
  30639. // being "executed" for the current rule.
  30640. //
  30641. // The parent contexts are useful for computing lookahead sets and
  30642. // getting error information.
  30643. //
  30644. // These objects are used during parsing and prediction.
  30645. // For the special case of parsers, we use the subclass
  30646. // ParserRuleContext.
  30647. //
  30648. // @see ParserRuleContext
  30649. ///
  30650. var RuleNode = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  30651. var INVALID_INTERVAL = __webpack_require__(/*! ./tree/Tree */ "./node_modules/antlr4/tree/Tree.js").INVALID_INTERVAL;
  30652. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  30653. function RuleContext(parent, invokingState) {
  30654. RuleNode.call(this);
  30655. // What context invoked this rule?
  30656. this.parentCtx = parent || null;
  30657. // What state invoked the rule associated with this context?
  30658. // The "return address" is the followState of invokingState
  30659. // If parent is null, this should be -1.
  30660. this.invokingState = invokingState || -1;
  30661. return this;
  30662. }
  30663. RuleContext.prototype = Object.create(RuleNode.prototype);
  30664. RuleContext.prototype.constructor = RuleContext;
  30665. RuleContext.prototype.depth = function() {
  30666. var n = 0;
  30667. var p = this;
  30668. while (p !== null) {
  30669. p = p.parentCtx;
  30670. n += 1;
  30671. }
  30672. return n;
  30673. };
  30674. // A context is empty if there is no invoking state; meaning nobody call
  30675. // current context.
  30676. RuleContext.prototype.isEmpty = function() {
  30677. return this.invokingState === -1;
  30678. };
  30679. // satisfy the ParseTree / SyntaxTree interface
  30680. RuleContext.prototype.getSourceInterval = function() {
  30681. return INVALID_INTERVAL;
  30682. };
  30683. RuleContext.prototype.getRuleContext = function() {
  30684. return this;
  30685. };
  30686. RuleContext.prototype.getPayload = function() {
  30687. return this;
  30688. };
  30689. // Return the combined text of all child nodes. This method only considers
  30690. // tokens which have been added to the parse tree.
  30691. // <p>
  30692. // Since tokens on hidden channels (e.g. whitespace or comments) are not
  30693. // added to the parse trees, they will not appear in the output of this
  30694. // method.
  30695. // /
  30696. RuleContext.prototype.getText = function() {
  30697. if (this.getChildCount() === 0) {
  30698. return "";
  30699. } else {
  30700. return this.children.map(function(child) {
  30701. return child.getText();
  30702. }).join("");
  30703. }
  30704. };
  30705. // For rule associated with this parse tree internal node, return
  30706. // the outer alternative number used to match the input. Default
  30707. // implementation does not compute nor store this alt num. Create
  30708. // a subclass of ParserRuleContext with backing field and set
  30709. // option contextSuperClass.
  30710. // to set it.
  30711. RuleContext.prototype.getAltNumber = function() { return INVALID_ALT_NUMBER; }
  30712. // Set the outer alternative number for this context node. Default
  30713. // implementation does nothing to avoid backing field overhead for
  30714. // trees that don't need it. Create
  30715. // a subclass of ParserRuleContext with backing field and set
  30716. // option contextSuperClass.
  30717. RuleContext.prototype.setAltNumber = function(altNumber) { }
  30718. RuleContext.prototype.getChild = function(i) {
  30719. return null;
  30720. };
  30721. RuleContext.prototype.getChildCount = function() {
  30722. return 0;
  30723. };
  30724. RuleContext.prototype.accept = function(visitor) {
  30725. return visitor.visitChildren(this);
  30726. };
  30727. //need to manage circular dependencies, so export now
  30728. exports.RuleContext = RuleContext;
  30729. var Trees = __webpack_require__(/*! ./tree/Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  30730. // Print out a whole tree, not just a node, in LISP format
  30731. // (root child1 .. childN). Print just a node if this is a leaf.
  30732. //
  30733. RuleContext.prototype.toStringTree = function(ruleNames, recog) {
  30734. return Trees.toStringTree(this, ruleNames, recog);
  30735. };
  30736. RuleContext.prototype.toString = function(ruleNames, stop) {
  30737. ruleNames = ruleNames || null;
  30738. stop = stop || null;
  30739. var p = this;
  30740. var s = "[";
  30741. while (p !== null && p !== stop) {
  30742. if (ruleNames === null) {
  30743. if (!p.isEmpty()) {
  30744. s += p.invokingState;
  30745. }
  30746. } else {
  30747. var ri = p.ruleIndex;
  30748. var ruleName = (ri >= 0 && ri < ruleNames.length) ? ruleNames[ri]
  30749. : "" + ri;
  30750. s += ruleName;
  30751. }
  30752. if (p.parentCtx !== null && (ruleNames !== null || !p.parentCtx.isEmpty())) {
  30753. s += " ";
  30754. }
  30755. p = p.parentCtx;
  30756. }
  30757. s += "]";
  30758. return s;
  30759. };
  30760. /***/ }),
  30761. /***/ "./node_modules/antlr4/Token.js":
  30762. /*!**************************************!*\
  30763. !*** ./node_modules/antlr4/Token.js ***!
  30764. \**************************************/
  30765. /*! no static exports found */
  30766. /***/ (function(module, exports) {
  30767. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30768. * Use of this file is governed by the BSD 3-clause license that
  30769. * can be found in the LICENSE.txt file in the project root.
  30770. */
  30771. //
  30772. // A token has properties: text, type, line, character position in the line
  30773. // (so we can ignore tabs), token channel, index, and source from which
  30774. // we obtained this token.
  30775. function Token() {
  30776. this.source = null;
  30777. this.type = null; // token type of the token
  30778. this.channel = null; // The parser ignores everything not on DEFAULT_CHANNEL
  30779. this.start = null; // optional; return -1 if not implemented.
  30780. this.stop = null; // optional; return -1 if not implemented.
  30781. this.tokenIndex = null; // from 0..n-1 of the token object in the input stream
  30782. this.line = null; // line=1..n of the 1st character
  30783. this.column = null; // beginning of the line at which it occurs, 0..n-1
  30784. this._text = null; // text of the token.
  30785. return this;
  30786. }
  30787. Token.INVALID_TYPE = 0;
  30788. // During lookahead operations, this "token" signifies we hit rule end ATN state
  30789. // and did not follow it despite needing to.
  30790. Token.EPSILON = -2;
  30791. Token.MIN_USER_TOKEN_TYPE = 1;
  30792. Token.EOF = -1;
  30793. // All tokens go to the parser (unless skip() is called in that rule)
  30794. // on a particular "channel". The parser tunes to a particular channel
  30795. // so that whitespace etc... can go to the parser on a "hidden" channel.
  30796. Token.DEFAULT_CHANNEL = 0;
  30797. // Anything on different channel than DEFAULT_CHANNEL is not parsed
  30798. // by parser.
  30799. Token.HIDDEN_CHANNEL = 1;
  30800. // Explicitly set the text for this token. If {code text} is not
  30801. // {@code null}, then {@link //getText} will return this value rather than
  30802. // extracting the text from the input.
  30803. //
  30804. // @param text The explicit text of the token, or {@code null} if the text
  30805. // should be obtained from the input along with the start and stop indexes
  30806. // of the token.
  30807. Object.defineProperty(Token.prototype, "text", {
  30808. get : function() {
  30809. return this._text;
  30810. },
  30811. set : function(text) {
  30812. this._text = text;
  30813. }
  30814. });
  30815. Token.prototype.getTokenSource = function() {
  30816. return this.source[0];
  30817. };
  30818. Token.prototype.getInputStream = function() {
  30819. return this.source[1];
  30820. };
  30821. function CommonToken(source, type, channel, start, stop) {
  30822. Token.call(this);
  30823. this.source = source !== undefined ? source : CommonToken.EMPTY_SOURCE;
  30824. this.type = type !== undefined ? type : null;
  30825. this.channel = channel !== undefined ? channel : Token.DEFAULT_CHANNEL;
  30826. this.start = start !== undefined ? start : -1;
  30827. this.stop = stop !== undefined ? stop : -1;
  30828. this.tokenIndex = -1;
  30829. if (this.source[0] !== null) {
  30830. this.line = source[0].line;
  30831. this.column = source[0].column;
  30832. } else {
  30833. this.column = -1;
  30834. }
  30835. return this;
  30836. }
  30837. CommonToken.prototype = Object.create(Token.prototype);
  30838. CommonToken.prototype.constructor = CommonToken;
  30839. // An empty {@link Pair} which is used as the default value of
  30840. // {@link //source} for tokens that do not have a source.
  30841. CommonToken.EMPTY_SOURCE = [ null, null ];
  30842. // Constructs a new {@link CommonToken} as a copy of another {@link Token}.
  30843. //
  30844. // <p>
  30845. // If {@code oldToken} is also a {@link CommonToken} instance, the newly
  30846. // constructed token will share a reference to the {@link //text} field and
  30847. // the {@link Pair} stored in {@link //source}. Otherwise, {@link //text} will
  30848. // be assigned the result of calling {@link //getText}, and {@link //source}
  30849. // will be constructed from the result of {@link Token//getTokenSource} and
  30850. // {@link Token//getInputStream}.</p>
  30851. //
  30852. // @param oldToken The token to copy.
  30853. //
  30854. CommonToken.prototype.clone = function() {
  30855. var t = new CommonToken(this.source, this.type, this.channel, this.start,
  30856. this.stop);
  30857. t.tokenIndex = this.tokenIndex;
  30858. t.line = this.line;
  30859. t.column = this.column;
  30860. t.text = this.text;
  30861. return t;
  30862. };
  30863. Object.defineProperty(CommonToken.prototype, "text", {
  30864. get : function() {
  30865. if (this._text !== null) {
  30866. return this._text;
  30867. }
  30868. var input = this.getInputStream();
  30869. if (input === null) {
  30870. return null;
  30871. }
  30872. var n = input.size;
  30873. if (this.start < n && this.stop < n) {
  30874. return input.getText(this.start, this.stop);
  30875. } else {
  30876. return "<EOF>";
  30877. }
  30878. },
  30879. set : function(text) {
  30880. this._text = text;
  30881. }
  30882. });
  30883. CommonToken.prototype.toString = function() {
  30884. var txt = this.text;
  30885. if (txt !== null) {
  30886. txt = txt.replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
  30887. } else {
  30888. txt = "<no text>";
  30889. }
  30890. return "[@" + this.tokenIndex + "," + this.start + ":" + this.stop + "='" +
  30891. txt + "',<" + this.type + ">" +
  30892. (this.channel > 0 ? ",channel=" + this.channel : "") + "," +
  30893. this.line + ":" + this.column + "]";
  30894. };
  30895. exports.Token = Token;
  30896. exports.CommonToken = CommonToken;
  30897. /***/ }),
  30898. /***/ "./node_modules/antlr4/Utils.js":
  30899. /*!**************************************!*\
  30900. !*** ./node_modules/antlr4/Utils.js ***!
  30901. \**************************************/
  30902. /*! no static exports found */
  30903. /***/ (function(module, exports) {
  30904. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  30905. * Use of this file is governed by the BSD 3-clause license that
  30906. * can be found in the LICENSE.txt file in the project root.
  30907. */
  30908. function arrayToString(a) {
  30909. return "[" + a.join(", ") + "]";
  30910. }
  30911. String.prototype.seed = String.prototype.seed || Math.round(Math.random() * Math.pow(2, 32));
  30912. String.prototype.hashCode = function () {
  30913. var remainder, bytes, h1, h1b, c1, c1b, c2, c2b, k1, i,
  30914. key = this.toString();
  30915. remainder = key.length & 3; // key.length % 4
  30916. bytes = key.length - remainder;
  30917. h1 = String.prototype.seed;
  30918. c1 = 0xcc9e2d51;
  30919. c2 = 0x1b873593;
  30920. i = 0;
  30921. while (i < bytes) {
  30922. k1 =
  30923. ((key.charCodeAt(i) & 0xff)) |
  30924. ((key.charCodeAt(++i) & 0xff) << 8) |
  30925. ((key.charCodeAt(++i) & 0xff) << 16) |
  30926. ((key.charCodeAt(++i) & 0xff) << 24);
  30927. ++i;
  30928. k1 = ((((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16))) & 0xffffffff;
  30929. k1 = (k1 << 15) | (k1 >>> 17);
  30930. k1 = ((((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16))) & 0xffffffff;
  30931. h1 ^= k1;
  30932. h1 = (h1 << 13) | (h1 >>> 19);
  30933. h1b = ((((h1 & 0xffff) * 5) + ((((h1 >>> 16) * 5) & 0xffff) << 16))) & 0xffffffff;
  30934. h1 = (((h1b & 0xffff) + 0x6b64) + ((((h1b >>> 16) + 0xe654) & 0xffff) << 16));
  30935. }
  30936. k1 = 0;
  30937. switch (remainder) {
  30938. case 3:
  30939. k1 ^= (key.charCodeAt(i + 2) & 0xff) << 16;
  30940. case 2:
  30941. k1 ^= (key.charCodeAt(i + 1) & 0xff) << 8;
  30942. case 1:
  30943. k1 ^= (key.charCodeAt(i) & 0xff);
  30944. k1 = (((k1 & 0xffff) * c1) + ((((k1 >>> 16) * c1) & 0xffff) << 16)) & 0xffffffff;
  30945. k1 = (k1 << 15) | (k1 >>> 17);
  30946. k1 = (((k1 & 0xffff) * c2) + ((((k1 >>> 16) * c2) & 0xffff) << 16)) & 0xffffffff;
  30947. h1 ^= k1;
  30948. }
  30949. h1 ^= key.length;
  30950. h1 ^= h1 >>> 16;
  30951. h1 = (((h1 & 0xffff) * 0x85ebca6b) + ((((h1 >>> 16) * 0x85ebca6b) & 0xffff) << 16)) & 0xffffffff;
  30952. h1 ^= h1 >>> 13;
  30953. h1 = ((((h1 & 0xffff) * 0xc2b2ae35) + ((((h1 >>> 16) * 0xc2b2ae35) & 0xffff) << 16))) & 0xffffffff;
  30954. h1 ^= h1 >>> 16;
  30955. return h1 >>> 0;
  30956. };
  30957. function standardEqualsFunction(a, b) {
  30958. return a.equals(b);
  30959. }
  30960. function standardHashCodeFunction(a) {
  30961. return a.hashCode();
  30962. }
  30963. function Set(hashFunction, equalsFunction) {
  30964. this.data = {};
  30965. this.hashFunction = hashFunction || standardHashCodeFunction;
  30966. this.equalsFunction = equalsFunction || standardEqualsFunction;
  30967. return this;
  30968. }
  30969. Object.defineProperty(Set.prototype, "length", {
  30970. get: function () {
  30971. var l = 0;
  30972. for (var key in this.data) {
  30973. if (key.indexOf("hash_") === 0) {
  30974. l = l + this.data[key].length;
  30975. }
  30976. }
  30977. return l;
  30978. }
  30979. });
  30980. Set.prototype.add = function (value) {
  30981. var hash = this.hashFunction(value);
  30982. var key = "hash_" + hash;
  30983. if (key in this.data) {
  30984. var values = this.data[key];
  30985. for (var i = 0; i < values.length; i++) {
  30986. if (this.equalsFunction(value, values[i])) {
  30987. return values[i];
  30988. }
  30989. }
  30990. values.push(value);
  30991. return value;
  30992. } else {
  30993. this.data[key] = [value];
  30994. return value;
  30995. }
  30996. };
  30997. Set.prototype.contains = function (value) {
  30998. return this.get(value) != null;
  30999. };
  31000. Set.prototype.get = function (value) {
  31001. var hash = this.hashFunction(value);
  31002. var key = "hash_" + hash;
  31003. if (key in this.data) {
  31004. var values = this.data[key];
  31005. for (var i = 0; i < values.length; i++) {
  31006. if (this.equalsFunction(value, values[i])) {
  31007. return values[i];
  31008. }
  31009. }
  31010. }
  31011. return null;
  31012. };
  31013. Set.prototype.values = function () {
  31014. var l = [];
  31015. for (var key in this.data) {
  31016. if (key.indexOf("hash_") === 0) {
  31017. l = l.concat(this.data[key]);
  31018. }
  31019. }
  31020. return l;
  31021. };
  31022. Set.prototype.toString = function () {
  31023. return arrayToString(this.values());
  31024. };
  31025. function BitSet() {
  31026. this.data = [];
  31027. return this;
  31028. }
  31029. BitSet.prototype.add = function (value) {
  31030. this.data[value] = true;
  31031. };
  31032. BitSet.prototype.or = function (set) {
  31033. var bits = this;
  31034. Object.keys(set.data).map(function (alt) {
  31035. bits.add(alt);
  31036. });
  31037. };
  31038. BitSet.prototype.remove = function (value) {
  31039. delete this.data[value];
  31040. };
  31041. BitSet.prototype.contains = function (value) {
  31042. return this.data[value] === true;
  31043. };
  31044. BitSet.prototype.values = function () {
  31045. return Object.keys(this.data);
  31046. };
  31047. BitSet.prototype.minValue = function () {
  31048. return Math.min.apply(null, this.values());
  31049. };
  31050. BitSet.prototype.hashCode = function () {
  31051. var hash = new Hash();
  31052. hash.update(this.values());
  31053. return hash.finish();
  31054. };
  31055. BitSet.prototype.equals = function (other) {
  31056. if (!(other instanceof BitSet)) {
  31057. return false;
  31058. }
  31059. return this.hashCode() === other.hashCode();
  31060. };
  31061. Object.defineProperty(BitSet.prototype, "length", {
  31062. get: function () {
  31063. return this.values().length;
  31064. }
  31065. });
  31066. BitSet.prototype.toString = function () {
  31067. return "{" + this.values().join(", ") + "}";
  31068. };
  31069. function Map(hashFunction, equalsFunction) {
  31070. this.data = {};
  31071. this.hashFunction = hashFunction || standardHashCodeFunction;
  31072. this.equalsFunction = equalsFunction || standardEqualsFunction;
  31073. return this;
  31074. }
  31075. Object.defineProperty(Map.prototype, "length", {
  31076. get: function () {
  31077. var l = 0;
  31078. for (var hashKey in this.data) {
  31079. if (hashKey.indexOf("hash_") === 0) {
  31080. l = l + this.data[hashKey].length;
  31081. }
  31082. }
  31083. return l;
  31084. }
  31085. });
  31086. Map.prototype.put = function (key, value) {
  31087. var hashKey = "hash_" + this.hashFunction(key);
  31088. if (hashKey in this.data) {
  31089. var entries = this.data[hashKey];
  31090. for (var i = 0; i < entries.length; i++) {
  31091. var entry = entries[i];
  31092. if (this.equalsFunction(key, entry.key)) {
  31093. var oldValue = entry.value;
  31094. entry.value = value;
  31095. return oldValue;
  31096. }
  31097. }
  31098. entries.push({key:key, value:value});
  31099. return value;
  31100. } else {
  31101. this.data[hashKey] = [{key:key, value:value}];
  31102. return value;
  31103. }
  31104. };
  31105. Map.prototype.containsKey = function (key) {
  31106. var hashKey = "hash_" + this.hashFunction(key);
  31107. if(hashKey in this.data) {
  31108. var entries = this.data[hashKey];
  31109. for (var i = 0; i < entries.length; i++) {
  31110. var entry = entries[i];
  31111. if (this.equalsFunction(key, entry.key))
  31112. return true;
  31113. }
  31114. }
  31115. return false;
  31116. };
  31117. Map.prototype.get = function (key) {
  31118. var hashKey = "hash_" + this.hashFunction(key);
  31119. if(hashKey in this.data) {
  31120. var entries = this.data[hashKey];
  31121. for (var i = 0; i < entries.length; i++) {
  31122. var entry = entries[i];
  31123. if (this.equalsFunction(key, entry.key))
  31124. return entry.value;
  31125. }
  31126. }
  31127. return null;
  31128. };
  31129. Map.prototype.entries = function () {
  31130. var l = [];
  31131. for (var key in this.data) {
  31132. if (key.indexOf("hash_") === 0) {
  31133. l = l.concat(this.data[key]);
  31134. }
  31135. }
  31136. return l;
  31137. };
  31138. Map.prototype.getKeys = function () {
  31139. return this.entries().map(function(e) {
  31140. return e.key;
  31141. });
  31142. };
  31143. Map.prototype.getValues = function () {
  31144. return this.entries().map(function(e) {
  31145. return e.value;
  31146. });
  31147. };
  31148. Map.prototype.toString = function () {
  31149. var ss = this.entries().map(function(entry) {
  31150. return '{' + entry.key + ':' + entry.value + '}';
  31151. });
  31152. return '[' + ss.join(", ") + ']';
  31153. };
  31154. function AltDict() {
  31155. this.data = {};
  31156. return this;
  31157. }
  31158. AltDict.prototype.get = function (key) {
  31159. key = "k-" + key;
  31160. if (key in this.data) {
  31161. return this.data[key];
  31162. } else {
  31163. return null;
  31164. }
  31165. };
  31166. AltDict.prototype.put = function (key, value) {
  31167. key = "k-" + key;
  31168. this.data[key] = value;
  31169. };
  31170. AltDict.prototype.values = function () {
  31171. var data = this.data;
  31172. var keys = Object.keys(this.data);
  31173. return keys.map(function (key) {
  31174. return data[key];
  31175. });
  31176. };
  31177. function DoubleDict() {
  31178. return this;
  31179. }
  31180. function Hash() {
  31181. this.count = 0;
  31182. this.hash = 0;
  31183. return this;
  31184. }
  31185. Hash.prototype.update = function () {
  31186. for(var i=0;i<arguments.length;i++) {
  31187. var value = arguments[i];
  31188. if (value == null)
  31189. continue;
  31190. if(Array.isArray(value))
  31191. this.update.apply(value);
  31192. else {
  31193. var k = 0;
  31194. switch (typeof(value)) {
  31195. case 'undefined':
  31196. case 'function':
  31197. continue;
  31198. case 'number':
  31199. case 'boolean':
  31200. k = value;
  31201. break;
  31202. case 'string':
  31203. k = value.hashCode();
  31204. break;
  31205. default:
  31206. value.updateHashCode(this);
  31207. continue;
  31208. }
  31209. k = k * 0xCC9E2D51;
  31210. k = (k << 15) | (k >>> (32 - 15));
  31211. k = k * 0x1B873593;
  31212. this.count = this.count + 1;
  31213. var hash = this.hash ^ k;
  31214. hash = (hash << 13) | (hash >>> (32 - 13));
  31215. hash = hash * 5 + 0xE6546B64;
  31216. this.hash = hash;
  31217. }
  31218. }
  31219. }
  31220. Hash.prototype.finish = function () {
  31221. var hash = this.hash ^ (this.count * 4);
  31222. hash = hash ^ (hash >>> 16);
  31223. hash = hash * 0x85EBCA6B;
  31224. hash = hash ^ (hash >>> 13);
  31225. hash = hash * 0xC2B2AE35;
  31226. hash = hash ^ (hash >>> 16);
  31227. return hash;
  31228. }
  31229. function hashStuff() {
  31230. var hash = new Hash();
  31231. hash.update.apply(arguments);
  31232. return hash.finish();
  31233. }
  31234. DoubleDict.prototype.get = function (a, b) {
  31235. var d = this[a] || null;
  31236. return d === null ? null : (d[b] || null);
  31237. };
  31238. DoubleDict.prototype.set = function (a, b, o) {
  31239. var d = this[a] || null;
  31240. if (d === null) {
  31241. d = {};
  31242. this[a] = d;
  31243. }
  31244. d[b] = o;
  31245. };
  31246. function escapeWhitespace(s, escapeSpaces) {
  31247. s = s.replace(/\t/g, "\\t")
  31248. .replace(/\n/g, "\\n")
  31249. .replace(/\r/g, "\\r");
  31250. if (escapeSpaces) {
  31251. s = s.replace(/ /g, "\u00B7");
  31252. }
  31253. return s;
  31254. }
  31255. function titleCase(str) {
  31256. return str.replace(/\w\S*/g, function (txt) {
  31257. return txt.charAt(0).toUpperCase() + txt.substr(1);
  31258. });
  31259. };
  31260. function equalArrays(a, b)
  31261. {
  31262. if (!Array.isArray(a) || !Array.isArray(b))
  31263. return false;
  31264. if (a == b)
  31265. return true;
  31266. if (a.length != b.length)
  31267. return false;
  31268. for (var i = 0; i < a.length; i++) {
  31269. if (a[i] == b[i])
  31270. continue;
  31271. if (!a[i].equals(b[i]))
  31272. return false;
  31273. }
  31274. return true;
  31275. };
  31276. exports.Hash = Hash;
  31277. exports.Set = Set;
  31278. exports.Map = Map;
  31279. exports.BitSet = BitSet;
  31280. exports.AltDict = AltDict;
  31281. exports.DoubleDict = DoubleDict;
  31282. exports.hashStuff = hashStuff;
  31283. exports.escapeWhitespace = escapeWhitespace;
  31284. exports.arrayToString = arrayToString;
  31285. exports.titleCase = titleCase;
  31286. exports.equalArrays = equalArrays;
  31287. /***/ }),
  31288. /***/ "./node_modules/antlr4/atn/ATN.js":
  31289. /*!****************************************!*\
  31290. !*** ./node_modules/antlr4/atn/ATN.js ***!
  31291. \****************************************/
  31292. /*! no static exports found */
  31293. /***/ (function(module, exports, __webpack_require__) {
  31294. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31295. * Use of this file is governed by the BSD 3-clause license that
  31296. * can be found in the LICENSE.txt file in the project root.
  31297. */
  31298. var LL1Analyzer = __webpack_require__(/*! ./../LL1Analyzer */ "./node_modules/antlr4/LL1Analyzer.js").LL1Analyzer;
  31299. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31300. function ATN(grammarType , maxTokenType) {
  31301. // Used for runtime deserialization of ATNs from strings///
  31302. // The type of the ATN.
  31303. this.grammarType = grammarType;
  31304. // The maximum value for any symbol recognized by a transition in the ATN.
  31305. this.maxTokenType = maxTokenType;
  31306. this.states = [];
  31307. // Each subrule/rule is a decision point and we must track them so we
  31308. // can go back later and build DFA predictors for them. This includes
  31309. // all the rules, subrules, optional blocks, ()+, ()* etc...
  31310. this.decisionToState = [];
  31311. // Maps from rule index to starting state number.
  31312. this.ruleToStartState = [];
  31313. // Maps from rule index to stop state number.
  31314. this.ruleToStopState = null;
  31315. this.modeNameToStartState = {};
  31316. // For lexer ATNs, this maps the rule index to the resulting token type.
  31317. // For parser ATNs, this maps the rule index to the generated bypass token
  31318. // type if the
  31319. // {@link ATNDeserializationOptions//isGenerateRuleBypassTransitions}
  31320. // deserialization option was specified; otherwise, this is {@code null}.
  31321. this.ruleToTokenType = null;
  31322. // For lexer ATNs, this is an array of {@link LexerAction} objects which may
  31323. // be referenced by action transitions in the ATN.
  31324. this.lexerActions = null;
  31325. this.modeToStartState = [];
  31326. return this;
  31327. }
  31328. // Compute the set of valid tokens that can occur starting in state {@code s}.
  31329. // If {@code ctx} is null, the set of tokens will not include what can follow
  31330. // the rule surrounding {@code s}. In other words, the set will be
  31331. // restricted to tokens reachable staying within {@code s}'s rule.
  31332. ATN.prototype.nextTokensInContext = function(s, ctx) {
  31333. var anal = new LL1Analyzer(this);
  31334. return anal.LOOK(s, null, ctx);
  31335. };
  31336. // Compute the set of valid tokens that can occur starting in {@code s} and
  31337. // staying in same rule. {@link Token//EPSILON} is in set if we reach end of
  31338. // rule.
  31339. ATN.prototype.nextTokensNoContext = function(s) {
  31340. if (s.nextTokenWithinRule !== null ) {
  31341. return s.nextTokenWithinRule;
  31342. }
  31343. s.nextTokenWithinRule = this.nextTokensInContext(s, null);
  31344. s.nextTokenWithinRule.readOnly = true;
  31345. return s.nextTokenWithinRule;
  31346. };
  31347. ATN.prototype.nextTokens = function(s, ctx) {
  31348. if ( ctx===undefined ) {
  31349. return this.nextTokensNoContext(s);
  31350. } else {
  31351. return this.nextTokensInContext(s, ctx);
  31352. }
  31353. };
  31354. ATN.prototype.addState = function( state) {
  31355. if ( state !== null ) {
  31356. state.atn = this;
  31357. state.stateNumber = this.states.length;
  31358. }
  31359. this.states.push(state);
  31360. };
  31361. ATN.prototype.removeState = function( state) {
  31362. this.states[state.stateNumber] = null; // just free mem, don't shift states in list
  31363. };
  31364. ATN.prototype.defineDecisionState = function( s) {
  31365. this.decisionToState.push(s);
  31366. s.decision = this.decisionToState.length-1;
  31367. return s.decision;
  31368. };
  31369. ATN.prototype.getDecisionState = function( decision) {
  31370. if (this.decisionToState.length===0) {
  31371. return null;
  31372. } else {
  31373. return this.decisionToState[decision];
  31374. }
  31375. };
  31376. // Computes the set of input symbols which could follow ATN state number
  31377. // {@code stateNumber} in the specified full {@code context}. This method
  31378. // considers the complete parser context, but does not evaluate semantic
  31379. // predicates (i.e. all predicates encountered during the calculation are
  31380. // assumed true). If a path in the ATN exists from the starting state to the
  31381. // {@link RuleStopState} of the outermost context without matching any
  31382. // symbols, {@link Token//EOF} is added to the returned set.
  31383. //
  31384. // <p>If {@code context} is {@code null}, it is treated as
  31385. // {@link ParserRuleContext//EMPTY}.</p>
  31386. //
  31387. // @param stateNumber the ATN state number
  31388. // @param context the full parse context
  31389. // @return The set of potentially valid input symbols which could follow the
  31390. // specified state in the specified context.
  31391. // @throws IllegalArgumentException if the ATN does not contain a state with
  31392. // number {@code stateNumber}
  31393. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31394. ATN.prototype.getExpectedTokens = function( stateNumber, ctx ) {
  31395. if ( stateNumber < 0 || stateNumber >= this.states.length ) {
  31396. throw("Invalid state number.");
  31397. }
  31398. var s = this.states[stateNumber];
  31399. var following = this.nextTokens(s);
  31400. if (!following.contains(Token.EPSILON)) {
  31401. return following;
  31402. }
  31403. var expected = new IntervalSet();
  31404. expected.addSet(following);
  31405. expected.removeOne(Token.EPSILON);
  31406. while (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {
  31407. var invokingState = this.states[ctx.invokingState];
  31408. var rt = invokingState.transitions[0];
  31409. following = this.nextTokens(rt.followState);
  31410. expected.addSet(following);
  31411. expected.removeOne(Token.EPSILON);
  31412. ctx = ctx.parentCtx;
  31413. }
  31414. if (following.contains(Token.EPSILON)) {
  31415. expected.addOne(Token.EOF);
  31416. }
  31417. return expected;
  31418. };
  31419. ATN.INVALID_ALT_NUMBER = 0;
  31420. exports.ATN = ATN;
  31421. /***/ }),
  31422. /***/ "./node_modules/antlr4/atn/ATNConfig.js":
  31423. /*!**********************************************!*\
  31424. !*** ./node_modules/antlr4/atn/ATNConfig.js ***!
  31425. \**********************************************/
  31426. /*! no static exports found */
  31427. /***/ (function(module, exports, __webpack_require__) {
  31428. //
  31429. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31430. * Use of this file is governed by the BSD 3-clause license that
  31431. * can be found in the LICENSE.txt file in the project root.
  31432. */
  31433. ///
  31434. // A tuple: (ATN state, predicted alt, syntactic, semantic context).
  31435. // The syntactic context is a graph-structured stack node whose
  31436. // path(s) to the root is the rule invocation(s)
  31437. // chain used to arrive at the state. The semantic context is
  31438. // the tree of semantic predicates encountered before reaching
  31439. // an ATN state.
  31440. ///
  31441. var DecisionState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").DecisionState;
  31442. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31443. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  31444. function checkParams(params, isCfg) {
  31445. if(params===null) {
  31446. var result = { state:null, alt:null, context:null, semanticContext:null };
  31447. if(isCfg) {
  31448. result.reachesIntoOuterContext = 0;
  31449. }
  31450. return result;
  31451. } else {
  31452. var props = {};
  31453. props.state = params.state || null;
  31454. props.alt = (params.alt === undefined) ? null : params.alt;
  31455. props.context = params.context || null;
  31456. props.semanticContext = params.semanticContext || null;
  31457. if(isCfg) {
  31458. props.reachesIntoOuterContext = params.reachesIntoOuterContext || 0;
  31459. props.precedenceFilterSuppressed = params.precedenceFilterSuppressed || false;
  31460. }
  31461. return props;
  31462. }
  31463. }
  31464. function ATNConfig(params, config) {
  31465. this.checkContext(params, config);
  31466. params = checkParams(params);
  31467. config = checkParams(config, true);
  31468. // The ATN state associated with this configuration///
  31469. this.state = params.state!==null ? params.state : config.state;
  31470. // What alt (or lexer rule) is predicted by this configuration///
  31471. this.alt = params.alt!==null ? params.alt : config.alt;
  31472. // The stack of invoking states leading to the rule/states associated
  31473. // with this config. We track only those contexts pushed during
  31474. // execution of the ATN simulator.
  31475. this.context = params.context!==null ? params.context : config.context;
  31476. this.semanticContext = params.semanticContext!==null ? params.semanticContext :
  31477. (config.semanticContext!==null ? config.semanticContext : SemanticContext.NONE);
  31478. // We cannot execute predicates dependent upon local context unless
  31479. // we know for sure we are in the correct context. Because there is
  31480. // no way to do this efficiently, we simply cannot evaluate
  31481. // dependent predicates unless we are in the rule that initially
  31482. // invokes the ATN simulator.
  31483. //
  31484. // closure() tracks the depth of how far we dip into the
  31485. // outer context: depth &gt; 0. Note that it may not be totally
  31486. // accurate depth since I don't ever decrement. TODO: make it a boolean then
  31487. this.reachesIntoOuterContext = config.reachesIntoOuterContext;
  31488. this.precedenceFilterSuppressed = config.precedenceFilterSuppressed;
  31489. return this;
  31490. }
  31491. ATNConfig.prototype.checkContext = function(params, config) {
  31492. if((params.context===null || params.context===undefined) &&
  31493. (config===null || config.context===null || config.context===undefined)) {
  31494. this.context = null;
  31495. }
  31496. };
  31497. ATNConfig.prototype.hashCode = function() {
  31498. var hash = new Hash();
  31499. this.updateHashCode(hash);
  31500. return hash.finish();
  31501. };
  31502. ATNConfig.prototype.updateHashCode = function(hash) {
  31503. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext);
  31504. };
  31505. // An ATN configuration is equal to another if both have
  31506. // the same state, they predict the same alternative, and
  31507. // syntactic/semantic contexts are the same.
  31508. ATNConfig.prototype.equals = function(other) {
  31509. if (this === other) {
  31510. return true;
  31511. } else if (! (other instanceof ATNConfig)) {
  31512. return false;
  31513. } else {
  31514. return this.state.stateNumber===other.state.stateNumber &&
  31515. this.alt===other.alt &&
  31516. (this.context===null ? other.context===null : this.context.equals(other.context)) &&
  31517. this.semanticContext.equals(other.semanticContext) &&
  31518. this.precedenceFilterSuppressed===other.precedenceFilterSuppressed;
  31519. }
  31520. };
  31521. ATNConfig.prototype.hashCodeForConfigSet = function() {
  31522. var hash = new Hash();
  31523. hash.update(this.state.stateNumber, this.alt, this.semanticContext);
  31524. return hash.finish();
  31525. };
  31526. ATNConfig.prototype.equalsForConfigSet = function(other) {
  31527. if (this === other) {
  31528. return true;
  31529. } else if (! (other instanceof ATNConfig)) {
  31530. return false;
  31531. } else {
  31532. return this.state.stateNumber===other.state.stateNumber &&
  31533. this.alt===other.alt &&
  31534. this.semanticContext.equals(other.semanticContext);
  31535. }
  31536. };
  31537. ATNConfig.prototype.toString = function() {
  31538. return "(" + this.state + "," + this.alt +
  31539. (this.context!==null ? ",[" + this.context.toString() + "]" : "") +
  31540. (this.semanticContext !== SemanticContext.NONE ?
  31541. ("," + this.semanticContext.toString())
  31542. : "") +
  31543. (this.reachesIntoOuterContext>0 ?
  31544. (",up=" + this.reachesIntoOuterContext)
  31545. : "") + ")";
  31546. };
  31547. function LexerATNConfig(params, config) {
  31548. ATNConfig.call(this, params, config);
  31549. // This is the backing field for {@link //getLexerActionExecutor}.
  31550. var lexerActionExecutor = params.lexerActionExecutor || null;
  31551. this.lexerActionExecutor = lexerActionExecutor || (config!==null ? config.lexerActionExecutor : null);
  31552. this.passedThroughNonGreedyDecision = config!==null ? this.checkNonGreedyDecision(config, this.state) : false;
  31553. return this;
  31554. }
  31555. LexerATNConfig.prototype = Object.create(ATNConfig.prototype);
  31556. LexerATNConfig.prototype.constructor = LexerATNConfig;
  31557. LexerATNConfig.prototype.updateHashCode = function(hash) {
  31558. hash.update(this.state.stateNumber, this.alt, this.context, this.semanticContext, this.passedThroughNonGreedyDecision, this.lexerActionExecutor);
  31559. };
  31560. LexerATNConfig.prototype.equals = function(other) {
  31561. return this === other ||
  31562. (other instanceof LexerATNConfig &&
  31563. this.passedThroughNonGreedyDecision == other.passedThroughNonGreedyDecision &&
  31564. (this.lexerActionExecutor ? this.lexerActionExecutor.equals(other.lexerActionExecutor) : !other.lexerActionExecutor) &&
  31565. ATNConfig.prototype.equals.call(this, other));
  31566. };
  31567. LexerATNConfig.prototype.hashCodeForConfigSet = LexerATNConfig.prototype.hashCode;
  31568. LexerATNConfig.prototype.equalsForConfigSet = LexerATNConfig.prototype.equals;
  31569. LexerATNConfig.prototype.checkNonGreedyDecision = function(source, target) {
  31570. return source.passedThroughNonGreedyDecision ||
  31571. (target instanceof DecisionState) && target.nonGreedy;
  31572. };
  31573. exports.ATNConfig = ATNConfig;
  31574. exports.LexerATNConfig = LexerATNConfig;
  31575. /***/ }),
  31576. /***/ "./node_modules/antlr4/atn/ATNConfigSet.js":
  31577. /*!*************************************************!*\
  31578. !*** ./node_modules/antlr4/atn/ATNConfigSet.js ***!
  31579. \*************************************************/
  31580. /*! no static exports found */
  31581. /***/ (function(module, exports, __webpack_require__) {
  31582. //
  31583. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31584. * Use of this file is governed by the BSD 3-clause license that
  31585. * can be found in the LICENSE.txt file in the project root.
  31586. */
  31587. //
  31588. // Specialized {@link Set}{@code <}{@link ATNConfig}{@code >} that can track
  31589. // info about the set, with support for combining similar configurations using a
  31590. // graph-structured stack.
  31591. ///
  31592. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31593. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  31594. var Hash = Utils.Hash;
  31595. var Set = Utils.Set;
  31596. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  31597. var merge = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").merge;
  31598. function hashATNConfig(c) {
  31599. return c.hashCodeForConfigSet();
  31600. }
  31601. function equalATNConfigs(a, b) {
  31602. if ( a===b ) {
  31603. return true;
  31604. } else if ( a===null || b===null ) {
  31605. return false;
  31606. } else
  31607. return a.equalsForConfigSet(b);
  31608. }
  31609. function ATNConfigSet(fullCtx) {
  31610. //
  31611. // The reason that we need this is because we don't want the hash map to use
  31612. // the standard hash code and equals. We need all configurations with the
  31613. // same
  31614. // {@code (s,i,_,semctx)} to be equal. Unfortunately, this key effectively
  31615. // doubles
  31616. // the number of objects associated with ATNConfigs. The other solution is
  31617. // to
  31618. // use a hash table that lets us specify the equals/hashcode operation.
  31619. // All configs but hashed by (s, i, _, pi) not including context. Wiped out
  31620. // when we go readonly as this set becomes a DFA state.
  31621. this.configLookup = new Set(hashATNConfig, equalATNConfigs);
  31622. // Indicates that this configuration set is part of a full context
  31623. // LL prediction. It will be used to determine how to merge $. With SLL
  31624. // it's a wildcard whereas it is not for LL context merge.
  31625. this.fullCtx = fullCtx === undefined ? true : fullCtx;
  31626. // Indicates that the set of configurations is read-only. Do not
  31627. // allow any code to manipulate the set; DFA states will point at
  31628. // the sets and they must not change. This does not protect the other
  31629. // fields; in particular, conflictingAlts is set after
  31630. // we've made this readonly.
  31631. this.readOnly = false;
  31632. // Track the elements as they are added to the set; supports get(i)///
  31633. this.configs = [];
  31634. // TODO: these fields make me pretty uncomfortable but nice to pack up info
  31635. // together, saves recomputation
  31636. // TODO: can we track conflicts as they are added to save scanning configs
  31637. // later?
  31638. this.uniqueAlt = 0;
  31639. this.conflictingAlts = null;
  31640. // Used in parser and lexer. In lexer, it indicates we hit a pred
  31641. // while computing a closure operation. Don't make a DFA state from this.
  31642. this.hasSemanticContext = false;
  31643. this.dipsIntoOuterContext = false;
  31644. this.cachedHashCode = -1;
  31645. return this;
  31646. }
  31647. // Adding a new config means merging contexts with existing configs for
  31648. // {@code (s, i, pi, _)}, where {@code s} is the
  31649. // {@link ATNConfig//state}, {@code i} is the {@link ATNConfig//alt}, and
  31650. // {@code pi} is the {@link ATNConfig//semanticContext}. We use
  31651. // {@code (s,i,pi)} as key.
  31652. //
  31653. // <p>This method updates {@link //dipsIntoOuterContext} and
  31654. // {@link //hasSemanticContext} when necessary.</p>
  31655. // /
  31656. ATNConfigSet.prototype.add = function(config, mergeCache) {
  31657. if (mergeCache === undefined) {
  31658. mergeCache = null;
  31659. }
  31660. if (this.readOnly) {
  31661. throw "This set is readonly";
  31662. }
  31663. if (config.semanticContext !== SemanticContext.NONE) {
  31664. this.hasSemanticContext = true;
  31665. }
  31666. if (config.reachesIntoOuterContext > 0) {
  31667. this.dipsIntoOuterContext = true;
  31668. }
  31669. var existing = this.configLookup.add(config);
  31670. if (existing === config) {
  31671. this.cachedHashCode = -1;
  31672. this.configs.push(config); // track order here
  31673. return true;
  31674. }
  31675. // a previous (s,i,pi,_), merge with it and save result
  31676. var rootIsWildcard = !this.fullCtx;
  31677. var merged = merge(existing.context, config.context, rootIsWildcard, mergeCache);
  31678. // no need to check for existing.context, config.context in cache
  31679. // since only way to create new graphs is "call rule" and here. We
  31680. // cache at both places.
  31681. existing.reachesIntoOuterContext = Math.max( existing.reachesIntoOuterContext, config.reachesIntoOuterContext);
  31682. // make sure to preserve the precedence filter suppression during the merge
  31683. if (config.precedenceFilterSuppressed) {
  31684. existing.precedenceFilterSuppressed = true;
  31685. }
  31686. existing.context = merged; // replace context; no need to alt mapping
  31687. return true;
  31688. };
  31689. ATNConfigSet.prototype.getStates = function() {
  31690. var states = new Set();
  31691. for (var i = 0; i < this.configs.length; i++) {
  31692. states.add(this.configs[i].state);
  31693. }
  31694. return states;
  31695. };
  31696. ATNConfigSet.prototype.getPredicates = function() {
  31697. var preds = [];
  31698. for (var i = 0; i < this.configs.length; i++) {
  31699. var c = this.configs[i].semanticContext;
  31700. if (c !== SemanticContext.NONE) {
  31701. preds.push(c.semanticContext);
  31702. }
  31703. }
  31704. return preds;
  31705. };
  31706. Object.defineProperty(ATNConfigSet.prototype, "items", {
  31707. get : function() {
  31708. return this.configs;
  31709. }
  31710. });
  31711. ATNConfigSet.prototype.optimizeConfigs = function(interpreter) {
  31712. if (this.readOnly) {
  31713. throw "This set is readonly";
  31714. }
  31715. if (this.configLookup.length === 0) {
  31716. return;
  31717. }
  31718. for (var i = 0; i < this.configs.length; i++) {
  31719. var config = this.configs[i];
  31720. config.context = interpreter.getCachedContext(config.context);
  31721. }
  31722. };
  31723. ATNConfigSet.prototype.addAll = function(coll) {
  31724. for (var i = 0; i < coll.length; i++) {
  31725. this.add(coll[i]);
  31726. }
  31727. return false;
  31728. };
  31729. ATNConfigSet.prototype.equals = function(other) {
  31730. return this === other ||
  31731. (other instanceof ATNConfigSet &&
  31732. Utils.equalArrays(this.configs, other.configs) &&
  31733. this.fullCtx === other.fullCtx &&
  31734. this.uniqueAlt === other.uniqueAlt &&
  31735. this.conflictingAlts === other.conflictingAlts &&
  31736. this.hasSemanticContext === other.hasSemanticContext &&
  31737. this.dipsIntoOuterContext === other.dipsIntoOuterContext);
  31738. };
  31739. ATNConfigSet.prototype.hashCode = function() {
  31740. var hash = new Hash();
  31741. this.updateHashCode(hash);
  31742. return hash.finish();
  31743. };
  31744. ATNConfigSet.prototype.updateHashCode = function(hash) {
  31745. if (this.readOnly) {
  31746. if (this.cachedHashCode === -1) {
  31747. var hash = new Hash();
  31748. hash.update(this.configs);
  31749. this.cachedHashCode = hash.finish();
  31750. }
  31751. hash.update(this.cachedHashCode);
  31752. } else {
  31753. hash.update(this.configs);
  31754. }
  31755. };
  31756. Object.defineProperty(ATNConfigSet.prototype, "length", {
  31757. get : function() {
  31758. return this.configs.length;
  31759. }
  31760. });
  31761. ATNConfigSet.prototype.isEmpty = function() {
  31762. return this.configs.length === 0;
  31763. };
  31764. ATNConfigSet.prototype.contains = function(item) {
  31765. if (this.configLookup === null) {
  31766. throw "This method is not implemented for readonly sets.";
  31767. }
  31768. return this.configLookup.contains(item);
  31769. };
  31770. ATNConfigSet.prototype.containsFast = function(item) {
  31771. if (this.configLookup === null) {
  31772. throw "This method is not implemented for readonly sets.";
  31773. }
  31774. return this.configLookup.containsFast(item);
  31775. };
  31776. ATNConfigSet.prototype.clear = function() {
  31777. if (this.readOnly) {
  31778. throw "This set is readonly";
  31779. }
  31780. this.configs = [];
  31781. this.cachedHashCode = -1;
  31782. this.configLookup = new Set();
  31783. };
  31784. ATNConfigSet.prototype.setReadonly = function(readOnly) {
  31785. this.readOnly = readOnly;
  31786. if (readOnly) {
  31787. this.configLookup = null; // can't mod, no need for lookup cache
  31788. }
  31789. };
  31790. ATNConfigSet.prototype.toString = function() {
  31791. return Utils.arrayToString(this.configs) +
  31792. (this.hasSemanticContext ? ",hasSemanticContext=" + this.hasSemanticContext : "") +
  31793. (this.uniqueAlt !== ATN.INVALID_ALT_NUMBER ? ",uniqueAlt=" + this.uniqueAlt : "") +
  31794. (this.conflictingAlts !== null ? ",conflictingAlts=" + this.conflictingAlts : "") +
  31795. (this.dipsIntoOuterContext ? ",dipsIntoOuterContext" : "");
  31796. };
  31797. function OrderedATNConfigSet() {
  31798. ATNConfigSet.call(this);
  31799. this.configLookup = new Set();
  31800. return this;
  31801. }
  31802. OrderedATNConfigSet.prototype = Object.create(ATNConfigSet.prototype);
  31803. OrderedATNConfigSet.prototype.constructor = OrderedATNConfigSet;
  31804. exports.ATNConfigSet = ATNConfigSet;
  31805. exports.OrderedATNConfigSet = OrderedATNConfigSet;
  31806. /***/ }),
  31807. /***/ "./node_modules/antlr4/atn/ATNDeserializationOptions.js":
  31808. /*!**************************************************************!*\
  31809. !*** ./node_modules/antlr4/atn/ATNDeserializationOptions.js ***!
  31810. \**************************************************************/
  31811. /*! no static exports found */
  31812. /***/ (function(module, exports) {
  31813. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31814. * Use of this file is governed by the BSD 3-clause license that
  31815. * can be found in the LICENSE.txt file in the project root.
  31816. */
  31817. function ATNDeserializationOptions(copyFrom) {
  31818. if(copyFrom===undefined) {
  31819. copyFrom = null;
  31820. }
  31821. this.readOnly = false;
  31822. this.verifyATN = copyFrom===null ? true : copyFrom.verifyATN;
  31823. this.generateRuleBypassTransitions = copyFrom===null ? false : copyFrom.generateRuleBypassTransitions;
  31824. return this;
  31825. }
  31826. ATNDeserializationOptions.defaultOptions = new ATNDeserializationOptions();
  31827. ATNDeserializationOptions.defaultOptions.readOnly = true;
  31828. // def __setattr__(self, key, value):
  31829. // if key!="readOnly" and self.readOnly:
  31830. // raise Exception("The object is read only.")
  31831. // super(type(self), self).__setattr__(key,value)
  31832. exports.ATNDeserializationOptions = ATNDeserializationOptions;
  31833. /***/ }),
  31834. /***/ "./node_modules/antlr4/atn/ATNDeserializer.js":
  31835. /*!****************************************************!*\
  31836. !*** ./node_modules/antlr4/atn/ATNDeserializer.js ***!
  31837. \****************************************************/
  31838. /*! no static exports found */
  31839. /***/ (function(module, exports, __webpack_require__) {
  31840. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  31841. * Use of this file is governed by the BSD 3-clause license that
  31842. * can be found in the LICENSE.txt file in the project root.
  31843. */
  31844. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  31845. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  31846. var ATNType = __webpack_require__(/*! ./ATNType */ "./node_modules/antlr4/atn/ATNType.js").ATNType;
  31847. var ATNStates = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js");
  31848. var ATNState = ATNStates.ATNState;
  31849. var BasicState = ATNStates.BasicState;
  31850. var DecisionState = ATNStates.DecisionState;
  31851. var BlockStartState = ATNStates.BlockStartState;
  31852. var BlockEndState = ATNStates.BlockEndState;
  31853. var LoopEndState = ATNStates.LoopEndState;
  31854. var RuleStartState = ATNStates.RuleStartState;
  31855. var RuleStopState = ATNStates.RuleStopState;
  31856. var TokensStartState = ATNStates.TokensStartState;
  31857. var PlusLoopbackState = ATNStates.PlusLoopbackState;
  31858. var StarLoopbackState = ATNStates.StarLoopbackState;
  31859. var StarLoopEntryState = ATNStates.StarLoopEntryState;
  31860. var PlusBlockStartState = ATNStates.PlusBlockStartState;
  31861. var StarBlockStartState = ATNStates.StarBlockStartState;
  31862. var BasicBlockStartState = ATNStates.BasicBlockStartState;
  31863. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  31864. var Transition = Transitions.Transition;
  31865. var AtomTransition = Transitions.AtomTransition;
  31866. var SetTransition = Transitions.SetTransition;
  31867. var NotSetTransition = Transitions.NotSetTransition;
  31868. var RuleTransition = Transitions.RuleTransition;
  31869. var RangeTransition = Transitions.RangeTransition;
  31870. var ActionTransition = Transitions.ActionTransition;
  31871. var EpsilonTransition = Transitions.EpsilonTransition;
  31872. var WildcardTransition = Transitions.WildcardTransition;
  31873. var PredicateTransition = Transitions.PredicateTransition;
  31874. var PrecedencePredicateTransition = Transitions.PrecedencePredicateTransition;
  31875. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  31876. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  31877. var ATNDeserializationOptions = __webpack_require__(/*! ./ATNDeserializationOptions */ "./node_modules/antlr4/atn/ATNDeserializationOptions.js").ATNDeserializationOptions;
  31878. var LexerActions = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js");
  31879. var LexerActionType = LexerActions.LexerActionType;
  31880. var LexerSkipAction = LexerActions.LexerSkipAction;
  31881. var LexerChannelAction = LexerActions.LexerChannelAction;
  31882. var LexerCustomAction = LexerActions.LexerCustomAction;
  31883. var LexerMoreAction = LexerActions.LexerMoreAction;
  31884. var LexerTypeAction = LexerActions.LexerTypeAction;
  31885. var LexerPushModeAction = LexerActions.LexerPushModeAction;
  31886. var LexerPopModeAction = LexerActions.LexerPopModeAction;
  31887. var LexerModeAction = LexerActions.LexerModeAction;
  31888. // This is the earliest supported serialized UUID.
  31889. // stick to serialized version for now, we don't need a UUID instance
  31890. var BASE_SERIALIZED_UUID = "AADB8D7E-AEEF-4415-AD2B-8204D6CF042E";
  31891. //
  31892. // This UUID indicates the serialized ATN contains two sets of
  31893. // IntervalSets, where the second set's values are encoded as
  31894. // 32-bit integers to support the full Unicode SMP range up to U+10FFFF.
  31895. //
  31896. var ADDED_UNICODE_SMP = "59627784-3BE5-417A-B9EB-8131A7286089";
  31897. // This list contains all of the currently supported UUIDs, ordered by when
  31898. // the feature first appeared in this branch.
  31899. var SUPPORTED_UUIDS = [ BASE_SERIALIZED_UUID, ADDED_UNICODE_SMP ];
  31900. var SERIALIZED_VERSION = 3;
  31901. // This is the current serialized UUID.
  31902. var SERIALIZED_UUID = ADDED_UNICODE_SMP;
  31903. function initArray( length, value) {
  31904. var tmp = [];
  31905. tmp[length-1] = value;
  31906. return tmp.map(function(i) {return value;});
  31907. }
  31908. function ATNDeserializer (options) {
  31909. if ( options=== undefined || options === null ) {
  31910. options = ATNDeserializationOptions.defaultOptions;
  31911. }
  31912. this.deserializationOptions = options;
  31913. this.stateFactories = null;
  31914. this.actionFactories = null;
  31915. return this;
  31916. }
  31917. // Determines if a particular serialized representation of an ATN supports
  31918. // a particular feature, identified by the {@link UUID} used for serializing
  31919. // the ATN at the time the feature was first introduced.
  31920. //
  31921. // @param feature The {@link UUID} marking the first time the feature was
  31922. // supported in the serialized ATN.
  31923. // @param actualUuid The {@link UUID} of the actual serialized ATN which is
  31924. // currently being deserialized.
  31925. // @return {@code true} if the {@code actualUuid} value represents a
  31926. // serialized ATN at or after the feature identified by {@code feature} was
  31927. // introduced; otherwise, {@code false}.
  31928. ATNDeserializer.prototype.isFeatureSupported = function(feature, actualUuid) {
  31929. var idx1 = SUPPORTED_UUIDS.indexOf(feature);
  31930. if (idx1<0) {
  31931. return false;
  31932. }
  31933. var idx2 = SUPPORTED_UUIDS.indexOf(actualUuid);
  31934. return idx2 >= idx1;
  31935. };
  31936. ATNDeserializer.prototype.deserialize = function(data) {
  31937. this.reset(data);
  31938. this.checkVersion();
  31939. this.checkUUID();
  31940. var atn = this.readATN();
  31941. this.readStates(atn);
  31942. this.readRules(atn);
  31943. this.readModes(atn);
  31944. var sets = [];
  31945. // First, deserialize sets with 16-bit arguments <= U+FFFF.
  31946. this.readSets(atn, sets, this.readInt.bind(this));
  31947. // Next, if the ATN was serialized with the Unicode SMP feature,
  31948. // deserialize sets with 32-bit arguments <= U+10FFFF.
  31949. if (this.isFeatureSupported(ADDED_UNICODE_SMP, this.uuid)) {
  31950. this.readSets(atn, sets, this.readInt32.bind(this));
  31951. }
  31952. this.readEdges(atn, sets);
  31953. this.readDecisions(atn);
  31954. this.readLexerActions(atn);
  31955. this.markPrecedenceDecisions(atn);
  31956. this.verifyATN(atn);
  31957. if (this.deserializationOptions.generateRuleBypassTransitions && atn.grammarType === ATNType.PARSER ) {
  31958. this.generateRuleBypassTransitions(atn);
  31959. // re-verify after modification
  31960. this.verifyATN(atn);
  31961. }
  31962. return atn;
  31963. };
  31964. ATNDeserializer.prototype.reset = function(data) {
  31965. var adjust = function(c) {
  31966. var v = c.charCodeAt(0);
  31967. return v>1 ? v-2 : v + 65533;
  31968. };
  31969. var temp = data.split("").map(adjust);
  31970. // don't adjust the first value since that's the version number
  31971. temp[0] = data.charCodeAt(0);
  31972. this.data = temp;
  31973. this.pos = 0;
  31974. };
  31975. ATNDeserializer.prototype.checkVersion = function() {
  31976. var version = this.readInt();
  31977. if ( version !== SERIALIZED_VERSION ) {
  31978. throw ("Could not deserialize ATN with version " + version + " (expected " + SERIALIZED_VERSION + ").");
  31979. }
  31980. };
  31981. ATNDeserializer.prototype.checkUUID = function() {
  31982. var uuid = this.readUUID();
  31983. if (SUPPORTED_UUIDS.indexOf(uuid)<0) {
  31984. throw ("Could not deserialize ATN with UUID: " + uuid +
  31985. " (expected " + SERIALIZED_UUID + " or a legacy UUID).", uuid, SERIALIZED_UUID);
  31986. }
  31987. this.uuid = uuid;
  31988. };
  31989. ATNDeserializer.prototype.readATN = function() {
  31990. var grammarType = this.readInt();
  31991. var maxTokenType = this.readInt();
  31992. return new ATN(grammarType, maxTokenType);
  31993. };
  31994. ATNDeserializer.prototype.readStates = function(atn) {
  31995. var j, pair, stateNumber;
  31996. var loopBackStateNumbers = [];
  31997. var endStateNumbers = [];
  31998. var nstates = this.readInt();
  31999. for(var i=0; i<nstates; i++) {
  32000. var stype = this.readInt();
  32001. // ignore bad type of states
  32002. if (stype===ATNState.INVALID_TYPE) {
  32003. atn.addState(null);
  32004. continue;
  32005. }
  32006. var ruleIndex = this.readInt();
  32007. if (ruleIndex === 0xFFFF) {
  32008. ruleIndex = -1;
  32009. }
  32010. var s = this.stateFactory(stype, ruleIndex);
  32011. if (stype === ATNState.LOOP_END) { // special case
  32012. var loopBackStateNumber = this.readInt();
  32013. loopBackStateNumbers.push([s, loopBackStateNumber]);
  32014. } else if(s instanceof BlockStartState) {
  32015. var endStateNumber = this.readInt();
  32016. endStateNumbers.push([s, endStateNumber]);
  32017. }
  32018. atn.addState(s);
  32019. }
  32020. // delay the assignment of loop back and end states until we know all the
  32021. // state instances have been initialized
  32022. for (j=0; j<loopBackStateNumbers.length; j++) {
  32023. pair = loopBackStateNumbers[j];
  32024. pair[0].loopBackState = atn.states[pair[1]];
  32025. }
  32026. for (j=0; j<endStateNumbers.length; j++) {
  32027. pair = endStateNumbers[j];
  32028. pair[0].endState = atn.states[pair[1]];
  32029. }
  32030. var numNonGreedyStates = this.readInt();
  32031. for (j=0; j<numNonGreedyStates; j++) {
  32032. stateNumber = this.readInt();
  32033. atn.states[stateNumber].nonGreedy = true;
  32034. }
  32035. var numPrecedenceStates = this.readInt();
  32036. for (j=0; j<numPrecedenceStates; j++) {
  32037. stateNumber = this.readInt();
  32038. atn.states[stateNumber].isPrecedenceRule = true;
  32039. }
  32040. };
  32041. ATNDeserializer.prototype.readRules = function(atn) {
  32042. var i;
  32043. var nrules = this.readInt();
  32044. if (atn.grammarType === ATNType.LEXER ) {
  32045. atn.ruleToTokenType = initArray(nrules, 0);
  32046. }
  32047. atn.ruleToStartState = initArray(nrules, 0);
  32048. for (i=0; i<nrules; i++) {
  32049. var s = this.readInt();
  32050. var startState = atn.states[s];
  32051. atn.ruleToStartState[i] = startState;
  32052. if ( atn.grammarType === ATNType.LEXER ) {
  32053. var tokenType = this.readInt();
  32054. if (tokenType === 0xFFFF) {
  32055. tokenType = Token.EOF;
  32056. }
  32057. atn.ruleToTokenType[i] = tokenType;
  32058. }
  32059. }
  32060. atn.ruleToStopState = initArray(nrules, 0);
  32061. for (i=0; i<atn.states.length; i++) {
  32062. var state = atn.states[i];
  32063. if (!(state instanceof RuleStopState)) {
  32064. continue;
  32065. }
  32066. atn.ruleToStopState[state.ruleIndex] = state;
  32067. atn.ruleToStartState[state.ruleIndex].stopState = state;
  32068. }
  32069. };
  32070. ATNDeserializer.prototype.readModes = function(atn) {
  32071. var nmodes = this.readInt();
  32072. for (var i=0; i<nmodes; i++) {
  32073. var s = this.readInt();
  32074. atn.modeToStartState.push(atn.states[s]);
  32075. }
  32076. };
  32077. ATNDeserializer.prototype.readSets = function(atn, sets, readUnicode) {
  32078. var m = this.readInt();
  32079. for (var i=0; i<m; i++) {
  32080. var iset = new IntervalSet();
  32081. sets.push(iset);
  32082. var n = this.readInt();
  32083. var containsEof = this.readInt();
  32084. if (containsEof!==0) {
  32085. iset.addOne(-1);
  32086. }
  32087. for (var j=0; j<n; j++) {
  32088. var i1 = readUnicode();
  32089. var i2 = readUnicode();
  32090. iset.addRange(i1, i2);
  32091. }
  32092. }
  32093. };
  32094. ATNDeserializer.prototype.readEdges = function(atn, sets) {
  32095. var i, j, state, trans, target;
  32096. var nedges = this.readInt();
  32097. for (i=0; i<nedges; i++) {
  32098. var src = this.readInt();
  32099. var trg = this.readInt();
  32100. var ttype = this.readInt();
  32101. var arg1 = this.readInt();
  32102. var arg2 = this.readInt();
  32103. var arg3 = this.readInt();
  32104. trans = this.edgeFactory(atn, ttype, src, trg, arg1, arg2, arg3, sets);
  32105. var srcState = atn.states[src];
  32106. srcState.addTransition(trans);
  32107. }
  32108. // edges for rule stop states can be derived, so they aren't serialized
  32109. for (i=0; i<atn.states.length; i++) {
  32110. state = atn.states[i];
  32111. for (j=0; j<state.transitions.length; j++) {
  32112. var t = state.transitions[j];
  32113. if (!(t instanceof RuleTransition)) {
  32114. continue;
  32115. }
  32116. var outermostPrecedenceReturn = -1;
  32117. if (atn.ruleToStartState[t.target.ruleIndex].isPrecedenceRule) {
  32118. if (t.precedence === 0) {
  32119. outermostPrecedenceReturn = t.target.ruleIndex;
  32120. }
  32121. }
  32122. trans = new EpsilonTransition(t.followState, outermostPrecedenceReturn);
  32123. atn.ruleToStopState[t.target.ruleIndex].addTransition(trans);
  32124. }
  32125. }
  32126. for (i=0; i<atn.states.length; i++) {
  32127. state = atn.states[i];
  32128. if (state instanceof BlockStartState) {
  32129. // we need to know the end state to set its start state
  32130. if (state.endState === null) {
  32131. throw ("IllegalState");
  32132. }
  32133. // block end states can only be associated to a single block start
  32134. // state
  32135. if ( state.endState.startState !== null) {
  32136. throw ("IllegalState");
  32137. }
  32138. state.endState.startState = state;
  32139. }
  32140. if (state instanceof PlusLoopbackState) {
  32141. for (j=0; j<state.transitions.length; j++) {
  32142. target = state.transitions[j].target;
  32143. if (target instanceof PlusBlockStartState) {
  32144. target.loopBackState = state;
  32145. }
  32146. }
  32147. } else if (state instanceof StarLoopbackState) {
  32148. for (j=0; j<state.transitions.length; j++) {
  32149. target = state.transitions[j].target;
  32150. if (target instanceof StarLoopEntryState) {
  32151. target.loopBackState = state;
  32152. }
  32153. }
  32154. }
  32155. }
  32156. };
  32157. ATNDeserializer.prototype.readDecisions = function(atn) {
  32158. var ndecisions = this.readInt();
  32159. for (var i=0; i<ndecisions; i++) {
  32160. var s = this.readInt();
  32161. var decState = atn.states[s];
  32162. atn.decisionToState.push(decState);
  32163. decState.decision = i;
  32164. }
  32165. };
  32166. ATNDeserializer.prototype.readLexerActions = function(atn) {
  32167. if (atn.grammarType === ATNType.LEXER) {
  32168. var count = this.readInt();
  32169. atn.lexerActions = initArray(count, null);
  32170. for (var i=0; i<count; i++) {
  32171. var actionType = this.readInt();
  32172. var data1 = this.readInt();
  32173. if (data1 === 0xFFFF) {
  32174. data1 = -1;
  32175. }
  32176. var data2 = this.readInt();
  32177. if (data2 === 0xFFFF) {
  32178. data2 = -1;
  32179. }
  32180. var lexerAction = this.lexerActionFactory(actionType, data1, data2);
  32181. atn.lexerActions[i] = lexerAction;
  32182. }
  32183. }
  32184. };
  32185. ATNDeserializer.prototype.generateRuleBypassTransitions = function(atn) {
  32186. var i;
  32187. var count = atn.ruleToStartState.length;
  32188. for(i=0; i<count; i++) {
  32189. atn.ruleToTokenType[i] = atn.maxTokenType + i + 1;
  32190. }
  32191. for(i=0; i<count; i++) {
  32192. this.generateRuleBypassTransition(atn, i);
  32193. }
  32194. };
  32195. ATNDeserializer.prototype.generateRuleBypassTransition = function(atn, idx) {
  32196. var i, state;
  32197. var bypassStart = new BasicBlockStartState();
  32198. bypassStart.ruleIndex = idx;
  32199. atn.addState(bypassStart);
  32200. var bypassStop = new BlockEndState();
  32201. bypassStop.ruleIndex = idx;
  32202. atn.addState(bypassStop);
  32203. bypassStart.endState = bypassStop;
  32204. atn.defineDecisionState(bypassStart);
  32205. bypassStop.startState = bypassStart;
  32206. var excludeTransition = null;
  32207. var endState = null;
  32208. if (atn.ruleToStartState[idx].isPrecedenceRule) {
  32209. // wrap from the beginning of the rule to the StarLoopEntryState
  32210. endState = null;
  32211. for(i=0; i<atn.states.length; i++) {
  32212. state = atn.states[i];
  32213. if (this.stateIsEndStateFor(state, idx)) {
  32214. endState = state;
  32215. excludeTransition = state.loopBackState.transitions[0];
  32216. break;
  32217. }
  32218. }
  32219. if (excludeTransition === null) {
  32220. throw ("Couldn't identify final state of the precedence rule prefix section.");
  32221. }
  32222. } else {
  32223. endState = atn.ruleToStopState[idx];
  32224. }
  32225. // all non-excluded transitions that currently target end state need to
  32226. // target blockEnd instead
  32227. for(i=0; i<atn.states.length; i++) {
  32228. state = atn.states[i];
  32229. for(var j=0; j<state.transitions.length; j++) {
  32230. var transition = state.transitions[j];
  32231. if (transition === excludeTransition) {
  32232. continue;
  32233. }
  32234. if (transition.target === endState) {
  32235. transition.target = bypassStop;
  32236. }
  32237. }
  32238. }
  32239. // all transitions leaving the rule start state need to leave blockStart
  32240. // instead
  32241. var ruleToStartState = atn.ruleToStartState[idx];
  32242. var count = ruleToStartState.transitions.length;
  32243. while ( count > 0) {
  32244. bypassStart.addTransition(ruleToStartState.transitions[count-1]);
  32245. ruleToStartState.transitions = ruleToStartState.transitions.slice(-1);
  32246. }
  32247. // link the new states
  32248. atn.ruleToStartState[idx].addTransition(new EpsilonTransition(bypassStart));
  32249. bypassStop.addTransition(new EpsilonTransition(endState));
  32250. var matchState = new BasicState();
  32251. atn.addState(matchState);
  32252. matchState.addTransition(new AtomTransition(bypassStop, atn.ruleToTokenType[idx]));
  32253. bypassStart.addTransition(new EpsilonTransition(matchState));
  32254. };
  32255. ATNDeserializer.prototype.stateIsEndStateFor = function(state, idx) {
  32256. if ( state.ruleIndex !== idx) {
  32257. return null;
  32258. }
  32259. if (!( state instanceof StarLoopEntryState)) {
  32260. return null;
  32261. }
  32262. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  32263. if (!( maybeLoopEndState instanceof LoopEndState)) {
  32264. return null;
  32265. }
  32266. if (maybeLoopEndState.epsilonOnlyTransitions &&
  32267. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  32268. return state;
  32269. } else {
  32270. return null;
  32271. }
  32272. };
  32273. //
  32274. // Analyze the {@link StarLoopEntryState} states in the specified ATN to set
  32275. // the {@link StarLoopEntryState//isPrecedenceDecision} field to the
  32276. // correct value.
  32277. //
  32278. // @param atn The ATN.
  32279. //
  32280. ATNDeserializer.prototype.markPrecedenceDecisions = function(atn) {
  32281. for(var i=0; i<atn.states.length; i++) {
  32282. var state = atn.states[i];
  32283. if (!( state instanceof StarLoopEntryState)) {
  32284. continue;
  32285. }
  32286. // We analyze the ATN to determine if this ATN decision state is the
  32287. // decision for the closure block that determines whether a
  32288. // precedence rule should continue or complete.
  32289. //
  32290. if ( atn.ruleToStartState[state.ruleIndex].isPrecedenceRule) {
  32291. var maybeLoopEndState = state.transitions[state.transitions.length - 1].target;
  32292. if (maybeLoopEndState instanceof LoopEndState) {
  32293. if ( maybeLoopEndState.epsilonOnlyTransitions &&
  32294. (maybeLoopEndState.transitions[0].target instanceof RuleStopState)) {
  32295. state.isPrecedenceDecision = true;
  32296. }
  32297. }
  32298. }
  32299. }
  32300. };
  32301. ATNDeserializer.prototype.verifyATN = function(atn) {
  32302. if (!this.deserializationOptions.verifyATN) {
  32303. return;
  32304. }
  32305. // verify assumptions
  32306. for(var i=0; i<atn.states.length; i++) {
  32307. var state = atn.states[i];
  32308. if (state === null) {
  32309. continue;
  32310. }
  32311. this.checkCondition(state.epsilonOnlyTransitions || state.transitions.length <= 1);
  32312. if (state instanceof PlusBlockStartState) {
  32313. this.checkCondition(state.loopBackState !== null);
  32314. } else if (state instanceof StarLoopEntryState) {
  32315. this.checkCondition(state.loopBackState !== null);
  32316. this.checkCondition(state.transitions.length === 2);
  32317. if (state.transitions[0].target instanceof StarBlockStartState) {
  32318. this.checkCondition(state.transitions[1].target instanceof LoopEndState);
  32319. this.checkCondition(!state.nonGreedy);
  32320. } else if (state.transitions[0].target instanceof LoopEndState) {
  32321. this.checkCondition(state.transitions[1].target instanceof StarBlockStartState);
  32322. this.checkCondition(state.nonGreedy);
  32323. } else {
  32324. throw("IllegalState");
  32325. }
  32326. } else if (state instanceof StarLoopbackState) {
  32327. this.checkCondition(state.transitions.length === 1);
  32328. this.checkCondition(state.transitions[0].target instanceof StarLoopEntryState);
  32329. } else if (state instanceof LoopEndState) {
  32330. this.checkCondition(state.loopBackState !== null);
  32331. } else if (state instanceof RuleStartState) {
  32332. this.checkCondition(state.stopState !== null);
  32333. } else if (state instanceof BlockStartState) {
  32334. this.checkCondition(state.endState !== null);
  32335. } else if (state instanceof BlockEndState) {
  32336. this.checkCondition(state.startState !== null);
  32337. } else if (state instanceof DecisionState) {
  32338. this.checkCondition(state.transitions.length <= 1 || state.decision >= 0);
  32339. } else {
  32340. this.checkCondition(state.transitions.length <= 1 || (state instanceof RuleStopState));
  32341. }
  32342. }
  32343. };
  32344. ATNDeserializer.prototype.checkCondition = function(condition, message) {
  32345. if (!condition) {
  32346. if (message === undefined || message===null) {
  32347. message = "IllegalState";
  32348. }
  32349. throw (message);
  32350. }
  32351. };
  32352. ATNDeserializer.prototype.readInt = function() {
  32353. return this.data[this.pos++];
  32354. };
  32355. ATNDeserializer.prototype.readInt32 = function() {
  32356. var low = this.readInt();
  32357. var high = this.readInt();
  32358. return low | (high << 16);
  32359. };
  32360. ATNDeserializer.prototype.readLong = function() {
  32361. var low = this.readInt32();
  32362. var high = this.readInt32();
  32363. return (low & 0x00000000FFFFFFFF) | (high << 32);
  32364. };
  32365. function createByteToHex() {
  32366. var bth = [];
  32367. for (var i = 0; i < 256; i++) {
  32368. bth[i] = (i + 0x100).toString(16).substr(1).toUpperCase();
  32369. }
  32370. return bth;
  32371. }
  32372. var byteToHex = createByteToHex();
  32373. ATNDeserializer.prototype.readUUID = function() {
  32374. var bb = [];
  32375. for(var i=7;i>=0;i--) {
  32376. var int = this.readInt();
  32377. /* jshint bitwise: false */
  32378. bb[(2*i)+1] = int & 0xFF;
  32379. bb[2*i] = (int >> 8) & 0xFF;
  32380. }
  32381. return byteToHex[bb[0]] + byteToHex[bb[1]] +
  32382. byteToHex[bb[2]] + byteToHex[bb[3]] + '-' +
  32383. byteToHex[bb[4]] + byteToHex[bb[5]] + '-' +
  32384. byteToHex[bb[6]] + byteToHex[bb[7]] + '-' +
  32385. byteToHex[bb[8]] + byteToHex[bb[9]] + '-' +
  32386. byteToHex[bb[10]] + byteToHex[bb[11]] +
  32387. byteToHex[bb[12]] + byteToHex[bb[13]] +
  32388. byteToHex[bb[14]] + byteToHex[bb[15]];
  32389. };
  32390. ATNDeserializer.prototype.edgeFactory = function(atn, type, src, trg, arg1, arg2, arg3, sets) {
  32391. var target = atn.states[trg];
  32392. switch(type) {
  32393. case Transition.EPSILON:
  32394. return new EpsilonTransition(target);
  32395. case Transition.RANGE:
  32396. return arg3 !== 0 ? new RangeTransition(target, Token.EOF, arg2) : new RangeTransition(target, arg1, arg2);
  32397. case Transition.RULE:
  32398. return new RuleTransition(atn.states[arg1], arg2, arg3, target);
  32399. case Transition.PREDICATE:
  32400. return new PredicateTransition(target, arg1, arg2, arg3 !== 0);
  32401. case Transition.PRECEDENCE:
  32402. return new PrecedencePredicateTransition(target, arg1);
  32403. case Transition.ATOM:
  32404. return arg3 !== 0 ? new AtomTransition(target, Token.EOF) : new AtomTransition(target, arg1);
  32405. case Transition.ACTION:
  32406. return new ActionTransition(target, arg1, arg2, arg3 !== 0);
  32407. case Transition.SET:
  32408. return new SetTransition(target, sets[arg1]);
  32409. case Transition.NOT_SET:
  32410. return new NotSetTransition(target, sets[arg1]);
  32411. case Transition.WILDCARD:
  32412. return new WildcardTransition(target);
  32413. default:
  32414. throw "The specified transition type: " + type + " is not valid.";
  32415. }
  32416. };
  32417. ATNDeserializer.prototype.stateFactory = function(type, ruleIndex) {
  32418. if (this.stateFactories === null) {
  32419. var sf = [];
  32420. sf[ATNState.INVALID_TYPE] = null;
  32421. sf[ATNState.BASIC] = function() { return new BasicState(); };
  32422. sf[ATNState.RULE_START] = function() { return new RuleStartState(); };
  32423. sf[ATNState.BLOCK_START] = function() { return new BasicBlockStartState(); };
  32424. sf[ATNState.PLUS_BLOCK_START] = function() { return new PlusBlockStartState(); };
  32425. sf[ATNState.STAR_BLOCK_START] = function() { return new StarBlockStartState(); };
  32426. sf[ATNState.TOKEN_START] = function() { return new TokensStartState(); };
  32427. sf[ATNState.RULE_STOP] = function() { return new RuleStopState(); };
  32428. sf[ATNState.BLOCK_END] = function() { return new BlockEndState(); };
  32429. sf[ATNState.STAR_LOOP_BACK] = function() { return new StarLoopbackState(); };
  32430. sf[ATNState.STAR_LOOP_ENTRY] = function() { return new StarLoopEntryState(); };
  32431. sf[ATNState.PLUS_LOOP_BACK] = function() { return new PlusLoopbackState(); };
  32432. sf[ATNState.LOOP_END] = function() { return new LoopEndState(); };
  32433. this.stateFactories = sf;
  32434. }
  32435. if (type>this.stateFactories.length || this.stateFactories[type] === null) {
  32436. throw("The specified state type " + type + " is not valid.");
  32437. } else {
  32438. var s = this.stateFactories[type]();
  32439. if (s!==null) {
  32440. s.ruleIndex = ruleIndex;
  32441. return s;
  32442. }
  32443. }
  32444. };
  32445. ATNDeserializer.prototype.lexerActionFactory = function(type, data1, data2) {
  32446. if (this.actionFactories === null) {
  32447. var af = [];
  32448. af[LexerActionType.CHANNEL] = function(data1, data2) { return new LexerChannelAction(data1); };
  32449. af[LexerActionType.CUSTOM] = function(data1, data2) { return new LexerCustomAction(data1, data2); };
  32450. af[LexerActionType.MODE] = function(data1, data2) { return new LexerModeAction(data1); };
  32451. af[LexerActionType.MORE] = function(data1, data2) { return LexerMoreAction.INSTANCE; };
  32452. af[LexerActionType.POP_MODE] = function(data1, data2) { return LexerPopModeAction.INSTANCE; };
  32453. af[LexerActionType.PUSH_MODE] = function(data1, data2) { return new LexerPushModeAction(data1); };
  32454. af[LexerActionType.SKIP] = function(data1, data2) { return LexerSkipAction.INSTANCE; };
  32455. af[LexerActionType.TYPE] = function(data1, data2) { return new LexerTypeAction(data1); };
  32456. this.actionFactories = af;
  32457. }
  32458. if (type>this.actionFactories.length || this.actionFactories[type] === null) {
  32459. throw("The specified lexer action type " + type + " is not valid.");
  32460. } else {
  32461. return this.actionFactories[type](data1, data2);
  32462. }
  32463. };
  32464. exports.ATNDeserializer = ATNDeserializer;
  32465. /***/ }),
  32466. /***/ "./node_modules/antlr4/atn/ATNSimulator.js":
  32467. /*!*************************************************!*\
  32468. !*** ./node_modules/antlr4/atn/ATNSimulator.js ***!
  32469. \*************************************************/
  32470. /*! no static exports found */
  32471. /***/ (function(module, exports, __webpack_require__) {
  32472. //
  32473. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32474. * Use of this file is governed by the BSD 3-clause license that
  32475. * can be found in the LICENSE.txt file in the project root.
  32476. */
  32477. ///
  32478. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32479. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32480. var getCachedPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").getCachedPredictionContext;
  32481. function ATNSimulator(atn, sharedContextCache) {
  32482. // The context cache maps all PredictionContext objects that are ==
  32483. // to a single cached copy. This cache is shared across all contexts
  32484. // in all ATNConfigs in all DFA states. We rebuild each ATNConfigSet
  32485. // to use only cached nodes/graphs in addDFAState(). We don't want to
  32486. // fill this during closure() since there are lots of contexts that
  32487. // pop up but are not used ever again. It also greatly slows down closure().
  32488. //
  32489. // <p>This cache makes a huge difference in memory and a little bit in speed.
  32490. // For the Java grammar on java.*, it dropped the memory requirements
  32491. // at the end from 25M to 16M. We don't store any of the full context
  32492. // graphs in the DFA because they are limited to local context only,
  32493. // but apparently there's a lot of repetition there as well. We optimize
  32494. // the config contexts before storing the config set in the DFA states
  32495. // by literally rebuilding them with cached subgraphs only.</p>
  32496. //
  32497. // <p>I tried a cache for use during closure operations, that was
  32498. // whacked after each adaptivePredict(). It cost a little bit
  32499. // more time I think and doesn't save on the overall footprint
  32500. // so it's not worth the complexity.</p>
  32501. ///
  32502. this.atn = atn;
  32503. this.sharedContextCache = sharedContextCache;
  32504. return this;
  32505. }
  32506. // Must distinguish between missing edge and edge we know leads nowhere///
  32507. ATNSimulator.ERROR = new DFAState(0x7FFFFFFF, new ATNConfigSet());
  32508. ATNSimulator.prototype.getCachedContext = function(context) {
  32509. if (this.sharedContextCache ===null) {
  32510. return context;
  32511. }
  32512. var visited = {};
  32513. return getCachedPredictionContext(context, this.sharedContextCache, visited);
  32514. };
  32515. exports.ATNSimulator = ATNSimulator;
  32516. /***/ }),
  32517. /***/ "./node_modules/antlr4/atn/ATNState.js":
  32518. /*!*********************************************!*\
  32519. !*** ./node_modules/antlr4/atn/ATNState.js ***!
  32520. \*********************************************/
  32521. /*! no static exports found */
  32522. /***/ (function(module, exports) {
  32523. //
  32524. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32525. * Use of this file is governed by the BSD 3-clause license that
  32526. * can be found in the LICENSE.txt file in the project root.
  32527. */
  32528. //
  32529. // The following images show the relation of states and
  32530. // {@link ATNState//transitions} for various grammar constructs.
  32531. //
  32532. // <ul>
  32533. //
  32534. // <li>Solid edges marked with an &//0949; indicate a required
  32535. // {@link EpsilonTransition}.</li>
  32536. //
  32537. // <li>Dashed edges indicate locations where any transition derived from
  32538. // {@link Transition} might appear.</li>
  32539. //
  32540. // <li>Dashed nodes are place holders for either a sequence of linked
  32541. // {@link BasicState} states or the inclusion of a block representing a nested
  32542. // construct in one of the forms below.</li>
  32543. //
  32544. // <li>Nodes showing multiple outgoing alternatives with a {@code ...} support
  32545. // any number of alternatives (one or more). Nodes without the {@code ...} only
  32546. // support the exact number of alternatives shown in the diagram.</li>
  32547. //
  32548. // </ul>
  32549. //
  32550. // <h2>Basic Blocks</h2>
  32551. //
  32552. // <h3>Rule</h3>
  32553. //
  32554. // <embed src="images/Rule.svg" type="image/svg+xml"/>
  32555. //
  32556. // <h3>Block of 1 or more alternatives</h3>
  32557. //
  32558. // <embed src="images/Block.svg" type="image/svg+xml"/>
  32559. //
  32560. // <h2>Greedy Loops</h2>
  32561. //
  32562. // <h3>Greedy Closure: {@code (...)*}</h3>
  32563. //
  32564. // <embed src="images/ClosureGreedy.svg" type="image/svg+xml"/>
  32565. //
  32566. // <h3>Greedy Positive Closure: {@code (...)+}</h3>
  32567. //
  32568. // <embed src="images/PositiveClosureGreedy.svg" type="image/svg+xml"/>
  32569. //
  32570. // <h3>Greedy Optional: {@code (...)?}</h3>
  32571. //
  32572. // <embed src="images/OptionalGreedy.svg" type="image/svg+xml"/>
  32573. //
  32574. // <h2>Non-Greedy Loops</h2>
  32575. //
  32576. // <h3>Non-Greedy Closure: {@code (...)*?}</h3>
  32577. //
  32578. // <embed src="images/ClosureNonGreedy.svg" type="image/svg+xml"/>
  32579. //
  32580. // <h3>Non-Greedy Positive Closure: {@code (...)+?}</h3>
  32581. //
  32582. // <embed src="images/PositiveClosureNonGreedy.svg" type="image/svg+xml"/>
  32583. //
  32584. // <h3>Non-Greedy Optional: {@code (...)??}</h3>
  32585. //
  32586. // <embed src="images/OptionalNonGreedy.svg" type="image/svg+xml"/>
  32587. //
  32588. var INITIAL_NUM_TRANSITIONS = 4;
  32589. function ATNState() {
  32590. // Which ATN are we in?
  32591. this.atn = null;
  32592. this.stateNumber = ATNState.INVALID_STATE_NUMBER;
  32593. this.stateType = null;
  32594. this.ruleIndex = 0; // at runtime, we don't have Rule objects
  32595. this.epsilonOnlyTransitions = false;
  32596. // Track the transitions emanating from this ATN state.
  32597. this.transitions = [];
  32598. // Used to cache lookahead during parsing, not used during construction
  32599. this.nextTokenWithinRule = null;
  32600. return this;
  32601. }
  32602. // constants for serialization
  32603. ATNState.INVALID_TYPE = 0;
  32604. ATNState.BASIC = 1;
  32605. ATNState.RULE_START = 2;
  32606. ATNState.BLOCK_START = 3;
  32607. ATNState.PLUS_BLOCK_START = 4;
  32608. ATNState.STAR_BLOCK_START = 5;
  32609. ATNState.TOKEN_START = 6;
  32610. ATNState.RULE_STOP = 7;
  32611. ATNState.BLOCK_END = 8;
  32612. ATNState.STAR_LOOP_BACK = 9;
  32613. ATNState.STAR_LOOP_ENTRY = 10;
  32614. ATNState.PLUS_LOOP_BACK = 11;
  32615. ATNState.LOOP_END = 12;
  32616. ATNState.serializationNames = [
  32617. "INVALID",
  32618. "BASIC",
  32619. "RULE_START",
  32620. "BLOCK_START",
  32621. "PLUS_BLOCK_START",
  32622. "STAR_BLOCK_START",
  32623. "TOKEN_START",
  32624. "RULE_STOP",
  32625. "BLOCK_END",
  32626. "STAR_LOOP_BACK",
  32627. "STAR_LOOP_ENTRY",
  32628. "PLUS_LOOP_BACK",
  32629. "LOOP_END" ];
  32630. ATNState.INVALID_STATE_NUMBER = -1;
  32631. ATNState.prototype.toString = function() {
  32632. return this.stateNumber;
  32633. };
  32634. ATNState.prototype.equals = function(other) {
  32635. if (other instanceof ATNState) {
  32636. return this.stateNumber===other.stateNumber;
  32637. } else {
  32638. return false;
  32639. }
  32640. };
  32641. ATNState.prototype.isNonGreedyExitState = function() {
  32642. return false;
  32643. };
  32644. ATNState.prototype.addTransition = function(trans, index) {
  32645. if(index===undefined) {
  32646. index = -1;
  32647. }
  32648. if (this.transitions.length===0) {
  32649. this.epsilonOnlyTransitions = trans.isEpsilon;
  32650. } else if(this.epsilonOnlyTransitions !== trans.isEpsilon) {
  32651. this.epsilonOnlyTransitions = false;
  32652. }
  32653. if (index===-1) {
  32654. this.transitions.push(trans);
  32655. } else {
  32656. this.transitions.splice(index, 1, trans);
  32657. }
  32658. };
  32659. function BasicState() {
  32660. ATNState.call(this);
  32661. this.stateType = ATNState.BASIC;
  32662. return this;
  32663. }
  32664. BasicState.prototype = Object.create(ATNState.prototype);
  32665. BasicState.prototype.constructor = BasicState;
  32666. function DecisionState() {
  32667. ATNState.call(this);
  32668. this.decision = -1;
  32669. this.nonGreedy = false;
  32670. return this;
  32671. }
  32672. DecisionState.prototype = Object.create(ATNState.prototype);
  32673. DecisionState.prototype.constructor = DecisionState;
  32674. // The start of a regular {@code (...)} block.
  32675. function BlockStartState() {
  32676. DecisionState.call(this);
  32677. this.endState = null;
  32678. return this;
  32679. }
  32680. BlockStartState.prototype = Object.create(DecisionState.prototype);
  32681. BlockStartState.prototype.constructor = BlockStartState;
  32682. function BasicBlockStartState() {
  32683. BlockStartState.call(this);
  32684. this.stateType = ATNState.BLOCK_START;
  32685. return this;
  32686. }
  32687. BasicBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32688. BasicBlockStartState.prototype.constructor = BasicBlockStartState;
  32689. // Terminal node of a simple {@code (a|b|c)} block.
  32690. function BlockEndState() {
  32691. ATNState.call(this);
  32692. this.stateType = ATNState.BLOCK_END;
  32693. this.startState = null;
  32694. return this;
  32695. }
  32696. BlockEndState.prototype = Object.create(ATNState.prototype);
  32697. BlockEndState.prototype.constructor = BlockEndState;
  32698. // The last node in the ATN for a rule, unless that rule is the start symbol.
  32699. // In that case, there is one transition to EOF. Later, we might encode
  32700. // references to all calls to this rule to compute FOLLOW sets for
  32701. // error handling.
  32702. //
  32703. function RuleStopState() {
  32704. ATNState.call(this);
  32705. this.stateType = ATNState.RULE_STOP;
  32706. return this;
  32707. }
  32708. RuleStopState.prototype = Object.create(ATNState.prototype);
  32709. RuleStopState.prototype.constructor = RuleStopState;
  32710. function RuleStartState() {
  32711. ATNState.call(this);
  32712. this.stateType = ATNState.RULE_START;
  32713. this.stopState = null;
  32714. this.isPrecedenceRule = false;
  32715. return this;
  32716. }
  32717. RuleStartState.prototype = Object.create(ATNState.prototype);
  32718. RuleStartState.prototype.constructor = RuleStartState;
  32719. // Decision state for {@code A+} and {@code (A|B)+}. It has two transitions:
  32720. // one to the loop back to start of the block and one to exit.
  32721. //
  32722. function PlusLoopbackState() {
  32723. DecisionState.call(this);
  32724. this.stateType = ATNState.PLUS_LOOP_BACK;
  32725. return this;
  32726. }
  32727. PlusLoopbackState.prototype = Object.create(DecisionState.prototype);
  32728. PlusLoopbackState.prototype.constructor = PlusLoopbackState;
  32729. // Start of {@code (A|B|...)+} loop. Technically a decision state, but
  32730. // we don't use for code generation; somebody might need it, so I'm defining
  32731. // it for completeness. In reality, the {@link PlusLoopbackState} node is the
  32732. // real decision-making note for {@code A+}.
  32733. //
  32734. function PlusBlockStartState() {
  32735. BlockStartState.call(this);
  32736. this.stateType = ATNState.PLUS_BLOCK_START;
  32737. this.loopBackState = null;
  32738. return this;
  32739. }
  32740. PlusBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32741. PlusBlockStartState.prototype.constructor = PlusBlockStartState;
  32742. // The block that begins a closure loop.
  32743. function StarBlockStartState() {
  32744. BlockStartState.call(this);
  32745. this.stateType = ATNState.STAR_BLOCK_START;
  32746. return this;
  32747. }
  32748. StarBlockStartState.prototype = Object.create(BlockStartState.prototype);
  32749. StarBlockStartState.prototype.constructor = StarBlockStartState;
  32750. function StarLoopbackState() {
  32751. ATNState.call(this);
  32752. this.stateType = ATNState.STAR_LOOP_BACK;
  32753. return this;
  32754. }
  32755. StarLoopbackState.prototype = Object.create(ATNState.prototype);
  32756. StarLoopbackState.prototype.constructor = StarLoopbackState;
  32757. function StarLoopEntryState() {
  32758. DecisionState.call(this);
  32759. this.stateType = ATNState.STAR_LOOP_ENTRY;
  32760. this.loopBackState = null;
  32761. // Indicates whether this state can benefit from a precedence DFA during SLL decision making.
  32762. this.isPrecedenceDecision = null;
  32763. return this;
  32764. }
  32765. StarLoopEntryState.prototype = Object.create(DecisionState.prototype);
  32766. StarLoopEntryState.prototype.constructor = StarLoopEntryState;
  32767. // Mark the end of a * or + loop.
  32768. function LoopEndState() {
  32769. ATNState.call(this);
  32770. this.stateType = ATNState.LOOP_END;
  32771. this.loopBackState = null;
  32772. return this;
  32773. }
  32774. LoopEndState.prototype = Object.create(ATNState.prototype);
  32775. LoopEndState.prototype.constructor = LoopEndState;
  32776. // The Tokens rule start state linking to each lexer rule start state */
  32777. function TokensStartState() {
  32778. DecisionState.call(this);
  32779. this.stateType = ATNState.TOKEN_START;
  32780. return this;
  32781. }
  32782. TokensStartState.prototype = Object.create(DecisionState.prototype);
  32783. TokensStartState.prototype.constructor = TokensStartState;
  32784. exports.ATNState = ATNState;
  32785. exports.BasicState = BasicState;
  32786. exports.DecisionState = DecisionState;
  32787. exports.BlockStartState = BlockStartState;
  32788. exports.BlockEndState = BlockEndState;
  32789. exports.LoopEndState = LoopEndState;
  32790. exports.RuleStartState = RuleStartState;
  32791. exports.RuleStopState = RuleStopState;
  32792. exports.TokensStartState = TokensStartState;
  32793. exports.PlusLoopbackState = PlusLoopbackState;
  32794. exports.StarLoopbackState = StarLoopbackState;
  32795. exports.StarLoopEntryState = StarLoopEntryState;
  32796. exports.PlusBlockStartState = PlusBlockStartState;
  32797. exports.StarBlockStartState = StarBlockStartState;
  32798. exports.BasicBlockStartState = BasicBlockStartState;
  32799. /***/ }),
  32800. /***/ "./node_modules/antlr4/atn/ATNType.js":
  32801. /*!********************************************!*\
  32802. !*** ./node_modules/antlr4/atn/ATNType.js ***!
  32803. \********************************************/
  32804. /*! no static exports found */
  32805. /***/ (function(module, exports) {
  32806. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32807. * Use of this file is governed by the BSD 3-clause license that
  32808. * can be found in the LICENSE.txt file in the project root.
  32809. */
  32810. ///
  32811. // Represents the type of recognizer an ATN applies to.
  32812. function ATNType() {
  32813. }
  32814. ATNType.LEXER = 0;
  32815. ATNType.PARSER = 1;
  32816. exports.ATNType = ATNType;
  32817. /***/ }),
  32818. /***/ "./node_modules/antlr4/atn/LexerATNSimulator.js":
  32819. /*!******************************************************!*\
  32820. !*** ./node_modules/antlr4/atn/LexerATNSimulator.js ***!
  32821. \******************************************************/
  32822. /*! no static exports found */
  32823. /***/ (function(module, exports, __webpack_require__) {
  32824. //
  32825. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  32826. * Use of this file is governed by the BSD 3-clause license that
  32827. * can be found in the LICENSE.txt file in the project root.
  32828. */
  32829. ///
  32830. // When we hit an accept state in either the DFA or the ATN, we
  32831. // have to notify the character stream to start buffering characters
  32832. // via {@link IntStream//mark} and record the current state. The current sim state
  32833. // includes the current index into the input, the current line,
  32834. // and current character position in that line. Note that the Lexer is
  32835. // tracking the starting line and characterization of the token. These
  32836. // variables track the "state" of the simulator when it hits an accept state.
  32837. //
  32838. // <p>We track these variables separately for the DFA and ATN simulation
  32839. // because the DFA simulation often has to fail over to the ATN
  32840. // simulation. If the ATN simulation fails, we need the DFA to fall
  32841. // back to its previously accepted state, if any. If the ATN succeeds,
  32842. // then the ATN does the accept and the DFA simulator that invoked it
  32843. // can simply return the predicted token type.</p>
  32844. ///
  32845. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  32846. var Lexer = __webpack_require__(/*! ./../Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  32847. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  32848. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  32849. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  32850. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  32851. var OrderedATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").OrderedATNConfigSet;
  32852. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  32853. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  32854. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  32855. var LexerATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").LexerATNConfig;
  32856. var Transition = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js").Transition;
  32857. var LexerActionExecutor = __webpack_require__(/*! ./LexerActionExecutor */ "./node_modules/antlr4/atn/LexerActionExecutor.js").LexerActionExecutor;
  32858. var LexerNoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  32859. function resetSimState(sim) {
  32860. sim.index = -1;
  32861. sim.line = 0;
  32862. sim.column = -1;
  32863. sim.dfaState = null;
  32864. }
  32865. function SimState() {
  32866. resetSimState(this);
  32867. return this;
  32868. }
  32869. SimState.prototype.reset = function() {
  32870. resetSimState(this);
  32871. };
  32872. function LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {
  32873. ATNSimulator.call(this, atn, sharedContextCache);
  32874. this.decisionToDFA = decisionToDFA;
  32875. this.recog = recog;
  32876. // The current token's starting index into the character stream.
  32877. // Shared across DFA to ATN simulation in case the ATN fails and the
  32878. // DFA did not have a previous accept state. In this case, we use the
  32879. // ATN-generated exception object.
  32880. this.startIndex = -1;
  32881. // line number 1..n within the input///
  32882. this.line = 1;
  32883. // The index of the character relative to the beginning of the line
  32884. // 0..n-1///
  32885. this.column = 0;
  32886. this.mode = Lexer.DEFAULT_MODE;
  32887. // Used during DFA/ATN exec to record the most recent accept configuration
  32888. // info
  32889. this.prevAccept = new SimState();
  32890. // done
  32891. return this;
  32892. }
  32893. LexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  32894. LexerATNSimulator.prototype.constructor = LexerATNSimulator;
  32895. LexerATNSimulator.debug = false;
  32896. LexerATNSimulator.dfa_debug = false;
  32897. LexerATNSimulator.MIN_DFA_EDGE = 0;
  32898. LexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN
  32899. LexerATNSimulator.match_calls = 0;
  32900. LexerATNSimulator.prototype.copyState = function(simulator) {
  32901. this.column = simulator.column;
  32902. this.line = simulator.line;
  32903. this.mode = simulator.mode;
  32904. this.startIndex = simulator.startIndex;
  32905. };
  32906. LexerATNSimulator.prototype.match = function(input, mode) {
  32907. this.match_calls += 1;
  32908. this.mode = mode;
  32909. var mark = input.mark();
  32910. try {
  32911. this.startIndex = input.index;
  32912. this.prevAccept.reset();
  32913. var dfa = this.decisionToDFA[mode];
  32914. if (dfa.s0 === null) {
  32915. return this.matchATN(input);
  32916. } else {
  32917. return this.execATN(input, dfa.s0);
  32918. }
  32919. } finally {
  32920. input.release(mark);
  32921. }
  32922. };
  32923. LexerATNSimulator.prototype.reset = function() {
  32924. this.prevAccept.reset();
  32925. this.startIndex = -1;
  32926. this.line = 1;
  32927. this.column = 0;
  32928. this.mode = Lexer.DEFAULT_MODE;
  32929. };
  32930. LexerATNSimulator.prototype.matchATN = function(input) {
  32931. var startState = this.atn.modeToStartState[this.mode];
  32932. if (LexerATNSimulator.debug) {
  32933. console.log("matchATN mode " + this.mode + " start: " + startState);
  32934. }
  32935. var old_mode = this.mode;
  32936. var s0_closure = this.computeStartState(input, startState);
  32937. var suppressEdge = s0_closure.hasSemanticContext;
  32938. s0_closure.hasSemanticContext = false;
  32939. var next = this.addDFAState(s0_closure);
  32940. if (!suppressEdge) {
  32941. this.decisionToDFA[this.mode].s0 = next;
  32942. }
  32943. var predict = this.execATN(input, next);
  32944. if (LexerATNSimulator.debug) {
  32945. console.log("DFA after matchATN: " + this.decisionToDFA[old_mode].toLexerString());
  32946. }
  32947. return predict;
  32948. };
  32949. LexerATNSimulator.prototype.execATN = function(input, ds0) {
  32950. if (LexerATNSimulator.debug) {
  32951. console.log("start state closure=" + ds0.configs);
  32952. }
  32953. if (ds0.isAcceptState) {
  32954. // allow zero-length tokens
  32955. this.captureSimState(this.prevAccept, input, ds0);
  32956. }
  32957. var t = input.LA(1);
  32958. var s = ds0; // s is current/from DFA state
  32959. while (true) { // while more work
  32960. if (LexerATNSimulator.debug) {
  32961. console.log("execATN loop starting closure: " + s.configs);
  32962. }
  32963. // As we move src->trg, src->trg, we keep track of the previous trg to
  32964. // avoid looking up the DFA state again, which is expensive.
  32965. // If the previous target was already part of the DFA, we might
  32966. // be able to avoid doing a reach operation upon t. If s!=null,
  32967. // it means that semantic predicates didn't prevent us from
  32968. // creating a DFA state. Once we know s!=null, we check to see if
  32969. // the DFA state has an edge already for t. If so, we can just reuse
  32970. // it's configuration set; there's no point in re-computing it.
  32971. // This is kind of like doing DFA simulation within the ATN
  32972. // simulation because DFA simulation is really just a way to avoid
  32973. // computing reach/closure sets. Technically, once we know that
  32974. // we have a previously added DFA state, we could jump over to
  32975. // the DFA simulator. But, that would mean popping back and forth
  32976. // a lot and making things more complicated algorithmically.
  32977. // This optimization makes a lot of sense for loops within DFA.
  32978. // A character will take us back to an existing DFA state
  32979. // that already has lots of edges out of it. e.g., .* in comments.
  32980. // print("Target for:" + str(s) + " and:" + str(t))
  32981. var target = this.getExistingTargetState(s, t);
  32982. // print("Existing:" + str(target))
  32983. if (target === null) {
  32984. target = this.computeTargetState(input, s, t);
  32985. // print("Computed:" + str(target))
  32986. }
  32987. if (target === ATNSimulator.ERROR) {
  32988. break;
  32989. }
  32990. // If this is a consumable input element, make sure to consume before
  32991. // capturing the accept state so the input index, line, and char
  32992. // position accurately reflect the state of the interpreter at the
  32993. // end of the token.
  32994. if (t !== Token.EOF) {
  32995. this.consume(input);
  32996. }
  32997. if (target.isAcceptState) {
  32998. this.captureSimState(this.prevAccept, input, target);
  32999. if (t === Token.EOF) {
  33000. break;
  33001. }
  33002. }
  33003. t = input.LA(1);
  33004. s = target; // flip; current DFA target becomes new src/from state
  33005. }
  33006. return this.failOrAccept(this.prevAccept, input, s.configs, t);
  33007. };
  33008. // Get an existing target state for an edge in the DFA. If the target state
  33009. // for the edge has not yet been computed or is otherwise not available,
  33010. // this method returns {@code null}.
  33011. //
  33012. // @param s The current DFA state
  33013. // @param t The next input symbol
  33014. // @return The existing target DFA state for the given input symbol
  33015. // {@code t}, or {@code null} if the target state for this edge is not
  33016. // already cached
  33017. LexerATNSimulator.prototype.getExistingTargetState = function(s, t) {
  33018. if (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {
  33019. return null;
  33020. }
  33021. var target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];
  33022. if(target===undefined) {
  33023. target = null;
  33024. }
  33025. if (LexerATNSimulator.debug && target !== null) {
  33026. console.log("reuse state " + s.stateNumber + " edge to " + target.stateNumber);
  33027. }
  33028. return target;
  33029. };
  33030. // Compute a target state for an edge in the DFA, and attempt to add the
  33031. // computed state and corresponding edge to the DFA.
  33032. //
  33033. // @param input The input stream
  33034. // @param s The current DFA state
  33035. // @param t The next input symbol
  33036. //
  33037. // @return The computed target DFA state for the given input symbol
  33038. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  33039. // returns {@link //ERROR}.
  33040. LexerATNSimulator.prototype.computeTargetState = function(input, s, t) {
  33041. var reach = new OrderedATNConfigSet();
  33042. // if we don't find an existing DFA state
  33043. // Fill reach starting from closure, following t transitions
  33044. this.getReachableConfigSet(input, s.configs, reach, t);
  33045. if (reach.items.length === 0) { // we got nowhere on t from s
  33046. if (!reach.hasSemanticContext) {
  33047. // we got nowhere on t, don't throw out this knowledge; it'd
  33048. // cause a failover from DFA later.
  33049. this.addDFAEdge(s, t, ATNSimulator.ERROR);
  33050. }
  33051. // stop when we can't match any more char
  33052. return ATNSimulator.ERROR;
  33053. }
  33054. // Add an edge from s to target DFA found/created for reach
  33055. return this.addDFAEdge(s, t, null, reach);
  33056. };
  33057. LexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {
  33058. if (this.prevAccept.dfaState !== null) {
  33059. var lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;
  33060. this.accept(input, lexerActionExecutor, this.startIndex,
  33061. prevAccept.index, prevAccept.line, prevAccept.column);
  33062. return prevAccept.dfaState.prediction;
  33063. } else {
  33064. // if no accept and EOF is first char, return EOF
  33065. if (t === Token.EOF && input.index === this.startIndex) {
  33066. return Token.EOF;
  33067. }
  33068. throw new LexerNoViableAltException(this.recog, input, this.startIndex, reach);
  33069. }
  33070. };
  33071. // Given a starting configuration set, figure out all ATN configurations
  33072. // we can reach upon input {@code t}. Parameter {@code reach} is a return
  33073. // parameter.
  33074. LexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,
  33075. reach, t) {
  33076. // this is used to skip processing for configs which have a lower priority
  33077. // than a config that already reached an accept state for the same rule
  33078. var skipAlt = ATN.INVALID_ALT_NUMBER;
  33079. for (var i = 0; i < closure.items.length; i++) {
  33080. var cfg = closure.items[i];
  33081. var currentAltReachedAcceptState = (cfg.alt === skipAlt);
  33082. if (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {
  33083. continue;
  33084. }
  33085. if (LexerATNSimulator.debug) {
  33086. console.log("testing %s at %s\n", this.getTokenName(t), cfg
  33087. .toString(this.recog, true));
  33088. }
  33089. for (var j = 0; j < cfg.state.transitions.length; j++) {
  33090. var trans = cfg.state.transitions[j]; // for each transition
  33091. var target = this.getReachableTarget(trans, t);
  33092. if (target !== null) {
  33093. var lexerActionExecutor = cfg.lexerActionExecutor;
  33094. if (lexerActionExecutor !== null) {
  33095. lexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);
  33096. }
  33097. var treatEofAsEpsilon = (t === Token.EOF);
  33098. var config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);
  33099. if (this.closure(input, config, reach,
  33100. currentAltReachedAcceptState, true, treatEofAsEpsilon)) {
  33101. // any remaining configs for this alt have a lower priority
  33102. // than the one that just reached an accept state.
  33103. skipAlt = cfg.alt;
  33104. }
  33105. }
  33106. }
  33107. }
  33108. };
  33109. LexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,
  33110. startIndex, index, line, charPos) {
  33111. if (LexerATNSimulator.debug) {
  33112. console.log("ACTION %s\n", lexerActionExecutor);
  33113. }
  33114. // seek to after last char in token
  33115. input.seek(index);
  33116. this.line = line;
  33117. this.column = charPos;
  33118. if (lexerActionExecutor !== null && this.recog !== null) {
  33119. lexerActionExecutor.execute(this.recog, input, startIndex);
  33120. }
  33121. };
  33122. LexerATNSimulator.prototype.getReachableTarget = function(trans, t) {
  33123. if (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {
  33124. return trans.target;
  33125. } else {
  33126. return null;
  33127. }
  33128. };
  33129. LexerATNSimulator.prototype.computeStartState = function(input, p) {
  33130. var initialContext = PredictionContext.EMPTY;
  33131. var configs = new OrderedATNConfigSet();
  33132. for (var i = 0; i < p.transitions.length; i++) {
  33133. var target = p.transitions[i].target;
  33134. var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);
  33135. this.closure(input, cfg, configs, false, false, false);
  33136. }
  33137. return configs;
  33138. };
  33139. // Since the alternatives within any lexer decision are ordered by
  33140. // preference, this method stops pursuing the closure as soon as an accept
  33141. // state is reached. After the first accept state is reached by depth-first
  33142. // search from {@code config}, all other (potentially reachable) states for
  33143. // this rule would have a lower priority.
  33144. //
  33145. // @return {@code true} if an accept state is reached, otherwise
  33146. // {@code false}.
  33147. LexerATNSimulator.prototype.closure = function(input, config, configs,
  33148. currentAltReachedAcceptState, speculative, treatEofAsEpsilon) {
  33149. var cfg = null;
  33150. if (LexerATNSimulator.debug) {
  33151. console.log("closure(" + config.toString(this.recog, true) + ")");
  33152. }
  33153. if (config.state instanceof RuleStopState) {
  33154. if (LexerATNSimulator.debug) {
  33155. if (this.recog !== null) {
  33156. console.log("closure at %s rule stop %s\n", this.recog.ruleNames[config.state.ruleIndex], config);
  33157. } else {
  33158. console.log("closure at rule stop %s\n", config);
  33159. }
  33160. }
  33161. if (config.context === null || config.context.hasEmptyPath()) {
  33162. if (config.context === null || config.context.isEmpty()) {
  33163. configs.add(config);
  33164. return true;
  33165. } else {
  33166. configs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));
  33167. currentAltReachedAcceptState = true;
  33168. }
  33169. }
  33170. if (config.context !== null && !config.context.isEmpty()) {
  33171. for (var i = 0; i < config.context.length; i++) {
  33172. if (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {
  33173. var newContext = config.context.getParent(i); // "pop" return state
  33174. var returnState = this.atn.states[config.context.getReturnState(i)];
  33175. cfg = new LexerATNConfig({ state:returnState, context:newContext }, config);
  33176. currentAltReachedAcceptState = this.closure(input, cfg,
  33177. configs, currentAltReachedAcceptState, speculative,
  33178. treatEofAsEpsilon);
  33179. }
  33180. }
  33181. }
  33182. return currentAltReachedAcceptState;
  33183. }
  33184. // optimization
  33185. if (!config.state.epsilonOnlyTransitions) {
  33186. if (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {
  33187. configs.add(config);
  33188. }
  33189. }
  33190. for (var j = 0; j < config.state.transitions.length; j++) {
  33191. var trans = config.state.transitions[j];
  33192. cfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);
  33193. if (cfg !== null) {
  33194. currentAltReachedAcceptState = this.closure(input, cfg, configs,
  33195. currentAltReachedAcceptState, speculative, treatEofAsEpsilon);
  33196. }
  33197. }
  33198. return currentAltReachedAcceptState;
  33199. };
  33200. // side-effect: can alter configs.hasSemanticContext
  33201. LexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,
  33202. configs, speculative, treatEofAsEpsilon) {
  33203. var cfg = null;
  33204. if (trans.serializationType === Transition.RULE) {
  33205. var newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);
  33206. cfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);
  33207. } else if (trans.serializationType === Transition.PRECEDENCE) {
  33208. throw "Precedence predicates are not supported in lexers.";
  33209. } else if (trans.serializationType === Transition.PREDICATE) {
  33210. // Track traversing semantic predicates. If we traverse,
  33211. // we cannot add a DFA state for this "reach" computation
  33212. // because the DFA would not test the predicate again in the
  33213. // future. Rather than creating collections of semantic predicates
  33214. // like v3 and testing them on prediction, v4 will test them on the
  33215. // fly all the time using the ATN not the DFA. This is slower but
  33216. // semantically it's not used that often. One of the key elements to
  33217. // this predicate mechanism is not adding DFA states that see
  33218. // predicates immediately afterwards in the ATN. For example,
  33219. // a : ID {p1}? | ID {p2}? ;
  33220. // should create the start state for rule 'a' (to save start state
  33221. // competition), but should not create target of ID state. The
  33222. // collection of ATN states the following ID references includes
  33223. // states reached by traversing predicates. Since this is when we
  33224. // test them, we cannot cash the DFA state target of ID.
  33225. if (LexerATNSimulator.debug) {
  33226. console.log("EVAL rule " + trans.ruleIndex + ":" + trans.predIndex);
  33227. }
  33228. configs.hasSemanticContext = true;
  33229. if (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {
  33230. cfg = new LexerATNConfig({ state:trans.target}, config);
  33231. }
  33232. } else if (trans.serializationType === Transition.ACTION) {
  33233. if (config.context === null || config.context.hasEmptyPath()) {
  33234. // execute actions anywhere in the start rule for a token.
  33235. //
  33236. // TODO: if the entry rule is invoked recursively, some
  33237. // actions may be executed during the recursive call. The
  33238. // problem can appear when hasEmptyPath() is true but
  33239. // isEmpty() is false. In this case, the config needs to be
  33240. // split into two contexts - one with just the empty path
  33241. // and another with everything but the empty path.
  33242. // Unfortunately, the current algorithm does not allow
  33243. // getEpsilonTarget to return two configurations, so
  33244. // additional modifications are needed before we can support
  33245. // the split operation.
  33246. var lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,
  33247. this.atn.lexerActions[trans.actionIndex]);
  33248. cfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);
  33249. } else {
  33250. // ignore actions in referenced rules
  33251. cfg = new LexerATNConfig( { state:trans.target}, config);
  33252. }
  33253. } else if (trans.serializationType === Transition.EPSILON) {
  33254. cfg = new LexerATNConfig({ state:trans.target}, config);
  33255. } else if (trans.serializationType === Transition.ATOM ||
  33256. trans.serializationType === Transition.RANGE ||
  33257. trans.serializationType === Transition.SET) {
  33258. if (treatEofAsEpsilon) {
  33259. if (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {
  33260. cfg = new LexerATNConfig( { state:trans.target }, config);
  33261. }
  33262. }
  33263. }
  33264. return cfg;
  33265. };
  33266. // Evaluate a predicate specified in the lexer.
  33267. //
  33268. // <p>If {@code speculative} is {@code true}, this method was called before
  33269. // {@link //consume} for the matched character. This method should call
  33270. // {@link //consume} before evaluating the predicate to ensure position
  33271. // sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},
  33272. // and {@link Lexer//getcolumn}, properly reflect the current
  33273. // lexer state. This method should restore {@code input} and the simulator
  33274. // to the original state before returning (i.e. undo the actions made by the
  33275. // call to {@link //consume}.</p>
  33276. //
  33277. // @param input The input stream.
  33278. // @param ruleIndex The rule containing the predicate.
  33279. // @param predIndex The index of the predicate within the rule.
  33280. // @param speculative {@code true} if the current index in {@code input} is
  33281. // one character before the predicate's location.
  33282. //
  33283. // @return {@code true} if the specified predicate evaluates to
  33284. // {@code true}.
  33285. // /
  33286. LexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,
  33287. predIndex, speculative) {
  33288. // assume true if no recognizer was provided
  33289. if (this.recog === null) {
  33290. return true;
  33291. }
  33292. if (!speculative) {
  33293. return this.recog.sempred(null, ruleIndex, predIndex);
  33294. }
  33295. var savedcolumn = this.column;
  33296. var savedLine = this.line;
  33297. var index = input.index;
  33298. var marker = input.mark();
  33299. try {
  33300. this.consume(input);
  33301. return this.recog.sempred(null, ruleIndex, predIndex);
  33302. } finally {
  33303. this.column = savedcolumn;
  33304. this.line = savedLine;
  33305. input.seek(index);
  33306. input.release(marker);
  33307. }
  33308. };
  33309. LexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {
  33310. settings.index = input.index;
  33311. settings.line = this.line;
  33312. settings.column = this.column;
  33313. settings.dfaState = dfaState;
  33314. };
  33315. LexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {
  33316. if (to === undefined) {
  33317. to = null;
  33318. }
  33319. if (cfgs === undefined) {
  33320. cfgs = null;
  33321. }
  33322. if (to === null && cfgs !== null) {
  33323. // leading to this call, ATNConfigSet.hasSemanticContext is used as a
  33324. // marker indicating dynamic predicate evaluation makes this edge
  33325. // dependent on the specific input sequence, so the static edge in the
  33326. // DFA should be omitted. The target DFAState is still created since
  33327. // execATN has the ability to resynchronize with the DFA state cache
  33328. // following the predicate evaluation step.
  33329. //
  33330. // TJP notes: next time through the DFA, we see a pred again and eval.
  33331. // If that gets us to a previously created (but dangling) DFA
  33332. // state, we can continue in pure DFA mode from there.
  33333. // /
  33334. var suppressEdge = cfgs.hasSemanticContext;
  33335. cfgs.hasSemanticContext = false;
  33336. to = this.addDFAState(cfgs);
  33337. if (suppressEdge) {
  33338. return to;
  33339. }
  33340. }
  33341. // add the edge
  33342. if (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {
  33343. // Only track edges within the DFA bounds
  33344. return to;
  33345. }
  33346. if (LexerATNSimulator.debug) {
  33347. console.log("EDGE " + from_ + " -> " + to + " upon " + tk);
  33348. }
  33349. if (from_.edges === null) {
  33350. // make room for tokens 1..n and -1 masquerading as index 0
  33351. from_.edges = [];
  33352. }
  33353. from_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect
  33354. return to;
  33355. };
  33356. // Add a new DFA state if there isn't one with this set of
  33357. // configurations already. This method also detects the first
  33358. // configuration containing an ATN rule stop state. Later, when
  33359. // traversing the DFA, we will know which rule to accept.
  33360. LexerATNSimulator.prototype.addDFAState = function(configs) {
  33361. var proposed = new DFAState(null, configs);
  33362. var firstConfigWithRuleStopState = null;
  33363. for (var i = 0; i < configs.items.length; i++) {
  33364. var cfg = configs.items[i];
  33365. if (cfg.state instanceof RuleStopState) {
  33366. firstConfigWithRuleStopState = cfg;
  33367. break;
  33368. }
  33369. }
  33370. if (firstConfigWithRuleStopState !== null) {
  33371. proposed.isAcceptState = true;
  33372. proposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;
  33373. proposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];
  33374. }
  33375. var dfa = this.decisionToDFA[this.mode];
  33376. var existing = dfa.states.get(proposed);
  33377. if (existing!==null) {
  33378. return existing;
  33379. }
  33380. var newState = proposed;
  33381. newState.stateNumber = dfa.states.length;
  33382. configs.setReadonly(true);
  33383. newState.configs = configs;
  33384. dfa.states.add(newState);
  33385. return newState;
  33386. };
  33387. LexerATNSimulator.prototype.getDFA = function(mode) {
  33388. return this.decisionToDFA[mode];
  33389. };
  33390. // Get the text matched so far for the current token.
  33391. LexerATNSimulator.prototype.getText = function(input) {
  33392. // index is first lookahead char, don't include.
  33393. return input.getText(this.startIndex, input.index - 1);
  33394. };
  33395. LexerATNSimulator.prototype.consume = function(input) {
  33396. var curChar = input.LA(1);
  33397. if (curChar === "\n".charCodeAt(0)) {
  33398. this.line += 1;
  33399. this.column = 0;
  33400. } else {
  33401. this.column += 1;
  33402. }
  33403. input.consume();
  33404. };
  33405. LexerATNSimulator.prototype.getTokenName = function(tt) {
  33406. if (tt === -1) {
  33407. return "EOF";
  33408. } else {
  33409. return "'" + String.fromCharCode(tt) + "'";
  33410. }
  33411. };
  33412. exports.LexerATNSimulator = LexerATNSimulator;
  33413. /***/ }),
  33414. /***/ "./node_modules/antlr4/atn/LexerAction.js":
  33415. /*!************************************************!*\
  33416. !*** ./node_modules/antlr4/atn/LexerAction.js ***!
  33417. \************************************************/
  33418. /*! no static exports found */
  33419. /***/ (function(module, exports) {
  33420. //
  33421. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33422. * Use of this file is governed by the BSD 3-clause license that
  33423. * can be found in the LICENSE.txt file in the project root.
  33424. */
  33425. //
  33426. function LexerActionType() {
  33427. }
  33428. LexerActionType.CHANNEL = 0; //The type of a {@link LexerChannelAction} action.
  33429. LexerActionType.CUSTOM = 1; //The type of a {@link LexerCustomAction} action.
  33430. LexerActionType.MODE = 2; //The type of a {@link LexerModeAction} action.
  33431. LexerActionType.MORE = 3; //The type of a {@link LexerMoreAction} action.
  33432. LexerActionType.POP_MODE = 4; //The type of a {@link LexerPopModeAction} action.
  33433. LexerActionType.PUSH_MODE = 5; //The type of a {@link LexerPushModeAction} action.
  33434. LexerActionType.SKIP = 6; //The type of a {@link LexerSkipAction} action.
  33435. LexerActionType.TYPE = 7; //The type of a {@link LexerTypeAction} action.
  33436. function LexerAction(action) {
  33437. this.actionType = action;
  33438. this.isPositionDependent = false;
  33439. return this;
  33440. }
  33441. LexerAction.prototype.hashCode = function() {
  33442. var hash = new Hash();
  33443. this.updateHashCode(hash);
  33444. return hash.finish()
  33445. };
  33446. LexerAction.prototype.updateHashCode = function(hash) {
  33447. hash.update(this.actionType);
  33448. };
  33449. LexerAction.prototype.equals = function(other) {
  33450. return this === other;
  33451. };
  33452. //
  33453. // Implements the {@code skip} lexer action by calling {@link Lexer//skip}.
  33454. //
  33455. // <p>The {@code skip} command does not have any parameters, so this action is
  33456. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33457. function LexerSkipAction() {
  33458. LexerAction.call(this, LexerActionType.SKIP);
  33459. return this;
  33460. }
  33461. LexerSkipAction.prototype = Object.create(LexerAction.prototype);
  33462. LexerSkipAction.prototype.constructor = LexerSkipAction;
  33463. // Provides a singleton instance of this parameterless lexer action.
  33464. LexerSkipAction.INSTANCE = new LexerSkipAction();
  33465. LexerSkipAction.prototype.execute = function(lexer) {
  33466. lexer.skip();
  33467. };
  33468. LexerSkipAction.prototype.toString = function() {
  33469. return "skip";
  33470. };
  33471. // Implements the {@code type} lexer action by calling {@link Lexer//setType}
  33472. // with the assigned type.
  33473. function LexerTypeAction(type) {
  33474. LexerAction.call(this, LexerActionType.TYPE);
  33475. this.type = type;
  33476. return this;
  33477. }
  33478. LexerTypeAction.prototype = Object.create(LexerAction.prototype);
  33479. LexerTypeAction.prototype.constructor = LexerTypeAction;
  33480. LexerTypeAction.prototype.execute = function(lexer) {
  33481. lexer.type = this.type;
  33482. };
  33483. LexerTypeAction.prototype.updateHashCode = function(hash) {
  33484. hash.update(this.actionType, this.type);
  33485. };
  33486. LexerTypeAction.prototype.equals = function(other) {
  33487. if(this === other) {
  33488. return true;
  33489. } else if (! (other instanceof LexerTypeAction)) {
  33490. return false;
  33491. } else {
  33492. return this.type === other.type;
  33493. }
  33494. };
  33495. LexerTypeAction.prototype.toString = function() {
  33496. return "type(" + this.type + ")";
  33497. };
  33498. // Implements the {@code pushMode} lexer action by calling
  33499. // {@link Lexer//pushMode} with the assigned mode.
  33500. function LexerPushModeAction(mode) {
  33501. LexerAction.call(this, LexerActionType.PUSH_MODE);
  33502. this.mode = mode;
  33503. return this;
  33504. }
  33505. LexerPushModeAction.prototype = Object.create(LexerAction.prototype);
  33506. LexerPushModeAction.prototype.constructor = LexerPushModeAction;
  33507. // <p>This action is implemented by calling {@link Lexer//pushMode} with the
  33508. // value provided by {@link //getMode}.</p>
  33509. LexerPushModeAction.prototype.execute = function(lexer) {
  33510. lexer.pushMode(this.mode);
  33511. };
  33512. LexerPushModeAction.prototype.updateHashCode = function(hash) {
  33513. hash.update(this.actionType, this.mode);
  33514. };
  33515. LexerPushModeAction.prototype.equals = function(other) {
  33516. if (this === other) {
  33517. return true;
  33518. } else if (! (other instanceof LexerPushModeAction)) {
  33519. return false;
  33520. } else {
  33521. return this.mode === other.mode;
  33522. }
  33523. };
  33524. LexerPushModeAction.prototype.toString = function() {
  33525. return "pushMode(" + this.mode + ")";
  33526. };
  33527. // Implements the {@code popMode} lexer action by calling {@link Lexer//popMode}.
  33528. //
  33529. // <p>The {@code popMode} command does not have any parameters, so this action is
  33530. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33531. function LexerPopModeAction() {
  33532. LexerAction.call(this,LexerActionType.POP_MODE);
  33533. return this;
  33534. }
  33535. LexerPopModeAction.prototype = Object.create(LexerAction.prototype);
  33536. LexerPopModeAction.prototype.constructor = LexerPopModeAction;
  33537. LexerPopModeAction.INSTANCE = new LexerPopModeAction();
  33538. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33539. LexerPopModeAction.prototype.execute = function(lexer) {
  33540. lexer.popMode();
  33541. };
  33542. LexerPopModeAction.prototype.toString = function() {
  33543. return "popMode";
  33544. };
  33545. // Implements the {@code more} lexer action by calling {@link Lexer//more}.
  33546. //
  33547. // <p>The {@code more} command does not have any parameters, so this action is
  33548. // implemented as a singleton instance exposed by {@link //INSTANCE}.</p>
  33549. function LexerMoreAction() {
  33550. LexerAction.call(this, LexerActionType.MORE);
  33551. return this;
  33552. }
  33553. LexerMoreAction.prototype = Object.create(LexerAction.prototype);
  33554. LexerMoreAction.prototype.constructor = LexerMoreAction;
  33555. LexerMoreAction.INSTANCE = new LexerMoreAction();
  33556. // <p>This action is implemented by calling {@link Lexer//popMode}.</p>
  33557. LexerMoreAction.prototype.execute = function(lexer) {
  33558. lexer.more();
  33559. };
  33560. LexerMoreAction.prototype.toString = function() {
  33561. return "more";
  33562. };
  33563. // Implements the {@code mode} lexer action by calling {@link Lexer//mode} with
  33564. // the assigned mode.
  33565. function LexerModeAction(mode) {
  33566. LexerAction.call(this, LexerActionType.MODE);
  33567. this.mode = mode;
  33568. return this;
  33569. }
  33570. LexerModeAction.prototype = Object.create(LexerAction.prototype);
  33571. LexerModeAction.prototype.constructor = LexerModeAction;
  33572. // <p>This action is implemented by calling {@link Lexer//mode} with the
  33573. // value provided by {@link //getMode}.</p>
  33574. LexerModeAction.prototype.execute = function(lexer) {
  33575. lexer.mode(this.mode);
  33576. };
  33577. LexerModeAction.prototype.updateHashCode = function(hash) {
  33578. hash.update(this.actionType, this.mode);
  33579. };
  33580. LexerModeAction.prototype.equals = function(other) {
  33581. if (this === other) {
  33582. return true;
  33583. } else if (! (other instanceof LexerModeAction)) {
  33584. return false;
  33585. } else {
  33586. return this.mode === other.mode;
  33587. }
  33588. };
  33589. LexerModeAction.prototype.toString = function() {
  33590. return "mode(" + this.mode + ")";
  33591. };
  33592. // Executes a custom lexer action by calling {@link Recognizer//action} with the
  33593. // rule and action indexes assigned to the custom action. The implementation of
  33594. // a custom action is added to the generated code for the lexer in an override
  33595. // of {@link Recognizer//action} when the grammar is compiled.
  33596. //
  33597. // <p>This class may represent embedded actions created with the <code>{...}</code>
  33598. // syntax in ANTLR 4, as well as actions created for lexer commands where the
  33599. // command argument could not be evaluated when the grammar was compiled.</p>
  33600. // Constructs a custom lexer action with the specified rule and action
  33601. // indexes.
  33602. //
  33603. // @param ruleIndex The rule index to use for calls to
  33604. // {@link Recognizer//action}.
  33605. // @param actionIndex The action index to use for calls to
  33606. // {@link Recognizer//action}.
  33607. function LexerCustomAction(ruleIndex, actionIndex) {
  33608. LexerAction.call(this, LexerActionType.CUSTOM);
  33609. this.ruleIndex = ruleIndex;
  33610. this.actionIndex = actionIndex;
  33611. this.isPositionDependent = true;
  33612. return this;
  33613. }
  33614. LexerCustomAction.prototype = Object.create(LexerAction.prototype);
  33615. LexerCustomAction.prototype.constructor = LexerCustomAction;
  33616. // <p>Custom actions are implemented by calling {@link Lexer//action} with the
  33617. // appropriate rule and action indexes.</p>
  33618. LexerCustomAction.prototype.execute = function(lexer) {
  33619. lexer.action(null, this.ruleIndex, this.actionIndex);
  33620. };
  33621. LexerCustomAction.prototype.updateHashCode = function(hash) {
  33622. hash.update(this.actionType, this.ruleIndex, this.actionIndex);
  33623. };
  33624. LexerCustomAction.prototype.equals = function(other) {
  33625. if (this === other) {
  33626. return true;
  33627. } else if (! (other instanceof LexerCustomAction)) {
  33628. return false;
  33629. } else {
  33630. return this.ruleIndex === other.ruleIndex && this.actionIndex === other.actionIndex;
  33631. }
  33632. };
  33633. // Implements the {@code channel} lexer action by calling
  33634. // {@link Lexer//setChannel} with the assigned channel.
  33635. // Constructs a new {@code channel} action with the specified channel value.
  33636. // @param channel The channel value to pass to {@link Lexer//setChannel}.
  33637. function LexerChannelAction(channel) {
  33638. LexerAction.call(this, LexerActionType.CHANNEL);
  33639. this.channel = channel;
  33640. return this;
  33641. }
  33642. LexerChannelAction.prototype = Object.create(LexerAction.prototype);
  33643. LexerChannelAction.prototype.constructor = LexerChannelAction;
  33644. // <p>This action is implemented by calling {@link Lexer//setChannel} with the
  33645. // value provided by {@link //getChannel}.</p>
  33646. LexerChannelAction.prototype.execute = function(lexer) {
  33647. lexer._channel = this.channel;
  33648. };
  33649. LexerChannelAction.prototype.updateHashCode = function(hash) {
  33650. hash.update(this.actionType, this.channel);
  33651. };
  33652. LexerChannelAction.prototype.equals = function(other) {
  33653. if (this === other) {
  33654. return true;
  33655. } else if (! (other instanceof LexerChannelAction)) {
  33656. return false;
  33657. } else {
  33658. return this.channel === other.channel;
  33659. }
  33660. };
  33661. LexerChannelAction.prototype.toString = function() {
  33662. return "channel(" + this.channel + ")";
  33663. };
  33664. // This implementation of {@link LexerAction} is used for tracking input offsets
  33665. // for position-dependent actions within a {@link LexerActionExecutor}.
  33666. //
  33667. // <p>This action is not serialized as part of the ATN, and is only required for
  33668. // position-dependent lexer actions which appear at a location other than the
  33669. // end of a rule. For more information about DFA optimizations employed for
  33670. // lexer actions, see {@link LexerActionExecutor//append} and
  33671. // {@link LexerActionExecutor//fixOffsetBeforeMatch}.</p>
  33672. // Constructs a new indexed custom action by associating a character offset
  33673. // with a {@link LexerAction}.
  33674. //
  33675. // <p>Note: This class is only required for lexer actions for which
  33676. // {@link LexerAction//isPositionDependent} returns {@code true}.</p>
  33677. //
  33678. // @param offset The offset into the input {@link CharStream}, relative to
  33679. // the token start index, at which the specified lexer action should be
  33680. // executed.
  33681. // @param action The lexer action to execute at a particular offset in the
  33682. // input {@link CharStream}.
  33683. function LexerIndexedCustomAction(offset, action) {
  33684. LexerAction.call(this, action.actionType);
  33685. this.offset = offset;
  33686. this.action = action;
  33687. this.isPositionDependent = true;
  33688. return this;
  33689. }
  33690. LexerIndexedCustomAction.prototype = Object.create(LexerAction.prototype);
  33691. LexerIndexedCustomAction.prototype.constructor = LexerIndexedCustomAction;
  33692. // <p>This method calls {@link //execute} on the result of {@link //getAction}
  33693. // using the provided {@code lexer}.</p>
  33694. LexerIndexedCustomAction.prototype.execute = function(lexer) {
  33695. // assume the input stream position was properly set by the calling code
  33696. this.action.execute(lexer);
  33697. };
  33698. LexerIndexedCustomAction.prototype.updateHashCode = function(hash) {
  33699. hash.update(this.actionType, this.offset, this.action);
  33700. };
  33701. LexerIndexedCustomAction.prototype.equals = function(other) {
  33702. if (this === other) {
  33703. return true;
  33704. } else if (! (other instanceof LexerIndexedCustomAction)) {
  33705. return false;
  33706. } else {
  33707. return this.offset === other.offset && this.action === other.action;
  33708. }
  33709. };
  33710. exports.LexerActionType = LexerActionType;
  33711. exports.LexerSkipAction = LexerSkipAction;
  33712. exports.LexerChannelAction = LexerChannelAction;
  33713. exports.LexerCustomAction = LexerCustomAction;
  33714. exports.LexerIndexedCustomAction = LexerIndexedCustomAction;
  33715. exports.LexerMoreAction = LexerMoreAction;
  33716. exports.LexerTypeAction = LexerTypeAction;
  33717. exports.LexerPushModeAction = LexerPushModeAction;
  33718. exports.LexerPopModeAction = LexerPopModeAction;
  33719. exports.LexerModeAction = LexerModeAction;
  33720. /***/ }),
  33721. /***/ "./node_modules/antlr4/atn/LexerActionExecutor.js":
  33722. /*!********************************************************!*\
  33723. !*** ./node_modules/antlr4/atn/LexerActionExecutor.js ***!
  33724. \********************************************************/
  33725. /*! no static exports found */
  33726. /***/ (function(module, exports, __webpack_require__) {
  33727. //
  33728. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33729. * Use of this file is governed by the BSD 3-clause license that
  33730. * can be found in the LICENSE.txt file in the project root.
  33731. */
  33732. ///
  33733. // Represents an executor for a sequence of lexer actions which traversed during
  33734. // the matching operation of a lexer rule (token).
  33735. //
  33736. // <p>The executor tracks position information for position-dependent lexer actions
  33737. // efficiently, ensuring that actions appearing only at the end of the rule do
  33738. // not cause bloating of the {@link DFA} created for the lexer.</p>
  33739. var hashStuff = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  33740. var LexerIndexedCustomAction = __webpack_require__(/*! ./LexerAction */ "./node_modules/antlr4/atn/LexerAction.js").LexerIndexedCustomAction;
  33741. function LexerActionExecutor(lexerActions) {
  33742. this.lexerActions = lexerActions === null ? [] : lexerActions;
  33743. // Caches the result of {@link //hashCode} since the hash code is an element
  33744. // of the performance-critical {@link LexerATNConfig//hashCode} operation.
  33745. this.cachedHashCode = hashStuff(lexerActions); // "".join([str(la) for la in
  33746. // lexerActions]))
  33747. return this;
  33748. }
  33749. // Creates a {@link LexerActionExecutor} which executes the actions for
  33750. // the input {@code lexerActionExecutor} followed by a specified
  33751. // {@code lexerAction}.
  33752. //
  33753. // @param lexerActionExecutor The executor for actions already traversed by
  33754. // the lexer while matching a token within a particular
  33755. // {@link LexerATNConfig}. If this is {@code null}, the method behaves as
  33756. // though it were an empty executor.
  33757. // @param lexerAction The lexer action to execute after the actions
  33758. // specified in {@code lexerActionExecutor}.
  33759. //
  33760. // @return A {@link LexerActionExecutor} for executing the combine actions
  33761. // of {@code lexerActionExecutor} and {@code lexerAction}.
  33762. LexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {
  33763. if (lexerActionExecutor === null) {
  33764. return new LexerActionExecutor([ lexerAction ]);
  33765. }
  33766. var lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);
  33767. return new LexerActionExecutor(lexerActions);
  33768. };
  33769. // Creates a {@link LexerActionExecutor} which encodes the current offset
  33770. // for position-dependent lexer actions.
  33771. //
  33772. // <p>Normally, when the executor encounters lexer actions where
  33773. // {@link LexerAction//isPositionDependent} returns {@code true}, it calls
  33774. // {@link IntStream//seek} on the input {@link CharStream} to set the input
  33775. // position to the <em>end</em> of the current token. This behavior provides
  33776. // for efficient DFA representation of lexer actions which appear at the end
  33777. // of a lexer rule, even when the lexer rule matches a variable number of
  33778. // characters.</p>
  33779. //
  33780. // <p>Prior to traversing a match transition in the ATN, the current offset
  33781. // from the token start index is assigned to all position-dependent lexer
  33782. // actions which have not already been assigned a fixed offset. By storing
  33783. // the offsets relative to the token start index, the DFA representation of
  33784. // lexer actions which appear in the middle of tokens remains efficient due
  33785. // to sharing among tokens of the same length, regardless of their absolute
  33786. // position in the input stream.</p>
  33787. //
  33788. // <p>If the current executor already has offsets assigned to all
  33789. // position-dependent lexer actions, the method returns {@code this}.</p>
  33790. //
  33791. // @param offset The current offset to assign to all position-dependent
  33792. // lexer actions which do not already have offsets assigned.
  33793. //
  33794. // @return A {@link LexerActionExecutor} which stores input stream offsets
  33795. // for all position-dependent lexer actions.
  33796. // /
  33797. LexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {
  33798. var updatedLexerActions = null;
  33799. for (var i = 0; i < this.lexerActions.length; i++) {
  33800. if (this.lexerActions[i].isPositionDependent &&
  33801. !(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {
  33802. if (updatedLexerActions === null) {
  33803. updatedLexerActions = this.lexerActions.concat([]);
  33804. }
  33805. updatedLexerActions[i] = new LexerIndexedCustomAction(offset,
  33806. this.lexerActions[i]);
  33807. }
  33808. }
  33809. if (updatedLexerActions === null) {
  33810. return this;
  33811. } else {
  33812. return new LexerActionExecutor(updatedLexerActions);
  33813. }
  33814. };
  33815. // Execute the actions encapsulated by this executor within the context of a
  33816. // particular {@link Lexer}.
  33817. //
  33818. // <p>This method calls {@link IntStream//seek} to set the position of the
  33819. // {@code input} {@link CharStream} prior to calling
  33820. // {@link LexerAction//execute} on a position-dependent action. Before the
  33821. // method returns, the input position will be restored to the same position
  33822. // it was in when the method was invoked.</p>
  33823. //
  33824. // @param lexer The lexer instance.
  33825. // @param input The input stream which is the source for the current token.
  33826. // When this method is called, the current {@link IntStream//index} for
  33827. // {@code input} should be the start of the following token, i.e. 1
  33828. // character past the end of the current token.
  33829. // @param startIndex The token start index. This value may be passed to
  33830. // {@link IntStream//seek} to set the {@code input} position to the beginning
  33831. // of the token.
  33832. // /
  33833. LexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {
  33834. var requiresSeek = false;
  33835. var stopIndex = input.index;
  33836. try {
  33837. for (var i = 0; i < this.lexerActions.length; i++) {
  33838. var lexerAction = this.lexerActions[i];
  33839. if (lexerAction instanceof LexerIndexedCustomAction) {
  33840. var offset = lexerAction.offset;
  33841. input.seek(startIndex + offset);
  33842. lexerAction = lexerAction.action;
  33843. requiresSeek = (startIndex + offset) !== stopIndex;
  33844. } else if (lexerAction.isPositionDependent) {
  33845. input.seek(stopIndex);
  33846. requiresSeek = false;
  33847. }
  33848. lexerAction.execute(lexer);
  33849. }
  33850. } finally {
  33851. if (requiresSeek) {
  33852. input.seek(stopIndex);
  33853. }
  33854. }
  33855. };
  33856. LexerActionExecutor.prototype.hashCode = function() {
  33857. return this.cachedHashCode;
  33858. };
  33859. LexerActionExecutor.prototype.updateHashCode = function(hash) {
  33860. hash.update(this.cachedHashCode);
  33861. };
  33862. LexerActionExecutor.prototype.equals = function(other) {
  33863. if (this === other) {
  33864. return true;
  33865. } else if (!(other instanceof LexerActionExecutor)) {
  33866. return false;
  33867. } else if (this.cachedHashCode != other.cachedHashCode) {
  33868. return false;
  33869. } else if (this.lexerActions.length != other.lexerActions.length) {
  33870. return false;
  33871. } else {
  33872. var numActions = this.lexerActions.length
  33873. for (var idx = 0; idx < numActions; ++idx) {
  33874. if (!this.lexerActions[idx].equals(other.lexerActions[idx])) {
  33875. return false;
  33876. }
  33877. }
  33878. return true;
  33879. }
  33880. };
  33881. exports.LexerActionExecutor = LexerActionExecutor;
  33882. /***/ }),
  33883. /***/ "./node_modules/antlr4/atn/ParserATNSimulator.js":
  33884. /*!*******************************************************!*\
  33885. !*** ./node_modules/antlr4/atn/ParserATNSimulator.js ***!
  33886. \*******************************************************/
  33887. /*! no static exports found */
  33888. /***/ (function(module, exports, __webpack_require__) {
  33889. //
  33890. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  33891. * Use of this file is governed by the BSD 3-clause license that
  33892. * can be found in the LICENSE.txt file in the project root.
  33893. */
  33894. //
  33895. //
  33896. // The embodiment of the adaptive LL(*), ALL(*), parsing strategy.
  33897. //
  33898. // <p>
  33899. // The basic complexity of the adaptive strategy makes it harder to understand.
  33900. // We begin with ATN simulation to build paths in a DFA. Subsequent prediction
  33901. // requests go through the DFA first. If they reach a state without an edge for
  33902. // the current symbol, the algorithm fails over to the ATN simulation to
  33903. // complete the DFA path for the current input (until it finds a conflict state
  33904. // or uniquely predicting state).</p>
  33905. //
  33906. // <p>
  33907. // All of that is done without using the outer context because we want to create
  33908. // a DFA that is not dependent upon the rule invocation stack when we do a
  33909. // prediction. One DFA works in all contexts. We avoid using context not
  33910. // necessarily because it's slower, although it can be, but because of the DFA
  33911. // caching problem. The closure routine only considers the rule invocation stack
  33912. // created during prediction beginning in the decision rule. For example, if
  33913. // prediction occurs without invoking another rule's ATN, there are no context
  33914. // stacks in the configurations. When lack of context leads to a conflict, we
  33915. // don't know if it's an ambiguity or a weakness in the strong LL(*) parsing
  33916. // strategy (versus full LL(*)).</p>
  33917. //
  33918. // <p>
  33919. // When SLL yields a configuration set with conflict, we rewind the input and
  33920. // retry the ATN simulation, this time using full outer context without adding
  33921. // to the DFA. Configuration context stacks will be the full invocation stacks
  33922. // from the start rule. If we get a conflict using full context, then we can
  33923. // definitively say we have a true ambiguity for that input sequence. If we
  33924. // don't get a conflict, it implies that the decision is sensitive to the outer
  33925. // context. (It is not context-sensitive in the sense of context-sensitive
  33926. // grammars.)</p>
  33927. //
  33928. // <p>
  33929. // The next time we reach this DFA state with an SLL conflict, through DFA
  33930. // simulation, we will again retry the ATN simulation using full context mode.
  33931. // This is slow because we can't save the results and have to "interpret" the
  33932. // ATN each time we get that input.</p>
  33933. //
  33934. // <p>
  33935. // <strong>CACHING FULL CONTEXT PREDICTIONS</strong></p>
  33936. //
  33937. // <p>
  33938. // We could cache results from full context to predicted alternative easily and
  33939. // that saves a lot of time but doesn't work in presence of predicates. The set
  33940. // of visible predicates from the ATN start state changes depending on the
  33941. // context, because closure can fall off the end of a rule. I tried to cache
  33942. // tuples (stack context, semantic context, predicted alt) but it was slower
  33943. // than interpreting and much more complicated. Also required a huge amount of
  33944. // memory. The goal is not to create the world's fastest parser anyway. I'd like
  33945. // to keep this algorithm simple. By launching multiple threads, we can improve
  33946. // the speed of parsing across a large number of files.</p>
  33947. //
  33948. // <p>
  33949. // There is no strict ordering between the amount of input used by SLL vs LL,
  33950. // which makes it really hard to build a cache for full context. Let's say that
  33951. // we have input A B C that leads to an SLL conflict with full context X. That
  33952. // implies that using X we might only use A B but we could also use A B C D to
  33953. // resolve conflict. Input A B C D could predict alternative 1 in one position
  33954. // in the input and A B C E could predict alternative 2 in another position in
  33955. // input. The conflicting SLL configurations could still be non-unique in the
  33956. // full context prediction, which would lead us to requiring more input than the
  33957. // original A B C. To make a prediction cache work, we have to track the exact
  33958. // input used during the previous prediction. That amounts to a cache that maps
  33959. // X to a specific DFA for that context.</p>
  33960. //
  33961. // <p>
  33962. // Something should be done for left-recursive expression predictions. They are
  33963. // likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry
  33964. // with full LL thing Sam does.</p>
  33965. //
  33966. // <p>
  33967. // <strong>AVOIDING FULL CONTEXT PREDICTION</strong></p>
  33968. //
  33969. // <p>
  33970. // We avoid doing full context retry when the outer context is empty, we did not
  33971. // dip into the outer context by falling off the end of the decision state rule,
  33972. // or when we force SLL mode.</p>
  33973. //
  33974. // <p>
  33975. // As an example of the not dip into outer context case, consider as super
  33976. // constructor calls versus function calls. One grammar might look like
  33977. // this:</p>
  33978. //
  33979. // <pre>
  33980. // ctorBody
  33981. // : '{' superCall? stat* '}'
  33982. // ;
  33983. // </pre>
  33984. //
  33985. // <p>
  33986. // Or, you might see something like</p>
  33987. //
  33988. // <pre>
  33989. // stat
  33990. // : superCall ';'
  33991. // | expression ';'
  33992. // | ...
  33993. // ;
  33994. // </pre>
  33995. //
  33996. // <p>
  33997. // In both cases I believe that no closure operations will dip into the outer
  33998. // context. In the first case ctorBody in the worst case will stop at the '}'.
  33999. // In the 2nd case it should stop at the ';'. Both cases should stay within the
  34000. // entry rule and not dip into the outer context.</p>
  34001. //
  34002. // <p>
  34003. // <strong>PREDICATES</strong></p>
  34004. //
  34005. // <p>
  34006. // Predicates are always evaluated if present in either SLL or LL both. SLL and
  34007. // LL simulation deals with predicates differently. SLL collects predicates as
  34008. // it performs closure operations like ANTLR v3 did. It delays predicate
  34009. // evaluation until it reaches and accept state. This allows us to cache the SLL
  34010. // ATN simulation whereas, if we had evaluated predicates on-the-fly during
  34011. // closure, the DFA state configuration sets would be different and we couldn't
  34012. // build up a suitable DFA.</p>
  34013. //
  34014. // <p>
  34015. // When building a DFA accept state during ATN simulation, we evaluate any
  34016. // predicates and return the sole semantically valid alternative. If there is
  34017. // more than 1 alternative, we report an ambiguity. If there are 0 alternatives,
  34018. // we throw an exception. Alternatives without predicates act like they have
  34019. // true predicates. The simple way to think about it is to strip away all
  34020. // alternatives with false predicates and choose the minimum alternative that
  34021. // remains.</p>
  34022. //
  34023. // <p>
  34024. // When we start in the DFA and reach an accept state that's predicated, we test
  34025. // those and return the minimum semantically viable alternative. If no
  34026. // alternatives are viable, we throw an exception.</p>
  34027. //
  34028. // <p>
  34029. // During full LL ATN simulation, closure always evaluates predicates and
  34030. // on-the-fly. This is crucial to reducing the configuration set size during
  34031. // closure. It hits a landmine when parsing with the Java grammar, for example,
  34032. // without this on-the-fly evaluation.</p>
  34033. //
  34034. // <p>
  34035. // <strong>SHARING DFA</strong></p>
  34036. //
  34037. // <p>
  34038. // All instances of the same parser share the same decision DFAs through a
  34039. // static field. Each instance gets its own ATN simulator but they share the
  34040. // same {@link //decisionToDFA} field. They also share a
  34041. // {@link PredictionContextCache} object that makes sure that all
  34042. // {@link PredictionContext} objects are shared among the DFA states. This makes
  34043. // a big size difference.</p>
  34044. //
  34045. // <p>
  34046. // <strong>THREAD SAFETY</strong></p>
  34047. //
  34048. // <p>
  34049. // The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when
  34050. // it adds a new DFA object to that array. {@link //addDFAEdge}
  34051. // locks on the DFA for the current decision when setting the
  34052. // {@link DFAState//edges} field. {@link //addDFAState} locks on
  34053. // the DFA for the current decision when looking up a DFA state to see if it
  34054. // already exists. We must make sure that all requests to add DFA states that
  34055. // are equivalent result in the same shared DFA object. This is because lots of
  34056. // threads will be trying to update the DFA at once. The
  34057. // {@link //addDFAState} method also locks inside the DFA lock
  34058. // but this time on the shared context cache when it rebuilds the
  34059. // configurations' {@link PredictionContext} objects using cached
  34060. // subgraphs/nodes. No other locking occurs, even during DFA simulation. This is
  34061. // safe as long as we can guarantee that all threads referencing
  34062. // {@code s.edge[t]} get the same physical target {@link DFAState}, or
  34063. // {@code null}. Once into the DFA, the DFA simulation does not reference the
  34064. // {@link DFA//states} map. It follows the {@link DFAState//edges} field to new
  34065. // targets. The DFA simulator will either find {@link DFAState//edges} to be
  34066. // {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or
  34067. // {@code dfa.edges[t]} to be non-null. The
  34068. // {@link //addDFAEdge} method could be racing to set the field
  34069. // but in either case the DFA simulator works; if {@code null}, and requests ATN
  34070. // simulation. It could also race trying to get {@code dfa.edges[t]}, but either
  34071. // way it will work because it's not doing a test and set operation.</p>
  34072. //
  34073. // <p>
  34074. // <strong>Starting with SLL then failing to combined SLL/LL (Two-Stage
  34075. // Parsing)</strong></p>
  34076. //
  34077. // <p>
  34078. // Sam pointed out that if SLL does not give a syntax error, then there is no
  34079. // point in doing full LL, which is slower. We only have to try LL if we get a
  34080. // syntax error. For maximum speed, Sam starts the parser set to pure SLL
  34081. // mode with the {@link BailErrorStrategy}:</p>
  34082. //
  34083. // <pre>
  34084. // parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};
  34085. // parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());
  34086. // </pre>
  34087. //
  34088. // <p>
  34089. // If it does not get a syntax error, then we're done. If it does get a syntax
  34090. // error, we need to retry with the combined SLL/LL strategy.</p>
  34091. //
  34092. // <p>
  34093. // The reason this works is as follows. If there are no SLL conflicts, then the
  34094. // grammar is SLL (at least for that input set). If there is an SLL conflict,
  34095. // the full LL analysis must yield a set of viable alternatives which is a
  34096. // subset of the alternatives reported by SLL. If the LL set is a singleton,
  34097. // then the grammar is LL but not SLL. If the LL set is the same size as the SLL
  34098. // set, the decision is SLL. If the LL set has size &gt; 1, then that decision
  34099. // is truly ambiguous on the current input. If the LL set is smaller, then the
  34100. // SLL conflict resolution might choose an alternative that the full LL would
  34101. // rule out as a possibility based upon better context information. If that's
  34102. // the case, then the SLL parse will definitely get an error because the full LL
  34103. // analysis says it's not viable. If SLL conflict resolution chooses an
  34104. // alternative within the LL set, them both SLL and LL would choose the same
  34105. // alternative because they both choose the minimum of multiple conflicting
  34106. // alternatives.</p>
  34107. //
  34108. // <p>
  34109. // Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and
  34110. // a smaller LL set called <em>s</em>. If <em>s</em> is {@code {2, 3}}, then SLL
  34111. // parsing will get an error because SLL will pursue alternative 1. If
  34112. // <em>s</em> is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will
  34113. // choose the same alternative because alternative one is the minimum of either
  34114. // set. If <em>s</em> is {@code {2}} or {@code {3}} then SLL will get a syntax
  34115. // error. If <em>s</em> is {@code {1}} then SLL will succeed.</p>
  34116. //
  34117. // <p>
  34118. // Of course, if the input is invalid, then we will get an error for sure in
  34119. // both SLL and LL parsing. Erroneous input will therefore require 2 passes over
  34120. // the input.</p>
  34121. //
  34122. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  34123. var Set = Utils.Set;
  34124. var BitSet = Utils.BitSet;
  34125. var DoubleDict = Utils.DoubleDict;
  34126. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  34127. var ATNState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  34128. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  34129. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  34130. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  34131. var DFAState = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  34132. var PredPrediction = __webpack_require__(/*! ./../dfa/DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  34133. var ATNSimulator = __webpack_require__(/*! ./ATNSimulator */ "./node_modules/antlr4/atn/ATNSimulator.js").ATNSimulator;
  34134. var PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  34135. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  34136. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  34137. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  34138. var StarLoopEntryState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  34139. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  34140. var PredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").PredictionContext;
  34141. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  34142. var Transitions = __webpack_require__(/*! ./Transition */ "./node_modules/antlr4/atn/Transition.js");
  34143. var Transition = Transitions.Transition;
  34144. var SetTransition = Transitions.SetTransition;
  34145. var NotSetTransition = Transitions.NotSetTransition;
  34146. var RuleTransition = Transitions.RuleTransition;
  34147. var ActionTransition = Transitions.ActionTransition;
  34148. var NoViableAltException = __webpack_require__(/*! ./../error/Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  34149. var SingletonPredictionContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").SingletonPredictionContext;
  34150. var predictionContextFromRuleContext = __webpack_require__(/*! ./../PredictionContext */ "./node_modules/antlr4/PredictionContext.js").predictionContextFromRuleContext;
  34151. function ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {
  34152. ATNSimulator.call(this, atn, sharedContextCache);
  34153. this.parser = parser;
  34154. this.decisionToDFA = decisionToDFA;
  34155. // SLL, LL, or LL + exact ambig detection?//
  34156. this.predictionMode = PredictionMode.LL;
  34157. // LAME globals to avoid parameters!!!!! I need these down deep in predTransition
  34158. this._input = null;
  34159. this._startIndex = 0;
  34160. this._outerContext = null;
  34161. this._dfa = null;
  34162. // Each prediction operation uses a cache for merge of prediction contexts.
  34163. // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap
  34164. // isn't synchronized but we're ok since two threads shouldn't reuse same
  34165. // parser/atnsim object because it can only handle one input at a time.
  34166. // This maps graphs a and b to merged result c. (a,b)&rarr;c. We can avoid
  34167. // the merge if we ever see a and b again. Note that (b,a)&rarr;c should
  34168. // also be examined during cache lookup.
  34169. //
  34170. this.mergeCache = null;
  34171. return this;
  34172. }
  34173. ParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);
  34174. ParserATNSimulator.prototype.constructor = ParserATNSimulator;
  34175. ParserATNSimulator.prototype.debug = false;
  34176. ParserATNSimulator.prototype.debug_closure = false;
  34177. ParserATNSimulator.prototype.debug_add = false;
  34178. ParserATNSimulator.prototype.debug_list_atn_decisions = false;
  34179. ParserATNSimulator.prototype.dfa_debug = false;
  34180. ParserATNSimulator.prototype.retry_debug = false;
  34181. ParserATNSimulator.prototype.reset = function() {
  34182. };
  34183. ParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {
  34184. if (this.debug || this.debug_list_atn_decisions) {
  34185. console.log("adaptivePredict decision " + decision +
  34186. " exec LA(1)==" + this.getLookaheadName(input) +
  34187. " line " + input.LT(1).line + ":" +
  34188. input.LT(1).column);
  34189. }
  34190. this._input = input;
  34191. this._startIndex = input.index;
  34192. this._outerContext = outerContext;
  34193. var dfa = this.decisionToDFA[decision];
  34194. this._dfa = dfa;
  34195. var m = input.mark();
  34196. var index = input.index;
  34197. // Now we are certain to have a specific decision's DFA
  34198. // But, do we still need an initial state?
  34199. try {
  34200. var s0;
  34201. if (dfa.precedenceDfa) {
  34202. // the start state for a precedence DFA depends on the current
  34203. // parser precedence, and is provided by a DFA method.
  34204. s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());
  34205. } else {
  34206. // the start state for a "regular" DFA is just s0
  34207. s0 = dfa.s0;
  34208. }
  34209. if (s0===null) {
  34210. if (outerContext===null) {
  34211. outerContext = RuleContext.EMPTY;
  34212. }
  34213. if (this.debug || this.debug_list_atn_decisions) {
  34214. console.log("predictATN decision " + dfa.decision +
  34215. " exec LA(1)==" + this.getLookaheadName(input) +
  34216. ", outerContext=" + outerContext.toString(this.parser.ruleNames));
  34217. }
  34218. var fullCtx = false;
  34219. var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);
  34220. if( dfa.precedenceDfa) {
  34221. // If this is a precedence DFA, we use applyPrecedenceFilter
  34222. // to convert the computed start state to a precedence start
  34223. // state. We then use DFA.setPrecedenceStartState to set the
  34224. // appropriate start state for the precedence level rather
  34225. // than simply setting DFA.s0.
  34226. //
  34227. dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway
  34228. s0_closure = this.applyPrecedenceFilter(s0_closure);
  34229. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  34230. dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);
  34231. } else {
  34232. s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));
  34233. dfa.s0 = s0;
  34234. }
  34235. }
  34236. var alt = this.execATN(dfa, s0, input, index, outerContext);
  34237. if (this.debug) {
  34238. console.log("DFA after predictATN: " + dfa.toString(this.parser.literalNames));
  34239. }
  34240. return alt;
  34241. } finally {
  34242. this._dfa = null;
  34243. this.mergeCache = null; // wack cache after each prediction
  34244. input.seek(index);
  34245. input.release(m);
  34246. }
  34247. };
  34248. // Performs ATN simulation to compute a predicted alternative based
  34249. // upon the remaining input, but also updates the DFA cache to avoid
  34250. // having to traverse the ATN again for the same input sequence.
  34251. // There are some key conditions we're looking for after computing a new
  34252. // set of ATN configs (proposed DFA state):
  34253. // if the set is empty, there is no viable alternative for current symbol
  34254. // does the state uniquely predict an alternative?
  34255. // does the state have a conflict that would prevent us from
  34256. // putting it on the work list?
  34257. // We also have some key operations to do:
  34258. // add an edge from previous DFA state to potentially new DFA state, D,
  34259. // upon current symbol but only if adding to work list, which means in all
  34260. // cases except no viable alternative (and possibly non-greedy decisions?)
  34261. // collecting predicates and adding semantic context to DFA accept states
  34262. // adding rule context to context-sensitive DFA accept states
  34263. // consuming an input symbol
  34264. // reporting a conflict
  34265. // reporting an ambiguity
  34266. // reporting a context sensitivity
  34267. // reporting insufficient predicates
  34268. // cover these cases:
  34269. // dead end
  34270. // single alt
  34271. // single alt + preds
  34272. // conflict
  34273. // conflict + preds
  34274. //
  34275. ParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {
  34276. if (this.debug || this.debug_list_atn_decisions) {
  34277. console.log("execATN decision " + dfa.decision +
  34278. " exec LA(1)==" + this.getLookaheadName(input) +
  34279. " line " + input.LT(1).line + ":" + input.LT(1).column);
  34280. }
  34281. var alt;
  34282. var previousD = s0;
  34283. if (this.debug) {
  34284. console.log("s0 = " + s0);
  34285. }
  34286. var t = input.LA(1);
  34287. while(true) { // while more work
  34288. var D = this.getExistingTargetState(previousD, t);
  34289. if(D===null) {
  34290. D = this.computeTargetState(dfa, previousD, t);
  34291. }
  34292. if(D===ATNSimulator.ERROR) {
  34293. // if any configs in previous dipped into outer context, that
  34294. // means that input up to t actually finished entry rule
  34295. // at least for SLL decision. Full LL doesn't dip into outer
  34296. // so don't need special case.
  34297. // We will get an error no matter what so delay until after
  34298. // decision; better error message. Also, no reachable target
  34299. // ATN states in SLL implies LL will also get nowhere.
  34300. // If conflict in states that dip out, choose min since we
  34301. // will get error no matter what.
  34302. var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);
  34303. input.seek(startIndex);
  34304. alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);
  34305. if(alt!==ATN.INVALID_ALT_NUMBER) {
  34306. return alt;
  34307. } else {
  34308. throw e;
  34309. }
  34310. }
  34311. if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {
  34312. // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)
  34313. var conflictingAlts = null;
  34314. if (D.predicates!==null) {
  34315. if (this.debug) {
  34316. console.log("DFA state has preds in DFA sim LL failover");
  34317. }
  34318. var conflictIndex = input.index;
  34319. if(conflictIndex !== startIndex) {
  34320. input.seek(startIndex);
  34321. }
  34322. conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);
  34323. if (conflictingAlts.length===1) {
  34324. if(this.debug) {
  34325. console.log("Full LL avoided");
  34326. }
  34327. return conflictingAlts.minValue();
  34328. }
  34329. if (conflictIndex !== startIndex) {
  34330. // restore the index so reporting the fallback to full
  34331. // context occurs with the index at the correct spot
  34332. input.seek(conflictIndex);
  34333. }
  34334. }
  34335. if (this.dfa_debug) {
  34336. console.log("ctx sensitive state " + outerContext +" in " + D);
  34337. }
  34338. var fullCtx = true;
  34339. var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);
  34340. this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);
  34341. alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);
  34342. return alt;
  34343. }
  34344. if (D.isAcceptState) {
  34345. if (D.predicates===null) {
  34346. return D.prediction;
  34347. }
  34348. var stopIndex = input.index;
  34349. input.seek(startIndex);
  34350. var alts = this.evalSemanticContext(D.predicates, outerContext, true);
  34351. if (alts.length===0) {
  34352. throw this.noViableAlt(input, outerContext, D.configs, startIndex);
  34353. } else if (alts.length===1) {
  34354. return alts.minValue();
  34355. } else {
  34356. // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.
  34357. this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);
  34358. return alts.minValue();
  34359. }
  34360. }
  34361. previousD = D;
  34362. if (t !== Token.EOF) {
  34363. input.consume();
  34364. t = input.LA(1);
  34365. }
  34366. }
  34367. };
  34368. //
  34369. // Get an existing target state for an edge in the DFA. If the target state
  34370. // for the edge has not yet been computed or is otherwise not available,
  34371. // this method returns {@code null}.
  34372. //
  34373. // @param previousD The current DFA state
  34374. // @param t The next input symbol
  34375. // @return The existing target DFA state for the given input symbol
  34376. // {@code t}, or {@code null} if the target state for this edge is not
  34377. // already cached
  34378. //
  34379. ParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {
  34380. var edges = previousD.edges;
  34381. if (edges===null) {
  34382. return null;
  34383. } else {
  34384. return edges[t + 1] || null;
  34385. }
  34386. };
  34387. //
  34388. // Compute a target state for an edge in the DFA, and attempt to add the
  34389. // computed state and corresponding edge to the DFA.
  34390. //
  34391. // @param dfa The DFA
  34392. // @param previousD The current DFA state
  34393. // @param t The next input symbol
  34394. //
  34395. // @return The computed target DFA state for the given input symbol
  34396. // {@code t}. If {@code t} does not lead to a valid DFA state, this method
  34397. // returns {@link //ERROR}.
  34398. //
  34399. ParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {
  34400. var reach = this.computeReachSet(previousD.configs, t, false);
  34401. if(reach===null) {
  34402. this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);
  34403. return ATNSimulator.ERROR;
  34404. }
  34405. // create new target state; we'll add to DFA after it's complete
  34406. var D = new DFAState(null, reach);
  34407. var predictedAlt = this.getUniqueAlt(reach);
  34408. if (this.debug) {
  34409. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  34410. console.log("SLL altSubSets=" + Utils.arrayToString(altSubSets) +
  34411. ", previous=" + previousD.configs +
  34412. ", configs=" + reach +
  34413. ", predict=" + predictedAlt +
  34414. ", allSubsetsConflict=" +
  34415. PredictionMode.allSubsetsConflict(altSubSets) + ", conflictingAlts=" +
  34416. this.getConflictingAlts(reach));
  34417. }
  34418. if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {
  34419. // NO CONFLICT, UNIQUELY PREDICTED ALT
  34420. D.isAcceptState = true;
  34421. D.configs.uniqueAlt = predictedAlt;
  34422. D.prediction = predictedAlt;
  34423. } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {
  34424. // MORE THAN ONE VIABLE ALTERNATIVE
  34425. D.configs.conflictingAlts = this.getConflictingAlts(reach);
  34426. D.requiresFullContext = true;
  34427. // in SLL-only mode, we will stop at this state and return the minimum alt
  34428. D.isAcceptState = true;
  34429. D.prediction = D.configs.conflictingAlts.minValue();
  34430. }
  34431. if (D.isAcceptState && D.configs.hasSemanticContext) {
  34432. this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));
  34433. if( D.predicates!==null) {
  34434. D.prediction = ATN.INVALID_ALT_NUMBER;
  34435. }
  34436. }
  34437. // all adds to dfa are done after we've created full D state
  34438. D = this.addDFAEdge(dfa, previousD, t, D);
  34439. return D;
  34440. };
  34441. ParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {
  34442. // We need to test all predicates, even in DFA states that
  34443. // uniquely predict alternative.
  34444. var nalts = decisionState.transitions.length;
  34445. // Update DFA so reach becomes accept state with (predicate,alt)
  34446. // pairs if preds found for conflicting alts
  34447. var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);
  34448. var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);
  34449. if (altToPred!==null) {
  34450. dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);
  34451. dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds
  34452. } else {
  34453. // There are preds in configs but they might go away
  34454. // when OR'd together like {p}? || NONE == NONE. If neither
  34455. // alt has preds, resolve to min alt
  34456. dfaState.prediction = altsToCollectPredsFrom.minValue();
  34457. }
  34458. };
  34459. // comes back with reach.uniqueAlt set to a valid alt
  34460. ParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over
  34461. s0,
  34462. input,
  34463. startIndex,
  34464. outerContext) {
  34465. if (this.debug || this.debug_list_atn_decisions) {
  34466. console.log("execATNWithFullContext "+s0);
  34467. }
  34468. var fullCtx = true;
  34469. var foundExactAmbig = false;
  34470. var reach = null;
  34471. var previous = s0;
  34472. input.seek(startIndex);
  34473. var t = input.LA(1);
  34474. var predictedAlt = -1;
  34475. while (true) { // while more work
  34476. reach = this.computeReachSet(previous, t, fullCtx);
  34477. if (reach===null) {
  34478. // if any configs in previous dipped into outer context, that
  34479. // means that input up to t actually finished entry rule
  34480. // at least for LL decision. Full LL doesn't dip into outer
  34481. // so don't need special case.
  34482. // We will get an error no matter what so delay until after
  34483. // decision; better error message. Also, no reachable target
  34484. // ATN states in SLL implies LL will also get nowhere.
  34485. // If conflict in states that dip out, choose min since we
  34486. // will get error no matter what.
  34487. var e = this.noViableAlt(input, outerContext, previous, startIndex);
  34488. input.seek(startIndex);
  34489. var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);
  34490. if(alt!==ATN.INVALID_ALT_NUMBER) {
  34491. return alt;
  34492. } else {
  34493. throw e;
  34494. }
  34495. }
  34496. var altSubSets = PredictionMode.getConflictingAltSubsets(reach);
  34497. if(this.debug) {
  34498. console.log("LL altSubSets=" + altSubSets + ", predict=" +
  34499. PredictionMode.getUniqueAlt(altSubSets) + ", resolvesToJustOneViableAlt=" +
  34500. PredictionMode.resolvesToJustOneViableAlt(altSubSets));
  34501. }
  34502. reach.uniqueAlt = this.getUniqueAlt(reach);
  34503. // unique prediction?
  34504. if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {
  34505. predictedAlt = reach.uniqueAlt;
  34506. break;
  34507. } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {
  34508. predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);
  34509. if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {
  34510. break;
  34511. }
  34512. } else {
  34513. // In exact ambiguity mode, we never try to terminate early.
  34514. // Just keeps scarfing until we know what the conflict is
  34515. if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {
  34516. foundExactAmbig = true;
  34517. predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);
  34518. break;
  34519. }
  34520. // else there are multiple non-conflicting subsets or
  34521. // we're not sure what the ambiguity is yet.
  34522. // So, keep going.
  34523. }
  34524. previous = reach;
  34525. if( t !== Token.EOF) {
  34526. input.consume();
  34527. t = input.LA(1);
  34528. }
  34529. }
  34530. // If the configuration set uniquely predicts an alternative,
  34531. // without conflict, then we know that it's a full LL decision
  34532. // not SLL.
  34533. if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {
  34534. this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);
  34535. return predictedAlt;
  34536. }
  34537. // We do not check predicates here because we have checked them
  34538. // on-the-fly when doing full context prediction.
  34539. //
  34540. // In non-exact ambiguity detection mode, we might actually be able to
  34541. // detect an exact ambiguity, but I'm not going to spend the cycles
  34542. // needed to check. We only emit ambiguity warnings in exact ambiguity
  34543. // mode.
  34544. //
  34545. // For example, we might know that we have conflicting configurations.
  34546. // But, that does not mean that there is no way forward without a
  34547. // conflict. It's possible to have nonconflicting alt subsets as in:
  34548. // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]
  34549. // from
  34550. //
  34551. // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),
  34552. // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]
  34553. //
  34554. // In this case, (17,1,[5 $]) indicates there is some next sequence that
  34555. // would resolve this without conflict to alternative 1. Any other viable
  34556. // next sequence, however, is associated with a conflict. We stop
  34557. // looking for input because no amount of further lookahead will alter
  34558. // the fact that we should predict alternative 1. We just can't say for
  34559. // sure that there is an ambiguity without looking further.
  34560. this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);
  34561. return predictedAlt;
  34562. };
  34563. ParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {
  34564. if (this.debug) {
  34565. console.log("in computeReachSet, starting closure: " + closure);
  34566. }
  34567. if( this.mergeCache===null) {
  34568. this.mergeCache = new DoubleDict();
  34569. }
  34570. var intermediate = new ATNConfigSet(fullCtx);
  34571. // Configurations already in a rule stop state indicate reaching the end
  34572. // of the decision rule (local context) or end of the start rule (full
  34573. // context). Once reached, these configurations are never updated by a
  34574. // closure operation, so they are handled separately for the performance
  34575. // advantage of having a smaller intermediate set when calling closure.
  34576. //
  34577. // For full-context reach operations, separate handling is required to
  34578. // ensure that the alternative matching the longest overall sequence is
  34579. // chosen when multiple such configurations can match the input.
  34580. var skippedStopStates = null;
  34581. // First figure out where we can reach on input t
  34582. for (var i=0; i<closure.items.length;i++) {
  34583. var c = closure.items[i];
  34584. if(this.debug_add) {
  34585. console.log("testing " + this.getTokenName(t) + " at " + c);
  34586. }
  34587. if (c.state instanceof RuleStopState) {
  34588. if (fullCtx || t === Token.EOF) {
  34589. if (skippedStopStates===null) {
  34590. skippedStopStates = [];
  34591. }
  34592. skippedStopStates.push(c);
  34593. if(this.debug_add) {
  34594. console.log("added " + c + " to skippedStopStates");
  34595. }
  34596. }
  34597. continue;
  34598. }
  34599. for(var j=0;j<c.state.transitions.length;j++) {
  34600. var trans = c.state.transitions[j];
  34601. var target = this.getReachableTarget(trans, t);
  34602. if (target!==null) {
  34603. var cfg = new ATNConfig({state:target}, c);
  34604. intermediate.add(cfg, this.mergeCache);
  34605. if(this.debug_add) {
  34606. console.log("added " + cfg + " to intermediate");
  34607. }
  34608. }
  34609. }
  34610. }
  34611. // Now figure out where the reach operation can take us...
  34612. var reach = null;
  34613. // This block optimizes the reach operation for intermediate sets which
  34614. // trivially indicate a termination state for the overall
  34615. // adaptivePredict operation.
  34616. //
  34617. // The conditions assume that intermediate
  34618. // contains all configurations relevant to the reach set, but this
  34619. // condition is not true when one or more configurations have been
  34620. // withheld in skippedStopStates, or when the current symbol is EOF.
  34621. //
  34622. if (skippedStopStates===null && t!==Token.EOF) {
  34623. if (intermediate.items.length===1) {
  34624. // Don't pursue the closure if there is just one state.
  34625. // It can only have one alternative; just add to result
  34626. // Also don't pursue the closure if there is unique alternative
  34627. // among the configurations.
  34628. reach = intermediate;
  34629. } else if (this.getUniqueAlt(intermediate)!==ATN.INVALID_ALT_NUMBER) {
  34630. // Also don't pursue the closure if there is unique alternative
  34631. // among the configurations.
  34632. reach = intermediate;
  34633. }
  34634. }
  34635. // If the reach set could not be trivially determined, perform a closure
  34636. // operation on the intermediate set to compute its initial value.
  34637. //
  34638. if (reach===null) {
  34639. reach = new ATNConfigSet(fullCtx);
  34640. var closureBusy = new Set();
  34641. var treatEofAsEpsilon = t === Token.EOF;
  34642. for (var k=0; k<intermediate.items.length;k++) {
  34643. this.closure(intermediate.items[k], reach, closureBusy, false, fullCtx, treatEofAsEpsilon);
  34644. }
  34645. }
  34646. if (t === Token.EOF) {
  34647. // After consuming EOF no additional input is possible, so we are
  34648. // only interested in configurations which reached the end of the
  34649. // decision rule (local context) or end of the start rule (full
  34650. // context). Update reach to contain only these configurations. This
  34651. // handles both explicit EOF transitions in the grammar and implicit
  34652. // EOF transitions following the end of the decision or start rule.
  34653. //
  34654. // When reach==intermediate, no closure operation was performed. In
  34655. // this case, removeAllConfigsNotInRuleStopState needs to check for
  34656. // reachable rule stop states as well as configurations already in
  34657. // a rule stop state.
  34658. //
  34659. // This is handled before the configurations in skippedStopStates,
  34660. // because any configurations potentially added from that list are
  34661. // already guaranteed to meet this condition whether or not it's
  34662. // required.
  34663. //
  34664. reach = this.removeAllConfigsNotInRuleStopState(reach, reach === intermediate);
  34665. }
  34666. // If skippedStopStates!==null, then it contains at least one
  34667. // configuration. For full-context reach operations, these
  34668. // configurations reached the end of the start rule, in which case we
  34669. // only add them back to reach if no configuration during the current
  34670. // closure operation reached such a state. This ensures adaptivePredict
  34671. // chooses an alternative matching the longest overall sequence when
  34672. // multiple alternatives are viable.
  34673. //
  34674. if (skippedStopStates!==null && ( (! fullCtx) || (! PredictionMode.hasConfigInRuleStopState(reach)))) {
  34675. for (var l=0; l<skippedStopStates.length;l++) {
  34676. reach.add(skippedStopStates[l], this.mergeCache);
  34677. }
  34678. }
  34679. if (reach.items.length===0) {
  34680. return null;
  34681. } else {
  34682. return reach;
  34683. }
  34684. };
  34685. //
  34686. // Return a configuration set containing only the configurations from
  34687. // {@code configs} which are in a {@link RuleStopState}. If all
  34688. // configurations in {@code configs} are already in a rule stop state, this
  34689. // method simply returns {@code configs}.
  34690. //
  34691. // <p>When {@code lookToEndOfRule} is true, this method uses
  34692. // {@link ATN//nextTokens} for each configuration in {@code configs} which is
  34693. // not already in a rule stop state to see if a rule stop state is reachable
  34694. // from the configuration via epsilon-only transitions.</p>
  34695. //
  34696. // @param configs the configuration set to update
  34697. // @param lookToEndOfRule when true, this method checks for rule stop states
  34698. // reachable by epsilon-only transitions from each configuration in
  34699. // {@code configs}.
  34700. //
  34701. // @return {@code configs} if all configurations in {@code configs} are in a
  34702. // rule stop state, otherwise return a new configuration set containing only
  34703. // the configurations from {@code configs} which are in a rule stop state
  34704. //
  34705. ParserATNSimulator.prototype.removeAllConfigsNotInRuleStopState = function(configs, lookToEndOfRule) {
  34706. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  34707. return configs;
  34708. }
  34709. var result = new ATNConfigSet(configs.fullCtx);
  34710. for(var i=0; i<configs.items.length;i++) {
  34711. var config = configs.items[i];
  34712. if (config.state instanceof RuleStopState) {
  34713. result.add(config, this.mergeCache);
  34714. continue;
  34715. }
  34716. if (lookToEndOfRule && config.state.epsilonOnlyTransitions) {
  34717. var nextTokens = this.atn.nextTokens(config.state);
  34718. if (nextTokens.contains(Token.EPSILON)) {
  34719. var endOfRuleState = this.atn.ruleToStopState[config.state.ruleIndex];
  34720. result.add(new ATNConfig({state:endOfRuleState}, config), this.mergeCache);
  34721. }
  34722. }
  34723. }
  34724. return result;
  34725. };
  34726. ParserATNSimulator.prototype.computeStartState = function(p, ctx, fullCtx) {
  34727. // always at least the implicit call to start rule
  34728. var initialContext = predictionContextFromRuleContext(this.atn, ctx);
  34729. var configs = new ATNConfigSet(fullCtx);
  34730. for(var i=0;i<p.transitions.length;i++) {
  34731. var target = p.transitions[i].target;
  34732. var c = new ATNConfig({ state:target, alt:i+1, context:initialContext }, null);
  34733. var closureBusy = new Set();
  34734. this.closure(c, configs, closureBusy, true, fullCtx, false);
  34735. }
  34736. return configs;
  34737. };
  34738. //
  34739. // This method transforms the start state computed by
  34740. // {@link //computeStartState} to the special start state used by a
  34741. // precedence DFA for a particular precedence value. The transformation
  34742. // process applies the following changes to the start state's configuration
  34743. // set.
  34744. //
  34745. // <ol>
  34746. // <li>Evaluate the precedence predicates for each configuration using
  34747. // {@link SemanticContext//evalPrecedence}.</li>
  34748. // <li>Remove all configurations which predict an alternative greater than
  34749. // 1, for which another configuration that predicts alternative 1 is in the
  34750. // same ATN state with the same prediction context. This transformation is
  34751. // valid for the following reasons:
  34752. // <ul>
  34753. // <li>The closure block cannot contain any epsilon transitions which bypass
  34754. // the body of the closure, so all states reachable via alternative 1 are
  34755. // part of the precedence alternatives of the transformed left-recursive
  34756. // rule.</li>
  34757. // <li>The "primary" portion of a left recursive rule cannot contain an
  34758. // epsilon transition, so the only way an alternative other than 1 can exist
  34759. // in a state that is also reachable via alternative 1 is by nesting calls
  34760. // to the left-recursive rule, with the outer calls not being at the
  34761. // preferred precedence level.</li>
  34762. // </ul>
  34763. // </li>
  34764. // </ol>
  34765. //
  34766. // <p>
  34767. // The prediction context must be considered by this filter to address
  34768. // situations like the following.
  34769. // </p>
  34770. // <code>
  34771. // <pre>
  34772. // grammar TA;
  34773. // prog: statement* EOF;
  34774. // statement: letterA | statement letterA 'b' ;
  34775. // letterA: 'a';
  34776. // </pre>
  34777. // </code>
  34778. // <p>
  34779. // If the above grammar, the ATN state immediately before the token
  34780. // reference {@code 'a'} in {@code letterA} is reachable from the left edge
  34781. // of both the primary and closure blocks of the left-recursive rule
  34782. // {@code statement}. The prediction context associated with each of these
  34783. // configurations distinguishes between them, and prevents the alternative
  34784. // which stepped out to {@code prog} (and then back in to {@code statement}
  34785. // from being eliminated by the filter.
  34786. // </p>
  34787. //
  34788. // @param configs The configuration set computed by
  34789. // {@link //computeStartState} as the start state for the DFA.
  34790. // @return The transformed configuration set representing the start state
  34791. // for a precedence DFA at a particular precedence level (determined by
  34792. // calling {@link Parser//getPrecedence}).
  34793. //
  34794. ParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {
  34795. var config;
  34796. var statesFromAlt1 = [];
  34797. var configSet = new ATNConfigSet(configs.fullCtx);
  34798. for(var i=0; i<configs.items.length; i++) {
  34799. config = configs.items[i];
  34800. // handle alt 1 first
  34801. if (config.alt !== 1) {
  34802. continue;
  34803. }
  34804. var updatedContext = config.semanticContext.evalPrecedence(this.parser, this._outerContext);
  34805. if (updatedContext===null) {
  34806. // the configuration was eliminated
  34807. continue;
  34808. }
  34809. statesFromAlt1[config.state.stateNumber] = config.context;
  34810. if (updatedContext !== config.semanticContext) {
  34811. configSet.add(new ATNConfig({semanticContext:updatedContext}, config), this.mergeCache);
  34812. } else {
  34813. configSet.add(config, this.mergeCache);
  34814. }
  34815. }
  34816. for(i=0; i<configs.items.length; i++) {
  34817. config = configs.items[i];
  34818. if (config.alt === 1) {
  34819. // already handled
  34820. continue;
  34821. }
  34822. // In the future, this elimination step could be updated to also
  34823. // filter the prediction context for alternatives predicting alt>1
  34824. // (basically a graph subtraction algorithm).
  34825. if (!config.precedenceFilterSuppressed) {
  34826. var context = statesFromAlt1[config.state.stateNumber] || null;
  34827. if (context!==null && context.equals(config.context)) {
  34828. // eliminated
  34829. continue;
  34830. }
  34831. }
  34832. configSet.add(config, this.mergeCache);
  34833. }
  34834. return configSet;
  34835. };
  34836. ParserATNSimulator.prototype.getReachableTarget = function(trans, ttype) {
  34837. if (trans.matches(ttype, 0, this.atn.maxTokenType)) {
  34838. return trans.target;
  34839. } else {
  34840. return null;
  34841. }
  34842. };
  34843. ParserATNSimulator.prototype.getPredsForAmbigAlts = function(ambigAlts, configs, nalts) {
  34844. // REACH=[1|1|[]|0:0, 1|2|[]|0:1]
  34845. // altToPred starts as an array of all null contexts. The entry at index i
  34846. // corresponds to alternative i. altToPred[i] may have one of three values:
  34847. // 1. null: no ATNConfig c is found such that c.alt==i
  34848. // 2. SemanticContext.NONE: At least one ATNConfig c exists such that
  34849. // c.alt==i and c.semanticContext==SemanticContext.NONE. In other words,
  34850. // alt i has at least one unpredicated config.
  34851. // 3. Non-NONE Semantic Context: There exists at least one, and for all
  34852. // ATNConfig c such that c.alt==i, c.semanticContext!=SemanticContext.NONE.
  34853. //
  34854. // From this, it is clear that NONE||anything==NONE.
  34855. //
  34856. var altToPred = [];
  34857. for(var i=0;i<configs.items.length;i++) {
  34858. var c = configs.items[i];
  34859. if(ambigAlts.contains( c.alt )) {
  34860. altToPred[c.alt] = SemanticContext.orContext(altToPred[c.alt] || null, c.semanticContext);
  34861. }
  34862. }
  34863. var nPredAlts = 0;
  34864. for (i =1;i< nalts+1;i++) {
  34865. var pred = altToPred[i] || null;
  34866. if (pred===null) {
  34867. altToPred[i] = SemanticContext.NONE;
  34868. } else if (pred !== SemanticContext.NONE) {
  34869. nPredAlts += 1;
  34870. }
  34871. }
  34872. // nonambig alts are null in altToPred
  34873. if (nPredAlts===0) {
  34874. altToPred = null;
  34875. }
  34876. if (this.debug) {
  34877. console.log("getPredsForAmbigAlts result " + Utils.arrayToString(altToPred));
  34878. }
  34879. return altToPred;
  34880. };
  34881. ParserATNSimulator.prototype.getPredicatePredictions = function(ambigAlts, altToPred) {
  34882. var pairs = [];
  34883. var containsPredicate = false;
  34884. for (var i=1; i<altToPred.length;i++) {
  34885. var pred = altToPred[i];
  34886. // unpredicated is indicated by SemanticContext.NONE
  34887. if( ambigAlts!==null && ambigAlts.contains( i )) {
  34888. pairs.push(new PredPrediction(pred, i));
  34889. }
  34890. if (pred !== SemanticContext.NONE) {
  34891. containsPredicate = true;
  34892. }
  34893. }
  34894. if (! containsPredicate) {
  34895. return null;
  34896. }
  34897. return pairs;
  34898. };
  34899. //
  34900. // This method is used to improve the localization of error messages by
  34901. // choosing an alternative rather than throwing a
  34902. // {@link NoViableAltException} in particular prediction scenarios where the
  34903. // {@link //ERROR} state was reached during ATN simulation.
  34904. //
  34905. // <p>
  34906. // The default implementation of this method uses the following
  34907. // algorithm to identify an ATN configuration which successfully parsed the
  34908. // decision entry rule. Choosing such an alternative ensures that the
  34909. // {@link ParserRuleContext} returned by the calling rule will be complete
  34910. // and valid, and the syntax error will be reported later at a more
  34911. // localized location.</p>
  34912. //
  34913. // <ul>
  34914. // <li>If a syntactically valid path or paths reach the end of the decision rule and
  34915. // they are semantically valid if predicated, return the min associated alt.</li>
  34916. // <li>Else, if a semantically invalid but syntactically valid path exist
  34917. // or paths exist, return the minimum associated alt.
  34918. // </li>
  34919. // <li>Otherwise, return {@link ATN//INVALID_ALT_NUMBER}.</li>
  34920. // </ul>
  34921. //
  34922. // <p>
  34923. // In some scenarios, the algorithm described above could predict an
  34924. // alternative which will result in a {@link FailedPredicateException} in
  34925. // the parser. Specifically, this could occur if the <em>only</em> configuration
  34926. // capable of successfully parsing to the end of the decision rule is
  34927. // blocked by a semantic predicate. By choosing this alternative within
  34928. // {@link //adaptivePredict} instead of throwing a
  34929. // {@link NoViableAltException}, the resulting
  34930. // {@link FailedPredicateException} in the parser will identify the specific
  34931. // predicate which is preventing the parser from successfully parsing the
  34932. // decision rule, which helps developers identify and correct logic errors
  34933. // in semantic predicates.
  34934. // </p>
  34935. //
  34936. // @param configs The ATN configurations which were valid immediately before
  34937. // the {@link //ERROR} state was reached
  34938. // @param outerContext The is the \gamma_0 initial parser context from the paper
  34939. // or the parser stack at the instant before prediction commences.
  34940. //
  34941. // @return The value to return from {@link //adaptivePredict}, or
  34942. // {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not
  34943. // identified and {@link //adaptivePredict} should report an error instead.
  34944. //
  34945. ParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {
  34946. var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);
  34947. var semValidConfigs = cfgs[0];
  34948. var semInvalidConfigs = cfgs[1];
  34949. var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);
  34950. if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists
  34951. return alt;
  34952. }
  34953. // Is there a syntactically valid path with a failed pred?
  34954. if (semInvalidConfigs.items.length>0) {
  34955. alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);
  34956. if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists
  34957. return alt;
  34958. }
  34959. }
  34960. return ATN.INVALID_ALT_NUMBER;
  34961. };
  34962. ParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {
  34963. var alts = [];
  34964. for(var i=0;i<configs.items.length; i++) {
  34965. var c = configs.items[i];
  34966. if (c.reachesIntoOuterContext>0 || ((c.state instanceof RuleStopState) && c.context.hasEmptyPath())) {
  34967. if(alts.indexOf(c.alt)<0) {
  34968. alts.push(c.alt);
  34969. }
  34970. }
  34971. }
  34972. if (alts.length===0) {
  34973. return ATN.INVALID_ALT_NUMBER;
  34974. } else {
  34975. return Math.min.apply(null, alts);
  34976. }
  34977. };
  34978. // Walk the list of configurations and split them according to
  34979. // those that have preds evaluating to true/false. If no pred, assume
  34980. // true pred and include in succeeded set. Returns Pair of sets.
  34981. //
  34982. // Create a new set so as not to alter the incoming parameter.
  34983. //
  34984. // Assumption: the input stream has been restored to the starting point
  34985. // prediction, which is where predicates need to evaluate.
  34986. //
  34987. ParserATNSimulator.prototype.splitAccordingToSemanticValidity = function( configs, outerContext) {
  34988. var succeeded = new ATNConfigSet(configs.fullCtx);
  34989. var failed = new ATNConfigSet(configs.fullCtx);
  34990. for(var i=0;i<configs.items.length; i++) {
  34991. var c = configs.items[i];
  34992. if (c.semanticContext !== SemanticContext.NONE) {
  34993. var predicateEvaluationResult = c.semanticContext.evaluate(this.parser, outerContext);
  34994. if (predicateEvaluationResult) {
  34995. succeeded.add(c);
  34996. } else {
  34997. failed.add(c);
  34998. }
  34999. } else {
  35000. succeeded.add(c);
  35001. }
  35002. }
  35003. return [succeeded, failed];
  35004. };
  35005. // Look through a list of predicate/alt pairs, returning alts for the
  35006. // pairs that win. A {@code NONE} predicate indicates an alt containing an
  35007. // unpredicated config which behaves as "always true." If !complete
  35008. // then we stop at the first predicate that evaluates to true. This
  35009. // includes pairs with null predicates.
  35010. //
  35011. ParserATNSimulator.prototype.evalSemanticContext = function(predPredictions, outerContext, complete) {
  35012. var predictions = new BitSet();
  35013. for(var i=0;i<predPredictions.length;i++) {
  35014. var pair = predPredictions[i];
  35015. if (pair.pred === SemanticContext.NONE) {
  35016. predictions.add(pair.alt);
  35017. if (! complete) {
  35018. break;
  35019. }
  35020. continue;
  35021. }
  35022. var predicateEvaluationResult = pair.pred.evaluate(this.parser, outerContext);
  35023. if (this.debug || this.dfa_debug) {
  35024. console.log("eval pred " + pair + "=" + predicateEvaluationResult);
  35025. }
  35026. if (predicateEvaluationResult) {
  35027. if (this.debug || this.dfa_debug) {
  35028. console.log("PREDICT " + pair.alt);
  35029. }
  35030. predictions.add(pair.alt);
  35031. if (! complete) {
  35032. break;
  35033. }
  35034. }
  35035. }
  35036. return predictions;
  35037. };
  35038. // TODO: If we are doing predicates, there is no point in pursuing
  35039. // closure operations if we reach a DFA state that uniquely predicts
  35040. // alternative. We will not be caching that DFA state and it is a
  35041. // waste to pursue the closure. Might have to advance when we do
  35042. // ambig detection thought :(
  35043. //
  35044. ParserATNSimulator.prototype.closure = function(config, configs, closureBusy, collectPredicates, fullCtx, treatEofAsEpsilon) {
  35045. var initialDepth = 0;
  35046. this.closureCheckingStopState(config, configs, closureBusy, collectPredicates,
  35047. fullCtx, initialDepth, treatEofAsEpsilon);
  35048. };
  35049. ParserATNSimulator.prototype.closureCheckingStopState = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  35050. if (this.debug || this.debug_closure) {
  35051. console.log("closure(" + config.toString(this.parser,true) + ")");
  35052. // console.log("configs(" + configs.toString() + ")");
  35053. if(config.reachesIntoOuterContext>50) {
  35054. throw "problem";
  35055. }
  35056. }
  35057. if (config.state instanceof RuleStopState) {
  35058. // We hit rule end. If we have context info, use it
  35059. // run thru all possible stack tops in ctx
  35060. if (! config.context.isEmpty()) {
  35061. for ( var i =0; i<config.context.length; i++) {
  35062. if (config.context.getReturnState(i) === PredictionContext.EMPTY_RETURN_STATE) {
  35063. if (fullCtx) {
  35064. configs.add(new ATNConfig({state:config.state, context:PredictionContext.EMPTY}, config), this.mergeCache);
  35065. continue;
  35066. } else {
  35067. // we have no context info, just chase follow links (if greedy)
  35068. if (this.debug) {
  35069. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  35070. }
  35071. this.closure_(config, configs, closureBusy, collectPredicates,
  35072. fullCtx, depth, treatEofAsEpsilon);
  35073. }
  35074. continue;
  35075. }
  35076. var returnState = this.atn.states[config.context.getReturnState(i)];
  35077. var newContext = config.context.getParent(i); // "pop" return state
  35078. var parms = {state:returnState, alt:config.alt, context:newContext, semanticContext:config.semanticContext};
  35079. var c = new ATNConfig(parms, null);
  35080. // While we have context to pop back from, we may have
  35081. // gotten that context AFTER having falling off a rule.
  35082. // Make sure we track that we are now out of context.
  35083. c.reachesIntoOuterContext = config.reachesIntoOuterContext;
  35084. this.closureCheckingStopState(c, configs, closureBusy, collectPredicates, fullCtx, depth - 1, treatEofAsEpsilon);
  35085. }
  35086. return;
  35087. } else if( fullCtx) {
  35088. // reached end of start rule
  35089. configs.add(config, this.mergeCache);
  35090. return;
  35091. } else {
  35092. // else if we have no context info, just chase follow links (if greedy)
  35093. if (this.debug) {
  35094. console.log("FALLING off rule " + this.getRuleName(config.state.ruleIndex));
  35095. }
  35096. }
  35097. }
  35098. this.closure_(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon);
  35099. };
  35100. // Do the actual work of walking epsilon edges//
  35101. ParserATNSimulator.prototype.closure_ = function(config, configs, closureBusy, collectPredicates, fullCtx, depth, treatEofAsEpsilon) {
  35102. var p = config.state;
  35103. // optimization
  35104. if (! p.epsilonOnlyTransitions) {
  35105. configs.add(config, this.mergeCache);
  35106. // make sure to not return here, because EOF transitions can act as
  35107. // both epsilon transitions and non-epsilon transitions.
  35108. }
  35109. for(var i = 0;i<p.transitions.length; i++) {
  35110. if(i==0 && this.canDropLoopEntryEdgeInLeftRecursiveRule(config))
  35111. continue;
  35112. var t = p.transitions[i];
  35113. var continueCollecting = collectPredicates && !(t instanceof ActionTransition);
  35114. var c = this.getEpsilonTarget(config, t, continueCollecting, depth === 0, fullCtx, treatEofAsEpsilon);
  35115. if (c!==null) {
  35116. var newDepth = depth;
  35117. if ( config.state instanceof RuleStopState) {
  35118. // target fell off end of rule; mark resulting c as having dipped into outer context
  35119. // We can't get here if incoming config was rule stop and we had context
  35120. // track how far we dip into outer context. Might
  35121. // come in handy and we avoid evaluating context dependent
  35122. // preds if this is > 0.
  35123. if (this._dfa !== null && this._dfa.precedenceDfa) {
  35124. if (t.outermostPrecedenceReturn === this._dfa.atnStartState.ruleIndex) {
  35125. c.precedenceFilterSuppressed = true;
  35126. }
  35127. }
  35128. c.reachesIntoOuterContext += 1;
  35129. if (closureBusy.add(c)!==c) {
  35130. // avoid infinite recursion for right-recursive rules
  35131. continue;
  35132. }
  35133. configs.dipsIntoOuterContext = true; // TODO: can remove? only care when we add to set per middle of this method
  35134. newDepth -= 1;
  35135. if (this.debug) {
  35136. console.log("dips into outer ctx: " + c);
  35137. }
  35138. } else {
  35139. if (!t.isEpsilon && closureBusy.add(c)!==c){
  35140. // avoid infinite recursion for EOF* and EOF+
  35141. continue;
  35142. }
  35143. if (t instanceof RuleTransition) {
  35144. // latch when newDepth goes negative - once we step out of the entry context we can't return
  35145. if (newDepth >= 0) {
  35146. newDepth += 1;
  35147. }
  35148. }
  35149. }
  35150. this.closureCheckingStopState(c, configs, closureBusy, continueCollecting, fullCtx, newDepth, treatEofAsEpsilon);
  35151. }
  35152. }
  35153. };
  35154. ParserATNSimulator.prototype.canDropLoopEntryEdgeInLeftRecursiveRule = function(config) {
  35155. // return False
  35156. var p = config.state;
  35157. // First check to see if we are in StarLoopEntryState generated during
  35158. // left-recursion elimination. For efficiency, also check if
  35159. // the context has an empty stack case. If so, it would mean
  35160. // global FOLLOW so we can't perform optimization
  35161. // Are we the special loop entry/exit state? or SLL wildcard
  35162. if(p.stateType != ATNState.STAR_LOOP_ENTRY)
  35163. return false;
  35164. if(p.stateType != ATNState.STAR_LOOP_ENTRY || !p.isPrecedenceDecision ||
  35165. config.context.isEmpty() || config.context.hasEmptyPath())
  35166. return false;
  35167. // Require all return states to return back to the same rule that p is in.
  35168. var numCtxs = config.context.length;
  35169. for(var i=0; i<numCtxs; i++) { // for each stack context
  35170. var returnState = this.atn.states[config.context.getReturnState(i)];
  35171. if (returnState.ruleIndex != p.ruleIndex)
  35172. return false;
  35173. }
  35174. var decisionStartState = p.transitions[0].target;
  35175. var blockEndStateNum = decisionStartState.endState.stateNumber;
  35176. var blockEndState = this.atn.states[blockEndStateNum];
  35177. // Verify that the top of each stack context leads to loop entry/exit
  35178. // state through epsilon edges and w/o leaving rule.
  35179. for(var i=0; i<numCtxs; i++) { // for each stack context
  35180. var returnStateNumber = config.context.getReturnState(i);
  35181. var returnState = this.atn.states[returnStateNumber];
  35182. // all states must have single outgoing epsilon edge
  35183. if (returnState.transitions.length != 1 || !returnState.transitions[0].isEpsilon)
  35184. return false;
  35185. // Look for prefix op case like 'not expr', (' type ')' expr
  35186. var returnStateTarget = returnState.transitions[0].target;
  35187. if ( returnState.stateType == ATNState.BLOCK_END && returnStateTarget == p )
  35188. continue;
  35189. // Look for 'expr op expr' or case where expr's return state is block end
  35190. // of (...)* internal block; the block end points to loop back
  35191. // which points to p but we don't need to check that
  35192. if ( returnState == blockEndState )
  35193. continue;
  35194. // Look for ternary expr ? expr : expr. The return state points at block end,
  35195. // which points at loop entry state
  35196. if ( returnStateTarget == blockEndState )
  35197. continue;
  35198. // Look for complex prefix 'between expr and expr' case where 2nd expr's
  35199. // return state points at block end state of (...)* internal block
  35200. if (returnStateTarget.stateType == ATNState.BLOCK_END && returnStateTarget.transitions.length == 1
  35201. && returnStateTarget.transitions[0].isEpsilon && returnStateTarget.transitions[0].target == p)
  35202. continue;
  35203. // anything else ain't conforming
  35204. return false;
  35205. }
  35206. return true;
  35207. };
  35208. ParserATNSimulator.prototype.getRuleName = function( index) {
  35209. if (this.parser!==null && index>=0) {
  35210. return this.parser.ruleNames[index];
  35211. } else {
  35212. return "<rule " + index + ">";
  35213. }
  35214. };
  35215. ParserATNSimulator.prototype.getEpsilonTarget = function(config, t, collectPredicates, inContext, fullCtx, treatEofAsEpsilon) {
  35216. switch(t.serializationType) {
  35217. case Transition.RULE:
  35218. return this.ruleTransition(config, t);
  35219. case Transition.PRECEDENCE:
  35220. return this.precedenceTransition(config, t, collectPredicates, inContext, fullCtx);
  35221. case Transition.PREDICATE:
  35222. return this.predTransition(config, t, collectPredicates, inContext, fullCtx);
  35223. case Transition.ACTION:
  35224. return this.actionTransition(config, t);
  35225. case Transition.EPSILON:
  35226. return new ATNConfig({state:t.target}, config);
  35227. case Transition.ATOM:
  35228. case Transition.RANGE:
  35229. case Transition.SET:
  35230. // EOF transitions act like epsilon transitions after the first EOF
  35231. // transition is traversed
  35232. if (treatEofAsEpsilon) {
  35233. if (t.matches(Token.EOF, 0, 1)) {
  35234. return new ATNConfig({state: t.target}, config);
  35235. }
  35236. }
  35237. return null;
  35238. default:
  35239. return null;
  35240. }
  35241. };
  35242. ParserATNSimulator.prototype.actionTransition = function(config, t) {
  35243. if (this.debug) {
  35244. var index = t.actionIndex==-1 ? 65535 : t.actionIndex;
  35245. console.log("ACTION edge " + t.ruleIndex + ":" + index);
  35246. }
  35247. return new ATNConfig({state:t.target}, config);
  35248. };
  35249. ParserATNSimulator.prototype.precedenceTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  35250. if (this.debug) {
  35251. console.log("PRED (collectPredicates=" + collectPredicates + ") " +
  35252. pt.precedence + ">=_p, ctx dependent=true");
  35253. if (this.parser!==null) {
  35254. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  35255. }
  35256. }
  35257. var c = null;
  35258. if (collectPredicates && inContext) {
  35259. if (fullCtx) {
  35260. // In full context mode, we can evaluate predicates on-the-fly
  35261. // during closure, which dramatically reduces the size of
  35262. // the config sets. It also obviates the need to test predicates
  35263. // later during conflict resolution.
  35264. var currentPosition = this._input.index;
  35265. this._input.seek(this._startIndex);
  35266. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  35267. this._input.seek(currentPosition);
  35268. if (predSucceeds) {
  35269. c = new ATNConfig({state:pt.target}, config); // no pred context
  35270. }
  35271. } else {
  35272. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  35273. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  35274. }
  35275. } else {
  35276. c = new ATNConfig({state:pt.target}, config);
  35277. }
  35278. if (this.debug) {
  35279. console.log("config from pred transition=" + c);
  35280. }
  35281. return c;
  35282. };
  35283. ParserATNSimulator.prototype.predTransition = function(config, pt, collectPredicates, inContext, fullCtx) {
  35284. if (this.debug) {
  35285. console.log("PRED (collectPredicates=" + collectPredicates + ") " + pt.ruleIndex +
  35286. ":" + pt.predIndex + ", ctx dependent=" + pt.isCtxDependent);
  35287. if (this.parser!==null) {
  35288. console.log("context surrounding pred is " + Utils.arrayToString(this.parser.getRuleInvocationStack()));
  35289. }
  35290. }
  35291. var c = null;
  35292. if (collectPredicates && ((pt.isCtxDependent && inContext) || ! pt.isCtxDependent)) {
  35293. if (fullCtx) {
  35294. // In full context mode, we can evaluate predicates on-the-fly
  35295. // during closure, which dramatically reduces the size of
  35296. // the config sets. It also obviates the need to test predicates
  35297. // later during conflict resolution.
  35298. var currentPosition = this._input.index;
  35299. this._input.seek(this._startIndex);
  35300. var predSucceeds = pt.getPredicate().evaluate(this.parser, this._outerContext);
  35301. this._input.seek(currentPosition);
  35302. if (predSucceeds) {
  35303. c = new ATNConfig({state:pt.target}, config); // no pred context
  35304. }
  35305. } else {
  35306. var newSemCtx = SemanticContext.andContext(config.semanticContext, pt.getPredicate());
  35307. c = new ATNConfig({state:pt.target, semanticContext:newSemCtx}, config);
  35308. }
  35309. } else {
  35310. c = new ATNConfig({state:pt.target}, config);
  35311. }
  35312. if (this.debug) {
  35313. console.log("config from pred transition=" + c);
  35314. }
  35315. return c;
  35316. };
  35317. ParserATNSimulator.prototype.ruleTransition = function(config, t) {
  35318. if (this.debug) {
  35319. console.log("CALL rule " + this.getRuleName(t.target.ruleIndex) + ", ctx=" + config.context);
  35320. }
  35321. var returnState = t.followState;
  35322. var newContext = SingletonPredictionContext.create(config.context, returnState.stateNumber);
  35323. return new ATNConfig({state:t.target, context:newContext}, config );
  35324. };
  35325. ParserATNSimulator.prototype.getConflictingAlts = function(configs) {
  35326. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35327. return PredictionMode.getAlts(altsets);
  35328. };
  35329. // Sam pointed out a problem with the previous definition, v3, of
  35330. // ambiguous states. If we have another state associated with conflicting
  35331. // alternatives, we should keep going. For example, the following grammar
  35332. //
  35333. // s : (ID | ID ID?) ';' ;
  35334. //
  35335. // When the ATN simulation reaches the state before ';', it has a DFA
  35336. // state that looks like: [12|1|[], 6|2|[], 12|2|[]]. Naturally
  35337. // 12|1|[] and 12|2|[] conflict, but we cannot stop processing this node
  35338. // because alternative to has another way to continue, via [6|2|[]].
  35339. // The key is that we have a single state that has config's only associated
  35340. // with a single alternative, 2, and crucially the state transitions
  35341. // among the configurations are all non-epsilon transitions. That means
  35342. // we don't consider any conflicts that include alternative 2. So, we
  35343. // ignore the conflict between alts 1 and 2. We ignore a set of
  35344. // conflicting alts when there is an intersection with an alternative
  35345. // associated with a single alt state in the state&rarr;config-list map.
  35346. //
  35347. // It's also the case that we might have two conflicting configurations but
  35348. // also a 3rd nonconflicting configuration for a different alternative:
  35349. // [1|1|[], 1|2|[], 8|3|[]]. This can come about from grammar:
  35350. //
  35351. // a : A | A | A B ;
  35352. //
  35353. // After matching input A, we reach the stop state for rule A, state 1.
  35354. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35355. // conflict and no amount of further lookahead will separate the two.
  35356. // However, alternative 3 will be able to continue and so we do not
  35357. // stop working on this state. In the previous example, we're concerned
  35358. // with states associated with the conflicting alternatives. Here alt
  35359. // 3 is not associated with the conflicting configs, but since we can continue
  35360. // looking for input reasonably, I don't declare the state done. We
  35361. // ignore a set of conflicting alts when we have an alternative
  35362. // that we still need to pursue.
  35363. //
  35364. ParserATNSimulator.prototype.getConflictingAltsOrUniqueAlt = function(configs) {
  35365. var conflictingAlts = null;
  35366. if (configs.uniqueAlt!== ATN.INVALID_ALT_NUMBER) {
  35367. conflictingAlts = new BitSet();
  35368. conflictingAlts.add(configs.uniqueAlt);
  35369. } else {
  35370. conflictingAlts = configs.conflictingAlts;
  35371. }
  35372. return conflictingAlts;
  35373. };
  35374. ParserATNSimulator.prototype.getTokenName = function( t) {
  35375. if (t===Token.EOF) {
  35376. return "EOF";
  35377. }
  35378. if( this.parser!==null && this.parser.literalNames!==null) {
  35379. if (t >= this.parser.literalNames.length && t >= this.parser.symbolicNames.length) {
  35380. console.log("" + t + " ttype out of range: " + this.parser.literalNames);
  35381. console.log("" + this.parser.getInputStream().getTokens());
  35382. } else {
  35383. var name = this.parser.literalNames[t] || this.parser.symbolicNames[t];
  35384. return name + "<" + t + ">";
  35385. }
  35386. }
  35387. return "" + t;
  35388. };
  35389. ParserATNSimulator.prototype.getLookaheadName = function(input) {
  35390. return this.getTokenName(input.LA(1));
  35391. };
  35392. // Used for debugging in adaptivePredict around execATN but I cut
  35393. // it out for clarity now that alg. works well. We can leave this
  35394. // "dead" code for a bit.
  35395. //
  35396. ParserATNSimulator.prototype.dumpDeadEndConfigs = function(nvae) {
  35397. console.log("dead end configs: ");
  35398. var decs = nvae.getDeadEndConfigs();
  35399. for(var i=0; i<decs.length; i++) {
  35400. var c = decs[i];
  35401. var trans = "no edges";
  35402. if (c.state.transitions.length>0) {
  35403. var t = c.state.transitions[0];
  35404. if (t instanceof AtomTransition) {
  35405. trans = "Atom "+ this.getTokenName(t.label);
  35406. } else if (t instanceof SetTransition) {
  35407. var neg = (t instanceof NotSetTransition);
  35408. trans = (neg ? "~" : "") + "Set " + t.set;
  35409. }
  35410. }
  35411. console.error(c.toString(this.parser, true) + ":" + trans);
  35412. }
  35413. };
  35414. ParserATNSimulator.prototype.noViableAlt = function(input, outerContext, configs, startIndex) {
  35415. return new NoViableAltException(this.parser, input, input.get(startIndex), input.LT(1), configs, outerContext);
  35416. };
  35417. ParserATNSimulator.prototype.getUniqueAlt = function(configs) {
  35418. var alt = ATN.INVALID_ALT_NUMBER;
  35419. for(var i=0;i<configs.items.length;i++) {
  35420. var c = configs.items[i];
  35421. if (alt === ATN.INVALID_ALT_NUMBER) {
  35422. alt = c.alt // found first alt
  35423. } else if( c.alt!==alt) {
  35424. return ATN.INVALID_ALT_NUMBER;
  35425. }
  35426. }
  35427. return alt;
  35428. };
  35429. //
  35430. // Add an edge to the DFA, if possible. This method calls
  35431. // {@link //addDFAState} to ensure the {@code to} state is present in the
  35432. // DFA. If {@code from} is {@code null}, or if {@code t} is outside the
  35433. // range of edges that can be represented in the DFA tables, this method
  35434. // returns without adding the edge to the DFA.
  35435. //
  35436. // <p>If {@code to} is {@code null}, this method returns {@code null}.
  35437. // Otherwise, this method returns the {@link DFAState} returned by calling
  35438. // {@link //addDFAState} for the {@code to} state.</p>
  35439. //
  35440. // @param dfa The DFA
  35441. // @param from The source state for the edge
  35442. // @param t The input symbol
  35443. // @param to The target state for the edge
  35444. //
  35445. // @return If {@code to} is {@code null}, this method returns {@code null};
  35446. // otherwise this method returns the result of calling {@link //addDFAState}
  35447. // on {@code to}
  35448. //
  35449. ParserATNSimulator.prototype.addDFAEdge = function(dfa, from_, t, to) {
  35450. if( this.debug) {
  35451. console.log("EDGE " + from_ + " -> " + to + " upon " + this.getTokenName(t));
  35452. }
  35453. if (to===null) {
  35454. return null;
  35455. }
  35456. to = this.addDFAState(dfa, to); // used existing if possible not incoming
  35457. if (from_===null || t < -1 || t > this.atn.maxTokenType) {
  35458. return to;
  35459. }
  35460. if (from_.edges===null) {
  35461. from_.edges = [];
  35462. }
  35463. from_.edges[t+1] = to; // connect
  35464. if (this.debug) {
  35465. var literalNames = this.parser===null ? null : this.parser.literalNames;
  35466. var symbolicNames = this.parser===null ? null : this.parser.symbolicNames;
  35467. console.log("DFA=\n" + dfa.toString(literalNames, symbolicNames));
  35468. }
  35469. return to;
  35470. };
  35471. //
  35472. // Add state {@code D} to the DFA if it is not already present, and return
  35473. // the actual instance stored in the DFA. If a state equivalent to {@code D}
  35474. // is already in the DFA, the existing state is returned. Otherwise this
  35475. // method returns {@code D} after adding it to the DFA.
  35476. //
  35477. // <p>If {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and
  35478. // does not change the DFA.</p>
  35479. //
  35480. // @param dfa The dfa
  35481. // @param D The DFA state to add
  35482. // @return The state stored in the DFA. This will be either the existing
  35483. // state if {@code D} is already in the DFA, or {@code D} itself if the
  35484. // state was not already present.
  35485. //
  35486. ParserATNSimulator.prototype.addDFAState = function(dfa, D) {
  35487. if (D == ATNSimulator.ERROR) {
  35488. return D;
  35489. }
  35490. var existing = dfa.states.get(D);
  35491. if(existing!==null) {
  35492. return existing;
  35493. }
  35494. D.stateNumber = dfa.states.length;
  35495. if (! D.configs.readOnly) {
  35496. D.configs.optimizeConfigs(this);
  35497. D.configs.setReadonly(true);
  35498. }
  35499. dfa.states.add(D);
  35500. if (this.debug) {
  35501. console.log("adding new DFA state: " + D);
  35502. }
  35503. return D;
  35504. };
  35505. ParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {
  35506. if (this.debug || this.retry_debug) {
  35507. var interval = new Interval(startIndex, stopIndex + 1);
  35508. console.log("reportAttemptingFullContext decision=" + dfa.decision + ":" + configs +
  35509. ", input=" + this.parser.getTokenStream().getText(interval));
  35510. }
  35511. if (this.parser!==null) {
  35512. this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);
  35513. }
  35514. };
  35515. ParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {
  35516. if (this.debug || this.retry_debug) {
  35517. var interval = new Interval(startIndex, stopIndex + 1);
  35518. console.log("reportContextSensitivity decision=" + dfa.decision + ":" + configs +
  35519. ", input=" + this.parser.getTokenStream().getText(interval));
  35520. }
  35521. if (this.parser!==null) {
  35522. this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);
  35523. }
  35524. };
  35525. // If context sensitive parsing, we know it's ambiguity not conflict//
  35526. ParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,
  35527. exact, ambigAlts, configs ) {
  35528. if (this.debug || this.retry_debug) {
  35529. var interval = new Interval(startIndex, stopIndex + 1);
  35530. console.log("reportAmbiguity " + ambigAlts + ":" + configs +
  35531. ", input=" + this.parser.getTokenStream().getText(interval));
  35532. }
  35533. if (this.parser!==null) {
  35534. this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);
  35535. }
  35536. };
  35537. exports.ParserATNSimulator = ParserATNSimulator;
  35538. /***/ }),
  35539. /***/ "./node_modules/antlr4/atn/PredictionMode.js":
  35540. /*!***************************************************!*\
  35541. !*** ./node_modules/antlr4/atn/PredictionMode.js ***!
  35542. \***************************************************/
  35543. /*! no static exports found */
  35544. /***/ (function(module, exports, __webpack_require__) {
  35545. //
  35546. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  35547. * Use of this file is governed by the BSD 3-clause license that
  35548. * can be found in the LICENSE.txt file in the project root.
  35549. */
  35550. //
  35551. //
  35552. // This enumeration defines the prediction modes available in ANTLR 4 along with
  35553. // utility methods for analyzing configuration sets for conflicts and/or
  35554. // ambiguities.
  35555. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  35556. var Map = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Map;
  35557. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  35558. var AltDict = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").AltDict;
  35559. var ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  35560. var RuleStopState = __webpack_require__(/*! ./ATNState */ "./node_modules/antlr4/atn/ATNState.js").RuleStopState;
  35561. var ATNConfigSet = __webpack_require__(/*! ./ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  35562. var ATNConfig = __webpack_require__(/*! ./ATNConfig */ "./node_modules/antlr4/atn/ATNConfig.js").ATNConfig;
  35563. var SemanticContext = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").SemanticContext;
  35564. var Hash = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  35565. var hashStuff = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").hashStuff;
  35566. var equalArrays = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").equalArrays;
  35567. function PredictionMode() {
  35568. return this;
  35569. }
  35570. //
  35571. // The SLL(*) prediction mode. This prediction mode ignores the current
  35572. // parser context when making predictions. This is the fastest prediction
  35573. // mode, and provides correct results for many grammars. This prediction
  35574. // mode is more powerful than the prediction mode provided by ANTLR 3, but
  35575. // may result in syntax errors for grammar and input combinations which are
  35576. // not SLL.
  35577. //
  35578. // <p>
  35579. // When using this prediction mode, the parser will either return a correct
  35580. // parse tree (i.e. the same parse tree that would be returned with the
  35581. // {@link //LL} prediction mode), or it will report a syntax error. If a
  35582. // syntax error is encountered when using the {@link //SLL} prediction mode,
  35583. // it may be due to either an actual syntax error in the input or indicate
  35584. // that the particular combination of grammar and input requires the more
  35585. // powerful {@link //LL} prediction abilities to complete successfully.</p>
  35586. //
  35587. // <p>
  35588. // This prediction mode does not provide any guarantees for prediction
  35589. // behavior for syntactically-incorrect inputs.</p>
  35590. //
  35591. PredictionMode.SLL = 0;
  35592. //
  35593. // The LL(*) prediction mode. This prediction mode allows the current parser
  35594. // context to be used for resolving SLL conflicts that occur during
  35595. // prediction. This is the fastest prediction mode that guarantees correct
  35596. // parse results for all combinations of grammars with syntactically correct
  35597. // inputs.
  35598. //
  35599. // <p>
  35600. // When using this prediction mode, the parser will make correct decisions
  35601. // for all syntactically-correct grammar and input combinations. However, in
  35602. // cases where the grammar is truly ambiguous this prediction mode might not
  35603. // report a precise answer for <em>exactly which</em> alternatives are
  35604. // ambiguous.</p>
  35605. //
  35606. // <p>
  35607. // This prediction mode does not provide any guarantees for prediction
  35608. // behavior for syntactically-incorrect inputs.</p>
  35609. //
  35610. PredictionMode.LL = 1;
  35611. //
  35612. // The LL(*) prediction mode with exact ambiguity detection. In addition to
  35613. // the correctness guarantees provided by the {@link //LL} prediction mode,
  35614. // this prediction mode instructs the prediction algorithm to determine the
  35615. // complete and exact set of ambiguous alternatives for every ambiguous
  35616. // decision encountered while parsing.
  35617. //
  35618. // <p>
  35619. // This prediction mode may be used for diagnosing ambiguities during
  35620. // grammar development. Due to the performance overhead of calculating sets
  35621. // of ambiguous alternatives, this prediction mode should be avoided when
  35622. // the exact results are not necessary.</p>
  35623. //
  35624. // <p>
  35625. // This prediction mode does not provide any guarantees for prediction
  35626. // behavior for syntactically-incorrect inputs.</p>
  35627. //
  35628. PredictionMode.LL_EXACT_AMBIG_DETECTION = 2;
  35629. //
  35630. // Computes the SLL prediction termination condition.
  35631. //
  35632. // <p>
  35633. // This method computes the SLL prediction termination condition for both of
  35634. // the following cases.</p>
  35635. //
  35636. // <ul>
  35637. // <li>The usual SLL+LL fallback upon SLL conflict</li>
  35638. // <li>Pure SLL without LL fallback</li>
  35639. // </ul>
  35640. //
  35641. // <p><strong>COMBINED SLL+LL PARSING</strong></p>
  35642. //
  35643. // <p>When LL-fallback is enabled upon SLL conflict, correct predictions are
  35644. // ensured regardless of how the termination condition is computed by this
  35645. // method. Due to the substantially higher cost of LL prediction, the
  35646. // prediction should only fall back to LL when the additional lookahead
  35647. // cannot lead to a unique SLL prediction.</p>
  35648. //
  35649. // <p>Assuming combined SLL+LL parsing, an SLL configuration set with only
  35650. // conflicting subsets should fall back to full LL, even if the
  35651. // configuration sets don't resolve to the same alternative (e.g.
  35652. // {@code {1,2}} and {@code {3,4}}. If there is at least one non-conflicting
  35653. // configuration, SLL could continue with the hopes that more lookahead will
  35654. // resolve via one of those non-conflicting configurations.</p>
  35655. //
  35656. // <p>Here's the prediction termination rule them: SLL (for SLL+LL parsing)
  35657. // stops when it sees only conflicting configuration subsets. In contrast,
  35658. // full LL keeps going when there is uncertainty.</p>
  35659. //
  35660. // <p><strong>HEURISTIC</strong></p>
  35661. //
  35662. // <p>As a heuristic, we stop prediction when we see any conflicting subset
  35663. // unless we see a state that only has one alternative associated with it.
  35664. // The single-alt-state thing lets prediction continue upon rules like
  35665. // (otherwise, it would admit defeat too soon):</p>
  35666. //
  35667. // <p>{@code [12|1|[], 6|2|[], 12|2|[]]. s : (ID | ID ID?) ';' ;}</p>
  35668. //
  35669. // <p>When the ATN simulation reaches the state before {@code ';'}, it has a
  35670. // DFA state that looks like: {@code [12|1|[], 6|2|[], 12|2|[]]}. Naturally
  35671. // {@code 12|1|[]} and {@code 12|2|[]} conflict, but we cannot stop
  35672. // processing this node because alternative to has another way to continue,
  35673. // via {@code [6|2|[]]}.</p>
  35674. //
  35675. // <p>It also let's us continue for this rule:</p>
  35676. //
  35677. // <p>{@code [1|1|[], 1|2|[], 8|3|[]] a : A | A | A B ;}</p>
  35678. //
  35679. // <p>After matching input A, we reach the stop state for rule A, state 1.
  35680. // State 8 is the state right before B. Clearly alternatives 1 and 2
  35681. // conflict and no amount of further lookahead will separate the two.
  35682. // However, alternative 3 will be able to continue and so we do not stop
  35683. // working on this state. In the previous example, we're concerned with
  35684. // states associated with the conflicting alternatives. Here alt 3 is not
  35685. // associated with the conflicting configs, but since we can continue
  35686. // looking for input reasonably, don't declare the state done.</p>
  35687. //
  35688. // <p><strong>PURE SLL PARSING</strong></p>
  35689. //
  35690. // <p>To handle pure SLL parsing, all we have to do is make sure that we
  35691. // combine stack contexts for configurations that differ only by semantic
  35692. // predicate. From there, we can do the usual SLL termination heuristic.</p>
  35693. //
  35694. // <p><strong>PREDICATES IN SLL+LL PARSING</strong></p>
  35695. //
  35696. // <p>SLL decisions don't evaluate predicates until after they reach DFA stop
  35697. // states because they need to create the DFA cache that works in all
  35698. // semantic situations. In contrast, full LL evaluates predicates collected
  35699. // during start state computation so it can ignore predicates thereafter.
  35700. // This means that SLL termination detection can totally ignore semantic
  35701. // predicates.</p>
  35702. //
  35703. // <p>Implementation-wise, {@link ATNConfigSet} combines stack contexts but not
  35704. // semantic predicate contexts so we might see two configurations like the
  35705. // following.</p>
  35706. //
  35707. // <p>{@code (s, 1, x, {}), (s, 1, x', {p})}</p>
  35708. //
  35709. // <p>Before testing these configurations against others, we have to merge
  35710. // {@code x} and {@code x'} (without modifying the existing configurations).
  35711. // For example, we test {@code (x+x')==x''} when looking for conflicts in
  35712. // the following configurations.</p>
  35713. //
  35714. // <p>{@code (s, 1, x, {}), (s, 1, x', {p}), (s, 2, x'', {})}</p>
  35715. //
  35716. // <p>If the configuration set has predicates (as indicated by
  35717. // {@link ATNConfigSet//hasSemanticContext}), this algorithm makes a copy of
  35718. // the configurations to strip out all of the predicates so that a standard
  35719. // {@link ATNConfigSet} will merge everything ignoring predicates.</p>
  35720. //
  35721. PredictionMode.hasSLLConflictTerminatingPrediction = function( mode, configs) {
  35722. // Configs in rule stop states indicate reaching the end of the decision
  35723. // rule (local context) or end of start rule (full context). If all
  35724. // configs meet this condition, then none of the configurations is able
  35725. // to match additional input so we terminate prediction.
  35726. //
  35727. if (PredictionMode.allConfigsInRuleStopStates(configs)) {
  35728. return true;
  35729. }
  35730. // pure SLL mode parsing
  35731. if (mode === PredictionMode.SLL) {
  35732. // Don't bother with combining configs from different semantic
  35733. // contexts if we can fail over to full LL; costs more time
  35734. // since we'll often fail over anyway.
  35735. if (configs.hasSemanticContext) {
  35736. // dup configs, tossing out semantic predicates
  35737. var dup = new ATNConfigSet();
  35738. for(var i=0;i<configs.items.length;i++) {
  35739. var c = configs.items[i];
  35740. c = new ATNConfig({semanticContext:SemanticContext.NONE}, c);
  35741. dup.add(c);
  35742. }
  35743. configs = dup;
  35744. }
  35745. // now we have combined contexts for configs with dissimilar preds
  35746. }
  35747. // pure SLL or combined SLL+LL mode parsing
  35748. var altsets = PredictionMode.getConflictingAltSubsets(configs);
  35749. return PredictionMode.hasConflictingAltSet(altsets) && !PredictionMode.hasStateAssociatedWithOneAlt(configs);
  35750. };
  35751. // Checks if any configuration in {@code configs} is in a
  35752. // {@link RuleStopState}. Configurations meeting this condition have reached
  35753. // the end of the decision rule (local context) or end of start rule (full
  35754. // context).
  35755. //
  35756. // @param configs the configuration set to test
  35757. // @return {@code true} if any configuration in {@code configs} is in a
  35758. // {@link RuleStopState}, otherwise {@code false}
  35759. PredictionMode.hasConfigInRuleStopState = function(configs) {
  35760. for(var i=0;i<configs.items.length;i++) {
  35761. var c = configs.items[i];
  35762. if (c.state instanceof RuleStopState) {
  35763. return true;
  35764. }
  35765. }
  35766. return false;
  35767. };
  35768. // Checks if all configurations in {@code configs} are in a
  35769. // {@link RuleStopState}. Configurations meeting this condition have reached
  35770. // the end of the decision rule (local context) or end of start rule (full
  35771. // context).
  35772. //
  35773. // @param configs the configuration set to test
  35774. // @return {@code true} if all configurations in {@code configs} are in a
  35775. // {@link RuleStopState}, otherwise {@code false}
  35776. PredictionMode.allConfigsInRuleStopStates = function(configs) {
  35777. for(var i=0;i<configs.items.length;i++) {
  35778. var c = configs.items[i];
  35779. if (!(c.state instanceof RuleStopState)) {
  35780. return false;
  35781. }
  35782. }
  35783. return true;
  35784. };
  35785. //
  35786. // Full LL prediction termination.
  35787. //
  35788. // <p>Can we stop looking ahead during ATN simulation or is there some
  35789. // uncertainty as to which alternative we will ultimately pick, after
  35790. // consuming more input? Even if there are partial conflicts, we might know
  35791. // that everything is going to resolve to the same minimum alternative. That
  35792. // means we can stop since no more lookahead will change that fact. On the
  35793. // other hand, there might be multiple conflicts that resolve to different
  35794. // minimums. That means we need more look ahead to decide which of those
  35795. // alternatives we should predict.</p>
  35796. //
  35797. // <p>The basic idea is to split the set of configurations {@code C}, into
  35798. // conflicting subsets {@code (s, _, ctx, _)} and singleton subsets with
  35799. // non-conflicting configurations. Two configurations conflict if they have
  35800. // identical {@link ATNConfig//state} and {@link ATNConfig//context} values
  35801. // but different {@link ATNConfig//alt} value, e.g. {@code (s, i, ctx, _)}
  35802. // and {@code (s, j, ctx, _)} for {@code i!=j}.</p>
  35803. //
  35804. // <p>Reduce these configuration subsets to the set of possible alternatives.
  35805. // You can compute the alternative subsets in one pass as follows:</p>
  35806. //
  35807. // <p>{@code A_s,ctx = {i | (s, i, ctx, _)}} for each configuration in
  35808. // {@code C} holding {@code s} and {@code ctx} fixed.</p>
  35809. //
  35810. // <p>Or in pseudo-code, for each configuration {@code c} in {@code C}:</p>
  35811. //
  35812. // <pre>
  35813. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  35814. // alt and not pred
  35815. // </pre>
  35816. //
  35817. // <p>The values in {@code map} are the set of {@code A_s,ctx} sets.</p>
  35818. //
  35819. // <p>If {@code |A_s,ctx|=1} then there is no conflict associated with
  35820. // {@code s} and {@code ctx}.</p>
  35821. //
  35822. // <p>Reduce the subsets to singletons by choosing a minimum of each subset. If
  35823. // the union of these alternative subsets is a singleton, then no amount of
  35824. // more lookahead will help us. We will always pick that alternative. If,
  35825. // however, there is more than one alternative, then we are uncertain which
  35826. // alternative to predict and must continue looking for resolution. We may
  35827. // or may not discover an ambiguity in the future, even if there are no
  35828. // conflicting subsets this round.</p>
  35829. //
  35830. // <p>The biggest sin is to terminate early because it means we've made a
  35831. // decision but were uncertain as to the eventual outcome. We haven't used
  35832. // enough lookahead. On the other hand, announcing a conflict too late is no
  35833. // big deal; you will still have the conflict. It's just inefficient. It
  35834. // might even look until the end of file.</p>
  35835. //
  35836. // <p>No special consideration for semantic predicates is required because
  35837. // predicates are evaluated on-the-fly for full LL prediction, ensuring that
  35838. // no configuration contains a semantic context during the termination
  35839. // check.</p>
  35840. //
  35841. // <p><strong>CONFLICTING CONFIGS</strong></p>
  35842. //
  35843. // <p>Two configurations {@code (s, i, x)} and {@code (s, j, x')}, conflict
  35844. // when {@code i!=j} but {@code x=x'}. Because we merge all
  35845. // {@code (s, i, _)} configurations together, that means that there are at
  35846. // most {@code n} configurations associated with state {@code s} for
  35847. // {@code n} possible alternatives in the decision. The merged stacks
  35848. // complicate the comparison of configuration contexts {@code x} and
  35849. // {@code x'}. Sam checks to see if one is a subset of the other by calling
  35850. // merge and checking to see if the merged result is either {@code x} or
  35851. // {@code x'}. If the {@code x} associated with lowest alternative {@code i}
  35852. // is the superset, then {@code i} is the only possible prediction since the
  35853. // others resolve to {@code min(i)} as well. However, if {@code x} is
  35854. // associated with {@code j>i} then at least one stack configuration for
  35855. // {@code j} is not in conflict with alternative {@code i}. The algorithm
  35856. // should keep going, looking for more lookahead due to the uncertainty.</p>
  35857. //
  35858. // <p>For simplicity, I'm doing a equality check between {@code x} and
  35859. // {@code x'} that lets the algorithm continue to consume lookahead longer
  35860. // than necessary. The reason I like the equality is of course the
  35861. // simplicity but also because that is the test you need to detect the
  35862. // alternatives that are actually in conflict.</p>
  35863. //
  35864. // <p><strong>CONTINUE/STOP RULE</strong></p>
  35865. //
  35866. // <p>Continue if union of resolved alternative sets from non-conflicting and
  35867. // conflicting alternative subsets has more than one alternative. We are
  35868. // uncertain about which alternative to predict.</p>
  35869. //
  35870. // <p>The complete set of alternatives, {@code [i for (_,i,_)]}, tells us which
  35871. // alternatives are still in the running for the amount of input we've
  35872. // consumed at this point. The conflicting sets let us to strip away
  35873. // configurations that won't lead to more states because we resolve
  35874. // conflicts to the configuration with a minimum alternate for the
  35875. // conflicting set.</p>
  35876. //
  35877. // <p><strong>CASES</strong></p>
  35878. //
  35879. // <ul>
  35880. //
  35881. // <li>no conflicts and more than 1 alternative in set =&gt; continue</li>
  35882. //
  35883. // <li> {@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s, 3, z)},
  35884. // {@code (s', 1, y)}, {@code (s', 2, y)} yields non-conflicting set
  35885. // {@code {3}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35886. // {@code {1,3}} =&gt; continue
  35887. // </li>
  35888. //
  35889. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35890. // {@code (s', 2, y)}, {@code (s'', 1, z)} yields non-conflicting set
  35891. // {@code {1}} U conflicting sets {@code min({1,2})} U {@code min({1,2})} =
  35892. // {@code {1}} =&gt; stop and predict 1</li>
  35893. //
  35894. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 1, y)},
  35895. // {@code (s', 2, y)} yields conflicting, reduced sets {@code {1}} U
  35896. // {@code {1}} = {@code {1}} =&gt; stop and predict 1, can announce
  35897. // ambiguity {@code {1,2}}</li>
  35898. //
  35899. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 2, y)},
  35900. // {@code (s', 3, y)} yields conflicting, reduced sets {@code {1}} U
  35901. // {@code {2}} = {@code {1,2}} =&gt; continue</li>
  35902. //
  35903. // <li>{@code (s, 1, x)}, {@code (s, 2, x)}, {@code (s', 3, y)},
  35904. // {@code (s', 4, y)} yields conflicting, reduced sets {@code {1}} U
  35905. // {@code {3}} = {@code {1,3}} =&gt; continue</li>
  35906. //
  35907. // </ul>
  35908. //
  35909. // <p><strong>EXACT AMBIGUITY DETECTION</strong></p>
  35910. //
  35911. // <p>If all states report the same conflicting set of alternatives, then we
  35912. // know we have the exact ambiguity set.</p>
  35913. //
  35914. // <p><code>|A_<em>i</em>|&gt;1</code> and
  35915. // <code>A_<em>i</em> = A_<em>j</em></code> for all <em>i</em>, <em>j</em>.</p>
  35916. //
  35917. // <p>In other words, we continue examining lookahead until all {@code A_i}
  35918. // have more than one alternative and all {@code A_i} are the same. If
  35919. // {@code A={{1,2}, {1,3}}}, then regular LL prediction would terminate
  35920. // because the resolved set is {@code {1}}. To determine what the real
  35921. // ambiguity is, we have to know whether the ambiguity is between one and
  35922. // two or one and three so we keep going. We can only stop prediction when
  35923. // we need exact ambiguity detection when the sets look like
  35924. // {@code A={{1,2}}} or {@code {{1,2},{1,2}}}, etc...</p>
  35925. //
  35926. PredictionMode.resolvesToJustOneViableAlt = function(altsets) {
  35927. return PredictionMode.getSingleViableAlt(altsets);
  35928. };
  35929. //
  35930. // Determines if every alternative subset in {@code altsets} contains more
  35931. // than one alternative.
  35932. //
  35933. // @param altsets a collection of alternative subsets
  35934. // @return {@code true} if every {@link BitSet} in {@code altsets} has
  35935. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35936. //
  35937. PredictionMode.allSubsetsConflict = function(altsets) {
  35938. return ! PredictionMode.hasNonConflictingAltSet(altsets);
  35939. };
  35940. //
  35941. // Determines if any single alternative subset in {@code altsets} contains
  35942. // exactly one alternative.
  35943. //
  35944. // @param altsets a collection of alternative subsets
  35945. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35946. // {@link BitSet//cardinality cardinality} 1, otherwise {@code false}
  35947. //
  35948. PredictionMode.hasNonConflictingAltSet = function(altsets) {
  35949. for(var i=0;i<altsets.length;i++) {
  35950. var alts = altsets[i];
  35951. if (alts.length===1) {
  35952. return true;
  35953. }
  35954. }
  35955. return false;
  35956. };
  35957. //
  35958. // Determines if any single alternative subset in {@code altsets} contains
  35959. // more than one alternative.
  35960. //
  35961. // @param altsets a collection of alternative subsets
  35962. // @return {@code true} if {@code altsets} contains a {@link BitSet} with
  35963. // {@link BitSet//cardinality cardinality} &gt; 1, otherwise {@code false}
  35964. //
  35965. PredictionMode.hasConflictingAltSet = function(altsets) {
  35966. for(var i=0;i<altsets.length;i++) {
  35967. var alts = altsets[i];
  35968. if (alts.length>1) {
  35969. return true;
  35970. }
  35971. }
  35972. return false;
  35973. };
  35974. //
  35975. // Determines if every alternative subset in {@code altsets} is equivalent.
  35976. //
  35977. // @param altsets a collection of alternative subsets
  35978. // @return {@code true} if every member of {@code altsets} is equal to the
  35979. // others, otherwise {@code false}
  35980. //
  35981. PredictionMode.allSubsetsEqual = function(altsets) {
  35982. var first = null;
  35983. for(var i=0;i<altsets.length;i++) {
  35984. var alts = altsets[i];
  35985. if (first === null) {
  35986. first = alts;
  35987. } else if (alts!==first) {
  35988. return false;
  35989. }
  35990. }
  35991. return true;
  35992. };
  35993. //
  35994. // Returns the unique alternative predicted by all alternative subsets in
  35995. // {@code altsets}. If no such alternative exists, this method returns
  35996. // {@link ATN//INVALID_ALT_NUMBER}.
  35997. //
  35998. // @param altsets a collection of alternative subsets
  35999. //
  36000. PredictionMode.getUniqueAlt = function(altsets) {
  36001. var all = PredictionMode.getAlts(altsets);
  36002. if (all.length===1) {
  36003. return all.minValue();
  36004. } else {
  36005. return ATN.INVALID_ALT_NUMBER;
  36006. }
  36007. };
  36008. // Gets the complete set of represented alternatives for a collection of
  36009. // alternative subsets. This method returns the union of each {@link BitSet}
  36010. // in {@code altsets}.
  36011. //
  36012. // @param altsets a collection of alternative subsets
  36013. // @return the set of represented alternatives in {@code altsets}
  36014. //
  36015. PredictionMode.getAlts = function(altsets) {
  36016. var all = new BitSet();
  36017. altsets.map( function(alts) { all.or(alts); });
  36018. return all;
  36019. };
  36020. //
  36021. // This function gets the conflicting alt subsets from a configuration set.
  36022. // For each configuration {@code c} in {@code configs}:
  36023. //
  36024. // <pre>
  36025. // map[c] U= c.{@link ATNConfig//alt alt} // map hash/equals uses s and x, not
  36026. // alt and not pred
  36027. // </pre>
  36028. PredictionMode.getConflictingAltSubsets = function(configs) {
  36029. var configToAlts = new Map();
  36030. configToAlts.hashFunction = function(cfg) { hashStuff(cfg.state.stateNumber, cfg.context); };
  36031. configToAlts.equalsFunction = function(c1, c2) { return c1.state.stateNumber==c2.state.stateNumber && c1.context.equals(c2.context);}
  36032. configs.items.map(function(cfg) {
  36033. var alts = configToAlts.get(cfg);
  36034. if (alts === null) {
  36035. alts = new BitSet();
  36036. configToAlts.put(cfg, alts);
  36037. }
  36038. alts.add(cfg.alt);
  36039. });
  36040. return configToAlts.getValues();
  36041. };
  36042. //
  36043. // Get a map from state to alt subset from a configuration set. For each
  36044. // configuration {@code c} in {@code configs}:
  36045. //
  36046. // <pre>
  36047. // map[c.{@link ATNConfig//state state}] U= c.{@link ATNConfig//alt alt}
  36048. // </pre>
  36049. //
  36050. PredictionMode.getStateToAltMap = function(configs) {
  36051. var m = new AltDict();
  36052. configs.items.map(function(c) {
  36053. var alts = m.get(c.state);
  36054. if (alts === null) {
  36055. alts = new BitSet();
  36056. m.put(c.state, alts);
  36057. }
  36058. alts.add(c.alt);
  36059. });
  36060. return m;
  36061. };
  36062. PredictionMode.hasStateAssociatedWithOneAlt = function(configs) {
  36063. var values = PredictionMode.getStateToAltMap(configs).values();
  36064. for(var i=0;i<values.length;i++) {
  36065. if (values[i].length===1) {
  36066. return true;
  36067. }
  36068. }
  36069. return false;
  36070. };
  36071. PredictionMode.getSingleViableAlt = function(altsets) {
  36072. var result = null;
  36073. for(var i=0;i<altsets.length;i++) {
  36074. var alts = altsets[i];
  36075. var minAlt = alts.minValue();
  36076. if(result===null) {
  36077. result = minAlt;
  36078. } else if(result!==minAlt) { // more than 1 viable alt
  36079. return ATN.INVALID_ALT_NUMBER;
  36080. }
  36081. }
  36082. return result;
  36083. };
  36084. exports.PredictionMode = PredictionMode;
  36085. /***/ }),
  36086. /***/ "./node_modules/antlr4/atn/SemanticContext.js":
  36087. /*!****************************************************!*\
  36088. !*** ./node_modules/antlr4/atn/SemanticContext.js ***!
  36089. \****************************************************/
  36090. /*! no static exports found */
  36091. /***/ (function(module, exports, __webpack_require__) {
  36092. //
  36093. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36094. * Use of this file is governed by the BSD 3-clause license that
  36095. * can be found in the LICENSE.txt file in the project root.
  36096. */
  36097. //
  36098. // A tree structure used to record the semantic context in which
  36099. // an ATN configuration is valid. It's either a single predicate,
  36100. // a conjunction {@code p1&&p2}, or a sum of products {@code p1||p2}.
  36101. //
  36102. // <p>I have scoped the {@link AND}, {@link OR}, and {@link Predicate} subclasses of
  36103. // {@link SemanticContext} within the scope of this outer class.</p>
  36104. //
  36105. var Set = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36106. var Hash = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").Hash;
  36107. function SemanticContext() {
  36108. return this;
  36109. }
  36110. SemanticContext.prototype.hashCode = function() {
  36111. var hash = new Hash();
  36112. this.updateHashCode(hash);
  36113. return hash.finish();
  36114. };
  36115. // For context independent predicates, we evaluate them without a local
  36116. // context (i.e., null context). That way, we can evaluate them without
  36117. // having to create proper rule-specific context during prediction (as
  36118. // opposed to the parser, which creates them naturally). In a practical
  36119. // sense, this avoids a cast exception from RuleContext to myruleContext.
  36120. //
  36121. // <p>For context dependent predicates, we must pass in a local context so that
  36122. // references such as $arg evaluate properly as _localctx.arg. We only
  36123. // capture context dependent predicates in the context in which we begin
  36124. // prediction, so we passed in the outer context here in case of context
  36125. // dependent predicate evaluation.</p>
  36126. //
  36127. SemanticContext.prototype.evaluate = function(parser, outerContext) {
  36128. };
  36129. //
  36130. // Evaluate the precedence predicates for the context and reduce the result.
  36131. //
  36132. // @param parser The parser instance.
  36133. // @param outerContext The current parser context object.
  36134. // @return The simplified semantic context after precedence predicates are
  36135. // evaluated, which will be one of the following values.
  36136. // <ul>
  36137. // <li>{@link //NONE}: if the predicate simplifies to {@code true} after
  36138. // precedence predicates are evaluated.</li>
  36139. // <li>{@code null}: if the predicate simplifies to {@code false} after
  36140. // precedence predicates are evaluated.</li>
  36141. // <li>{@code this}: if the semantic context is not changed as a result of
  36142. // precedence predicate evaluation.</li>
  36143. // <li>A non-{@code null} {@link SemanticContext}: the new simplified
  36144. // semantic context after precedence predicates are evaluated.</li>
  36145. // </ul>
  36146. //
  36147. SemanticContext.prototype.evalPrecedence = function(parser, outerContext) {
  36148. return this;
  36149. };
  36150. SemanticContext.andContext = function(a, b) {
  36151. if (a === null || a === SemanticContext.NONE) {
  36152. return b;
  36153. }
  36154. if (b === null || b === SemanticContext.NONE) {
  36155. return a;
  36156. }
  36157. var result = new AND(a, b);
  36158. if (result.opnds.length === 1) {
  36159. return result.opnds[0];
  36160. } else {
  36161. return result;
  36162. }
  36163. };
  36164. SemanticContext.orContext = function(a, b) {
  36165. if (a === null) {
  36166. return b;
  36167. }
  36168. if (b === null) {
  36169. return a;
  36170. }
  36171. if (a === SemanticContext.NONE || b === SemanticContext.NONE) {
  36172. return SemanticContext.NONE;
  36173. }
  36174. var result = new OR(a, b);
  36175. if (result.opnds.length === 1) {
  36176. return result.opnds[0];
  36177. } else {
  36178. return result;
  36179. }
  36180. };
  36181. function Predicate(ruleIndex, predIndex, isCtxDependent) {
  36182. SemanticContext.call(this);
  36183. this.ruleIndex = ruleIndex === undefined ? -1 : ruleIndex;
  36184. this.predIndex = predIndex === undefined ? -1 : predIndex;
  36185. this.isCtxDependent = isCtxDependent === undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36186. return this;
  36187. }
  36188. Predicate.prototype = Object.create(SemanticContext.prototype);
  36189. Predicate.prototype.constructor = Predicate;
  36190. //The default {@link SemanticContext}, which is semantically equivalent to
  36191. //a predicate of the form {@code {true}?}.
  36192. //
  36193. SemanticContext.NONE = new Predicate();
  36194. Predicate.prototype.evaluate = function(parser, outerContext) {
  36195. var localctx = this.isCtxDependent ? outerContext : null;
  36196. return parser.sempred(localctx, this.ruleIndex, this.predIndex);
  36197. };
  36198. Predicate.prototype.updateHashCode = function(hash) {
  36199. hash.update(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36200. };
  36201. Predicate.prototype.equals = function(other) {
  36202. if (this === other) {
  36203. return true;
  36204. } else if (!(other instanceof Predicate)) {
  36205. return false;
  36206. } else {
  36207. return this.ruleIndex === other.ruleIndex &&
  36208. this.predIndex === other.predIndex &&
  36209. this.isCtxDependent === other.isCtxDependent;
  36210. }
  36211. };
  36212. Predicate.prototype.toString = function() {
  36213. return "{" + this.ruleIndex + ":" + this.predIndex + "}?";
  36214. };
  36215. function PrecedencePredicate(precedence) {
  36216. SemanticContext.call(this);
  36217. this.precedence = precedence === undefined ? 0 : precedence;
  36218. }
  36219. PrecedencePredicate.prototype = Object.create(SemanticContext.prototype);
  36220. PrecedencePredicate.prototype.constructor = PrecedencePredicate;
  36221. PrecedencePredicate.prototype.evaluate = function(parser, outerContext) {
  36222. return parser.precpred(outerContext, this.precedence);
  36223. };
  36224. PrecedencePredicate.prototype.evalPrecedence = function(parser, outerContext) {
  36225. if (parser.precpred(outerContext, this.precedence)) {
  36226. return SemanticContext.NONE;
  36227. } else {
  36228. return null;
  36229. }
  36230. };
  36231. PrecedencePredicate.prototype.compareTo = function(other) {
  36232. return this.precedence - other.precedence;
  36233. };
  36234. PrecedencePredicate.prototype.updateHashCode = function(hash) {
  36235. hash.update(31);
  36236. };
  36237. PrecedencePredicate.prototype.equals = function(other) {
  36238. if (this === other) {
  36239. return true;
  36240. } else if (!(other instanceof PrecedencePredicate)) {
  36241. return false;
  36242. } else {
  36243. return this.precedence === other.precedence;
  36244. }
  36245. };
  36246. PrecedencePredicate.prototype.toString = function() {
  36247. return "{"+this.precedence+">=prec}?";
  36248. };
  36249. PrecedencePredicate.filterPrecedencePredicates = function(set) {
  36250. var result = [];
  36251. set.values().map( function(context) {
  36252. if (context instanceof PrecedencePredicate) {
  36253. result.push(context);
  36254. }
  36255. });
  36256. return result;
  36257. };
  36258. // A semantic context which is true whenever none of the contained contexts
  36259. // is false.
  36260. //
  36261. function AND(a, b) {
  36262. SemanticContext.call(this);
  36263. var operands = new Set();
  36264. if (a instanceof AND) {
  36265. a.opnds.map(function(o) {
  36266. operands.add(o);
  36267. });
  36268. } else {
  36269. operands.add(a);
  36270. }
  36271. if (b instanceof AND) {
  36272. b.opnds.map(function(o) {
  36273. operands.add(o);
  36274. });
  36275. } else {
  36276. operands.add(b);
  36277. }
  36278. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  36279. if (precedencePredicates.length > 0) {
  36280. // interested in the transition with the lowest precedence
  36281. var reduced = null;
  36282. precedencePredicates.map( function(p) {
  36283. if(reduced===null || p.precedence<reduced.precedence) {
  36284. reduced = p;
  36285. }
  36286. });
  36287. operands.add(reduced);
  36288. }
  36289. this.opnds = operands.values();
  36290. return this;
  36291. }
  36292. AND.prototype = Object.create(SemanticContext.prototype);
  36293. AND.prototype.constructor = AND;
  36294. AND.prototype.equals = function(other) {
  36295. if (this === other) {
  36296. return true;
  36297. } else if (!(other instanceof AND)) {
  36298. return false;
  36299. } else {
  36300. return this.opnds === other.opnds;
  36301. }
  36302. };
  36303. AND.prototype.updateHashCode = function(hash) {
  36304. hash.update(this.opnds, "AND");
  36305. };
  36306. //
  36307. // {@inheritDoc}
  36308. //
  36309. // <p>
  36310. // The evaluation of predicates by this context is short-circuiting, but
  36311. // unordered.</p>
  36312. //
  36313. AND.prototype.evaluate = function(parser, outerContext) {
  36314. for (var i = 0; i < this.opnds.length; i++) {
  36315. if (!this.opnds[i].evaluate(parser, outerContext)) {
  36316. return false;
  36317. }
  36318. }
  36319. return true;
  36320. };
  36321. AND.prototype.evalPrecedence = function(parser, outerContext) {
  36322. var differs = false;
  36323. var operands = [];
  36324. for (var i = 0; i < this.opnds.length; i++) {
  36325. var context = this.opnds[i];
  36326. var evaluated = context.evalPrecedence(parser, outerContext);
  36327. differs |= (evaluated !== context);
  36328. if (evaluated === null) {
  36329. // The AND context is false if any element is false
  36330. return null;
  36331. } else if (evaluated !== SemanticContext.NONE) {
  36332. // Reduce the result by skipping true elements
  36333. operands.push(evaluated);
  36334. }
  36335. }
  36336. if (!differs) {
  36337. return this;
  36338. }
  36339. if (operands.length === 0) {
  36340. // all elements were true, so the AND context is true
  36341. return SemanticContext.NONE;
  36342. }
  36343. var result = null;
  36344. operands.map(function(o) {
  36345. result = result === null ? o : SemanticContext.andContext(result, o);
  36346. });
  36347. return result;
  36348. };
  36349. AND.prototype.toString = function() {
  36350. var s = "";
  36351. this.opnds.map(function(o) {
  36352. s += "&& " + o.toString();
  36353. });
  36354. return s.length > 3 ? s.slice(3) : s;
  36355. };
  36356. //
  36357. // A semantic context which is true whenever at least one of the contained
  36358. // contexts is true.
  36359. //
  36360. function OR(a, b) {
  36361. SemanticContext.call(this);
  36362. var operands = new Set();
  36363. if (a instanceof OR) {
  36364. a.opnds.map(function(o) {
  36365. operands.add(o);
  36366. });
  36367. } else {
  36368. operands.add(a);
  36369. }
  36370. if (b instanceof OR) {
  36371. b.opnds.map(function(o) {
  36372. operands.add(o);
  36373. });
  36374. } else {
  36375. operands.add(b);
  36376. }
  36377. var precedencePredicates = PrecedencePredicate.filterPrecedencePredicates(operands);
  36378. if (precedencePredicates.length > 0) {
  36379. // interested in the transition with the highest precedence
  36380. var s = precedencePredicates.sort(function(a, b) {
  36381. return a.compareTo(b);
  36382. });
  36383. var reduced = s[s.length-1];
  36384. operands.add(reduced);
  36385. }
  36386. this.opnds = operands.values();
  36387. return this;
  36388. }
  36389. OR.prototype = Object.create(SemanticContext.prototype);
  36390. OR.prototype.constructor = OR;
  36391. OR.prototype.constructor = function(other) {
  36392. if (this === other) {
  36393. return true;
  36394. } else if (!(other instanceof OR)) {
  36395. return false;
  36396. } else {
  36397. return this.opnds === other.opnds;
  36398. }
  36399. };
  36400. OR.prototype.updateHashCode = function(hash) {
  36401. hash.update(this.opnds, "OR");
  36402. };
  36403. // <p>
  36404. // The evaluation of predicates by this context is short-circuiting, but
  36405. // unordered.</p>
  36406. //
  36407. OR.prototype.evaluate = function(parser, outerContext) {
  36408. for (var i = 0; i < this.opnds.length; i++) {
  36409. if (this.opnds[i].evaluate(parser, outerContext)) {
  36410. return true;
  36411. }
  36412. }
  36413. return false;
  36414. };
  36415. OR.prototype.evalPrecedence = function(parser, outerContext) {
  36416. var differs = false;
  36417. var operands = [];
  36418. for (var i = 0; i < this.opnds.length; i++) {
  36419. var context = this.opnds[i];
  36420. var evaluated = context.evalPrecedence(parser, outerContext);
  36421. differs |= (evaluated !== context);
  36422. if (evaluated === SemanticContext.NONE) {
  36423. // The OR context is true if any element is true
  36424. return SemanticContext.NONE;
  36425. } else if (evaluated !== null) {
  36426. // Reduce the result by skipping false elements
  36427. operands.push(evaluated);
  36428. }
  36429. }
  36430. if (!differs) {
  36431. return this;
  36432. }
  36433. if (operands.length === 0) {
  36434. // all elements were false, so the OR context is false
  36435. return null;
  36436. }
  36437. var result = null;
  36438. operands.map(function(o) {
  36439. return result === null ? o : SemanticContext.orContext(result, o);
  36440. });
  36441. return result;
  36442. };
  36443. OR.prototype.toString = function() {
  36444. var s = "";
  36445. this.opnds.map(function(o) {
  36446. s += "|| " + o.toString();
  36447. });
  36448. return s.length > 3 ? s.slice(3) : s;
  36449. };
  36450. exports.SemanticContext = SemanticContext;
  36451. exports.PrecedencePredicate = PrecedencePredicate;
  36452. exports.Predicate = Predicate;
  36453. /***/ }),
  36454. /***/ "./node_modules/antlr4/atn/Transition.js":
  36455. /*!***********************************************!*\
  36456. !*** ./node_modules/antlr4/atn/Transition.js ***!
  36457. \***********************************************/
  36458. /*! no static exports found */
  36459. /***/ (function(module, exports, __webpack_require__) {
  36460. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36461. * Use of this file is governed by the BSD 3-clause license that
  36462. * can be found in the LICENSE.txt file in the project root.
  36463. */
  36464. //
  36465. // An ATN transition between any two ATN states. Subclasses define
  36466. // atom, set, epsilon, action, predicate, rule transitions.
  36467. //
  36468. // <p>This is a one way link. It emanates from a state (usually via a list of
  36469. // transitions) and has a target state.</p>
  36470. //
  36471. // <p>Since we never have to change the ATN transitions once we construct it,
  36472. // we can fix these transitions as specific classes. The DFA transitions
  36473. // on the other hand need to update the labels as it adds transitions to
  36474. // the states. We'll use the term Edge for the DFA to distinguish them from
  36475. // ATN transitions.</p>
  36476. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  36477. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  36478. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  36479. var Predicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").Predicate;
  36480. var PrecedencePredicate = __webpack_require__(/*! ./SemanticContext */ "./node_modules/antlr4/atn/SemanticContext.js").PrecedencePredicate;
  36481. function Transition (target) {
  36482. // The target of this transition.
  36483. if (target===undefined || target===null) {
  36484. throw "target cannot be null.";
  36485. }
  36486. this.target = target;
  36487. // Are we epsilon, action, sempred?
  36488. this.isEpsilon = false;
  36489. this.label = null;
  36490. return this;
  36491. }
  36492. // constants for serialization
  36493. Transition.EPSILON = 1;
  36494. Transition.RANGE = 2;
  36495. Transition.RULE = 3;
  36496. Transition.PREDICATE = 4; // e.g., {isType(input.LT(1))}?
  36497. Transition.ATOM = 5;
  36498. Transition.ACTION = 6;
  36499. Transition.SET = 7; // ~(A|B) or ~atom, wildcard, which convert to next 2
  36500. Transition.NOT_SET = 8;
  36501. Transition.WILDCARD = 9;
  36502. Transition.PRECEDENCE = 10;
  36503. Transition.serializationNames = [
  36504. "INVALID",
  36505. "EPSILON",
  36506. "RANGE",
  36507. "RULE",
  36508. "PREDICATE",
  36509. "ATOM",
  36510. "ACTION",
  36511. "SET",
  36512. "NOT_SET",
  36513. "WILDCARD",
  36514. "PRECEDENCE"
  36515. ];
  36516. Transition.serializationTypes = {
  36517. EpsilonTransition: Transition.EPSILON,
  36518. RangeTransition: Transition.RANGE,
  36519. RuleTransition: Transition.RULE,
  36520. PredicateTransition: Transition.PREDICATE,
  36521. AtomTransition: Transition.ATOM,
  36522. ActionTransition: Transition.ACTION,
  36523. SetTransition: Transition.SET,
  36524. NotSetTransition: Transition.NOT_SET,
  36525. WildcardTransition: Transition.WILDCARD,
  36526. PrecedencePredicateTransition: Transition.PRECEDENCE
  36527. };
  36528. // TODO: make all transitions sets? no, should remove set edges
  36529. function AtomTransition(target, label) {
  36530. Transition.call(this, target);
  36531. this.label_ = label; // The token type or character value; or, signifies special label.
  36532. this.label = this.makeLabel();
  36533. this.serializationType = Transition.ATOM;
  36534. return this;
  36535. }
  36536. AtomTransition.prototype = Object.create(Transition.prototype);
  36537. AtomTransition.prototype.constructor = AtomTransition;
  36538. AtomTransition.prototype.makeLabel = function() {
  36539. var s = new IntervalSet();
  36540. s.addOne(this.label_);
  36541. return s;
  36542. };
  36543. AtomTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36544. return this.label_ === symbol;
  36545. };
  36546. AtomTransition.prototype.toString = function() {
  36547. return this.label_;
  36548. };
  36549. function RuleTransition(ruleStart, ruleIndex, precedence, followState) {
  36550. Transition.call(this, ruleStart);
  36551. this.ruleIndex = ruleIndex; // ptr to the rule definition object for this rule ref
  36552. this.precedence = precedence;
  36553. this.followState = followState; // what node to begin computations following ref to rule
  36554. this.serializationType = Transition.RULE;
  36555. this.isEpsilon = true;
  36556. return this;
  36557. }
  36558. RuleTransition.prototype = Object.create(Transition.prototype);
  36559. RuleTransition.prototype.constructor = RuleTransition;
  36560. RuleTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36561. return false;
  36562. };
  36563. function EpsilonTransition(target, outermostPrecedenceReturn) {
  36564. Transition.call(this, target);
  36565. this.serializationType = Transition.EPSILON;
  36566. this.isEpsilon = true;
  36567. this.outermostPrecedenceReturn = outermostPrecedenceReturn;
  36568. return this;
  36569. }
  36570. EpsilonTransition.prototype = Object.create(Transition.prototype);
  36571. EpsilonTransition.prototype.constructor = EpsilonTransition;
  36572. EpsilonTransition.prototype.matches = function( symbol, minVocabSymbol, maxVocabSymbol) {
  36573. return false;
  36574. };
  36575. EpsilonTransition.prototype.toString = function() {
  36576. return "epsilon";
  36577. };
  36578. function RangeTransition(target, start, stop) {
  36579. Transition.call(this, target);
  36580. this.serializationType = Transition.RANGE;
  36581. this.start = start;
  36582. this.stop = stop;
  36583. this.label = this.makeLabel();
  36584. return this;
  36585. }
  36586. RangeTransition.prototype = Object.create(Transition.prototype);
  36587. RangeTransition.prototype.constructor = RangeTransition;
  36588. RangeTransition.prototype.makeLabel = function() {
  36589. var s = new IntervalSet();
  36590. s.addRange(this.start, this.stop);
  36591. return s;
  36592. };
  36593. RangeTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36594. return symbol >= this.start && symbol <= this.stop;
  36595. };
  36596. RangeTransition.prototype.toString = function() {
  36597. return "'" + String.fromCharCode(this.start) + "'..'" + String.fromCharCode(this.stop) + "'";
  36598. };
  36599. function AbstractPredicateTransition(target) {
  36600. Transition.call(this, target);
  36601. return this;
  36602. }
  36603. AbstractPredicateTransition.prototype = Object.create(Transition.prototype);
  36604. AbstractPredicateTransition.prototype.constructor = AbstractPredicateTransition;
  36605. function PredicateTransition(target, ruleIndex, predIndex, isCtxDependent) {
  36606. AbstractPredicateTransition.call(this, target);
  36607. this.serializationType = Transition.PREDICATE;
  36608. this.ruleIndex = ruleIndex;
  36609. this.predIndex = predIndex;
  36610. this.isCtxDependent = isCtxDependent; // e.g., $i ref in pred
  36611. this.isEpsilon = true;
  36612. return this;
  36613. }
  36614. PredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36615. PredicateTransition.prototype.constructor = PredicateTransition;
  36616. PredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36617. return false;
  36618. };
  36619. PredicateTransition.prototype.getPredicate = function() {
  36620. return new Predicate(this.ruleIndex, this.predIndex, this.isCtxDependent);
  36621. };
  36622. PredicateTransition.prototype.toString = function() {
  36623. return "pred_" + this.ruleIndex + ":" + this.predIndex;
  36624. };
  36625. function ActionTransition(target, ruleIndex, actionIndex, isCtxDependent) {
  36626. Transition.call(this, target);
  36627. this.serializationType = Transition.ACTION;
  36628. this.ruleIndex = ruleIndex;
  36629. this.actionIndex = actionIndex===undefined ? -1 : actionIndex;
  36630. this.isCtxDependent = isCtxDependent===undefined ? false : isCtxDependent; // e.g., $i ref in pred
  36631. this.isEpsilon = true;
  36632. return this;
  36633. }
  36634. ActionTransition.prototype = Object.create(Transition.prototype);
  36635. ActionTransition.prototype.constructor = ActionTransition;
  36636. ActionTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36637. return false;
  36638. };
  36639. ActionTransition.prototype.toString = function() {
  36640. return "action_" + this.ruleIndex + ":" + this.actionIndex;
  36641. };
  36642. // A transition containing a set of values.
  36643. function SetTransition(target, set) {
  36644. Transition.call(this, target);
  36645. this.serializationType = Transition.SET;
  36646. if (set !==undefined && set !==null) {
  36647. this.label = set;
  36648. } else {
  36649. this.label = new IntervalSet();
  36650. this.label.addOne(Token.INVALID_TYPE);
  36651. }
  36652. return this;
  36653. }
  36654. SetTransition.prototype = Object.create(Transition.prototype);
  36655. SetTransition.prototype.constructor = SetTransition;
  36656. SetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36657. return this.label.contains(symbol);
  36658. };
  36659. SetTransition.prototype.toString = function() {
  36660. return this.label.toString();
  36661. };
  36662. function NotSetTransition(target, set) {
  36663. SetTransition.call(this, target, set);
  36664. this.serializationType = Transition.NOT_SET;
  36665. return this;
  36666. }
  36667. NotSetTransition.prototype = Object.create(SetTransition.prototype);
  36668. NotSetTransition.prototype.constructor = NotSetTransition;
  36669. NotSetTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36670. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol &&
  36671. !SetTransition.prototype.matches.call(this, symbol, minVocabSymbol, maxVocabSymbol);
  36672. };
  36673. NotSetTransition.prototype.toString = function() {
  36674. return '~' + SetTransition.prototype.toString.call(this);
  36675. };
  36676. function WildcardTransition(target) {
  36677. Transition.call(this, target);
  36678. this.serializationType = Transition.WILDCARD;
  36679. return this;
  36680. }
  36681. WildcardTransition.prototype = Object.create(Transition.prototype);
  36682. WildcardTransition.prototype.constructor = WildcardTransition;
  36683. WildcardTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36684. return symbol >= minVocabSymbol && symbol <= maxVocabSymbol;
  36685. };
  36686. WildcardTransition.prototype.toString = function() {
  36687. return ".";
  36688. };
  36689. function PrecedencePredicateTransition(target, precedence) {
  36690. AbstractPredicateTransition.call(this, target);
  36691. this.serializationType = Transition.PRECEDENCE;
  36692. this.precedence = precedence;
  36693. this.isEpsilon = true;
  36694. return this;
  36695. }
  36696. PrecedencePredicateTransition.prototype = Object.create(AbstractPredicateTransition.prototype);
  36697. PrecedencePredicateTransition.prototype.constructor = PrecedencePredicateTransition;
  36698. PrecedencePredicateTransition.prototype.matches = function(symbol, minVocabSymbol, maxVocabSymbol) {
  36699. return false;
  36700. };
  36701. PrecedencePredicateTransition.prototype.getPredicate = function() {
  36702. return new PrecedencePredicate(this.precedence);
  36703. };
  36704. PrecedencePredicateTransition.prototype.toString = function() {
  36705. return this.precedence + " >= _p";
  36706. };
  36707. exports.Transition = Transition;
  36708. exports.AtomTransition = AtomTransition;
  36709. exports.SetTransition = SetTransition;
  36710. exports.NotSetTransition = NotSetTransition;
  36711. exports.RuleTransition = RuleTransition;
  36712. exports.ActionTransition = ActionTransition;
  36713. exports.EpsilonTransition = EpsilonTransition;
  36714. exports.RangeTransition = RangeTransition;
  36715. exports.WildcardTransition = WildcardTransition;
  36716. exports.PredicateTransition = PredicateTransition;
  36717. exports.PrecedencePredicateTransition = PrecedencePredicateTransition;
  36718. exports.AbstractPredicateTransition = AbstractPredicateTransition;
  36719. /***/ }),
  36720. /***/ "./node_modules/antlr4/atn/index.js":
  36721. /*!******************************************!*\
  36722. !*** ./node_modules/antlr4/atn/index.js ***!
  36723. \******************************************/
  36724. /*! no static exports found */
  36725. /***/ (function(module, exports, __webpack_require__) {
  36726. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36727. * Use of this file is governed by the BSD 3-clause license that
  36728. * can be found in the LICENSE.txt file in the project root.
  36729. */
  36730. exports.ATN = __webpack_require__(/*! ./ATN */ "./node_modules/antlr4/atn/ATN.js").ATN;
  36731. exports.ATNDeserializer = __webpack_require__(/*! ./ATNDeserializer */ "./node_modules/antlr4/atn/ATNDeserializer.js").ATNDeserializer;
  36732. exports.LexerATNSimulator = __webpack_require__(/*! ./LexerATNSimulator */ "./node_modules/antlr4/atn/LexerATNSimulator.js").LexerATNSimulator;
  36733. exports.ParserATNSimulator = __webpack_require__(/*! ./ParserATNSimulator */ "./node_modules/antlr4/atn/ParserATNSimulator.js").ParserATNSimulator;
  36734. exports.PredictionMode = __webpack_require__(/*! ./PredictionMode */ "./node_modules/antlr4/atn/PredictionMode.js").PredictionMode;
  36735. /***/ }),
  36736. /***/ "./node_modules/antlr4/dfa/DFA.js":
  36737. /*!****************************************!*\
  36738. !*** ./node_modules/antlr4/dfa/DFA.js ***!
  36739. \****************************************/
  36740. /*! no static exports found */
  36741. /***/ (function(module, exports, __webpack_require__) {
  36742. //
  36743. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36744. * Use of this file is governed by the BSD 3-clause license that
  36745. * can be found in the LICENSE.txt file in the project root.
  36746. */
  36747. var Set = __webpack_require__(/*! ../Utils */ "./node_modules/antlr4/Utils.js").Set;
  36748. var DFAState = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").DFAState;
  36749. var StarLoopEntryState = __webpack_require__(/*! ../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").StarLoopEntryState;
  36750. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36751. var DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  36752. var LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  36753. function DFA(atnStartState, decision) {
  36754. if (decision === undefined) {
  36755. decision = 0;
  36756. }
  36757. // From which ATN state did we create this DFA?
  36758. this.atnStartState = atnStartState;
  36759. this.decision = decision;
  36760. // A set of all DFA states. Use {@link Map} so we can get old state back
  36761. // ({@link Set} only allows you to see if it's there).
  36762. this._states = new Set();
  36763. this.s0 = null;
  36764. // {@code true} if this DFA is for a precedence decision; otherwise,
  36765. // {@code false}. This is the backing field for {@link //isPrecedenceDfa},
  36766. // {@link //setPrecedenceDfa}.
  36767. this.precedenceDfa = false;
  36768. if (atnStartState instanceof StarLoopEntryState)
  36769. {
  36770. if (atnStartState.isPrecedenceDecision) {
  36771. this.precedenceDfa = true;
  36772. var precedenceState = new DFAState(null, new ATNConfigSet());
  36773. precedenceState.edges = [];
  36774. precedenceState.isAcceptState = false;
  36775. precedenceState.requiresFullContext = false;
  36776. this.s0 = precedenceState;
  36777. }
  36778. }
  36779. return this;
  36780. }
  36781. // Get the start state for a specific precedence value.
  36782. //
  36783. // @param precedence The current precedence.
  36784. // @return The start state corresponding to the specified precedence, or
  36785. // {@code null} if no start state exists for the specified precedence.
  36786. //
  36787. // @throws IllegalStateException if this is not a precedence DFA.
  36788. // @see //isPrecedenceDfa()
  36789. DFA.prototype.getPrecedenceStartState = function(precedence) {
  36790. if (!(this.precedenceDfa)) {
  36791. throw ("Only precedence DFAs may contain a precedence start state.");
  36792. }
  36793. // s0.edges is never null for a precedence DFA
  36794. if (precedence < 0 || precedence >= this.s0.edges.length) {
  36795. return null;
  36796. }
  36797. return this.s0.edges[precedence] || null;
  36798. };
  36799. // Set the start state for a specific precedence value.
  36800. //
  36801. // @param precedence The current precedence.
  36802. // @param startState The start state corresponding to the specified
  36803. // precedence.
  36804. //
  36805. // @throws IllegalStateException if this is not a precedence DFA.
  36806. // @see //isPrecedenceDfa()
  36807. //
  36808. DFA.prototype.setPrecedenceStartState = function(precedence, startState) {
  36809. if (!(this.precedenceDfa)) {
  36810. throw ("Only precedence DFAs may contain a precedence start state.");
  36811. }
  36812. if (precedence < 0) {
  36813. return;
  36814. }
  36815. // synchronization on s0 here is ok. when the DFA is turned into a
  36816. // precedence DFA, s0 will be initialized once and not updated again
  36817. // s0.edges is never null for a precedence DFA
  36818. this.s0.edges[precedence] = startState;
  36819. };
  36820. //
  36821. // Sets whether this is a precedence DFA. If the specified value differs
  36822. // from the current DFA configuration, the following actions are taken;
  36823. // otherwise no changes are made to the current DFA.
  36824. //
  36825. // <ul>
  36826. // <li>The {@link //states} map is cleared</li>
  36827. // <li>If {@code precedenceDfa} is {@code false}, the initial state
  36828. // {@link //s0} is set to {@code null}; otherwise, it is initialized to a new
  36829. // {@link DFAState} with an empty outgoing {@link DFAState//edges} array to
  36830. // store the start states for individual precedence values.</li>
  36831. // <li>The {@link //precedenceDfa} field is updated</li>
  36832. // </ul>
  36833. //
  36834. // @param precedenceDfa {@code true} if this is a precedence DFA; otherwise,
  36835. // {@code false}
  36836. DFA.prototype.setPrecedenceDfa = function(precedenceDfa) {
  36837. if (this.precedenceDfa!==precedenceDfa) {
  36838. this._states = new DFAStatesSet();
  36839. if (precedenceDfa) {
  36840. var precedenceState = new DFAState(null, new ATNConfigSet());
  36841. precedenceState.edges = [];
  36842. precedenceState.isAcceptState = false;
  36843. precedenceState.requiresFullContext = false;
  36844. this.s0 = precedenceState;
  36845. } else {
  36846. this.s0 = null;
  36847. }
  36848. this.precedenceDfa = precedenceDfa;
  36849. }
  36850. };
  36851. Object.defineProperty(DFA.prototype, "states", {
  36852. get : function() {
  36853. return this._states;
  36854. }
  36855. });
  36856. // Return a list of all states in this DFA, ordered by state number.
  36857. DFA.prototype.sortedStates = function() {
  36858. var list = this._states.values();
  36859. return list.sort(function(a, b) {
  36860. return a.stateNumber - b.stateNumber;
  36861. });
  36862. };
  36863. DFA.prototype.toString = function(literalNames, symbolicNames) {
  36864. literalNames = literalNames || null;
  36865. symbolicNames = symbolicNames || null;
  36866. if (this.s0 === null) {
  36867. return "";
  36868. }
  36869. var serializer = new DFASerializer(this, literalNames, symbolicNames);
  36870. return serializer.toString();
  36871. };
  36872. DFA.prototype.toLexerString = function() {
  36873. if (this.s0 === null) {
  36874. return "";
  36875. }
  36876. var serializer = new LexerDFASerializer(this);
  36877. return serializer.toString();
  36878. };
  36879. exports.DFA = DFA;
  36880. /***/ }),
  36881. /***/ "./node_modules/antlr4/dfa/DFASerializer.js":
  36882. /*!**************************************************!*\
  36883. !*** ./node_modules/antlr4/dfa/DFASerializer.js ***!
  36884. \**************************************************/
  36885. /*! no static exports found */
  36886. /***/ (function(module, exports) {
  36887. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36888. * Use of this file is governed by the BSD 3-clause license that
  36889. * can be found in the LICENSE.txt file in the project root.
  36890. */
  36891. // A DFA walker that knows how to dump them to serialized strings.#/
  36892. function DFASerializer(dfa, literalNames, symbolicNames) {
  36893. this.dfa = dfa;
  36894. this.literalNames = literalNames || [];
  36895. this.symbolicNames = symbolicNames || [];
  36896. return this;
  36897. }
  36898. DFASerializer.prototype.toString = function() {
  36899. if(this.dfa.s0 === null) {
  36900. return null;
  36901. }
  36902. var buf = "";
  36903. var states = this.dfa.sortedStates();
  36904. for(var i=0;i<states.length;i++) {
  36905. var s = states[i];
  36906. if(s.edges!==null) {
  36907. var n = s.edges.length;
  36908. for(var j=0;j<n;j++) {
  36909. var t = s.edges[j] || null;
  36910. if(t!==null && t.stateNumber !== 0x7FFFFFFF) {
  36911. buf = buf.concat(this.getStateString(s));
  36912. buf = buf.concat("-");
  36913. buf = buf.concat(this.getEdgeLabel(j));
  36914. buf = buf.concat("->");
  36915. buf = buf.concat(this.getStateString(t));
  36916. buf = buf.concat('\n');
  36917. }
  36918. }
  36919. }
  36920. }
  36921. return buf.length===0 ? null : buf;
  36922. };
  36923. DFASerializer.prototype.getEdgeLabel = function(i) {
  36924. if (i===0) {
  36925. return "EOF";
  36926. } else if(this.literalNames !==null || this.symbolicNames!==null) {
  36927. return this.literalNames[i-1] || this.symbolicNames[i-1];
  36928. } else {
  36929. return String.fromCharCode(i-1);
  36930. }
  36931. };
  36932. DFASerializer.prototype.getStateString = function(s) {
  36933. var baseStateStr = ( s.isAcceptState ? ":" : "") + "s" + s.stateNumber + ( s.requiresFullContext ? "^" : "");
  36934. if(s.isAcceptState) {
  36935. if (s.predicates !== null) {
  36936. return baseStateStr + "=>" + s.predicates.toString();
  36937. } else {
  36938. return baseStateStr + "=>" + s.prediction.toString();
  36939. }
  36940. } else {
  36941. return baseStateStr;
  36942. }
  36943. };
  36944. function LexerDFASerializer(dfa) {
  36945. DFASerializer.call(this, dfa, null);
  36946. return this;
  36947. }
  36948. LexerDFASerializer.prototype = Object.create(DFASerializer.prototype);
  36949. LexerDFASerializer.prototype.constructor = LexerDFASerializer;
  36950. LexerDFASerializer.prototype.getEdgeLabel = function(i) {
  36951. return "'" + String.fromCharCode(i) + "'";
  36952. };
  36953. exports.DFASerializer = DFASerializer;
  36954. exports.LexerDFASerializer = LexerDFASerializer;
  36955. /***/ }),
  36956. /***/ "./node_modules/antlr4/dfa/DFAState.js":
  36957. /*!*********************************************!*\
  36958. !*** ./node_modules/antlr4/dfa/DFAState.js ***!
  36959. \*********************************************/
  36960. /*! no static exports found */
  36961. /***/ (function(module, exports, __webpack_require__) {
  36962. //
  36963. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  36964. * Use of this file is governed by the BSD 3-clause license that
  36965. * can be found in the LICENSE.txt file in the project root.
  36966. */
  36967. ///
  36968. var ATNConfigSet = __webpack_require__(/*! ./../atn/ATNConfigSet */ "./node_modules/antlr4/atn/ATNConfigSet.js").ATNConfigSet;
  36969. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  36970. var Hash = Utils.Hash;
  36971. var Set = Utils.Set;
  36972. // Map a predicate to a predicted alternative.///
  36973. function PredPrediction(pred, alt) {
  36974. this.alt = alt;
  36975. this.pred = pred;
  36976. return this;
  36977. }
  36978. PredPrediction.prototype.toString = function() {
  36979. return "(" + this.pred + ", " + this.alt + ")";
  36980. };
  36981. // A DFA state represents a set of possible ATN configurations.
  36982. // As Aho, Sethi, Ullman p. 117 says "The DFA uses its state
  36983. // to keep track of all possible states the ATN can be in after
  36984. // reading each input symbol. That is to say, after reading
  36985. // input a1a2..an, the DFA is in a state that represents the
  36986. // subset T of the states of the ATN that are reachable from the
  36987. // ATN's start state along some path labeled a1a2..an."
  36988. // In conventional NFA&rarr;DFA conversion, therefore, the subset T
  36989. // would be a bitset representing the set of states the
  36990. // ATN could be in. We need to track the alt predicted by each
  36991. // state as well, however. More importantly, we need to maintain
  36992. // a stack of states, tracking the closure operations as they
  36993. // jump from rule to rule, emulating rule invocations (method calls).
  36994. // I have to add a stack to simulate the proper lookahead sequences for
  36995. // the underlying LL grammar from which the ATN was derived.
  36996. //
  36997. // <p>I use a set of ATNConfig objects not simple states. An ATNConfig
  36998. // is both a state (ala normal conversion) and a RuleContext describing
  36999. // the chain of rules (if any) followed to arrive at that state.</p>
  37000. //
  37001. // <p>A DFA state may have multiple references to a particular state,
  37002. // but with different ATN contexts (with same or different alts)
  37003. // meaning that state was reached via a different set of rule invocations.</p>
  37004. // /
  37005. function DFAState(stateNumber, configs) {
  37006. if (stateNumber === null) {
  37007. stateNumber = -1;
  37008. }
  37009. if (configs === null) {
  37010. configs = new ATNConfigSet();
  37011. }
  37012. this.stateNumber = stateNumber;
  37013. this.configs = configs;
  37014. // {@code edges[symbol]} points to target of symbol. Shift up by 1 so (-1)
  37015. // {@link Token//EOF} maps to {@code edges[0]}.
  37016. this.edges = null;
  37017. this.isAcceptState = false;
  37018. // if accept state, what ttype do we match or alt do we predict?
  37019. // This is set to {@link ATN//INVALID_ALT_NUMBER} when {@link
  37020. // //predicates}{@code !=null} or
  37021. // {@link //requiresFullContext}.
  37022. this.prediction = 0;
  37023. this.lexerActionExecutor = null;
  37024. // Indicates that this state was created during SLL prediction that
  37025. // discovered a conflict between the configurations in the state. Future
  37026. // {@link ParserATNSimulator//execATN} invocations immediately jumped doing
  37027. // full context prediction if this field is true.
  37028. this.requiresFullContext = false;
  37029. // During SLL parsing, this is a list of predicates associated with the
  37030. // ATN configurations of the DFA state. When we have predicates,
  37031. // {@link //requiresFullContext} is {@code false} since full context
  37032. // prediction evaluates predicates
  37033. // on-the-fly. If this is not null, then {@link //prediction} is
  37034. // {@link ATN//INVALID_ALT_NUMBER}.
  37035. //
  37036. // <p>We only use these for non-{@link //requiresFullContext} but
  37037. // conflicting states. That
  37038. // means we know from the context (it's $ or we don't dip into outer
  37039. // context) that it's an ambiguity not a conflict.</p>
  37040. //
  37041. // <p>This list is computed by {@link
  37042. // ParserATNSimulator//predicateDFAState}.</p>
  37043. this.predicates = null;
  37044. return this;
  37045. }
  37046. // Get the set of all alts mentioned by all ATN configurations in this
  37047. // DFA state.
  37048. DFAState.prototype.getAltSet = function() {
  37049. var alts = new Set();
  37050. if (this.configs !== null) {
  37051. for (var i = 0; i < this.configs.length; i++) {
  37052. var c = this.configs[i];
  37053. alts.add(c.alt);
  37054. }
  37055. }
  37056. if (alts.length === 0) {
  37057. return null;
  37058. } else {
  37059. return alts;
  37060. }
  37061. };
  37062. // Two {@link DFAState} instances are equal if their ATN configuration sets
  37063. // are the same. This method is used to see if a state already exists.
  37064. //
  37065. // <p>Because the number of alternatives and number of ATN configurations are
  37066. // finite, there is a finite number of DFA states that can be processed.
  37067. // This is necessary to show that the algorithm terminates.</p>
  37068. //
  37069. // <p>Cannot test the DFA state numbers here because in
  37070. // {@link ParserATNSimulator//addDFAState} we need to know if any other state
  37071. // exists that has this exact set of ATN configurations. The
  37072. // {@link //stateNumber} is irrelevant.</p>
  37073. DFAState.prototype.equals = function(other) {
  37074. // compare set of ATN configurations in this set with other
  37075. return this === other ||
  37076. (other instanceof DFAState &&
  37077. this.configs.equals(other.configs));
  37078. };
  37079. DFAState.prototype.toString = function() {
  37080. var s = "" + this.stateNumber + ":" + this.configs;
  37081. if(this.isAcceptState) {
  37082. s = s + "=>";
  37083. if (this.predicates !== null)
  37084. s = s + this.predicates;
  37085. else
  37086. s = s + this.prediction;
  37087. }
  37088. return s;
  37089. };
  37090. DFAState.prototype.hashCode = function() {
  37091. var hash = new Hash();
  37092. hash.update(this.configs);
  37093. if(this.isAcceptState) {
  37094. if (this.predicates !== null)
  37095. hash.update(this.predicates);
  37096. else
  37097. hash.update(this.prediction);
  37098. }
  37099. return hash.finish();
  37100. };
  37101. exports.DFAState = DFAState;
  37102. exports.PredPrediction = PredPrediction;
  37103. /***/ }),
  37104. /***/ "./node_modules/antlr4/dfa/index.js":
  37105. /*!******************************************!*\
  37106. !*** ./node_modules/antlr4/dfa/index.js ***!
  37107. \******************************************/
  37108. /*! no static exports found */
  37109. /***/ (function(module, exports, __webpack_require__) {
  37110. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37111. * Use of this file is governed by the BSD 3-clause license that
  37112. * can be found in the LICENSE.txt file in the project root.
  37113. */
  37114. exports.DFA = __webpack_require__(/*! ./DFA */ "./node_modules/antlr4/dfa/DFA.js").DFA;
  37115. exports.DFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").DFASerializer;
  37116. exports.LexerDFASerializer = __webpack_require__(/*! ./DFASerializer */ "./node_modules/antlr4/dfa/DFASerializer.js").LexerDFASerializer;
  37117. exports.PredPrediction = __webpack_require__(/*! ./DFAState */ "./node_modules/antlr4/dfa/DFAState.js").PredPrediction;
  37118. /***/ }),
  37119. /***/ "./node_modules/antlr4/error/DiagnosticErrorListener.js":
  37120. /*!**************************************************************!*\
  37121. !*** ./node_modules/antlr4/error/DiagnosticErrorListener.js ***!
  37122. \**************************************************************/
  37123. /*! no static exports found */
  37124. /***/ (function(module, exports, __webpack_require__) {
  37125. //
  37126. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37127. * Use of this file is governed by the BSD 3-clause license that
  37128. * can be found in the LICENSE.txt file in the project root.
  37129. */
  37130. //
  37131. //
  37132. // This implementation of {@link ANTLRErrorListener} can be used to identify
  37133. // certain potential correctness and performance problems in grammars. "Reports"
  37134. // are made by calling {@link Parser//notifyErrorListeners} with the appropriate
  37135. // message.
  37136. //
  37137. // <ul>
  37138. // <li><b>Ambiguities</b>: These are cases where more than one path through the
  37139. // grammar can match the input.</li>
  37140. // <li><b>Weak context sensitivity</b>: These are cases where full-context
  37141. // prediction resolved an SLL conflict to a unique alternative which equaled the
  37142. // minimum alternative of the SLL conflict.</li>
  37143. // <li><b>Strong (forced) context sensitivity</b>: These are cases where the
  37144. // full-context prediction resolved an SLL conflict to a unique alternative,
  37145. // <em>and</em> the minimum alternative of the SLL conflict was found to not be
  37146. // a truly viable alternative. Two-stage parsing cannot be used for inputs where
  37147. // this situation occurs.</li>
  37148. // </ul>
  37149. var BitSet = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js").BitSet;
  37150. var ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  37151. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37152. function DiagnosticErrorListener(exactOnly) {
  37153. ErrorListener.call(this);
  37154. exactOnly = exactOnly || true;
  37155. // whether all ambiguities or only exact ambiguities are reported.
  37156. this.exactOnly = exactOnly;
  37157. return this;
  37158. }
  37159. DiagnosticErrorListener.prototype = Object.create(ErrorListener.prototype);
  37160. DiagnosticErrorListener.prototype.constructor = DiagnosticErrorListener;
  37161. DiagnosticErrorListener.prototype.reportAmbiguity = function(recognizer, dfa,
  37162. startIndex, stopIndex, exact, ambigAlts, configs) {
  37163. if (this.exactOnly && !exact) {
  37164. return;
  37165. }
  37166. var msg = "reportAmbiguity d=" +
  37167. this.getDecisionDescription(recognizer, dfa) +
  37168. ": ambigAlts=" +
  37169. this.getConflictingAlts(ambigAlts, configs) +
  37170. ", input='" +
  37171. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37172. recognizer.notifyErrorListeners(msg);
  37173. };
  37174. DiagnosticErrorListener.prototype.reportAttemptingFullContext = function(
  37175. recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37176. var msg = "reportAttemptingFullContext d=" +
  37177. this.getDecisionDescription(recognizer, dfa) +
  37178. ", input='" +
  37179. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37180. recognizer.notifyErrorListeners(msg);
  37181. };
  37182. DiagnosticErrorListener.prototype.reportContextSensitivity = function(
  37183. recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37184. var msg = "reportContextSensitivity d=" +
  37185. this.getDecisionDescription(recognizer, dfa) +
  37186. ", input='" +
  37187. recognizer.getTokenStream().getText(new Interval(startIndex, stopIndex)) + "'";
  37188. recognizer.notifyErrorListeners(msg);
  37189. };
  37190. DiagnosticErrorListener.prototype.getDecisionDescription = function(recognizer, dfa) {
  37191. var decision = dfa.decision;
  37192. var ruleIndex = dfa.atnStartState.ruleIndex;
  37193. var ruleNames = recognizer.ruleNames;
  37194. if (ruleIndex < 0 || ruleIndex >= ruleNames.length) {
  37195. return "" + decision;
  37196. }
  37197. var ruleName = ruleNames[ruleIndex] || null;
  37198. if (ruleName === null || ruleName.length === 0) {
  37199. return "" + decision;
  37200. }
  37201. return "" + decision + " (" + ruleName + ")";
  37202. };
  37203. //
  37204. // Computes the set of conflicting or ambiguous alternatives from a
  37205. // configuration set, if that information was not already provided by the
  37206. // parser.
  37207. //
  37208. // @param reportedAlts The set of conflicting or ambiguous alternatives, as
  37209. // reported by the parser.
  37210. // @param configs The conflicting or ambiguous configuration set.
  37211. // @return Returns {@code reportedAlts} if it is not {@code null}, otherwise
  37212. // returns the set of alternatives represented in {@code configs}.
  37213. //
  37214. DiagnosticErrorListener.prototype.getConflictingAlts = function(reportedAlts, configs) {
  37215. if (reportedAlts !== null) {
  37216. return reportedAlts;
  37217. }
  37218. var result = new BitSet();
  37219. for (var i = 0; i < configs.items.length; i++) {
  37220. result.add(configs.items[i].alt);
  37221. }
  37222. return "{" + result.values().join(", ") + "}";
  37223. };
  37224. exports.DiagnosticErrorListener = DiagnosticErrorListener;
  37225. /***/ }),
  37226. /***/ "./node_modules/antlr4/error/ErrorListener.js":
  37227. /*!****************************************************!*\
  37228. !*** ./node_modules/antlr4/error/ErrorListener.js ***!
  37229. \****************************************************/
  37230. /*! no static exports found */
  37231. /***/ (function(module, exports) {
  37232. //
  37233. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37234. * Use of this file is governed by the BSD 3-clause license that
  37235. * can be found in the LICENSE.txt file in the project root.
  37236. */
  37237. // Provides an empty default implementation of {@link ANTLRErrorListener}. The
  37238. // default implementation of each method does nothing, but can be overridden as
  37239. // necessary.
  37240. function ErrorListener() {
  37241. return this;
  37242. }
  37243. ErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37244. };
  37245. ErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  37246. };
  37247. ErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37248. };
  37249. ErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37250. };
  37251. function ConsoleErrorListener() {
  37252. ErrorListener.call(this);
  37253. return this;
  37254. }
  37255. ConsoleErrorListener.prototype = Object.create(ErrorListener.prototype);
  37256. ConsoleErrorListener.prototype.constructor = ConsoleErrorListener;
  37257. //
  37258. // Provides a default instance of {@link ConsoleErrorListener}.
  37259. //
  37260. ConsoleErrorListener.INSTANCE = new ConsoleErrorListener();
  37261. //
  37262. // {@inheritDoc}
  37263. //
  37264. // <p>
  37265. // This implementation prints messages to {@link System//err} containing the
  37266. // values of {@code line}, {@code charPositionInLine}, and {@code msg} using
  37267. // the following format.</p>
  37268. //
  37269. // <pre>
  37270. // line <em>line</em>:<em>charPositionInLine</em> <em>msg</em>
  37271. // </pre>
  37272. //
  37273. ConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37274. console.error("line " + line + ":" + column + " " + msg);
  37275. };
  37276. function ProxyErrorListener(delegates) {
  37277. ErrorListener.call(this);
  37278. if (delegates===null) {
  37279. throw "delegates";
  37280. }
  37281. this.delegates = delegates;
  37282. return this;
  37283. }
  37284. ProxyErrorListener.prototype = Object.create(ErrorListener.prototype);
  37285. ProxyErrorListener.prototype.constructor = ProxyErrorListener;
  37286. ProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {
  37287. this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });
  37288. };
  37289. ProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {
  37290. this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });
  37291. };
  37292. ProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {
  37293. this.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });
  37294. };
  37295. ProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {
  37296. this.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });
  37297. };
  37298. exports.ErrorListener = ErrorListener;
  37299. exports.ConsoleErrorListener = ConsoleErrorListener;
  37300. exports.ProxyErrorListener = ProxyErrorListener;
  37301. /***/ }),
  37302. /***/ "./node_modules/antlr4/error/ErrorStrategy.js":
  37303. /*!****************************************************!*\
  37304. !*** ./node_modules/antlr4/error/ErrorStrategy.js ***!
  37305. \****************************************************/
  37306. /*! no static exports found */
  37307. /***/ (function(module, exports, __webpack_require__) {
  37308. //
  37309. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  37310. * Use of this file is governed by the BSD 3-clause license that
  37311. * can be found in the LICENSE.txt file in the project root.
  37312. */
  37313. //
  37314. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  37315. var Errors = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js");
  37316. var NoViableAltException = Errors.NoViableAltException;
  37317. var InputMismatchException = Errors.InputMismatchException;
  37318. var FailedPredicateException = Errors.FailedPredicateException;
  37319. var ParseCancellationException = Errors.ParseCancellationException;
  37320. var ATNState = __webpack_require__(/*! ./../atn/ATNState */ "./node_modules/antlr4/atn/ATNState.js").ATNState;
  37321. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  37322. var IntervalSet = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").IntervalSet;
  37323. function ErrorStrategy() {
  37324. }
  37325. ErrorStrategy.prototype.reset = function(recognizer){
  37326. };
  37327. ErrorStrategy.prototype.recoverInline = function(recognizer){
  37328. };
  37329. ErrorStrategy.prototype.recover = function(recognizer, e){
  37330. };
  37331. ErrorStrategy.prototype.sync = function(recognizer){
  37332. };
  37333. ErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer){
  37334. };
  37335. ErrorStrategy.prototype.reportError = function(recognizer){
  37336. };
  37337. // This is the default implementation of {@link ANTLRErrorStrategy} used for
  37338. // error reporting and recovery in ANTLR parsers.
  37339. //
  37340. function DefaultErrorStrategy() {
  37341. ErrorStrategy.call(this);
  37342. // Indicates whether the error strategy is currently "recovering from an
  37343. // error". This is used to suppress reporting multiple error messages while
  37344. // attempting to recover from a detected syntax error.
  37345. //
  37346. // @see //inErrorRecoveryMode
  37347. //
  37348. this.errorRecoveryMode = false;
  37349. // The index into the input stream where the last error occurred.
  37350. // This is used to prevent infinite loops where an error is found
  37351. // but no token is consumed during recovery...another error is found,
  37352. // ad nauseum. This is a failsafe mechanism to guarantee that at least
  37353. // one token/tree node is consumed for two errors.
  37354. //
  37355. this.lastErrorIndex = -1;
  37356. this.lastErrorStates = null;
  37357. return this;
  37358. }
  37359. DefaultErrorStrategy.prototype = Object.create(ErrorStrategy.prototype);
  37360. DefaultErrorStrategy.prototype.constructor = DefaultErrorStrategy;
  37361. // <p>The default implementation simply calls {@link //endErrorCondition} to
  37362. // ensure that the handler is not in error recovery mode.</p>
  37363. DefaultErrorStrategy.prototype.reset = function(recognizer) {
  37364. this.endErrorCondition(recognizer);
  37365. };
  37366. //
  37367. // This method is called to enter error recovery mode when a recognition
  37368. // exception is reported.
  37369. //
  37370. // @param recognizer the parser instance
  37371. //
  37372. DefaultErrorStrategy.prototype.beginErrorCondition = function(recognizer) {
  37373. this.errorRecoveryMode = true;
  37374. };
  37375. DefaultErrorStrategy.prototype.inErrorRecoveryMode = function(recognizer) {
  37376. return this.errorRecoveryMode;
  37377. };
  37378. //
  37379. // This method is called to leave error recovery mode after recovering from
  37380. // a recognition exception.
  37381. //
  37382. // @param recognizer
  37383. //
  37384. DefaultErrorStrategy.prototype.endErrorCondition = function(recognizer) {
  37385. this.errorRecoveryMode = false;
  37386. this.lastErrorStates = null;
  37387. this.lastErrorIndex = -1;
  37388. };
  37389. //
  37390. // {@inheritDoc}
  37391. //
  37392. // <p>The default implementation simply calls {@link //endErrorCondition}.</p>
  37393. //
  37394. DefaultErrorStrategy.prototype.reportMatch = function(recognizer) {
  37395. this.endErrorCondition(recognizer);
  37396. };
  37397. //
  37398. // {@inheritDoc}
  37399. //
  37400. // <p>The default implementation returns immediately if the handler is already
  37401. // in error recovery mode. Otherwise, it calls {@link //beginErrorCondition}
  37402. // and dispatches the reporting task based on the runtime type of {@code e}
  37403. // according to the following table.</p>
  37404. //
  37405. // <ul>
  37406. // <li>{@link NoViableAltException}: Dispatches the call to
  37407. // {@link //reportNoViableAlternative}</li>
  37408. // <li>{@link InputMismatchException}: Dispatches the call to
  37409. // {@link //reportInputMismatch}</li>
  37410. // <li>{@link FailedPredicateException}: Dispatches the call to
  37411. // {@link //reportFailedPredicate}</li>
  37412. // <li>All other types: calls {@link Parser//notifyErrorListeners} to report
  37413. // the exception</li>
  37414. // </ul>
  37415. //
  37416. DefaultErrorStrategy.prototype.reportError = function(recognizer, e) {
  37417. // if we've already reported an error and have not matched a token
  37418. // yet successfully, don't report any errors.
  37419. if(this.inErrorRecoveryMode(recognizer)) {
  37420. return; // don't report spurious errors
  37421. }
  37422. this.beginErrorCondition(recognizer);
  37423. if ( e instanceof NoViableAltException ) {
  37424. this.reportNoViableAlternative(recognizer, e);
  37425. } else if ( e instanceof InputMismatchException ) {
  37426. this.reportInputMismatch(recognizer, e);
  37427. } else if ( e instanceof FailedPredicateException ) {
  37428. this.reportFailedPredicate(recognizer, e);
  37429. } else {
  37430. console.log("unknown recognition error type: " + e.constructor.name);
  37431. console.log(e.stack);
  37432. recognizer.notifyErrorListeners(e.getOffendingToken(), e.getMessage(), e);
  37433. }
  37434. };
  37435. //
  37436. // {@inheritDoc}
  37437. //
  37438. // <p>The default implementation resynchronizes the parser by consuming tokens
  37439. // until we find one in the resynchronization set--loosely the set of tokens
  37440. // that can follow the current rule.</p>
  37441. //
  37442. DefaultErrorStrategy.prototype.recover = function(recognizer, e) {
  37443. if (this.lastErrorIndex===recognizer.getInputStream().index &&
  37444. this.lastErrorStates !== null && this.lastErrorStates.indexOf(recognizer.state)>=0) {
  37445. // uh oh, another error at same token index and previously-visited
  37446. // state in ATN; must be a case where LT(1) is in the recovery
  37447. // token set so nothing got consumed. Consume a single token
  37448. // at least to prevent an infinite loop; this is a failsafe.
  37449. recognizer.consume();
  37450. }
  37451. this.lastErrorIndex = recognizer._input.index;
  37452. if (this.lastErrorStates === null) {
  37453. this.lastErrorStates = [];
  37454. }
  37455. this.lastErrorStates.push(recognizer.state);
  37456. var followSet = this.getErrorRecoverySet(recognizer);
  37457. this.consumeUntil(recognizer, followSet);
  37458. };
  37459. // The default implementation of {@link ANTLRErrorStrategy//sync} makes sure
  37460. // that the current lookahead symbol is consistent with what were expecting
  37461. // at this point in the ATN. You can call this anytime but ANTLR only
  37462. // generates code to check before subrules/loops and each iteration.
  37463. //
  37464. // <p>Implements Jim Idle's magic sync mechanism in closures and optional
  37465. // subrules. E.g.,</p>
  37466. //
  37467. // <pre>
  37468. // a : sync ( stuff sync )* ;
  37469. // sync : {consume to what can follow sync} ;
  37470. // </pre>
  37471. //
  37472. // At the start of a sub rule upon error, {@link //sync} performs single
  37473. // token deletion, if possible. If it can't do that, it bails on the current
  37474. // rule and uses the default error recovery, which consumes until the
  37475. // resynchronization set of the current rule.
  37476. //
  37477. // <p>If the sub rule is optional ({@code (...)?}, {@code (...)*}, or block
  37478. // with an empty alternative), then the expected set includes what follows
  37479. // the subrule.</p>
  37480. //
  37481. // <p>During loop iteration, it consumes until it sees a token that can start a
  37482. // sub rule or what follows loop. Yes, that is pretty aggressive. We opt to
  37483. // stay in the loop as long as possible.</p>
  37484. //
  37485. // <p><strong>ORIGINS</strong></p>
  37486. //
  37487. // <p>Previous versions of ANTLR did a poor job of their recovery within loops.
  37488. // A single mismatch token or missing token would force the parser to bail
  37489. // out of the entire rules surrounding the loop. So, for rule</p>
  37490. //
  37491. // <pre>
  37492. // classDef : 'class' ID '{' member* '}'
  37493. // </pre>
  37494. //
  37495. // input with an extra token between members would force the parser to
  37496. // consume until it found the next class definition rather than the next
  37497. // member definition of the current class.
  37498. //
  37499. // <p>This functionality cost a little bit of effort because the parser has to
  37500. // compare token set at the start of the loop and at each iteration. If for
  37501. // some reason speed is suffering for you, you can turn off this
  37502. // functionality by simply overriding this method as a blank { }.</p>
  37503. //
  37504. DefaultErrorStrategy.prototype.sync = function(recognizer) {
  37505. // If already recovering, don't try to sync
  37506. if (this.inErrorRecoveryMode(recognizer)) {
  37507. return;
  37508. }
  37509. var s = recognizer._interp.atn.states[recognizer.state];
  37510. var la = recognizer.getTokenStream().LA(1);
  37511. // try cheaper subset first; might get lucky. seems to shave a wee bit off
  37512. var nextTokens = recognizer.atn.nextTokens(s);
  37513. if (nextTokens.contains(Token.EPSILON) || nextTokens.contains(la)) {
  37514. return;
  37515. }
  37516. switch (s.stateType) {
  37517. case ATNState.BLOCK_START:
  37518. case ATNState.STAR_BLOCK_START:
  37519. case ATNState.PLUS_BLOCK_START:
  37520. case ATNState.STAR_LOOP_ENTRY:
  37521. // report error and recover if possible
  37522. if( this.singleTokenDeletion(recognizer) !== null) {
  37523. return;
  37524. } else {
  37525. throw new InputMismatchException(recognizer);
  37526. }
  37527. break;
  37528. case ATNState.PLUS_LOOP_BACK:
  37529. case ATNState.STAR_LOOP_BACK:
  37530. this.reportUnwantedToken(recognizer);
  37531. var expecting = new IntervalSet();
  37532. expecting.addSet(recognizer.getExpectedTokens());
  37533. var whatFollowsLoopIterationOrRule = expecting.addSet(this.getErrorRecoverySet(recognizer));
  37534. this.consumeUntil(recognizer, whatFollowsLoopIterationOrRule);
  37535. break;
  37536. default:
  37537. // do nothing if we can't identify the exact kind of ATN state
  37538. }
  37539. };
  37540. // This is called by {@link //reportError} when the exception is a
  37541. // {@link NoViableAltException}.
  37542. //
  37543. // @see //reportError
  37544. //
  37545. // @param recognizer the parser instance
  37546. // @param e the recognition exception
  37547. //
  37548. DefaultErrorStrategy.prototype.reportNoViableAlternative = function(recognizer, e) {
  37549. var tokens = recognizer.getTokenStream();
  37550. var input;
  37551. if(tokens !== null) {
  37552. if (e.startToken.type===Token.EOF) {
  37553. input = "<EOF>";
  37554. } else {
  37555. input = tokens.getText(new Interval(e.startToken.tokenIndex, e.offendingToken.tokenIndex));
  37556. }
  37557. } else {
  37558. input = "<unknown input>";
  37559. }
  37560. var msg = "no viable alternative at input " + this.escapeWSAndQuote(input);
  37561. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37562. };
  37563. //
  37564. // This is called by {@link //reportError} when the exception is an
  37565. // {@link InputMismatchException}.
  37566. //
  37567. // @see //reportError
  37568. //
  37569. // @param recognizer the parser instance
  37570. // @param e the recognition exception
  37571. //
  37572. DefaultErrorStrategy.prototype.reportInputMismatch = function(recognizer, e) {
  37573. var msg = "mismatched input " + this.getTokenErrorDisplay(e.offendingToken) +
  37574. " expecting " + e.getExpectedTokens().toString(recognizer.literalNames, recognizer.symbolicNames);
  37575. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37576. };
  37577. //
  37578. // This is called by {@link //reportError} when the exception is a
  37579. // {@link FailedPredicateException}.
  37580. //
  37581. // @see //reportError
  37582. //
  37583. // @param recognizer the parser instance
  37584. // @param e the recognition exception
  37585. //
  37586. DefaultErrorStrategy.prototype.reportFailedPredicate = function(recognizer, e) {
  37587. var ruleName = recognizer.ruleNames[recognizer._ctx.ruleIndex];
  37588. var msg = "rule " + ruleName + " " + e.message;
  37589. recognizer.notifyErrorListeners(msg, e.offendingToken, e);
  37590. };
  37591. // This method is called to report a syntax error which requires the removal
  37592. // of a token from the input stream. At the time this method is called, the
  37593. // erroneous symbol is current {@code LT(1)} symbol and has not yet been
  37594. // removed from the input stream. When this method returns,
  37595. // {@code recognizer} is in error recovery mode.
  37596. //
  37597. // <p>This method is called when {@link //singleTokenDeletion} identifies
  37598. // single-token deletion as a viable recovery strategy for a mismatched
  37599. // input error.</p>
  37600. //
  37601. // <p>The default implementation simply returns if the handler is already in
  37602. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37603. // enter error recovery mode, followed by calling
  37604. // {@link Parser//notifyErrorListeners}.</p>
  37605. //
  37606. // @param recognizer the parser instance
  37607. //
  37608. DefaultErrorStrategy.prototype.reportUnwantedToken = function(recognizer) {
  37609. if (this.inErrorRecoveryMode(recognizer)) {
  37610. return;
  37611. }
  37612. this.beginErrorCondition(recognizer);
  37613. var t = recognizer.getCurrentToken();
  37614. var tokenName = this.getTokenErrorDisplay(t);
  37615. var expecting = this.getExpectedTokens(recognizer);
  37616. var msg = "extraneous input " + tokenName + " expecting " +
  37617. expecting.toString(recognizer.literalNames, recognizer.symbolicNames);
  37618. recognizer.notifyErrorListeners(msg, t, null);
  37619. };
  37620. // This method is called to report a syntax error which requires the
  37621. // insertion of a missing token into the input stream. At the time this
  37622. // method is called, the missing token has not yet been inserted. When this
  37623. // method returns, {@code recognizer} is in error recovery mode.
  37624. //
  37625. // <p>This method is called when {@link //singleTokenInsertion} identifies
  37626. // single-token insertion as a viable recovery strategy for a mismatched
  37627. // input error.</p>
  37628. //
  37629. // <p>The default implementation simply returns if the handler is already in
  37630. // error recovery mode. Otherwise, it calls {@link //beginErrorCondition} to
  37631. // enter error recovery mode, followed by calling
  37632. // {@link Parser//notifyErrorListeners}.</p>
  37633. //
  37634. // @param recognizer the parser instance
  37635. //
  37636. DefaultErrorStrategy.prototype.reportMissingToken = function(recognizer) {
  37637. if ( this.inErrorRecoveryMode(recognizer)) {
  37638. return;
  37639. }
  37640. this.beginErrorCondition(recognizer);
  37641. var t = recognizer.getCurrentToken();
  37642. var expecting = this.getExpectedTokens(recognizer);
  37643. var msg = "missing " + expecting.toString(recognizer.literalNames, recognizer.symbolicNames) +
  37644. " at " + this.getTokenErrorDisplay(t);
  37645. recognizer.notifyErrorListeners(msg, t, null);
  37646. };
  37647. // <p>The default implementation attempts to recover from the mismatched input
  37648. // by using single token insertion and deletion as described below. If the
  37649. // recovery attempt fails, this method throws an
  37650. // {@link InputMismatchException}.</p>
  37651. //
  37652. // <p><strong>EXTRA TOKEN</strong> (single token deletion)</p>
  37653. //
  37654. // <p>{@code LA(1)} is not what we are looking for. If {@code LA(2)} has the
  37655. // right token, however, then assume {@code LA(1)} is some extra spurious
  37656. // token and delete it. Then consume and return the next token (which was
  37657. // the {@code LA(2)} token) as the successful result of the match operation.</p>
  37658. //
  37659. // <p>This recovery strategy is implemented by {@link
  37660. // //singleTokenDeletion}.</p>
  37661. //
  37662. // <p><strong>MISSING TOKEN</strong> (single token insertion)</p>
  37663. //
  37664. // <p>If current token (at {@code LA(1)}) is consistent with what could come
  37665. // after the expected {@code LA(1)} token, then assume the token is missing
  37666. // and use the parser's {@link TokenFactory} to create it on the fly. The
  37667. // "insertion" is performed by returning the created token as the successful
  37668. // result of the match operation.</p>
  37669. //
  37670. // <p>This recovery strategy is implemented by {@link
  37671. // //singleTokenInsertion}.</p>
  37672. //
  37673. // <p><strong>EXAMPLE</strong></p>
  37674. //
  37675. // <p>For example, Input {@code i=(3;} is clearly missing the {@code ')'}. When
  37676. // the parser returns from the nested call to {@code expr}, it will have
  37677. // call chain:</p>
  37678. //
  37679. // <pre>
  37680. // stat &rarr; expr &rarr; atom
  37681. // </pre>
  37682. //
  37683. // and it will be trying to match the {@code ')'} at this point in the
  37684. // derivation:
  37685. //
  37686. // <pre>
  37687. // =&gt; ID '=' '(' INT ')' ('+' atom)* ';'
  37688. // ^
  37689. // </pre>
  37690. //
  37691. // The attempt to match {@code ')'} will fail when it sees {@code ';'} and
  37692. // call {@link //recoverInline}. To recover, it sees that {@code LA(1)==';'}
  37693. // is in the set of tokens that can follow the {@code ')'} token reference
  37694. // in rule {@code atom}. It can assume that you forgot the {@code ')'}.
  37695. //
  37696. DefaultErrorStrategy.prototype.recoverInline = function(recognizer) {
  37697. // SINGLE TOKEN DELETION
  37698. var matchedSymbol = this.singleTokenDeletion(recognizer);
  37699. if (matchedSymbol !== null) {
  37700. // we have deleted the extra token.
  37701. // now, move past ttype token as if all were ok
  37702. recognizer.consume();
  37703. return matchedSymbol;
  37704. }
  37705. // SINGLE TOKEN INSERTION
  37706. if (this.singleTokenInsertion(recognizer)) {
  37707. return this.getMissingSymbol(recognizer);
  37708. }
  37709. // even that didn't work; must throw the exception
  37710. throw new InputMismatchException(recognizer);
  37711. };
  37712. //
  37713. // This method implements the single-token insertion inline error recovery
  37714. // strategy. It is called by {@link //recoverInline} if the single-token
  37715. // deletion strategy fails to recover from the mismatched input. If this
  37716. // method returns {@code true}, {@code recognizer} will be in error recovery
  37717. // mode.
  37718. //
  37719. // <p>This method determines whether or not single-token insertion is viable by
  37720. // checking if the {@code LA(1)} input symbol could be successfully matched
  37721. // if it were instead the {@code LA(2)} symbol. If this method returns
  37722. // {@code true}, the caller is responsible for creating and inserting a
  37723. // token with the correct type to produce this behavior.</p>
  37724. //
  37725. // @param recognizer the parser instance
  37726. // @return {@code true} if single-token insertion is a viable recovery
  37727. // strategy for the current mismatched input, otherwise {@code false}
  37728. //
  37729. DefaultErrorStrategy.prototype.singleTokenInsertion = function(recognizer) {
  37730. var currentSymbolType = recognizer.getTokenStream().LA(1);
  37731. // if current token is consistent with what could come after current
  37732. // ATN state, then we know we're missing a token; error recovery
  37733. // is free to conjure up and insert the missing token
  37734. var atn = recognizer._interp.atn;
  37735. var currentState = atn.states[recognizer.state];
  37736. var next = currentState.transitions[0].target;
  37737. var expectingAtLL2 = atn.nextTokens(next, recognizer._ctx);
  37738. if (expectingAtLL2.contains(currentSymbolType) ){
  37739. this.reportMissingToken(recognizer);
  37740. return true;
  37741. } else {
  37742. return false;
  37743. }
  37744. };
  37745. // This method implements the single-token deletion inline error recovery
  37746. // strategy. It is called by {@link //recoverInline} to attempt to recover
  37747. // from mismatched input. If this method returns null, the parser and error
  37748. // handler state will not have changed. If this method returns non-null,
  37749. // {@code recognizer} will <em>not</em> be in error recovery mode since the
  37750. // returned token was a successful match.
  37751. //
  37752. // <p>If the single-token deletion is successful, this method calls
  37753. // {@link //reportUnwantedToken} to report the error, followed by
  37754. // {@link Parser//consume} to actually "delete" the extraneous token. Then,
  37755. // before returning {@link //reportMatch} is called to signal a successful
  37756. // match.</p>
  37757. //
  37758. // @param recognizer the parser instance
  37759. // @return the successfully matched {@link Token} instance if single-token
  37760. // deletion successfully recovers from the mismatched input, otherwise
  37761. // {@code null}
  37762. //
  37763. DefaultErrorStrategy.prototype.singleTokenDeletion = function(recognizer) {
  37764. var nextTokenType = recognizer.getTokenStream().LA(2);
  37765. var expecting = this.getExpectedTokens(recognizer);
  37766. if (expecting.contains(nextTokenType)) {
  37767. this.reportUnwantedToken(recognizer);
  37768. // print("recoverFromMismatchedToken deleting " \
  37769. // + str(recognizer.getTokenStream().LT(1)) \
  37770. // + " since " + str(recognizer.getTokenStream().LT(2)) \
  37771. // + " is what we want", file=sys.stderr)
  37772. recognizer.consume(); // simply delete extra token
  37773. // we want to return the token we're actually matching
  37774. var matchedSymbol = recognizer.getCurrentToken();
  37775. this.reportMatch(recognizer); // we know current token is correct
  37776. return matchedSymbol;
  37777. } else {
  37778. return null;
  37779. }
  37780. };
  37781. // Conjure up a missing token during error recovery.
  37782. //
  37783. // The recognizer attempts to recover from single missing
  37784. // symbols. But, actions might refer to that missing symbol.
  37785. // For example, x=ID {f($x);}. The action clearly assumes
  37786. // that there has been an identifier matched previously and that
  37787. // $x points at that token. If that token is missing, but
  37788. // the next token in the stream is what we want we assume that
  37789. // this token is missing and we keep going. Because we
  37790. // have to return some token to replace the missing token,
  37791. // we have to conjure one up. This method gives the user control
  37792. // over the tokens returned for missing tokens. Mostly,
  37793. // you will want to create something special for identifier
  37794. // tokens. For literals such as '{' and ',', the default
  37795. // action in the parser or tree parser works. It simply creates
  37796. // a CommonToken of the appropriate type. The text will be the token.
  37797. // If you change what tokens must be created by the lexer,
  37798. // override this method to create the appropriate tokens.
  37799. //
  37800. DefaultErrorStrategy.prototype.getMissingSymbol = function(recognizer) {
  37801. var currentSymbol = recognizer.getCurrentToken();
  37802. var expecting = this.getExpectedTokens(recognizer);
  37803. var expectedTokenType = expecting.first(); // get any element
  37804. var tokenText;
  37805. if (expectedTokenType===Token.EOF) {
  37806. tokenText = "<missing EOF>";
  37807. } else {
  37808. tokenText = "<missing " + recognizer.literalNames[expectedTokenType] + ">";
  37809. }
  37810. var current = currentSymbol;
  37811. var lookback = recognizer.getTokenStream().LT(-1);
  37812. if (current.type===Token.EOF && lookback !== null) {
  37813. current = lookback;
  37814. }
  37815. return recognizer.getTokenFactory().create(current.source,
  37816. expectedTokenType, tokenText, Token.DEFAULT_CHANNEL,
  37817. -1, -1, current.line, current.column);
  37818. };
  37819. DefaultErrorStrategy.prototype.getExpectedTokens = function(recognizer) {
  37820. return recognizer.getExpectedTokens();
  37821. };
  37822. // How should a token be displayed in an error message? The default
  37823. // is to display just the text, but during development you might
  37824. // want to have a lot of information spit out. Override in that case
  37825. // to use t.toString() (which, for CommonToken, dumps everything about
  37826. // the token). This is better than forcing you to override a method in
  37827. // your token objects because you don't have to go modify your lexer
  37828. // so that it creates a new Java type.
  37829. //
  37830. DefaultErrorStrategy.prototype.getTokenErrorDisplay = function(t) {
  37831. if (t === null) {
  37832. return "<no token>";
  37833. }
  37834. var s = t.text;
  37835. if (s === null) {
  37836. if (t.type===Token.EOF) {
  37837. s = "<EOF>";
  37838. } else {
  37839. s = "<" + t.type + ">";
  37840. }
  37841. }
  37842. return this.escapeWSAndQuote(s);
  37843. };
  37844. DefaultErrorStrategy.prototype.escapeWSAndQuote = function(s) {
  37845. s = s.replace(/\n/g,"\\n");
  37846. s = s.replace(/\r/g,"\\r");
  37847. s = s.replace(/\t/g,"\\t");
  37848. return "'" + s + "'";
  37849. };
  37850. // Compute the error recovery set for the current rule. During
  37851. // rule invocation, the parser pushes the set of tokens that can
  37852. // follow that rule reference on the stack; this amounts to
  37853. // computing FIRST of what follows the rule reference in the
  37854. // enclosing rule. See LinearApproximator.FIRST().
  37855. // This local follow set only includes tokens
  37856. // from within the rule; i.e., the FIRST computation done by
  37857. // ANTLR stops at the end of a rule.
  37858. //
  37859. // EXAMPLE
  37860. //
  37861. // When you find a "no viable alt exception", the input is not
  37862. // consistent with any of the alternatives for rule r. The best
  37863. // thing to do is to consume tokens until you see something that
  37864. // can legally follow a call to r//or* any rule that called r.
  37865. // You don't want the exact set of viable next tokens because the
  37866. // input might just be missing a token--you might consume the
  37867. // rest of the input looking for one of the missing tokens.
  37868. //
  37869. // Consider grammar:
  37870. //
  37871. // a : '[' b ']'
  37872. // | '(' b ')'
  37873. // ;
  37874. // b : c '^' INT ;
  37875. // c : ID
  37876. // | INT
  37877. // ;
  37878. //
  37879. // At each rule invocation, the set of tokens that could follow
  37880. // that rule is pushed on a stack. Here are the various
  37881. // context-sensitive follow sets:
  37882. //
  37883. // FOLLOW(b1_in_a) = FIRST(']') = ']'
  37884. // FOLLOW(b2_in_a) = FIRST(')') = ')'
  37885. // FOLLOW(c_in_b) = FIRST('^') = '^'
  37886. //
  37887. // Upon erroneous input "[]", the call chain is
  37888. //
  37889. // a -> b -> c
  37890. //
  37891. // and, hence, the follow context stack is:
  37892. //
  37893. // depth follow set start of rule execution
  37894. // 0 <EOF> a (from main())
  37895. // 1 ']' b
  37896. // 2 '^' c
  37897. //
  37898. // Notice that ')' is not included, because b would have to have
  37899. // been called from a different context in rule a for ')' to be
  37900. // included.
  37901. //
  37902. // For error recovery, we cannot consider FOLLOW(c)
  37903. // (context-sensitive or otherwise). We need the combined set of
  37904. // all context-sensitive FOLLOW sets--the set of all tokens that
  37905. // could follow any reference in the call chain. We need to
  37906. // resync to one of those tokens. Note that FOLLOW(c)='^' and if
  37907. // we resync'd to that token, we'd consume until EOF. We need to
  37908. // sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
  37909. // In this case, for input "[]", LA(1) is ']' and in the set, so we would
  37910. // not consume anything. After printing an error, rule c would
  37911. // return normally. Rule b would not find the required '^' though.
  37912. // At this point, it gets a mismatched token error and throws an
  37913. // exception (since LA(1) is not in the viable following token
  37914. // set). The rule exception handler tries to recover, but finds
  37915. // the same recovery set and doesn't consume anything. Rule b
  37916. // exits normally returning to rule a. Now it finds the ']' (and
  37917. // with the successful match exits errorRecovery mode).
  37918. //
  37919. // So, you can see that the parser walks up the call chain looking
  37920. // for the token that was a member of the recovery set.
  37921. //
  37922. // Errors are not generated in errorRecovery mode.
  37923. //
  37924. // ANTLR's error recovery mechanism is based upon original ideas:
  37925. //
  37926. // "Algorithms + Data Structures = Programs" by Niklaus Wirth
  37927. //
  37928. // and
  37929. //
  37930. // "A note on error recovery in recursive descent parsers":
  37931. // http://portal.acm.org/citation.cfm?id=947902.947905
  37932. //
  37933. // Later, Josef Grosch had some good ideas:
  37934. //
  37935. // "Efficient and Comfortable Error Recovery in Recursive Descent
  37936. // Parsers":
  37937. // ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
  37938. //
  37939. // Like Grosch I implement context-sensitive FOLLOW sets that are combined
  37940. // at run-time upon error to avoid overhead during parsing.
  37941. //
  37942. DefaultErrorStrategy.prototype.getErrorRecoverySet = function(recognizer) {
  37943. var atn = recognizer._interp.atn;
  37944. var ctx = recognizer._ctx;
  37945. var recoverSet = new IntervalSet();
  37946. while (ctx !== null && ctx.invokingState>=0) {
  37947. // compute what follows who invoked us
  37948. var invokingState = atn.states[ctx.invokingState];
  37949. var rt = invokingState.transitions[0];
  37950. var follow = atn.nextTokens(rt.followState);
  37951. recoverSet.addSet(follow);
  37952. ctx = ctx.parentCtx;
  37953. }
  37954. recoverSet.removeOne(Token.EPSILON);
  37955. return recoverSet;
  37956. };
  37957. // Consume tokens until one matches the given token set.//
  37958. DefaultErrorStrategy.prototype.consumeUntil = function(recognizer, set) {
  37959. var ttype = recognizer.getTokenStream().LA(1);
  37960. while( ttype !== Token.EOF && !set.contains(ttype)) {
  37961. recognizer.consume();
  37962. ttype = recognizer.getTokenStream().LA(1);
  37963. }
  37964. };
  37965. //
  37966. // This implementation of {@link ANTLRErrorStrategy} responds to syntax errors
  37967. // by immediately canceling the parse operation with a
  37968. // {@link ParseCancellationException}. The implementation ensures that the
  37969. // {@link ParserRuleContext//exception} field is set for all parse tree nodes
  37970. // that were not completed prior to encountering the error.
  37971. //
  37972. // <p>
  37973. // This error strategy is useful in the following scenarios.</p>
  37974. //
  37975. // <ul>
  37976. // <li><strong>Two-stage parsing:</strong> This error strategy allows the first
  37977. // stage of two-stage parsing to immediately terminate if an error is
  37978. // encountered, and immediately fall back to the second stage. In addition to
  37979. // avoiding wasted work by attempting to recover from errors here, the empty
  37980. // implementation of {@link BailErrorStrategy//sync} improves the performance of
  37981. // the first stage.</li>
  37982. // <li><strong>Silent validation:</strong> When syntax errors are not being
  37983. // reported or logged, and the parse result is simply ignored if errors occur,
  37984. // the {@link BailErrorStrategy} avoids wasting work on recovering from errors
  37985. // when the result will be ignored either way.</li>
  37986. // </ul>
  37987. //
  37988. // <p>
  37989. // {@code myparser.setErrorHandler(new BailErrorStrategy());}</p>
  37990. //
  37991. // @see Parser//setErrorHandler(ANTLRErrorStrategy)
  37992. //
  37993. function BailErrorStrategy() {
  37994. DefaultErrorStrategy.call(this);
  37995. return this;
  37996. }
  37997. BailErrorStrategy.prototype = Object.create(DefaultErrorStrategy.prototype);
  37998. BailErrorStrategy.prototype.constructor = BailErrorStrategy;
  37999. // Instead of recovering from exception {@code e}, re-throw it wrapped
  38000. // in a {@link ParseCancellationException} so it is not caught by the
  38001. // rule function catches. Use {@link Exception//getCause()} to get the
  38002. // original {@link RecognitionException}.
  38003. //
  38004. BailErrorStrategy.prototype.recover = function(recognizer, e) {
  38005. var context = recognizer._ctx;
  38006. while (context !== null) {
  38007. context.exception = e;
  38008. context = context.parentCtx;
  38009. }
  38010. throw new ParseCancellationException(e);
  38011. };
  38012. // Make sure we don't attempt to recover inline; if the parser
  38013. // successfully recovers, it won't throw an exception.
  38014. //
  38015. BailErrorStrategy.prototype.recoverInline = function(recognizer) {
  38016. this.recover(recognizer, new InputMismatchException(recognizer));
  38017. };
  38018. // Make sure we don't attempt to recover from problems in subrules.//
  38019. BailErrorStrategy.prototype.sync = function(recognizer) {
  38020. // pass
  38021. };
  38022. exports.BailErrorStrategy = BailErrorStrategy;
  38023. exports.DefaultErrorStrategy = DefaultErrorStrategy;
  38024. /***/ }),
  38025. /***/ "./node_modules/antlr4/error/Errors.js":
  38026. /*!*********************************************!*\
  38027. !*** ./node_modules/antlr4/error/Errors.js ***!
  38028. \*********************************************/
  38029. /*! no static exports found */
  38030. /***/ (function(module, exports, __webpack_require__) {
  38031. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38032. * Use of this file is governed by the BSD 3-clause license that
  38033. * can be found in the LICENSE.txt file in the project root.
  38034. */
  38035. // The root of the ANTLR exception hierarchy. In general, ANTLR tracks just
  38036. // 3 kinds of errors: prediction errors, failed predicate errors, and
  38037. // mismatched input errors. In each case, the parser knows where it is
  38038. // in the input, where it is in the ATN, the rule invocation stack,
  38039. // and what kind of problem occurred.
  38040. var PredicateTransition = __webpack_require__(/*! ./../atn/Transition */ "./node_modules/antlr4/atn/Transition.js").PredicateTransition;
  38041. function RecognitionException(params) {
  38042. Error.call(this);
  38043. if (!!Error.captureStackTrace) {
  38044. Error.captureStackTrace(this, RecognitionException);
  38045. } else {
  38046. var stack = new Error().stack;
  38047. }
  38048. this.message = params.message;
  38049. this.recognizer = params.recognizer;
  38050. this.input = params.input;
  38051. this.ctx = params.ctx;
  38052. // The current {@link Token} when an error occurred. Since not all streams
  38053. // support accessing symbols by index, we have to track the {@link Token}
  38054. // instance itself.
  38055. this.offendingToken = null;
  38056. // Get the ATN state number the parser was in at the time the error
  38057. // occurred. For {@link NoViableAltException} and
  38058. // {@link LexerNoViableAltException} exceptions, this is the
  38059. // {@link DecisionState} number. For others, it is the state whose outgoing
  38060. // edge we couldn't match.
  38061. this.offendingState = -1;
  38062. if (this.recognizer!==null) {
  38063. this.offendingState = this.recognizer.state;
  38064. }
  38065. return this;
  38066. }
  38067. RecognitionException.prototype = Object.create(Error.prototype);
  38068. RecognitionException.prototype.constructor = RecognitionException;
  38069. // <p>If the state number is not known, this method returns -1.</p>
  38070. //
  38071. // Gets the set of input symbols which could potentially follow the
  38072. // previously matched symbol at the time this exception was thrown.
  38073. //
  38074. // <p>If the set of expected tokens is not known and could not be computed,
  38075. // this method returns {@code null}.</p>
  38076. //
  38077. // @return The set of token types that could potentially follow the current
  38078. // state in the ATN, or {@code null} if the information is not available.
  38079. // /
  38080. RecognitionException.prototype.getExpectedTokens = function() {
  38081. if (this.recognizer!==null) {
  38082. return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);
  38083. } else {
  38084. return null;
  38085. }
  38086. };
  38087. RecognitionException.prototype.toString = function() {
  38088. return this.message;
  38089. };
  38090. function LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {
  38091. RecognitionException.call(this, {message:"", recognizer:lexer, input:input, ctx:null});
  38092. this.startIndex = startIndex;
  38093. this.deadEndConfigs = deadEndConfigs;
  38094. return this;
  38095. }
  38096. LexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);
  38097. LexerNoViableAltException.prototype.constructor = LexerNoViableAltException;
  38098. LexerNoViableAltException.prototype.toString = function() {
  38099. var symbol = "";
  38100. if (this.startIndex >= 0 && this.startIndex < this.input.size) {
  38101. symbol = this.input.getText((this.startIndex,this.startIndex));
  38102. }
  38103. return "LexerNoViableAltException" + symbol;
  38104. };
  38105. // Indicates that the parser could not decide which of two or more paths
  38106. // to take based upon the remaining input. It tracks the starting token
  38107. // of the offending input and also knows where the parser was
  38108. // in the various paths when the error. Reported by reportNoViableAlternative()
  38109. //
  38110. function NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {
  38111. ctx = ctx || recognizer._ctx;
  38112. offendingToken = offendingToken || recognizer.getCurrentToken();
  38113. startToken = startToken || recognizer.getCurrentToken();
  38114. input = input || recognizer.getInputStream();
  38115. RecognitionException.call(this, {message:"", recognizer:recognizer, input:input, ctx:ctx});
  38116. // Which configurations did we try at input.index() that couldn't match
  38117. // input.LT(1)?//
  38118. this.deadEndConfigs = deadEndConfigs;
  38119. // The token object at the start index; the input stream might
  38120. // not be buffering tokens so get a reference to it. (At the
  38121. // time the error occurred, of course the stream needs to keep a
  38122. // buffer all of the tokens but later we might not have access to those.)
  38123. this.startToken = startToken;
  38124. this.offendingToken = offendingToken;
  38125. }
  38126. NoViableAltException.prototype = Object.create(RecognitionException.prototype);
  38127. NoViableAltException.prototype.constructor = NoViableAltException;
  38128. // This signifies any kind of mismatched input exceptions such as
  38129. // when the current input does not match the expected token.
  38130. //
  38131. function InputMismatchException(recognizer) {
  38132. RecognitionException.call(this, {message:"", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});
  38133. this.offendingToken = recognizer.getCurrentToken();
  38134. }
  38135. InputMismatchException.prototype = Object.create(RecognitionException.prototype);
  38136. InputMismatchException.prototype.constructor = InputMismatchException;
  38137. // A semantic predicate failed during validation. Validation of predicates
  38138. // occurs when normally parsing the alternative just like matching a token.
  38139. // Disambiguating predicate evaluation occurs when we test a predicate during
  38140. // prediction.
  38141. function FailedPredicateException(recognizer, predicate, message) {
  38142. RecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,
  38143. input:recognizer.getInputStream(), ctx:recognizer._ctx});
  38144. var s = recognizer._interp.atn.states[recognizer.state];
  38145. var trans = s.transitions[0];
  38146. if (trans instanceof PredicateTransition) {
  38147. this.ruleIndex = trans.ruleIndex;
  38148. this.predicateIndex = trans.predIndex;
  38149. } else {
  38150. this.ruleIndex = 0;
  38151. this.predicateIndex = 0;
  38152. }
  38153. this.predicate = predicate;
  38154. this.offendingToken = recognizer.getCurrentToken();
  38155. return this;
  38156. }
  38157. FailedPredicateException.prototype = Object.create(RecognitionException.prototype);
  38158. FailedPredicateException.prototype.constructor = FailedPredicateException;
  38159. FailedPredicateException.prototype.formatMessage = function(predicate, message) {
  38160. if (message !==null) {
  38161. return message;
  38162. } else {
  38163. return "failed predicate: {" + predicate + "}?";
  38164. }
  38165. };
  38166. function ParseCancellationException() {
  38167. Error.call(this);
  38168. Error.captureStackTrace(this, ParseCancellationException);
  38169. return this;
  38170. }
  38171. ParseCancellationException.prototype = Object.create(Error.prototype);
  38172. ParseCancellationException.prototype.constructor = ParseCancellationException;
  38173. exports.RecognitionException = RecognitionException;
  38174. exports.NoViableAltException = NoViableAltException;
  38175. exports.LexerNoViableAltException = LexerNoViableAltException;
  38176. exports.InputMismatchException = InputMismatchException;
  38177. exports.FailedPredicateException = FailedPredicateException;
  38178. exports.ParseCancellationException = ParseCancellationException;
  38179. /***/ }),
  38180. /***/ "./node_modules/antlr4/error/index.js":
  38181. /*!********************************************!*\
  38182. !*** ./node_modules/antlr4/error/index.js ***!
  38183. \********************************************/
  38184. /*! no static exports found */
  38185. /***/ (function(module, exports, __webpack_require__) {
  38186. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38187. * Use of this file is governed by the BSD 3-clause license that
  38188. * can be found in the LICENSE.txt file in the project root.
  38189. */
  38190. exports.RecognitionException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").RecognitionException;
  38191. exports.NoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").NoViableAltException;
  38192. exports.LexerNoViableAltException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").LexerNoViableAltException;
  38193. exports.InputMismatchException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").InputMismatchException;
  38194. exports.FailedPredicateException = __webpack_require__(/*! ./Errors */ "./node_modules/antlr4/error/Errors.js").FailedPredicateException;
  38195. exports.DiagnosticErrorListener = __webpack_require__(/*! ./DiagnosticErrorListener */ "./node_modules/antlr4/error/DiagnosticErrorListener.js").DiagnosticErrorListener;
  38196. exports.BailErrorStrategy = __webpack_require__(/*! ./ErrorStrategy */ "./node_modules/antlr4/error/ErrorStrategy.js").BailErrorStrategy;
  38197. exports.ErrorListener = __webpack_require__(/*! ./ErrorListener */ "./node_modules/antlr4/error/ErrorListener.js").ErrorListener;
  38198. /***/ }),
  38199. /***/ "./node_modules/antlr4/index.js":
  38200. /*!**************************************!*\
  38201. !*** ./node_modules/antlr4/index.js ***!
  38202. \**************************************/
  38203. /*! no static exports found */
  38204. /***/ (function(module, exports, __webpack_require__) {
  38205. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38206. * Use of this file is governed by the BSD 3-clause license that
  38207. * can be found in the LICENSE.txt file in the project root.
  38208. */
  38209. exports.atn = __webpack_require__(/*! ./atn/index */ "./node_modules/antlr4/atn/index.js");
  38210. exports.codepointat = __webpack_require__(/*! ./polyfills/codepointat */ "./node_modules/antlr4/polyfills/codepointat.js");
  38211. exports.dfa = __webpack_require__(/*! ./dfa/index */ "./node_modules/antlr4/dfa/index.js");
  38212. exports.fromcodepoint = __webpack_require__(/*! ./polyfills/fromcodepoint */ "./node_modules/antlr4/polyfills/fromcodepoint.js");
  38213. exports.tree = __webpack_require__(/*! ./tree/index */ "./node_modules/antlr4/tree/index.js");
  38214. exports.error = __webpack_require__(/*! ./error/index */ "./node_modules/antlr4/error/index.js");
  38215. exports.Token = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").Token;
  38216. exports.CharStreams = __webpack_require__(/*! ./CharStreams */ "./node_modules/antlr4/CharStreams.js").CharStreams;
  38217. exports.CommonToken = __webpack_require__(/*! ./Token */ "./node_modules/antlr4/Token.js").CommonToken;
  38218. exports.InputStream = __webpack_require__(/*! ./InputStream */ "./node_modules/antlr4/InputStream.js").InputStream;
  38219. exports.FileStream = __webpack_require__(/*! ./FileStream */ "./node_modules/antlr4/FileStream.js").FileStream;
  38220. exports.CommonTokenStream = __webpack_require__(/*! ./CommonTokenStream */ "./node_modules/antlr4/CommonTokenStream.js").CommonTokenStream;
  38221. exports.Lexer = __webpack_require__(/*! ./Lexer */ "./node_modules/antlr4/Lexer.js").Lexer;
  38222. exports.Parser = __webpack_require__(/*! ./Parser */ "./node_modules/antlr4/Parser.js").Parser;
  38223. var pc = __webpack_require__(/*! ./PredictionContext */ "./node_modules/antlr4/PredictionContext.js");
  38224. exports.PredictionContextCache = pc.PredictionContextCache;
  38225. exports.ParserRuleContext = __webpack_require__(/*! ./ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38226. exports.Interval = __webpack_require__(/*! ./IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  38227. exports.Utils = __webpack_require__(/*! ./Utils */ "./node_modules/antlr4/Utils.js");
  38228. /***/ }),
  38229. /***/ "./node_modules/antlr4/polyfills/codepointat.js":
  38230. /*!******************************************************!*\
  38231. !*** ./node_modules/antlr4/polyfills/codepointat.js ***!
  38232. \******************************************************/
  38233. /*! no static exports found */
  38234. /***/ (function(module, exports) {
  38235. /*! https://mths.be/codepointat v0.2.0 by @mathias */
  38236. if (!String.prototype.codePointAt) {
  38237. (function() {
  38238. 'use strict'; // needed to support `apply`/`call` with `undefined`/`null`
  38239. var defineProperty = (function() {
  38240. // IE 8 only supports `Object.defineProperty` on DOM elements
  38241. try {
  38242. var object = {};
  38243. var $defineProperty = Object.defineProperty;
  38244. var result = $defineProperty(object, object, object) && $defineProperty;
  38245. } catch(error) {}
  38246. return result;
  38247. }());
  38248. var codePointAt = function(position) {
  38249. if (this == null) {
  38250. throw TypeError();
  38251. }
  38252. var string = String(this);
  38253. var size = string.length;
  38254. // `ToInteger`
  38255. var index = position ? Number(position) : 0;
  38256. if (index != index) { // better `isNaN`
  38257. index = 0;
  38258. }
  38259. // Account for out-of-bounds indices:
  38260. if (index < 0 || index >= size) {
  38261. return undefined;
  38262. }
  38263. // Get the first code unit
  38264. var first = string.charCodeAt(index);
  38265. var second;
  38266. if ( // check if it’s the start of a surrogate pair
  38267. first >= 0xD800 && first <= 0xDBFF && // high surrogate
  38268. size > index + 1 // there is a next code unit
  38269. ) {
  38270. second = string.charCodeAt(index + 1);
  38271. if (second >= 0xDC00 && second <= 0xDFFF) { // low surrogate
  38272. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  38273. return (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
  38274. }
  38275. }
  38276. return first;
  38277. };
  38278. if (defineProperty) {
  38279. defineProperty(String.prototype, 'codePointAt', {
  38280. 'value': codePointAt,
  38281. 'configurable': true,
  38282. 'writable': true
  38283. });
  38284. } else {
  38285. String.prototype.codePointAt = codePointAt;
  38286. }
  38287. }());
  38288. }
  38289. /***/ }),
  38290. /***/ "./node_modules/antlr4/polyfills/fromcodepoint.js":
  38291. /*!********************************************************!*\
  38292. !*** ./node_modules/antlr4/polyfills/fromcodepoint.js ***!
  38293. \********************************************************/
  38294. /*! no static exports found */
  38295. /***/ (function(module, exports) {
  38296. /*! https://mths.be/fromcodepoint v0.2.1 by @mathias */
  38297. if (!String.fromCodePoint) {
  38298. (function() {
  38299. var defineProperty = (function() {
  38300. // IE 8 only supports `Object.defineProperty` on DOM elements
  38301. try {
  38302. var object = {};
  38303. var $defineProperty = Object.defineProperty;
  38304. var result = $defineProperty(object, object, object) && $defineProperty;
  38305. } catch(error) {}
  38306. return result;
  38307. }());
  38308. var stringFromCharCode = String.fromCharCode;
  38309. var floor = Math.floor;
  38310. var fromCodePoint = function(_) {
  38311. var MAX_SIZE = 0x4000;
  38312. var codeUnits = [];
  38313. var highSurrogate;
  38314. var lowSurrogate;
  38315. var index = -1;
  38316. var length = arguments.length;
  38317. if (!length) {
  38318. return '';
  38319. }
  38320. var result = '';
  38321. while (++index < length) {
  38322. var codePoint = Number(arguments[index]);
  38323. if (
  38324. !isFinite(codePoint) || // `NaN`, `+Infinity`, or `-Infinity`
  38325. codePoint < 0 || // not a valid Unicode code point
  38326. codePoint > 0x10FFFF || // not a valid Unicode code point
  38327. floor(codePoint) != codePoint // not an integer
  38328. ) {
  38329. throw RangeError('Invalid code point: ' + codePoint);
  38330. }
  38331. if (codePoint <= 0xFFFF) { // BMP code point
  38332. codeUnits.push(codePoint);
  38333. } else { // Astral code point; split in surrogate halves
  38334. // https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  38335. codePoint -= 0x10000;
  38336. highSurrogate = (codePoint >> 10) + 0xD800;
  38337. lowSurrogate = (codePoint % 0x400) + 0xDC00;
  38338. codeUnits.push(highSurrogate, lowSurrogate);
  38339. }
  38340. if (index + 1 == length || codeUnits.length > MAX_SIZE) {
  38341. result += stringFromCharCode.apply(null, codeUnits);
  38342. codeUnits.length = 0;
  38343. }
  38344. }
  38345. return result;
  38346. };
  38347. if (defineProperty) {
  38348. defineProperty(String, 'fromCodePoint', {
  38349. 'value': fromCodePoint,
  38350. 'configurable': true,
  38351. 'writable': true
  38352. });
  38353. } else {
  38354. String.fromCodePoint = fromCodePoint;
  38355. }
  38356. }());
  38357. }
  38358. /***/ }),
  38359. /***/ "./node_modules/antlr4/tree/Tree.js":
  38360. /*!******************************************!*\
  38361. !*** ./node_modules/antlr4/tree/Tree.js ***!
  38362. \******************************************/
  38363. /*! no static exports found */
  38364. /***/ (function(module, exports, __webpack_require__) {
  38365. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38366. * Use of this file is governed by the BSD 3-clause license that
  38367. * can be found in the LICENSE.txt file in the project root.
  38368. */
  38369. ///
  38370. // The basic notion of a tree has a parent, a payload, and a list of children.
  38371. // It is the most abstract interface for all the trees used by ANTLR.
  38372. ///
  38373. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38374. var Interval = __webpack_require__(/*! ./../IntervalSet */ "./node_modules/antlr4/IntervalSet.js").Interval;
  38375. var INVALID_INTERVAL = new Interval(-1, -2);
  38376. var Utils = __webpack_require__(/*! ../Utils.js */ "./node_modules/antlr4/Utils.js");
  38377. function Tree() {
  38378. return this;
  38379. }
  38380. function SyntaxTree() {
  38381. Tree.call(this);
  38382. return this;
  38383. }
  38384. SyntaxTree.prototype = Object.create(Tree.prototype);
  38385. SyntaxTree.prototype.constructor = SyntaxTree;
  38386. function ParseTree() {
  38387. SyntaxTree.call(this);
  38388. return this;
  38389. }
  38390. ParseTree.prototype = Object.create(SyntaxTree.prototype);
  38391. ParseTree.prototype.constructor = ParseTree;
  38392. function RuleNode() {
  38393. ParseTree.call(this);
  38394. return this;
  38395. }
  38396. RuleNode.prototype = Object.create(ParseTree.prototype);
  38397. RuleNode.prototype.constructor = RuleNode;
  38398. function TerminalNode() {
  38399. ParseTree.call(this);
  38400. return this;
  38401. }
  38402. TerminalNode.prototype = Object.create(ParseTree.prototype);
  38403. TerminalNode.prototype.constructor = TerminalNode;
  38404. function ErrorNode() {
  38405. TerminalNode.call(this);
  38406. return this;
  38407. }
  38408. ErrorNode.prototype = Object.create(TerminalNode.prototype);
  38409. ErrorNode.prototype.constructor = ErrorNode;
  38410. function ParseTreeVisitor() {
  38411. return this;
  38412. }
  38413. ParseTreeVisitor.prototype.visit = function(ctx) {
  38414. if (Array.isArray(ctx)) {
  38415. return ctx.map(function(child) {
  38416. return child.accept(this);
  38417. }, this);
  38418. } else {
  38419. return ctx.accept(this);
  38420. }
  38421. };
  38422. ParseTreeVisitor.prototype.visitChildren = function(ctx) {
  38423. if (ctx.children) {
  38424. return this.visit(ctx.children);
  38425. } else {
  38426. return null;
  38427. }
  38428. }
  38429. ParseTreeVisitor.prototype.visitTerminal = function(node) {
  38430. };
  38431. ParseTreeVisitor.prototype.visitErrorNode = function(node) {
  38432. };
  38433. function ParseTreeListener() {
  38434. return this;
  38435. }
  38436. ParseTreeListener.prototype.visitTerminal = function(node) {
  38437. };
  38438. ParseTreeListener.prototype.visitErrorNode = function(node) {
  38439. };
  38440. ParseTreeListener.prototype.enterEveryRule = function(node) {
  38441. };
  38442. ParseTreeListener.prototype.exitEveryRule = function(node) {
  38443. };
  38444. function TerminalNodeImpl(symbol) {
  38445. TerminalNode.call(this);
  38446. this.parentCtx = null;
  38447. this.symbol = symbol;
  38448. return this;
  38449. }
  38450. TerminalNodeImpl.prototype = Object.create(TerminalNode.prototype);
  38451. TerminalNodeImpl.prototype.constructor = TerminalNodeImpl;
  38452. TerminalNodeImpl.prototype.getChild = function(i) {
  38453. return null;
  38454. };
  38455. TerminalNodeImpl.prototype.getSymbol = function() {
  38456. return this.symbol;
  38457. };
  38458. TerminalNodeImpl.prototype.getParent = function() {
  38459. return this.parentCtx;
  38460. };
  38461. TerminalNodeImpl.prototype.getPayload = function() {
  38462. return this.symbol;
  38463. };
  38464. TerminalNodeImpl.prototype.getSourceInterval = function() {
  38465. if (this.symbol === null) {
  38466. return INVALID_INTERVAL;
  38467. }
  38468. var tokenIndex = this.symbol.tokenIndex;
  38469. return new Interval(tokenIndex, tokenIndex);
  38470. };
  38471. TerminalNodeImpl.prototype.getChildCount = function() {
  38472. return 0;
  38473. };
  38474. TerminalNodeImpl.prototype.accept = function(visitor) {
  38475. return visitor.visitTerminal(this);
  38476. };
  38477. TerminalNodeImpl.prototype.getText = function() {
  38478. return this.symbol.text;
  38479. };
  38480. TerminalNodeImpl.prototype.toString = function() {
  38481. if (this.symbol.type === Token.EOF) {
  38482. return "<EOF>";
  38483. } else {
  38484. return this.symbol.text;
  38485. }
  38486. };
  38487. // Represents a token that was consumed during resynchronization
  38488. // rather than during a valid match operation. For example,
  38489. // we will create this kind of a node during single token insertion
  38490. // and deletion as well as during "consume until error recovery set"
  38491. // upon no viable alternative exceptions.
  38492. function ErrorNodeImpl(token) {
  38493. TerminalNodeImpl.call(this, token);
  38494. return this;
  38495. }
  38496. ErrorNodeImpl.prototype = Object.create(TerminalNodeImpl.prototype);
  38497. ErrorNodeImpl.prototype.constructor = ErrorNodeImpl;
  38498. ErrorNodeImpl.prototype.isErrorNode = function() {
  38499. return true;
  38500. };
  38501. ErrorNodeImpl.prototype.accept = function(visitor) {
  38502. return visitor.visitErrorNode(this);
  38503. };
  38504. function ParseTreeWalker() {
  38505. return this;
  38506. }
  38507. ParseTreeWalker.prototype.walk = function(listener, t) {
  38508. var errorNode = t instanceof ErrorNode ||
  38509. (t.isErrorNode !== undefined && t.isErrorNode());
  38510. if (errorNode) {
  38511. listener.visitErrorNode(t);
  38512. } else if (t instanceof TerminalNode) {
  38513. listener.visitTerminal(t);
  38514. } else {
  38515. this.enterRule(listener, t);
  38516. for (var i = 0; i < t.getChildCount(); i++) {
  38517. var child = t.getChild(i);
  38518. this.walk(listener, child);
  38519. }
  38520. this.exitRule(listener, t);
  38521. }
  38522. };
  38523. //
  38524. // The discovery of a rule node, involves sending two events: the generic
  38525. // {@link ParseTreeListener//enterEveryRule} and a
  38526. // {@link RuleContext}-specific event. First we trigger the generic and then
  38527. // the rule specific. We to them in reverse order upon finishing the node.
  38528. //
  38529. ParseTreeWalker.prototype.enterRule = function(listener, r) {
  38530. var ctx = r.getRuleContext();
  38531. listener.enterEveryRule(ctx);
  38532. ctx.enterRule(listener);
  38533. };
  38534. ParseTreeWalker.prototype.exitRule = function(listener, r) {
  38535. var ctx = r.getRuleContext();
  38536. ctx.exitRule(listener);
  38537. listener.exitEveryRule(ctx);
  38538. };
  38539. ParseTreeWalker.DEFAULT = new ParseTreeWalker();
  38540. exports.RuleNode = RuleNode;
  38541. exports.ErrorNode = ErrorNode;
  38542. exports.TerminalNode = TerminalNode;
  38543. exports.ErrorNodeImpl = ErrorNodeImpl;
  38544. exports.TerminalNodeImpl = TerminalNodeImpl;
  38545. exports.ParseTreeListener = ParseTreeListener;
  38546. exports.ParseTreeVisitor = ParseTreeVisitor;
  38547. exports.ParseTreeWalker = ParseTreeWalker;
  38548. exports.INVALID_INTERVAL = INVALID_INTERVAL;
  38549. /***/ }),
  38550. /***/ "./node_modules/antlr4/tree/Trees.js":
  38551. /*!*******************************************!*\
  38552. !*** ./node_modules/antlr4/tree/Trees.js ***!
  38553. \*******************************************/
  38554. /*! no static exports found */
  38555. /***/ (function(module, exports, __webpack_require__) {
  38556. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38557. * Use of this file is governed by the BSD 3-clause license that
  38558. * can be found in the LICENSE.txt file in the project root.
  38559. */
  38560. var Utils = __webpack_require__(/*! ./../Utils */ "./node_modules/antlr4/Utils.js");
  38561. var Token = __webpack_require__(/*! ./../Token */ "./node_modules/antlr4/Token.js").Token;
  38562. var RuleNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").RuleNode;
  38563. var ErrorNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").ErrorNode;
  38564. var TerminalNode = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js").TerminalNode;
  38565. var ParserRuleContext = __webpack_require__(/*! ./../ParserRuleContext */ "./node_modules/antlr4/ParserRuleContext.js").ParserRuleContext;
  38566. var RuleContext = __webpack_require__(/*! ./../RuleContext */ "./node_modules/antlr4/RuleContext.js").RuleContext;
  38567. var INVALID_ALT_NUMBER = __webpack_require__(/*! ./../atn/ATN */ "./node_modules/antlr4/atn/ATN.js").INVALID_ALT_NUMBER;
  38568. /** A set of utility routines useful for all kinds of ANTLR trees. */
  38569. function Trees() {
  38570. }
  38571. // Print out a whole tree in LISP form. {@link //getNodeText} is used on the
  38572. // node payloads to get the text for the nodes. Detect
  38573. // parse trees and extract data appropriately.
  38574. Trees.toStringTree = function(tree, ruleNames, recog) {
  38575. ruleNames = ruleNames || null;
  38576. recog = recog || null;
  38577. if(recog!==null) {
  38578. ruleNames = recog.ruleNames;
  38579. }
  38580. var s = Trees.getNodeText(tree, ruleNames);
  38581. s = Utils.escapeWhitespace(s, false);
  38582. var c = tree.getChildCount();
  38583. if(c===0) {
  38584. return s;
  38585. }
  38586. var res = "(" + s + ' ';
  38587. if(c>0) {
  38588. s = Trees.toStringTree(tree.getChild(0), ruleNames);
  38589. res = res.concat(s);
  38590. }
  38591. for(var i=1;i<c;i++) {
  38592. s = Trees.toStringTree(tree.getChild(i), ruleNames);
  38593. res = res.concat(' ' + s);
  38594. }
  38595. res = res.concat(")");
  38596. return res;
  38597. };
  38598. Trees.getNodeText = function(t, ruleNames, recog) {
  38599. ruleNames = ruleNames || null;
  38600. recog = recog || null;
  38601. if(recog!==null) {
  38602. ruleNames = recog.ruleNames;
  38603. }
  38604. if(ruleNames!==null) {
  38605. if (t instanceof RuleContext) {
  38606. var altNumber = t.getAltNumber();
  38607. if ( altNumber!=INVALID_ALT_NUMBER ) {
  38608. return ruleNames[t.ruleIndex]+":"+altNumber;
  38609. }
  38610. return ruleNames[t.ruleIndex];
  38611. } else if ( t instanceof ErrorNode) {
  38612. return t.toString();
  38613. } else if(t instanceof TerminalNode) {
  38614. if(t.symbol!==null) {
  38615. return t.symbol.text;
  38616. }
  38617. }
  38618. }
  38619. // no recog for rule names
  38620. var payload = t.getPayload();
  38621. if (payload instanceof Token ) {
  38622. return payload.text;
  38623. }
  38624. return t.getPayload().toString();
  38625. };
  38626. // Return ordered list of all children of this node
  38627. Trees.getChildren = function(t) {
  38628. var list = [];
  38629. for(var i=0;i<t.getChildCount();i++) {
  38630. list.push(t.getChild(i));
  38631. }
  38632. return list;
  38633. };
  38634. // Return a list of all ancestors of this node. The first node of
  38635. // list is the root and the last is the parent of this node.
  38636. //
  38637. Trees.getAncestors = function(t) {
  38638. var ancestors = [];
  38639. t = t.getParent();
  38640. while(t!==null) {
  38641. ancestors = [t].concat(ancestors);
  38642. t = t.getParent();
  38643. }
  38644. return ancestors;
  38645. };
  38646. Trees.findAllTokenNodes = function(t, ttype) {
  38647. return Trees.findAllNodes(t, ttype, true);
  38648. };
  38649. Trees.findAllRuleNodes = function(t, ruleIndex) {
  38650. return Trees.findAllNodes(t, ruleIndex, false);
  38651. };
  38652. Trees.findAllNodes = function(t, index, findTokens) {
  38653. var nodes = [];
  38654. Trees._findAllNodes(t, index, findTokens, nodes);
  38655. return nodes;
  38656. };
  38657. Trees._findAllNodes = function(t, index, findTokens, nodes) {
  38658. // check this node (the root) first
  38659. if(findTokens && (t instanceof TerminalNode)) {
  38660. if(t.symbol.type===index) {
  38661. nodes.push(t);
  38662. }
  38663. } else if(!findTokens && (t instanceof ParserRuleContext)) {
  38664. if(t.ruleIndex===index) {
  38665. nodes.push(t);
  38666. }
  38667. }
  38668. // check children
  38669. for(var i=0;i<t.getChildCount();i++) {
  38670. Trees._findAllNodes(t.getChild(i), index, findTokens, nodes);
  38671. }
  38672. };
  38673. Trees.descendants = function(t) {
  38674. var nodes = [t];
  38675. for(var i=0;i<t.getChildCount();i++) {
  38676. nodes = nodes.concat(Trees.descendants(t.getChild(i)));
  38677. }
  38678. return nodes;
  38679. };
  38680. exports.Trees = Trees;
  38681. /***/ }),
  38682. /***/ "./node_modules/antlr4/tree/index.js":
  38683. /*!*******************************************!*\
  38684. !*** ./node_modules/antlr4/tree/index.js ***!
  38685. \*******************************************/
  38686. /*! no static exports found */
  38687. /***/ (function(module, exports, __webpack_require__) {
  38688. /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
  38689. * Use of this file is governed by the BSD 3-clause license that
  38690. * can be found in the LICENSE.txt file in the project root.
  38691. */
  38692. var Tree = __webpack_require__(/*! ./Tree */ "./node_modules/antlr4/tree/Tree.js");
  38693. exports.Trees = __webpack_require__(/*! ./Trees */ "./node_modules/antlr4/tree/Trees.js").Trees;
  38694. exports.RuleNode = Tree.RuleNode;
  38695. exports.ParseTreeListener = Tree.ParseTreeListener;
  38696. exports.ParseTreeVisitor = Tree.ParseTreeVisitor;
  38697. exports.ParseTreeWalker = Tree.ParseTreeWalker;
  38698. /***/ }),
  38699. /***/ "./node_modules/decimal.js/decimal.js":
  38700. /*!********************************************!*\
  38701. !*** ./node_modules/decimal.js/decimal.js ***!
  38702. \********************************************/
  38703. /*! no static exports found */
  38704. /***/ (function(module, exports, __webpack_require__) {
  38705. var __WEBPACK_AMD_DEFINE_RESULT__;;(function (globalScope) {
  38706. 'use strict';
  38707. /*
  38708. * decimal.js v10.1.1
  38709. * An arbitrary-precision Decimal type for JavaScript.
  38710. * https://github.com/MikeMcl/decimal.js
  38711. * Copyright (c) 2019 Michael Mclaughlin <M8ch88l@gmail.com>
  38712. * MIT Licence
  38713. */
  38714. // ----------------------------------- EDITABLE DEFAULTS ------------------------------------ //
  38715. // The maximum exponent magnitude.
  38716. // The limit on the value of `toExpNeg`, `toExpPos`, `minE` and `maxE`.
  38717. var EXP_LIMIT = 9e15, // 0 to 9e15
  38718. // The limit on the value of `precision`, and on the value of the first argument to
  38719. // `toDecimalPlaces`, `toExponential`, `toFixed`, `toPrecision` and `toSignificantDigits`.
  38720. MAX_DIGITS = 1e9, // 0 to 1e9
  38721. // Base conversion alphabet.
  38722. NUMERALS = '0123456789abcdef',
  38723. // The natural logarithm of 10 (1025 digits).
  38724. LN10 = '2.3025850929940456840179914546843642076011014886287729760333279009675726096773524802359972050895982983419677840422862486334095254650828067566662873690987816894829072083255546808437998948262331985283935053089653777326288461633662222876982198867465436674744042432743651550489343149393914796194044002221051017141748003688084012647080685567743216228355220114804663715659121373450747856947683463616792101806445070648000277502684916746550586856935673420670581136429224554405758925724208241314695689016758940256776311356919292033376587141660230105703089634572075440370847469940168269282808481184289314848524948644871927809676271275775397027668605952496716674183485704422507197965004714951050492214776567636938662976979522110718264549734772662425709429322582798502585509785265383207606726317164309505995087807523710333101197857547331541421808427543863591778117054309827482385045648019095610299291824318237525357709750539565187697510374970888692180205189339507238539205144634197265287286965110862571492198849978748873771345686209167058',
  38725. // Pi (1025 digits).
  38726. PI = '3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632789',
  38727. // The initial configuration properties of the Decimal constructor.
  38728. DEFAULTS = {
  38729. // These values must be integers within the stated ranges (inclusive).
  38730. // Most of these values can be changed at run-time using the `Decimal.config` method.
  38731. // The maximum number of significant digits of the result of a calculation or base conversion.
  38732. // E.g. `Decimal.config({ precision: 20 });`
  38733. precision: 20, // 1 to MAX_DIGITS
  38734. // The rounding mode used when rounding to `precision`.
  38735. //
  38736. // ROUND_UP 0 Away from zero.
  38737. // ROUND_DOWN 1 Towards zero.
  38738. // ROUND_CEIL 2 Towards +Infinity.
  38739. // ROUND_FLOOR 3 Towards -Infinity.
  38740. // ROUND_HALF_UP 4 Towards nearest neighbour. If equidistant, up.
  38741. // ROUND_HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.
  38742. // ROUND_HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.
  38743. // ROUND_HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.
  38744. // ROUND_HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.
  38745. //
  38746. // E.g.
  38747. // `Decimal.rounding = 4;`
  38748. // `Decimal.rounding = Decimal.ROUND_HALF_UP;`
  38749. rounding: 4, // 0 to 8
  38750. // The modulo mode used when calculating the modulus: a mod n.
  38751. // The quotient (q = a / n) is calculated according to the corresponding rounding mode.
  38752. // The remainder (r) is calculated as: r = a - n * q.
  38753. //
  38754. // UP 0 The remainder is positive if the dividend is negative, else is negative.
  38755. // DOWN 1 The remainder has the same sign as the dividend (JavaScript %).
  38756. // FLOOR 3 The remainder has the same sign as the divisor (Python %).
  38757. // HALF_EVEN 6 The IEEE 754 remainder function.
  38758. // EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)). Always positive.
  38759. //
  38760. // Truncated division (1), floored division (3), the IEEE 754 remainder (6), and Euclidian
  38761. // division (9) are commonly used for the modulus operation. The other rounding modes can also
  38762. // be used, but they may not give useful results.
  38763. modulo: 1, // 0 to 9
  38764. // The exponent value at and beneath which `toString` returns exponential notation.
  38765. // JavaScript numbers: -7
  38766. toExpNeg: -7, // 0 to -EXP_LIMIT
  38767. // The exponent value at and above which `toString` returns exponential notation.
  38768. // JavaScript numbers: 21
  38769. toExpPos: 21, // 0 to EXP_LIMIT
  38770. // The minimum exponent value, beneath which underflow to zero occurs.
  38771. // JavaScript numbers: -324 (5e-324)
  38772. minE: -EXP_LIMIT, // -1 to -EXP_LIMIT
  38773. // The maximum exponent value, above which overflow to Infinity occurs.
  38774. // JavaScript numbers: 308 (1.7976931348623157e+308)
  38775. maxE: EXP_LIMIT, // 1 to EXP_LIMIT
  38776. // Whether to use cryptographically-secure random number generation, if available.
  38777. crypto: false // true/false
  38778. },
  38779. // ----------------------------------- END OF EDITABLE DEFAULTS ------------------------------- //
  38780. Decimal, inexact, noConflict, quadrant,
  38781. external = true,
  38782. decimalError = '[DecimalError] ',
  38783. invalidArgument = decimalError + 'Invalid argument: ',
  38784. precisionLimitExceeded = decimalError + 'Precision limit exceeded',
  38785. cryptoUnavailable = decimalError + 'crypto unavailable',
  38786. mathfloor = Math.floor,
  38787. mathpow = Math.pow,
  38788. isBinary = /^0b([01]+(\.[01]*)?|\.[01]+)(p[+-]?\d+)?$/i,
  38789. isHex = /^0x([0-9a-f]+(\.[0-9a-f]*)?|\.[0-9a-f]+)(p[+-]?\d+)?$/i,
  38790. isOctal = /^0o([0-7]+(\.[0-7]*)?|\.[0-7]+)(p[+-]?\d+)?$/i,
  38791. isDecimal = /^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
  38792. BASE = 1e7,
  38793. LOG_BASE = 7,
  38794. MAX_SAFE_INTEGER = 9007199254740991,
  38795. LN10_PRECISION = LN10.length - 1,
  38796. PI_PRECISION = PI.length - 1,
  38797. // Decimal.prototype object
  38798. P = { name: '[object Decimal]' };
  38799. // Decimal prototype methods
  38800. /*
  38801. * absoluteValue abs
  38802. * ceil
  38803. * comparedTo cmp
  38804. * cosine cos
  38805. * cubeRoot cbrt
  38806. * decimalPlaces dp
  38807. * dividedBy div
  38808. * dividedToIntegerBy divToInt
  38809. * equals eq
  38810. * floor
  38811. * greaterThan gt
  38812. * greaterThanOrEqualTo gte
  38813. * hyperbolicCosine cosh
  38814. * hyperbolicSine sinh
  38815. * hyperbolicTangent tanh
  38816. * inverseCosine acos
  38817. * inverseHyperbolicCosine acosh
  38818. * inverseHyperbolicSine asinh
  38819. * inverseHyperbolicTangent atanh
  38820. * inverseSine asin
  38821. * inverseTangent atan
  38822. * isFinite
  38823. * isInteger isInt
  38824. * isNaN
  38825. * isNegative isNeg
  38826. * isPositive isPos
  38827. * isZero
  38828. * lessThan lt
  38829. * lessThanOrEqualTo lte
  38830. * logarithm log
  38831. * [maximum] [max]
  38832. * [minimum] [min]
  38833. * minus sub
  38834. * modulo mod
  38835. * naturalExponential exp
  38836. * naturalLogarithm ln
  38837. * negated neg
  38838. * plus add
  38839. * precision sd
  38840. * round
  38841. * sine sin
  38842. * squareRoot sqrt
  38843. * tangent tan
  38844. * times mul
  38845. * toBinary
  38846. * toDecimalPlaces toDP
  38847. * toExponential
  38848. * toFixed
  38849. * toFraction
  38850. * toHexadecimal toHex
  38851. * toNearest
  38852. * toNumber
  38853. * toOctal
  38854. * toPower pow
  38855. * toPrecision
  38856. * toSignificantDigits toSD
  38857. * toString
  38858. * truncated trunc
  38859. * valueOf toJSON
  38860. */
  38861. /*
  38862. * Return a new Decimal whose value is the absolute value of this Decimal.
  38863. *
  38864. */
  38865. P.absoluteValue = P.abs = function () {
  38866. var x = new this.constructor(this);
  38867. if (x.s < 0) x.s = 1;
  38868. return finalise(x);
  38869. };
  38870. /*
  38871. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  38872. * direction of positive Infinity.
  38873. *
  38874. */
  38875. P.ceil = function () {
  38876. return finalise(new this.constructor(this), this.e + 1, 2);
  38877. };
  38878. /*
  38879. * Return
  38880. * 1 if the value of this Decimal is greater than the value of `y`,
  38881. * -1 if the value of this Decimal is less than the value of `y`,
  38882. * 0 if they have the same value,
  38883. * NaN if the value of either Decimal is NaN.
  38884. *
  38885. */
  38886. P.comparedTo = P.cmp = function (y) {
  38887. var i, j, xdL, ydL,
  38888. x = this,
  38889. xd = x.d,
  38890. yd = (y = new x.constructor(y)).d,
  38891. xs = x.s,
  38892. ys = y.s;
  38893. // Either NaN or ±Infinity?
  38894. if (!xd || !yd) {
  38895. return !xs || !ys ? NaN : xs !== ys ? xs : xd === yd ? 0 : !xd ^ xs < 0 ? 1 : -1;
  38896. }
  38897. // Either zero?
  38898. if (!xd[0] || !yd[0]) return xd[0] ? xs : yd[0] ? -ys : 0;
  38899. // Signs differ?
  38900. if (xs !== ys) return xs;
  38901. // Compare exponents.
  38902. if (x.e !== y.e) return x.e > y.e ^ xs < 0 ? 1 : -1;
  38903. xdL = xd.length;
  38904. ydL = yd.length;
  38905. // Compare digit by digit.
  38906. for (i = 0, j = xdL < ydL ? xdL : ydL; i < j; ++i) {
  38907. if (xd[i] !== yd[i]) return xd[i] > yd[i] ^ xs < 0 ? 1 : -1;
  38908. }
  38909. // Compare lengths.
  38910. return xdL === ydL ? 0 : xdL > ydL ^ xs < 0 ? 1 : -1;
  38911. };
  38912. /*
  38913. * Return a new Decimal whose value is the cosine of the value in radians of this Decimal.
  38914. *
  38915. * Domain: [-Infinity, Infinity]
  38916. * Range: [-1, 1]
  38917. *
  38918. * cos(0) = 1
  38919. * cos(-0) = 1
  38920. * cos(Infinity) = NaN
  38921. * cos(-Infinity) = NaN
  38922. * cos(NaN) = NaN
  38923. *
  38924. */
  38925. P.cosine = P.cos = function () {
  38926. var pr, rm,
  38927. x = this,
  38928. Ctor = x.constructor;
  38929. if (!x.d) return new Ctor(NaN);
  38930. // cos(0) = cos(-0) = 1
  38931. if (!x.d[0]) return new Ctor(1);
  38932. pr = Ctor.precision;
  38933. rm = Ctor.rounding;
  38934. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  38935. Ctor.rounding = 1;
  38936. x = cosine(Ctor, toLessThanHalfPi(Ctor, x));
  38937. Ctor.precision = pr;
  38938. Ctor.rounding = rm;
  38939. return finalise(quadrant == 2 || quadrant == 3 ? x.neg() : x, pr, rm, true);
  38940. };
  38941. /*
  38942. *
  38943. * Return a new Decimal whose value is the cube root of the value of this Decimal, rounded to
  38944. * `precision` significant digits using rounding mode `rounding`.
  38945. *
  38946. * cbrt(0) = 0
  38947. * cbrt(-0) = -0
  38948. * cbrt(1) = 1
  38949. * cbrt(-1) = -1
  38950. * cbrt(N) = N
  38951. * cbrt(-I) = -I
  38952. * cbrt(I) = I
  38953. *
  38954. * Math.cbrt(x) = (x < 0 ? -Math.pow(-x, 1/3) : Math.pow(x, 1/3))
  38955. *
  38956. */
  38957. P.cubeRoot = P.cbrt = function () {
  38958. var e, m, n, r, rep, s, sd, t, t3, t3plusx,
  38959. x = this,
  38960. Ctor = x.constructor;
  38961. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  38962. external = false;
  38963. // Initial estimate.
  38964. s = x.s * Math.pow(x.s * x, 1 / 3);
  38965. // Math.cbrt underflow/overflow?
  38966. // Pass x to Math.pow as integer, then adjust the exponent of the result.
  38967. if (!s || Math.abs(s) == 1 / 0) {
  38968. n = digitsToString(x.d);
  38969. e = x.e;
  38970. // Adjust n exponent so it is a multiple of 3 away from x exponent.
  38971. if (s = (e - n.length + 1) % 3) n += (s == 1 || s == -2 ? '0' : '00');
  38972. s = Math.pow(n, 1 / 3);
  38973. // Rarely, e may be one less than the result exponent value.
  38974. e = mathfloor((e + 1) / 3) - (e % 3 == (e < 0 ? -1 : 2));
  38975. if (s == 1 / 0) {
  38976. n = '5e' + e;
  38977. } else {
  38978. n = s.toExponential();
  38979. n = n.slice(0, n.indexOf('e') + 1) + e;
  38980. }
  38981. r = new Ctor(n);
  38982. r.s = x.s;
  38983. } else {
  38984. r = new Ctor(s.toString());
  38985. }
  38986. sd = (e = Ctor.precision) + 3;
  38987. // Halley's method.
  38988. // TODO? Compare Newton's method.
  38989. for (;;) {
  38990. t = r;
  38991. t3 = t.times(t).times(t);
  38992. t3plusx = t3.plus(x);
  38993. r = divide(t3plusx.plus(x).times(t), t3plusx.plus(t3), sd + 2, 1);
  38994. // TODO? Replace with for-loop and checkRoundingDigits.
  38995. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  38996. n = n.slice(sd - 3, sd + 1);
  38997. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or 4999
  38998. // , i.e. approaching a rounding boundary, continue the iteration.
  38999. if (n == '9999' || !rep && n == '4999') {
  39000. // On the first iteration only, check to see if rounding up gives the exact result as the
  39001. // nines may infinitely repeat.
  39002. if (!rep) {
  39003. finalise(t, e + 1, 0);
  39004. if (t.times(t).times(t).eq(x)) {
  39005. r = t;
  39006. break;
  39007. }
  39008. }
  39009. sd += 4;
  39010. rep = 1;
  39011. } else {
  39012. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  39013. // If not, then there are further digits and m will be truthy.
  39014. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  39015. // Truncate to the first rounding digit.
  39016. finalise(r, e + 1, 1);
  39017. m = !r.times(r).times(r).eq(x);
  39018. }
  39019. break;
  39020. }
  39021. }
  39022. }
  39023. external = true;
  39024. return finalise(r, e, Ctor.rounding, m);
  39025. };
  39026. /*
  39027. * Return the number of decimal places of the value of this Decimal.
  39028. *
  39029. */
  39030. P.decimalPlaces = P.dp = function () {
  39031. var w,
  39032. d = this.d,
  39033. n = NaN;
  39034. if (d) {
  39035. w = d.length - 1;
  39036. n = (w - mathfloor(this.e / LOG_BASE)) * LOG_BASE;
  39037. // Subtract the number of trailing zeros of the last word.
  39038. w = d[w];
  39039. if (w) for (; w % 10 == 0; w /= 10) n--;
  39040. if (n < 0) n = 0;
  39041. }
  39042. return n;
  39043. };
  39044. /*
  39045. * n / 0 = I
  39046. * n / N = N
  39047. * n / I = 0
  39048. * 0 / n = 0
  39049. * 0 / 0 = N
  39050. * 0 / N = N
  39051. * 0 / I = 0
  39052. * N / n = N
  39053. * N / 0 = N
  39054. * N / N = N
  39055. * N / I = N
  39056. * I / n = I
  39057. * I / 0 = I
  39058. * I / N = N
  39059. * I / I = N
  39060. *
  39061. * Return a new Decimal whose value is the value of this Decimal divided by `y`, rounded to
  39062. * `precision` significant digits using rounding mode `rounding`.
  39063. *
  39064. */
  39065. P.dividedBy = P.div = function (y) {
  39066. return divide(this, new this.constructor(y));
  39067. };
  39068. /*
  39069. * Return a new Decimal whose value is the integer part of dividing the value of this Decimal
  39070. * by the value of `y`, rounded to `precision` significant digits using rounding mode `rounding`.
  39071. *
  39072. */
  39073. P.dividedToIntegerBy = P.divToInt = function (y) {
  39074. var x = this,
  39075. Ctor = x.constructor;
  39076. return finalise(divide(x, new Ctor(y), 0, 1, 1), Ctor.precision, Ctor.rounding);
  39077. };
  39078. /*
  39079. * Return true if the value of this Decimal is equal to the value of `y`, otherwise return false.
  39080. *
  39081. */
  39082. P.equals = P.eq = function (y) {
  39083. return this.cmp(y) === 0;
  39084. };
  39085. /*
  39086. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number in the
  39087. * direction of negative Infinity.
  39088. *
  39089. */
  39090. P.floor = function () {
  39091. return finalise(new this.constructor(this), this.e + 1, 3);
  39092. };
  39093. /*
  39094. * Return true if the value of this Decimal is greater than the value of `y`, otherwise return
  39095. * false.
  39096. *
  39097. */
  39098. P.greaterThan = P.gt = function (y) {
  39099. return this.cmp(y) > 0;
  39100. };
  39101. /*
  39102. * Return true if the value of this Decimal is greater than or equal to the value of `y`,
  39103. * otherwise return false.
  39104. *
  39105. */
  39106. P.greaterThanOrEqualTo = P.gte = function (y) {
  39107. var k = this.cmp(y);
  39108. return k == 1 || k === 0;
  39109. };
  39110. /*
  39111. * Return a new Decimal whose value is the hyperbolic cosine of the value in radians of this
  39112. * Decimal.
  39113. *
  39114. * Domain: [-Infinity, Infinity]
  39115. * Range: [1, Infinity]
  39116. *
  39117. * cosh(x) = 1 + x^2/2! + x^4/4! + x^6/6! + ...
  39118. *
  39119. * cosh(0) = 1
  39120. * cosh(-0) = 1
  39121. * cosh(Infinity) = Infinity
  39122. * cosh(-Infinity) = Infinity
  39123. * cosh(NaN) = NaN
  39124. *
  39125. * x time taken (ms) result
  39126. * 1000 9 9.8503555700852349694e+433
  39127. * 10000 25 4.4034091128314607936e+4342
  39128. * 100000 171 1.4033316802130615897e+43429
  39129. * 1000000 3817 1.5166076984010437725e+434294
  39130. * 10000000 abandoned after 2 minute wait
  39131. *
  39132. * TODO? Compare performance of cosh(x) = 0.5 * (exp(x) + exp(-x))
  39133. *
  39134. */
  39135. P.hyperbolicCosine = P.cosh = function () {
  39136. var k, n, pr, rm, len,
  39137. x = this,
  39138. Ctor = x.constructor,
  39139. one = new Ctor(1);
  39140. if (!x.isFinite()) return new Ctor(x.s ? 1 / 0 : NaN);
  39141. if (x.isZero()) return one;
  39142. pr = Ctor.precision;
  39143. rm = Ctor.rounding;
  39144. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  39145. Ctor.rounding = 1;
  39146. len = x.d.length;
  39147. // Argument reduction: cos(4x) = 1 - 8cos^2(x) + 8cos^4(x) + 1
  39148. // i.e. cos(x) = 1 - cos^2(x/4)(8 - 8cos^2(x/4))
  39149. // Estimate the optimum number of times to use the argument reduction.
  39150. // TODO? Estimation reused from cosine() and may not be optimal here.
  39151. if (len < 32) {
  39152. k = Math.ceil(len / 3);
  39153. n = Math.pow(4, -k).toString();
  39154. } else {
  39155. k = 16;
  39156. n = '2.3283064365386962890625e-10';
  39157. }
  39158. x = taylorSeries(Ctor, 1, x.times(n), new Ctor(1), true);
  39159. // Reverse argument reduction
  39160. var cosh2_x,
  39161. i = k,
  39162. d8 = new Ctor(8);
  39163. for (; i--;) {
  39164. cosh2_x = x.times(x);
  39165. x = one.minus(cosh2_x.times(d8.minus(cosh2_x.times(d8))));
  39166. }
  39167. return finalise(x, Ctor.precision = pr, Ctor.rounding = rm, true);
  39168. };
  39169. /*
  39170. * Return a new Decimal whose value is the hyperbolic sine of the value in radians of this
  39171. * Decimal.
  39172. *
  39173. * Domain: [-Infinity, Infinity]
  39174. * Range: [-Infinity, Infinity]
  39175. *
  39176. * sinh(x) = x + x^3/3! + x^5/5! + x^7/7! + ...
  39177. *
  39178. * sinh(0) = 0
  39179. * sinh(-0) = -0
  39180. * sinh(Infinity) = Infinity
  39181. * sinh(-Infinity) = -Infinity
  39182. * sinh(NaN) = NaN
  39183. *
  39184. * x time taken (ms)
  39185. * 10 2 ms
  39186. * 100 5 ms
  39187. * 1000 14 ms
  39188. * 10000 82 ms
  39189. * 100000 886 ms 1.4033316802130615897e+43429
  39190. * 200000 2613 ms
  39191. * 300000 5407 ms
  39192. * 400000 8824 ms
  39193. * 500000 13026 ms 8.7080643612718084129e+217146
  39194. * 1000000 48543 ms
  39195. *
  39196. * TODO? Compare performance of sinh(x) = 0.5 * (exp(x) - exp(-x))
  39197. *
  39198. */
  39199. P.hyperbolicSine = P.sinh = function () {
  39200. var k, pr, rm, len,
  39201. x = this,
  39202. Ctor = x.constructor;
  39203. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  39204. pr = Ctor.precision;
  39205. rm = Ctor.rounding;
  39206. Ctor.precision = pr + Math.max(x.e, x.sd()) + 4;
  39207. Ctor.rounding = 1;
  39208. len = x.d.length;
  39209. if (len < 3) {
  39210. x = taylorSeries(Ctor, 2, x, x, true);
  39211. } else {
  39212. // Alternative argument reduction: sinh(3x) = sinh(x)(3 + 4sinh^2(x))
  39213. // i.e. sinh(x) = sinh(x/3)(3 + 4sinh^2(x/3))
  39214. // 3 multiplications and 1 addition
  39215. // Argument reduction: sinh(5x) = sinh(x)(5 + sinh^2(x)(20 + 16sinh^2(x)))
  39216. // i.e. sinh(x) = sinh(x/5)(5 + sinh^2(x/5)(20 + 16sinh^2(x/5)))
  39217. // 4 multiplications and 2 additions
  39218. // Estimate the optimum number of times to use the argument reduction.
  39219. k = 1.4 * Math.sqrt(len);
  39220. k = k > 16 ? 16 : k | 0;
  39221. x = x.times(Math.pow(5, -k));
  39222. x = taylorSeries(Ctor, 2, x, x, true);
  39223. // Reverse argument reduction
  39224. var sinh2_x,
  39225. d5 = new Ctor(5),
  39226. d16 = new Ctor(16),
  39227. d20 = new Ctor(20);
  39228. for (; k--;) {
  39229. sinh2_x = x.times(x);
  39230. x = x.times(d5.plus(sinh2_x.times(d16.times(sinh2_x).plus(d20))));
  39231. }
  39232. }
  39233. Ctor.precision = pr;
  39234. Ctor.rounding = rm;
  39235. return finalise(x, pr, rm, true);
  39236. };
  39237. /*
  39238. * Return a new Decimal whose value is the hyperbolic tangent of the value in radians of this
  39239. * Decimal.
  39240. *
  39241. * Domain: [-Infinity, Infinity]
  39242. * Range: [-1, 1]
  39243. *
  39244. * tanh(x) = sinh(x) / cosh(x)
  39245. *
  39246. * tanh(0) = 0
  39247. * tanh(-0) = -0
  39248. * tanh(Infinity) = 1
  39249. * tanh(-Infinity) = -1
  39250. * tanh(NaN) = NaN
  39251. *
  39252. */
  39253. P.hyperbolicTangent = P.tanh = function () {
  39254. var pr, rm,
  39255. x = this,
  39256. Ctor = x.constructor;
  39257. if (!x.isFinite()) return new Ctor(x.s);
  39258. if (x.isZero()) return new Ctor(x);
  39259. pr = Ctor.precision;
  39260. rm = Ctor.rounding;
  39261. Ctor.precision = pr + 7;
  39262. Ctor.rounding = 1;
  39263. return divide(x.sinh(), x.cosh(), Ctor.precision = pr, Ctor.rounding = rm);
  39264. };
  39265. /*
  39266. * Return a new Decimal whose value is the arccosine (inverse cosine) in radians of the value of
  39267. * this Decimal.
  39268. *
  39269. * Domain: [-1, 1]
  39270. * Range: [0, pi]
  39271. *
  39272. * acos(x) = pi/2 - asin(x)
  39273. *
  39274. * acos(0) = pi/2
  39275. * acos(-0) = pi/2
  39276. * acos(1) = 0
  39277. * acos(-1) = pi
  39278. * acos(1/2) = pi/3
  39279. * acos(-1/2) = 2*pi/3
  39280. * acos(|x| > 1) = NaN
  39281. * acos(NaN) = NaN
  39282. *
  39283. */
  39284. P.inverseCosine = P.acos = function () {
  39285. var halfPi,
  39286. x = this,
  39287. Ctor = x.constructor,
  39288. k = x.abs().cmp(1),
  39289. pr = Ctor.precision,
  39290. rm = Ctor.rounding;
  39291. if (k !== -1) {
  39292. return k === 0
  39293. // |x| is 1
  39294. ? x.isNeg() ? getPi(Ctor, pr, rm) : new Ctor(0)
  39295. // |x| > 1 or x is NaN
  39296. : new Ctor(NaN);
  39297. }
  39298. if (x.isZero()) return getPi(Ctor, pr + 4, rm).times(0.5);
  39299. // TODO? Special case acos(0.5) = pi/3 and acos(-0.5) = 2*pi/3
  39300. Ctor.precision = pr + 6;
  39301. Ctor.rounding = 1;
  39302. x = x.asin();
  39303. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  39304. Ctor.precision = pr;
  39305. Ctor.rounding = rm;
  39306. return halfPi.minus(x);
  39307. };
  39308. /*
  39309. * Return a new Decimal whose value is the inverse of the hyperbolic cosine in radians of the
  39310. * value of this Decimal.
  39311. *
  39312. * Domain: [1, Infinity]
  39313. * Range: [0, Infinity]
  39314. *
  39315. * acosh(x) = ln(x + sqrt(x^2 - 1))
  39316. *
  39317. * acosh(x < 1) = NaN
  39318. * acosh(NaN) = NaN
  39319. * acosh(Infinity) = Infinity
  39320. * acosh(-Infinity) = NaN
  39321. * acosh(0) = NaN
  39322. * acosh(-0) = NaN
  39323. * acosh(1) = 0
  39324. * acosh(-1) = NaN
  39325. *
  39326. */
  39327. P.inverseHyperbolicCosine = P.acosh = function () {
  39328. var pr, rm,
  39329. x = this,
  39330. Ctor = x.constructor;
  39331. if (x.lte(1)) return new Ctor(x.eq(1) ? 0 : NaN);
  39332. if (!x.isFinite()) return new Ctor(x);
  39333. pr = Ctor.precision;
  39334. rm = Ctor.rounding;
  39335. Ctor.precision = pr + Math.max(Math.abs(x.e), x.sd()) + 4;
  39336. Ctor.rounding = 1;
  39337. external = false;
  39338. x = x.times(x).minus(1).sqrt().plus(x);
  39339. external = true;
  39340. Ctor.precision = pr;
  39341. Ctor.rounding = rm;
  39342. return x.ln();
  39343. };
  39344. /*
  39345. * Return a new Decimal whose value is the inverse of the hyperbolic sine in radians of the value
  39346. * of this Decimal.
  39347. *
  39348. * Domain: [-Infinity, Infinity]
  39349. * Range: [-Infinity, Infinity]
  39350. *
  39351. * asinh(x) = ln(x + sqrt(x^2 + 1))
  39352. *
  39353. * asinh(NaN) = NaN
  39354. * asinh(Infinity) = Infinity
  39355. * asinh(-Infinity) = -Infinity
  39356. * asinh(0) = 0
  39357. * asinh(-0) = -0
  39358. *
  39359. */
  39360. P.inverseHyperbolicSine = P.asinh = function () {
  39361. var pr, rm,
  39362. x = this,
  39363. Ctor = x.constructor;
  39364. if (!x.isFinite() || x.isZero()) return new Ctor(x);
  39365. pr = Ctor.precision;
  39366. rm = Ctor.rounding;
  39367. Ctor.precision = pr + 2 * Math.max(Math.abs(x.e), x.sd()) + 6;
  39368. Ctor.rounding = 1;
  39369. external = false;
  39370. x = x.times(x).plus(1).sqrt().plus(x);
  39371. external = true;
  39372. Ctor.precision = pr;
  39373. Ctor.rounding = rm;
  39374. return x.ln();
  39375. };
  39376. /*
  39377. * Return a new Decimal whose value is the inverse of the hyperbolic tangent in radians of the
  39378. * value of this Decimal.
  39379. *
  39380. * Domain: [-1, 1]
  39381. * Range: [-Infinity, Infinity]
  39382. *
  39383. * atanh(x) = 0.5 * ln((1 + x) / (1 - x))
  39384. *
  39385. * atanh(|x| > 1) = NaN
  39386. * atanh(NaN) = NaN
  39387. * atanh(Infinity) = NaN
  39388. * atanh(-Infinity) = NaN
  39389. * atanh(0) = 0
  39390. * atanh(-0) = -0
  39391. * atanh(1) = Infinity
  39392. * atanh(-1) = -Infinity
  39393. *
  39394. */
  39395. P.inverseHyperbolicTangent = P.atanh = function () {
  39396. var pr, rm, wpr, xsd,
  39397. x = this,
  39398. Ctor = x.constructor;
  39399. if (!x.isFinite()) return new Ctor(NaN);
  39400. if (x.e >= 0) return new Ctor(x.abs().eq(1) ? x.s / 0 : x.isZero() ? x : NaN);
  39401. pr = Ctor.precision;
  39402. rm = Ctor.rounding;
  39403. xsd = x.sd();
  39404. if (Math.max(xsd, pr) < 2 * -x.e - 1) return finalise(new Ctor(x), pr, rm, true);
  39405. Ctor.precision = wpr = xsd - x.e;
  39406. x = divide(x.plus(1), new Ctor(1).minus(x), wpr + pr, 1);
  39407. Ctor.precision = pr + 4;
  39408. Ctor.rounding = 1;
  39409. x = x.ln();
  39410. Ctor.precision = pr;
  39411. Ctor.rounding = rm;
  39412. return x.times(0.5);
  39413. };
  39414. /*
  39415. * Return a new Decimal whose value is the arcsine (inverse sine) in radians of the value of this
  39416. * Decimal.
  39417. *
  39418. * Domain: [-Infinity, Infinity]
  39419. * Range: [-pi/2, pi/2]
  39420. *
  39421. * asin(x) = 2*atan(x/(1 + sqrt(1 - x^2)))
  39422. *
  39423. * asin(0) = 0
  39424. * asin(-0) = -0
  39425. * asin(1/2) = pi/6
  39426. * asin(-1/2) = -pi/6
  39427. * asin(1) = pi/2
  39428. * asin(-1) = -pi/2
  39429. * asin(|x| > 1) = NaN
  39430. * asin(NaN) = NaN
  39431. *
  39432. * TODO? Compare performance of Taylor series.
  39433. *
  39434. */
  39435. P.inverseSine = P.asin = function () {
  39436. var halfPi, k,
  39437. pr, rm,
  39438. x = this,
  39439. Ctor = x.constructor;
  39440. if (x.isZero()) return new Ctor(x);
  39441. k = x.abs().cmp(1);
  39442. pr = Ctor.precision;
  39443. rm = Ctor.rounding;
  39444. if (k !== -1) {
  39445. // |x| is 1
  39446. if (k === 0) {
  39447. halfPi = getPi(Ctor, pr + 4, rm).times(0.5);
  39448. halfPi.s = x.s;
  39449. return halfPi;
  39450. }
  39451. // |x| > 1 or x is NaN
  39452. return new Ctor(NaN);
  39453. }
  39454. // TODO? Special case asin(1/2) = pi/6 and asin(-1/2) = -pi/6
  39455. Ctor.precision = pr + 6;
  39456. Ctor.rounding = 1;
  39457. x = x.div(new Ctor(1).minus(x.times(x)).sqrt().plus(1)).atan();
  39458. Ctor.precision = pr;
  39459. Ctor.rounding = rm;
  39460. return x.times(2);
  39461. };
  39462. /*
  39463. * Return a new Decimal whose value is the arctangent (inverse tangent) in radians of the value
  39464. * of this Decimal.
  39465. *
  39466. * Domain: [-Infinity, Infinity]
  39467. * Range: [-pi/2, pi/2]
  39468. *
  39469. * atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  39470. *
  39471. * atan(0) = 0
  39472. * atan(-0) = -0
  39473. * atan(1) = pi/4
  39474. * atan(-1) = -pi/4
  39475. * atan(Infinity) = pi/2
  39476. * atan(-Infinity) = -pi/2
  39477. * atan(NaN) = NaN
  39478. *
  39479. */
  39480. P.inverseTangent = P.atan = function () {
  39481. var i, j, k, n, px, t, r, wpr, x2,
  39482. x = this,
  39483. Ctor = x.constructor,
  39484. pr = Ctor.precision,
  39485. rm = Ctor.rounding;
  39486. if (!x.isFinite()) {
  39487. if (!x.s) return new Ctor(NaN);
  39488. if (pr + 4 <= PI_PRECISION) {
  39489. r = getPi(Ctor, pr + 4, rm).times(0.5);
  39490. r.s = x.s;
  39491. return r;
  39492. }
  39493. } else if (x.isZero()) {
  39494. return new Ctor(x);
  39495. } else if (x.abs().eq(1) && pr + 4 <= PI_PRECISION) {
  39496. r = getPi(Ctor, pr + 4, rm).times(0.25);
  39497. r.s = x.s;
  39498. return r;
  39499. }
  39500. Ctor.precision = wpr = pr + 10;
  39501. Ctor.rounding = 1;
  39502. // TODO? if (x >= 1 && pr <= PI_PRECISION) atan(x) = halfPi * x.s - atan(1 / x);
  39503. // Argument reduction
  39504. // Ensure |x| < 0.42
  39505. // atan(x) = 2 * atan(x / (1 + sqrt(1 + x^2)))
  39506. k = Math.min(28, wpr / LOG_BASE + 2 | 0);
  39507. for (i = k; i; --i) x = x.div(x.times(x).plus(1).sqrt().plus(1));
  39508. external = false;
  39509. j = Math.ceil(wpr / LOG_BASE);
  39510. n = 1;
  39511. x2 = x.times(x);
  39512. r = new Ctor(x);
  39513. px = x;
  39514. // atan(x) = x - x^3/3 + x^5/5 - x^7/7 + ...
  39515. for (; i !== -1;) {
  39516. px = px.times(x2);
  39517. t = r.minus(px.div(n += 2));
  39518. px = px.times(x2);
  39519. r = t.plus(px.div(n += 2));
  39520. if (r.d[j] !== void 0) for (i = j; r.d[i] === t.d[i] && i--;);
  39521. }
  39522. if (k) r = r.times(2 << (k - 1));
  39523. external = true;
  39524. return finalise(r, Ctor.precision = pr, Ctor.rounding = rm, true);
  39525. };
  39526. /*
  39527. * Return true if the value of this Decimal is a finite number, otherwise return false.
  39528. *
  39529. */
  39530. P.isFinite = function () {
  39531. return !!this.d;
  39532. };
  39533. /*
  39534. * Return true if the value of this Decimal is an integer, otherwise return false.
  39535. *
  39536. */
  39537. P.isInteger = P.isInt = function () {
  39538. return !!this.d && mathfloor(this.e / LOG_BASE) > this.d.length - 2;
  39539. };
  39540. /*
  39541. * Return true if the value of this Decimal is NaN, otherwise return false.
  39542. *
  39543. */
  39544. P.isNaN = function () {
  39545. return !this.s;
  39546. };
  39547. /*
  39548. * Return true if the value of this Decimal is negative, otherwise return false.
  39549. *
  39550. */
  39551. P.isNegative = P.isNeg = function () {
  39552. return this.s < 0;
  39553. };
  39554. /*
  39555. * Return true if the value of this Decimal is positive, otherwise return false.
  39556. *
  39557. */
  39558. P.isPositive = P.isPos = function () {
  39559. return this.s > 0;
  39560. };
  39561. /*
  39562. * Return true if the value of this Decimal is 0 or -0, otherwise return false.
  39563. *
  39564. */
  39565. P.isZero = function () {
  39566. return !!this.d && this.d[0] === 0;
  39567. };
  39568. /*
  39569. * Return true if the value of this Decimal is less than `y`, otherwise return false.
  39570. *
  39571. */
  39572. P.lessThan = P.lt = function (y) {
  39573. return this.cmp(y) < 0;
  39574. };
  39575. /*
  39576. * Return true if the value of this Decimal is less than or equal to `y`, otherwise return false.
  39577. *
  39578. */
  39579. P.lessThanOrEqualTo = P.lte = function (y) {
  39580. return this.cmp(y) < 1;
  39581. };
  39582. /*
  39583. * Return the logarithm of the value of this Decimal to the specified base, rounded to `precision`
  39584. * significant digits using rounding mode `rounding`.
  39585. *
  39586. * If no base is specified, return log[10](arg).
  39587. *
  39588. * log[base](arg) = ln(arg) / ln(base)
  39589. *
  39590. * The result will always be correctly rounded if the base of the log is 10, and 'almost always'
  39591. * otherwise:
  39592. *
  39593. * Depending on the rounding mode, the result may be incorrectly rounded if the first fifteen
  39594. * rounding digits are [49]99999999999999 or [50]00000000000000. In that case, the maximum error
  39595. * between the result and the correctly rounded result will be one ulp (unit in the last place).
  39596. *
  39597. * log[-b](a) = NaN
  39598. * log[0](a) = NaN
  39599. * log[1](a) = NaN
  39600. * log[NaN](a) = NaN
  39601. * log[Infinity](a) = NaN
  39602. * log[b](0) = -Infinity
  39603. * log[b](-0) = -Infinity
  39604. * log[b](-a) = NaN
  39605. * log[b](1) = 0
  39606. * log[b](Infinity) = Infinity
  39607. * log[b](NaN) = NaN
  39608. *
  39609. * [base] {number|string|Decimal} The base of the logarithm.
  39610. *
  39611. */
  39612. P.logarithm = P.log = function (base) {
  39613. var isBase10, d, denominator, k, inf, num, sd, r,
  39614. arg = this,
  39615. Ctor = arg.constructor,
  39616. pr = Ctor.precision,
  39617. rm = Ctor.rounding,
  39618. guard = 5;
  39619. // Default base is 10.
  39620. if (base == null) {
  39621. base = new Ctor(10);
  39622. isBase10 = true;
  39623. } else {
  39624. base = new Ctor(base);
  39625. d = base.d;
  39626. // Return NaN if base is negative, or non-finite, or is 0 or 1.
  39627. if (base.s < 0 || !d || !d[0] || base.eq(1)) return new Ctor(NaN);
  39628. isBase10 = base.eq(10);
  39629. }
  39630. d = arg.d;
  39631. // Is arg negative, non-finite, 0 or 1?
  39632. if (arg.s < 0 || !d || !d[0] || arg.eq(1)) {
  39633. return new Ctor(d && !d[0] ? -1 / 0 : arg.s != 1 ? NaN : d ? 0 : 1 / 0);
  39634. }
  39635. // The result will have a non-terminating decimal expansion if base is 10 and arg is not an
  39636. // integer power of 10.
  39637. if (isBase10) {
  39638. if (d.length > 1) {
  39639. inf = true;
  39640. } else {
  39641. for (k = d[0]; k % 10 === 0;) k /= 10;
  39642. inf = k !== 1;
  39643. }
  39644. }
  39645. external = false;
  39646. sd = pr + guard;
  39647. num = naturalLogarithm(arg, sd);
  39648. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39649. // The result will have 5 rounding digits.
  39650. r = divide(num, denominator, sd, 1);
  39651. // If at a rounding boundary, i.e. the result's rounding digits are [49]9999 or [50]0000,
  39652. // calculate 10 further digits.
  39653. //
  39654. // If the result is known to have an infinite decimal expansion, repeat this until it is clear
  39655. // that the result is above or below the boundary. Otherwise, if after calculating the 10
  39656. // further digits, the last 14 are nines, round up and assume the result is exact.
  39657. // Also assume the result is exact if the last 14 are zero.
  39658. //
  39659. // Example of a result that will be incorrectly rounded:
  39660. // log[1048576](4503599627370502) = 2.60000000000000009610279511444746...
  39661. // The above result correctly rounded using ROUND_CEIL to 1 decimal place should be 2.7, but it
  39662. // will be given as 2.6 as there are 15 zeros immediately after the requested decimal place, so
  39663. // the exact result would be assumed to be 2.6, which rounded using ROUND_CEIL to 1 decimal
  39664. // place is still 2.6.
  39665. if (checkRoundingDigits(r.d, k = pr, rm)) {
  39666. do {
  39667. sd += 10;
  39668. num = naturalLogarithm(arg, sd);
  39669. denominator = isBase10 ? getLn10(Ctor, sd + 10) : naturalLogarithm(base, sd);
  39670. r = divide(num, denominator, sd, 1);
  39671. if (!inf) {
  39672. // Check for 14 nines from the 2nd rounding digit, as the first may be 4.
  39673. if (+digitsToString(r.d).slice(k + 1, k + 15) + 1 == 1e14) {
  39674. r = finalise(r, pr + 1, 0);
  39675. }
  39676. break;
  39677. }
  39678. } while (checkRoundingDigits(r.d, k += 10, rm));
  39679. }
  39680. external = true;
  39681. return finalise(r, pr, rm);
  39682. };
  39683. /*
  39684. * Return a new Decimal whose value is the maximum of the arguments and the value of this Decimal.
  39685. *
  39686. * arguments {number|string|Decimal}
  39687. *
  39688. P.max = function () {
  39689. Array.prototype.push.call(arguments, this);
  39690. return maxOrMin(this.constructor, arguments, 'lt');
  39691. };
  39692. */
  39693. /*
  39694. * Return a new Decimal whose value is the minimum of the arguments and the value of this Decimal.
  39695. *
  39696. * arguments {number|string|Decimal}
  39697. *
  39698. P.min = function () {
  39699. Array.prototype.push.call(arguments, this);
  39700. return maxOrMin(this.constructor, arguments, 'gt');
  39701. };
  39702. */
  39703. /*
  39704. * n - 0 = n
  39705. * n - N = N
  39706. * n - I = -I
  39707. * 0 - n = -n
  39708. * 0 - 0 = 0
  39709. * 0 - N = N
  39710. * 0 - I = -I
  39711. * N - n = N
  39712. * N - 0 = N
  39713. * N - N = N
  39714. * N - I = N
  39715. * I - n = I
  39716. * I - 0 = I
  39717. * I - N = N
  39718. * I - I = N
  39719. *
  39720. * Return a new Decimal whose value is the value of this Decimal minus `y`, rounded to `precision`
  39721. * significant digits using rounding mode `rounding`.
  39722. *
  39723. */
  39724. P.minus = P.sub = function (y) {
  39725. var d, e, i, j, k, len, pr, rm, xd, xe, xLTy, yd,
  39726. x = this,
  39727. Ctor = x.constructor;
  39728. y = new Ctor(y);
  39729. // If either is not finite...
  39730. if (!x.d || !y.d) {
  39731. // Return NaN if either is NaN.
  39732. if (!x.s || !y.s) y = new Ctor(NaN);
  39733. // Return y negated if x is finite and y is ±Infinity.
  39734. else if (x.d) y.s = -y.s;
  39735. // Return x if y is finite and x is ±Infinity.
  39736. // Return x if both are ±Infinity with different signs.
  39737. // Return NaN if both are ±Infinity with the same sign.
  39738. else y = new Ctor(y.d || x.s !== y.s ? x : NaN);
  39739. return y;
  39740. }
  39741. // If signs differ...
  39742. if (x.s != y.s) {
  39743. y.s = -y.s;
  39744. return x.plus(y);
  39745. }
  39746. xd = x.d;
  39747. yd = y.d;
  39748. pr = Ctor.precision;
  39749. rm = Ctor.rounding;
  39750. // If either is zero...
  39751. if (!xd[0] || !yd[0]) {
  39752. // Return y negated if x is zero and y is non-zero.
  39753. if (yd[0]) y.s = -y.s;
  39754. // Return x if y is zero and x is non-zero.
  39755. else if (xd[0]) y = new Ctor(x);
  39756. // Return zero if both are zero.
  39757. // From IEEE 754 (2008) 6.3: 0 - 0 = -0 - -0 = -0 when rounding to -Infinity.
  39758. else return new Ctor(rm === 3 ? -0 : 0);
  39759. return external ? finalise(y, pr, rm) : y;
  39760. }
  39761. // x and y are finite, non-zero numbers with the same sign.
  39762. // Calculate base 1e7 exponents.
  39763. e = mathfloor(y.e / LOG_BASE);
  39764. xe = mathfloor(x.e / LOG_BASE);
  39765. xd = xd.slice();
  39766. k = xe - e;
  39767. // If base 1e7 exponents differ...
  39768. if (k) {
  39769. xLTy = k < 0;
  39770. if (xLTy) {
  39771. d = xd;
  39772. k = -k;
  39773. len = yd.length;
  39774. } else {
  39775. d = yd;
  39776. e = xe;
  39777. len = xd.length;
  39778. }
  39779. // Numbers with massively different exponents would result in a very high number of
  39780. // zeros needing to be prepended, but this can be avoided while still ensuring correct
  39781. // rounding by limiting the number of zeros to `Math.ceil(pr / LOG_BASE) + 2`.
  39782. i = Math.max(Math.ceil(pr / LOG_BASE), len) + 2;
  39783. if (k > i) {
  39784. k = i;
  39785. d.length = 1;
  39786. }
  39787. // Prepend zeros to equalise exponents.
  39788. d.reverse();
  39789. for (i = k; i--;) d.push(0);
  39790. d.reverse();
  39791. // Base 1e7 exponents equal.
  39792. } else {
  39793. // Check digits to determine which is the bigger number.
  39794. i = xd.length;
  39795. len = yd.length;
  39796. xLTy = i < len;
  39797. if (xLTy) len = i;
  39798. for (i = 0; i < len; i++) {
  39799. if (xd[i] != yd[i]) {
  39800. xLTy = xd[i] < yd[i];
  39801. break;
  39802. }
  39803. }
  39804. k = 0;
  39805. }
  39806. if (xLTy) {
  39807. d = xd;
  39808. xd = yd;
  39809. yd = d;
  39810. y.s = -y.s;
  39811. }
  39812. len = xd.length;
  39813. // Append zeros to `xd` if shorter.
  39814. // Don't add zeros to `yd` if shorter as subtraction only needs to start at `yd` length.
  39815. for (i = yd.length - len; i > 0; --i) xd[len++] = 0;
  39816. // Subtract yd from xd.
  39817. for (i = yd.length; i > k;) {
  39818. if (xd[--i] < yd[i]) {
  39819. for (j = i; j && xd[--j] === 0;) xd[j] = BASE - 1;
  39820. --xd[j];
  39821. xd[i] += BASE;
  39822. }
  39823. xd[i] -= yd[i];
  39824. }
  39825. // Remove trailing zeros.
  39826. for (; xd[--len] === 0;) xd.pop();
  39827. // Remove leading zeros and adjust exponent accordingly.
  39828. for (; xd[0] === 0; xd.shift()) --e;
  39829. // Zero?
  39830. if (!xd[0]) return new Ctor(rm === 3 ? -0 : 0);
  39831. y.d = xd;
  39832. y.e = getBase10Exponent(xd, e);
  39833. return external ? finalise(y, pr, rm) : y;
  39834. };
  39835. /*
  39836. * n % 0 = N
  39837. * n % N = N
  39838. * n % I = n
  39839. * 0 % n = 0
  39840. * -0 % n = -0
  39841. * 0 % 0 = N
  39842. * 0 % N = N
  39843. * 0 % I = 0
  39844. * N % n = N
  39845. * N % 0 = N
  39846. * N % N = N
  39847. * N % I = N
  39848. * I % n = N
  39849. * I % 0 = N
  39850. * I % N = N
  39851. * I % I = N
  39852. *
  39853. * Return a new Decimal whose value is the value of this Decimal modulo `y`, rounded to
  39854. * `precision` significant digits using rounding mode `rounding`.
  39855. *
  39856. * The result depends on the modulo mode.
  39857. *
  39858. */
  39859. P.modulo = P.mod = function (y) {
  39860. var q,
  39861. x = this,
  39862. Ctor = x.constructor;
  39863. y = new Ctor(y);
  39864. // Return NaN if x is ±Infinity or NaN, or y is NaN or ±0.
  39865. if (!x.d || !y.s || y.d && !y.d[0]) return new Ctor(NaN);
  39866. // Return x if y is ±Infinity or x is ±0.
  39867. if (!y.d || x.d && !x.d[0]) {
  39868. return finalise(new Ctor(x), Ctor.precision, Ctor.rounding);
  39869. }
  39870. // Prevent rounding of intermediate calculations.
  39871. external = false;
  39872. if (Ctor.modulo == 9) {
  39873. // Euclidian division: q = sign(y) * floor(x / abs(y))
  39874. // result = x - q * y where 0 <= result < abs(y)
  39875. q = divide(x, y.abs(), 0, 3, 1);
  39876. q.s *= y.s;
  39877. } else {
  39878. q = divide(x, y, 0, Ctor.modulo, 1);
  39879. }
  39880. q = q.times(y);
  39881. external = true;
  39882. return x.minus(q);
  39883. };
  39884. /*
  39885. * Return a new Decimal whose value is the natural exponential of the value of this Decimal,
  39886. * i.e. the base e raised to the power the value of this Decimal, rounded to `precision`
  39887. * significant digits using rounding mode `rounding`.
  39888. *
  39889. */
  39890. P.naturalExponential = P.exp = function () {
  39891. return naturalExponential(this);
  39892. };
  39893. /*
  39894. * Return a new Decimal whose value is the natural logarithm of the value of this Decimal,
  39895. * rounded to `precision` significant digits using rounding mode `rounding`.
  39896. *
  39897. */
  39898. P.naturalLogarithm = P.ln = function () {
  39899. return naturalLogarithm(this);
  39900. };
  39901. /*
  39902. * Return a new Decimal whose value is the value of this Decimal negated, i.e. as if multiplied by
  39903. * -1.
  39904. *
  39905. */
  39906. P.negated = P.neg = function () {
  39907. var x = new this.constructor(this);
  39908. x.s = -x.s;
  39909. return finalise(x);
  39910. };
  39911. /*
  39912. * n + 0 = n
  39913. * n + N = N
  39914. * n + I = I
  39915. * 0 + n = n
  39916. * 0 + 0 = 0
  39917. * 0 + N = N
  39918. * 0 + I = I
  39919. * N + n = N
  39920. * N + 0 = N
  39921. * N + N = N
  39922. * N + I = N
  39923. * I + n = I
  39924. * I + 0 = I
  39925. * I + N = N
  39926. * I + I = I
  39927. *
  39928. * Return a new Decimal whose value is the value of this Decimal plus `y`, rounded to `precision`
  39929. * significant digits using rounding mode `rounding`.
  39930. *
  39931. */
  39932. P.plus = P.add = function (y) {
  39933. var carry, d, e, i, k, len, pr, rm, xd, yd,
  39934. x = this,
  39935. Ctor = x.constructor;
  39936. y = new Ctor(y);
  39937. // If either is not finite...
  39938. if (!x.d || !y.d) {
  39939. // Return NaN if either is NaN.
  39940. if (!x.s || !y.s) y = new Ctor(NaN);
  39941. // Return x if y is finite and x is ±Infinity.
  39942. // Return x if both are ±Infinity with the same sign.
  39943. // Return NaN if both are ±Infinity with different signs.
  39944. // Return y if x is finite and y is ±Infinity.
  39945. else if (!x.d) y = new Ctor(y.d || x.s === y.s ? x : NaN);
  39946. return y;
  39947. }
  39948. // If signs differ...
  39949. if (x.s != y.s) {
  39950. y.s = -y.s;
  39951. return x.minus(y);
  39952. }
  39953. xd = x.d;
  39954. yd = y.d;
  39955. pr = Ctor.precision;
  39956. rm = Ctor.rounding;
  39957. // If either is zero...
  39958. if (!xd[0] || !yd[0]) {
  39959. // Return x if y is zero.
  39960. // Return y if y is non-zero.
  39961. if (!yd[0]) y = new Ctor(x);
  39962. return external ? finalise(y, pr, rm) : y;
  39963. }
  39964. // x and y are finite, non-zero numbers with the same sign.
  39965. // Calculate base 1e7 exponents.
  39966. k = mathfloor(x.e / LOG_BASE);
  39967. e = mathfloor(y.e / LOG_BASE);
  39968. xd = xd.slice();
  39969. i = k - e;
  39970. // If base 1e7 exponents differ...
  39971. if (i) {
  39972. if (i < 0) {
  39973. d = xd;
  39974. i = -i;
  39975. len = yd.length;
  39976. } else {
  39977. d = yd;
  39978. e = k;
  39979. len = xd.length;
  39980. }
  39981. // Limit number of zeros prepended to max(ceil(pr / LOG_BASE), len) + 1.
  39982. k = Math.ceil(pr / LOG_BASE);
  39983. len = k > len ? k + 1 : len + 1;
  39984. if (i > len) {
  39985. i = len;
  39986. d.length = 1;
  39987. }
  39988. // Prepend zeros to equalise exponents. Note: Faster to use reverse then do unshifts.
  39989. d.reverse();
  39990. for (; i--;) d.push(0);
  39991. d.reverse();
  39992. }
  39993. len = xd.length;
  39994. i = yd.length;
  39995. // If yd is longer than xd, swap xd and yd so xd points to the longer array.
  39996. if (len - i < 0) {
  39997. i = len;
  39998. d = yd;
  39999. yd = xd;
  40000. xd = d;
  40001. }
  40002. // Only start adding at yd.length - 1 as the further digits of xd can be left as they are.
  40003. for (carry = 0; i;) {
  40004. carry = (xd[--i] = xd[i] + yd[i] + carry) / BASE | 0;
  40005. xd[i] %= BASE;
  40006. }
  40007. if (carry) {
  40008. xd.unshift(carry);
  40009. ++e;
  40010. }
  40011. // Remove trailing zeros.
  40012. // No need to check for zero, as +x + +y != 0 && -x + -y != 0
  40013. for (len = xd.length; xd[--len] == 0;) xd.pop();
  40014. y.d = xd;
  40015. y.e = getBase10Exponent(xd, e);
  40016. return external ? finalise(y, pr, rm) : y;
  40017. };
  40018. /*
  40019. * Return the number of significant digits of the value of this Decimal.
  40020. *
  40021. * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.
  40022. *
  40023. */
  40024. P.precision = P.sd = function (z) {
  40025. var k,
  40026. x = this;
  40027. if (z !== void 0 && z !== !!z && z !== 1 && z !== 0) throw Error(invalidArgument + z);
  40028. if (x.d) {
  40029. k = getPrecision(x.d);
  40030. if (z && x.e + 1 > k) k = x.e + 1;
  40031. } else {
  40032. k = NaN;
  40033. }
  40034. return k;
  40035. };
  40036. /*
  40037. * Return a new Decimal whose value is the value of this Decimal rounded to a whole number using
  40038. * rounding mode `rounding`.
  40039. *
  40040. */
  40041. P.round = function () {
  40042. var x = this,
  40043. Ctor = x.constructor;
  40044. return finalise(new Ctor(x), x.e + 1, Ctor.rounding);
  40045. };
  40046. /*
  40047. * Return a new Decimal whose value is the sine of the value in radians of this Decimal.
  40048. *
  40049. * Domain: [-Infinity, Infinity]
  40050. * Range: [-1, 1]
  40051. *
  40052. * sin(x) = x - x^3/3! + x^5/5! - ...
  40053. *
  40054. * sin(0) = 0
  40055. * sin(-0) = -0
  40056. * sin(Infinity) = NaN
  40057. * sin(-Infinity) = NaN
  40058. * sin(NaN) = NaN
  40059. *
  40060. */
  40061. P.sine = P.sin = function () {
  40062. var pr, rm,
  40063. x = this,
  40064. Ctor = x.constructor;
  40065. if (!x.isFinite()) return new Ctor(NaN);
  40066. if (x.isZero()) return new Ctor(x);
  40067. pr = Ctor.precision;
  40068. rm = Ctor.rounding;
  40069. Ctor.precision = pr + Math.max(x.e, x.sd()) + LOG_BASE;
  40070. Ctor.rounding = 1;
  40071. x = sine(Ctor, toLessThanHalfPi(Ctor, x));
  40072. Ctor.precision = pr;
  40073. Ctor.rounding = rm;
  40074. return finalise(quadrant > 2 ? x.neg() : x, pr, rm, true);
  40075. };
  40076. /*
  40077. * Return a new Decimal whose value is the square root of this Decimal, rounded to `precision`
  40078. * significant digits using rounding mode `rounding`.
  40079. *
  40080. * sqrt(-n) = N
  40081. * sqrt(N) = N
  40082. * sqrt(-I) = N
  40083. * sqrt(I) = I
  40084. * sqrt(0) = 0
  40085. * sqrt(-0) = -0
  40086. *
  40087. */
  40088. P.squareRoot = P.sqrt = function () {
  40089. var m, n, sd, r, rep, t,
  40090. x = this,
  40091. d = x.d,
  40092. e = x.e,
  40093. s = x.s,
  40094. Ctor = x.constructor;
  40095. // Negative/NaN/Infinity/zero?
  40096. if (s !== 1 || !d || !d[0]) {
  40097. return new Ctor(!s || s < 0 && (!d || d[0]) ? NaN : d ? x : 1 / 0);
  40098. }
  40099. external = false;
  40100. // Initial estimate.
  40101. s = Math.sqrt(+x);
  40102. // Math.sqrt underflow/overflow?
  40103. // Pass x to Math.sqrt as integer, then adjust the exponent of the result.
  40104. if (s == 0 || s == 1 / 0) {
  40105. n = digitsToString(d);
  40106. if ((n.length + e) % 2 == 0) n += '0';
  40107. s = Math.sqrt(n);
  40108. e = mathfloor((e + 1) / 2) - (e < 0 || e % 2);
  40109. if (s == 1 / 0) {
  40110. n = '1e' + e;
  40111. } else {
  40112. n = s.toExponential();
  40113. n = n.slice(0, n.indexOf('e') + 1) + e;
  40114. }
  40115. r = new Ctor(n);
  40116. } else {
  40117. r = new Ctor(s.toString());
  40118. }
  40119. sd = (e = Ctor.precision) + 3;
  40120. // Newton-Raphson iteration.
  40121. for (;;) {
  40122. t = r;
  40123. r = t.plus(divide(x, t, sd + 2, 1)).times(0.5);
  40124. // TODO? Replace with for-loop and checkRoundingDigits.
  40125. if (digitsToString(t.d).slice(0, sd) === (n = digitsToString(r.d)).slice(0, sd)) {
  40126. n = n.slice(sd - 3, sd + 1);
  40127. // The 4th rounding digit may be in error by -1 so if the 4 rounding digits are 9999 or
  40128. // 4999, i.e. approaching a rounding boundary, continue the iteration.
  40129. if (n == '9999' || !rep && n == '4999') {
  40130. // On the first iteration only, check to see if rounding up gives the exact result as the
  40131. // nines may infinitely repeat.
  40132. if (!rep) {
  40133. finalise(t, e + 1, 0);
  40134. if (t.times(t).eq(x)) {
  40135. r = t;
  40136. break;
  40137. }
  40138. }
  40139. sd += 4;
  40140. rep = 1;
  40141. } else {
  40142. // If the rounding digits are null, 0{0,4} or 50{0,3}, check for an exact result.
  40143. // If not, then there are further digits and m will be truthy.
  40144. if (!+n || !+n.slice(1) && n.charAt(0) == '5') {
  40145. // Truncate to the first rounding digit.
  40146. finalise(r, e + 1, 1);
  40147. m = !r.times(r).eq(x);
  40148. }
  40149. break;
  40150. }
  40151. }
  40152. }
  40153. external = true;
  40154. return finalise(r, e, Ctor.rounding, m);
  40155. };
  40156. /*
  40157. * Return a new Decimal whose value is the tangent of the value in radians of this Decimal.
  40158. *
  40159. * Domain: [-Infinity, Infinity]
  40160. * Range: [-Infinity, Infinity]
  40161. *
  40162. * tan(0) = 0
  40163. * tan(-0) = -0
  40164. * tan(Infinity) = NaN
  40165. * tan(-Infinity) = NaN
  40166. * tan(NaN) = NaN
  40167. *
  40168. */
  40169. P.tangent = P.tan = function () {
  40170. var pr, rm,
  40171. x = this,
  40172. Ctor = x.constructor;
  40173. if (!x.isFinite()) return new Ctor(NaN);
  40174. if (x.isZero()) return new Ctor(x);
  40175. pr = Ctor.precision;
  40176. rm = Ctor.rounding;
  40177. Ctor.precision = pr + 10;
  40178. Ctor.rounding = 1;
  40179. x = x.sin();
  40180. x.s = 1;
  40181. x = divide(x, new Ctor(1).minus(x.times(x)).sqrt(), pr + 10, 0);
  40182. Ctor.precision = pr;
  40183. Ctor.rounding = rm;
  40184. return finalise(quadrant == 2 || quadrant == 4 ? x.neg() : x, pr, rm, true);
  40185. };
  40186. /*
  40187. * n * 0 = 0
  40188. * n * N = N
  40189. * n * I = I
  40190. * 0 * n = 0
  40191. * 0 * 0 = 0
  40192. * 0 * N = N
  40193. * 0 * I = N
  40194. * N * n = N
  40195. * N * 0 = N
  40196. * N * N = N
  40197. * N * I = N
  40198. * I * n = I
  40199. * I * 0 = N
  40200. * I * N = N
  40201. * I * I = I
  40202. *
  40203. * Return a new Decimal whose value is this Decimal times `y`, rounded to `precision` significant
  40204. * digits using rounding mode `rounding`.
  40205. *
  40206. */
  40207. P.times = P.mul = function (y) {
  40208. var carry, e, i, k, r, rL, t, xdL, ydL,
  40209. x = this,
  40210. Ctor = x.constructor,
  40211. xd = x.d,
  40212. yd = (y = new Ctor(y)).d;
  40213. y.s *= x.s;
  40214. // If either is NaN, ±Infinity or ±0...
  40215. if (!xd || !xd[0] || !yd || !yd[0]) {
  40216. return new Ctor(!y.s || xd && !xd[0] && !yd || yd && !yd[0] && !xd
  40217. // Return NaN if either is NaN.
  40218. // Return NaN if x is ±0 and y is ±Infinity, or y is ±0 and x is ±Infinity.
  40219. ? NaN
  40220. // Return ±Infinity if either is ±Infinity.
  40221. // Return ±0 if either is ±0.
  40222. : !xd || !yd ? y.s / 0 : y.s * 0);
  40223. }
  40224. e = mathfloor(x.e / LOG_BASE) + mathfloor(y.e / LOG_BASE);
  40225. xdL = xd.length;
  40226. ydL = yd.length;
  40227. // Ensure xd points to the longer array.
  40228. if (xdL < ydL) {
  40229. r = xd;
  40230. xd = yd;
  40231. yd = r;
  40232. rL = xdL;
  40233. xdL = ydL;
  40234. ydL = rL;
  40235. }
  40236. // Initialise the result array with zeros.
  40237. r = [];
  40238. rL = xdL + ydL;
  40239. for (i = rL; i--;) r.push(0);
  40240. // Multiply!
  40241. for (i = ydL; --i >= 0;) {
  40242. carry = 0;
  40243. for (k = xdL + i; k > i;) {
  40244. t = r[k] + yd[i] * xd[k - i - 1] + carry;
  40245. r[k--] = t % BASE | 0;
  40246. carry = t / BASE | 0;
  40247. }
  40248. r[k] = (r[k] + carry) % BASE | 0;
  40249. }
  40250. // Remove trailing zeros.
  40251. for (; !r[--rL];) r.pop();
  40252. if (carry) ++e;
  40253. else r.shift();
  40254. y.d = r;
  40255. y.e = getBase10Exponent(r, e);
  40256. return external ? finalise(y, Ctor.precision, Ctor.rounding) : y;
  40257. };
  40258. /*
  40259. * Return a string representing the value of this Decimal in base 2, round to `sd` significant
  40260. * digits using rounding mode `rm`.
  40261. *
  40262. * If the optional `sd` argument is present then return binary exponential notation.
  40263. *
  40264. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40265. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40266. *
  40267. */
  40268. P.toBinary = function (sd, rm) {
  40269. return toStringBinary(this, 2, sd, rm);
  40270. };
  40271. /*
  40272. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `dp`
  40273. * decimal places using rounding mode `rm` or `rounding` if `rm` is omitted.
  40274. *
  40275. * If `dp` is omitted, return a new Decimal whose value is the value of this Decimal.
  40276. *
  40277. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40278. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40279. *
  40280. */
  40281. P.toDecimalPlaces = P.toDP = function (dp, rm) {
  40282. var x = this,
  40283. Ctor = x.constructor;
  40284. x = new Ctor(x);
  40285. if (dp === void 0) return x;
  40286. checkInt32(dp, 0, MAX_DIGITS);
  40287. if (rm === void 0) rm = Ctor.rounding;
  40288. else checkInt32(rm, 0, 8);
  40289. return finalise(x, dp + x.e + 1, rm);
  40290. };
  40291. /*
  40292. * Return a string representing the value of this Decimal in exponential notation rounded to
  40293. * `dp` fixed decimal places using rounding mode `rounding`.
  40294. *
  40295. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40296. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40297. *
  40298. */
  40299. P.toExponential = function (dp, rm) {
  40300. var str,
  40301. x = this,
  40302. Ctor = x.constructor;
  40303. if (dp === void 0) {
  40304. str = finiteToString(x, true);
  40305. } else {
  40306. checkInt32(dp, 0, MAX_DIGITS);
  40307. if (rm === void 0) rm = Ctor.rounding;
  40308. else checkInt32(rm, 0, 8);
  40309. x = finalise(new Ctor(x), dp + 1, rm);
  40310. str = finiteToString(x, true, dp + 1);
  40311. }
  40312. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40313. };
  40314. /*
  40315. * Return a string representing the value of this Decimal in normal (fixed-point) notation to
  40316. * `dp` fixed decimal places and rounded using rounding mode `rm` or `rounding` if `rm` is
  40317. * omitted.
  40318. *
  40319. * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
  40320. *
  40321. * [dp] {number} Decimal places. Integer, 0 to MAX_DIGITS inclusive.
  40322. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40323. *
  40324. * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
  40325. * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
  40326. * (-0).toFixed(3) is '0.000'.
  40327. * (-0.5).toFixed(0) is '-0'.
  40328. *
  40329. */
  40330. P.toFixed = function (dp, rm) {
  40331. var str, y,
  40332. x = this,
  40333. Ctor = x.constructor;
  40334. if (dp === void 0) {
  40335. str = finiteToString(x);
  40336. } else {
  40337. checkInt32(dp, 0, MAX_DIGITS);
  40338. if (rm === void 0) rm = Ctor.rounding;
  40339. else checkInt32(rm, 0, 8);
  40340. y = finalise(new Ctor(x), dp + x.e + 1, rm);
  40341. str = finiteToString(y, false, dp + y.e + 1);
  40342. }
  40343. // To determine whether to add the minus sign look at the value before it was rounded,
  40344. // i.e. look at `x` rather than `y`.
  40345. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40346. };
  40347. /*
  40348. * Return an array representing the value of this Decimal as a simple fraction with an integer
  40349. * numerator and an integer denominator.
  40350. *
  40351. * The denominator will be a positive non-zero value less than or equal to the specified maximum
  40352. * denominator. If a maximum denominator is not specified, the denominator will be the lowest
  40353. * value necessary to represent the number exactly.
  40354. *
  40355. * [maxD] {number|string|Decimal} Maximum denominator. Integer >= 1 and < Infinity.
  40356. *
  40357. */
  40358. P.toFraction = function (maxD) {
  40359. var d, d0, d1, d2, e, k, n, n0, n1, pr, q, r,
  40360. x = this,
  40361. xd = x.d,
  40362. Ctor = x.constructor;
  40363. if (!xd) return new Ctor(x);
  40364. n1 = d0 = new Ctor(1);
  40365. d1 = n0 = new Ctor(0);
  40366. d = new Ctor(d1);
  40367. e = d.e = getPrecision(xd) - x.e - 1;
  40368. k = e % LOG_BASE;
  40369. d.d[0] = mathpow(10, k < 0 ? LOG_BASE + k : k);
  40370. if (maxD == null) {
  40371. // d is 10**e, the minimum max-denominator needed.
  40372. maxD = e > 0 ? d : n1;
  40373. } else {
  40374. n = new Ctor(maxD);
  40375. if (!n.isInt() || n.lt(n1)) throw Error(invalidArgument + n);
  40376. maxD = n.gt(d) ? (e > 0 ? d : n1) : n;
  40377. }
  40378. external = false;
  40379. n = new Ctor(digitsToString(xd));
  40380. pr = Ctor.precision;
  40381. Ctor.precision = e = xd.length * LOG_BASE * 2;
  40382. for (;;) {
  40383. q = divide(n, d, 0, 1, 1);
  40384. d2 = d0.plus(q.times(d1));
  40385. if (d2.cmp(maxD) == 1) break;
  40386. d0 = d1;
  40387. d1 = d2;
  40388. d2 = n1;
  40389. n1 = n0.plus(q.times(d2));
  40390. n0 = d2;
  40391. d2 = d;
  40392. d = n.minus(q.times(d2));
  40393. n = d2;
  40394. }
  40395. d2 = divide(maxD.minus(d0), d1, 0, 1, 1);
  40396. n0 = n0.plus(d2.times(n1));
  40397. d0 = d0.plus(d2.times(d1));
  40398. n0.s = n1.s = x.s;
  40399. // Determine which fraction is closer to x, n0/d0 or n1/d1?
  40400. r = divide(n1, d1, e, 1).minus(x).abs().cmp(divide(n0, d0, e, 1).minus(x).abs()) < 1
  40401. ? [n1, d1] : [n0, d0];
  40402. Ctor.precision = pr;
  40403. external = true;
  40404. return r;
  40405. };
  40406. /*
  40407. * Return a string representing the value of this Decimal in base 16, round to `sd` significant
  40408. * digits using rounding mode `rm`.
  40409. *
  40410. * If the optional `sd` argument is present then return binary exponential notation.
  40411. *
  40412. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40413. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40414. *
  40415. */
  40416. P.toHexadecimal = P.toHex = function (sd, rm) {
  40417. return toStringBinary(this, 16, sd, rm);
  40418. };
  40419. /*
  40420. * Returns a new Decimal whose value is the nearest multiple of `y` in the direction of rounding
  40421. * mode `rm`, or `Decimal.rounding` if `rm` is omitted, to the value of this Decimal.
  40422. *
  40423. * The return value will always have the same sign as this Decimal, unless either this Decimal
  40424. * or `y` is NaN, in which case the return value will be also be NaN.
  40425. *
  40426. * The return value is not affected by the value of `precision`.
  40427. *
  40428. * y {number|string|Decimal} The magnitude to round to a multiple of.
  40429. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40430. *
  40431. * 'toNearest() rounding mode not an integer: {rm}'
  40432. * 'toNearest() rounding mode out of range: {rm}'
  40433. *
  40434. */
  40435. P.toNearest = function (y, rm) {
  40436. var x = this,
  40437. Ctor = x.constructor;
  40438. x = new Ctor(x);
  40439. if (y == null) {
  40440. // If x is not finite, return x.
  40441. if (!x.d) return x;
  40442. y = new Ctor(1);
  40443. rm = Ctor.rounding;
  40444. } else {
  40445. y = new Ctor(y);
  40446. if (rm === void 0) {
  40447. rm = Ctor.rounding;
  40448. } else {
  40449. checkInt32(rm, 0, 8);
  40450. }
  40451. // If x is not finite, return x if y is not NaN, else NaN.
  40452. if (!x.d) return y.s ? x : y;
  40453. // If y is not finite, return Infinity with the sign of x if y is Infinity, else NaN.
  40454. if (!y.d) {
  40455. if (y.s) y.s = x.s;
  40456. return y;
  40457. }
  40458. }
  40459. // If y is not zero, calculate the nearest multiple of y to x.
  40460. if (y.d[0]) {
  40461. external = false;
  40462. x = divide(x, y, 0, rm, 1).times(y);
  40463. external = true;
  40464. finalise(x);
  40465. // If y is zero, return zero with the sign of x.
  40466. } else {
  40467. y.s = x.s;
  40468. x = y;
  40469. }
  40470. return x;
  40471. };
  40472. /*
  40473. * Return the value of this Decimal converted to a number primitive.
  40474. * Zero keeps its sign.
  40475. *
  40476. */
  40477. P.toNumber = function () {
  40478. return +this;
  40479. };
  40480. /*
  40481. * Return a string representing the value of this Decimal in base 8, round to `sd` significant
  40482. * digits using rounding mode `rm`.
  40483. *
  40484. * If the optional `sd` argument is present then return binary exponential notation.
  40485. *
  40486. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40487. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40488. *
  40489. */
  40490. P.toOctal = function (sd, rm) {
  40491. return toStringBinary(this, 8, sd, rm);
  40492. };
  40493. /*
  40494. * Return a new Decimal whose value is the value of this Decimal raised to the power `y`, rounded
  40495. * to `precision` significant digits using rounding mode `rounding`.
  40496. *
  40497. * ECMAScript compliant.
  40498. *
  40499. * pow(x, NaN) = NaN
  40500. * pow(x, ±0) = 1
  40501. * pow(NaN, non-zero) = NaN
  40502. * pow(abs(x) > 1, +Infinity) = +Infinity
  40503. * pow(abs(x) > 1, -Infinity) = +0
  40504. * pow(abs(x) == 1, ±Infinity) = NaN
  40505. * pow(abs(x) < 1, +Infinity) = +0
  40506. * pow(abs(x) < 1, -Infinity) = +Infinity
  40507. * pow(+Infinity, y > 0) = +Infinity
  40508. * pow(+Infinity, y < 0) = +0
  40509. * pow(-Infinity, odd integer > 0) = -Infinity
  40510. * pow(-Infinity, even integer > 0) = +Infinity
  40511. * pow(-Infinity, odd integer < 0) = -0
  40512. * pow(-Infinity, even integer < 0) = +0
  40513. * pow(+0, y > 0) = +0
  40514. * pow(+0, y < 0) = +Infinity
  40515. * pow(-0, odd integer > 0) = -0
  40516. * pow(-0, even integer > 0) = +0
  40517. * pow(-0, odd integer < 0) = -Infinity
  40518. * pow(-0, even integer < 0) = +Infinity
  40519. * pow(finite x < 0, finite non-integer) = NaN
  40520. *
  40521. * For non-integer or very large exponents pow(x, y) is calculated using
  40522. *
  40523. * x^y = exp(y*ln(x))
  40524. *
  40525. * Assuming the first 15 rounding digits are each equally likely to be any digit 0-9, the
  40526. * probability of an incorrectly rounded result
  40527. * P([49]9{14} | [50]0{14}) = 2 * 0.2 * 10^-14 = 4e-15 = 1/2.5e+14
  40528. * i.e. 1 in 250,000,000,000,000
  40529. *
  40530. * If a result is incorrectly rounded the maximum error will be 1 ulp (unit in last place).
  40531. *
  40532. * y {number|string|Decimal} The power to which to raise this Decimal.
  40533. *
  40534. */
  40535. P.toPower = P.pow = function (y) {
  40536. var e, k, pr, r, rm, s,
  40537. x = this,
  40538. Ctor = x.constructor,
  40539. yn = +(y = new Ctor(y));
  40540. // Either ±Infinity, NaN or ±0?
  40541. if (!x.d || !y.d || !x.d[0] || !y.d[0]) return new Ctor(mathpow(+x, yn));
  40542. x = new Ctor(x);
  40543. if (x.eq(1)) return x;
  40544. pr = Ctor.precision;
  40545. rm = Ctor.rounding;
  40546. if (y.eq(1)) return finalise(x, pr, rm);
  40547. // y exponent
  40548. e = mathfloor(y.e / LOG_BASE);
  40549. // If y is a small integer use the 'exponentiation by squaring' algorithm.
  40550. if (e >= y.d.length - 1 && (k = yn < 0 ? -yn : yn) <= MAX_SAFE_INTEGER) {
  40551. r = intPow(Ctor, x, k, pr);
  40552. return y.s < 0 ? new Ctor(1).div(r) : finalise(r, pr, rm);
  40553. }
  40554. s = x.s;
  40555. // if x is negative
  40556. if (s < 0) {
  40557. // if y is not an integer
  40558. if (e < y.d.length - 1) return new Ctor(NaN);
  40559. // Result is positive if x is negative and the last digit of integer y is even.
  40560. if ((y.d[e] & 1) == 0) s = 1;
  40561. // if x.eq(-1)
  40562. if (x.e == 0 && x.d[0] == 1 && x.d.length == 1) {
  40563. x.s = s;
  40564. return x;
  40565. }
  40566. }
  40567. // Estimate result exponent.
  40568. // x^y = 10^e, where e = y * log10(x)
  40569. // log10(x) = log10(x_significand) + x_exponent
  40570. // log10(x_significand) = ln(x_significand) / ln(10)
  40571. k = mathpow(+x, yn);
  40572. e = k == 0 || !isFinite(k)
  40573. ? mathfloor(yn * (Math.log('0.' + digitsToString(x.d)) / Math.LN10 + x.e + 1))
  40574. : new Ctor(k + '').e;
  40575. // Exponent estimate may be incorrect e.g. x: 0.999999999999999999, y: 2.29, e: 0, r.e: -1.
  40576. // Overflow/underflow?
  40577. if (e > Ctor.maxE + 1 || e < Ctor.minE - 1) return new Ctor(e > 0 ? s / 0 : 0);
  40578. external = false;
  40579. Ctor.rounding = x.s = 1;
  40580. // Estimate the extra guard digits needed to ensure five correct rounding digits from
  40581. // naturalLogarithm(x). Example of failure without these extra digits (precision: 10):
  40582. // new Decimal(2.32456).pow('2087987436534566.46411')
  40583. // should be 1.162377823e+764914905173815, but is 1.162355823e+764914905173815
  40584. k = Math.min(12, (e + '').length);
  40585. // r = x^y = exp(y*ln(x))
  40586. r = naturalExponential(y.times(naturalLogarithm(x, pr + k)), pr);
  40587. // r may be Infinity, e.g. (0.9999999999999999).pow(-1e+40)
  40588. if (r.d) {
  40589. // Truncate to the required precision plus five rounding digits.
  40590. r = finalise(r, pr + 5, 1);
  40591. // If the rounding digits are [49]9999 or [50]0000 increase the precision by 10 and recalculate
  40592. // the result.
  40593. if (checkRoundingDigits(r.d, pr, rm)) {
  40594. e = pr + 10;
  40595. // Truncate to the increased precision plus five rounding digits.
  40596. r = finalise(naturalExponential(y.times(naturalLogarithm(x, e + k)), e), e + 5, 1);
  40597. // Check for 14 nines from the 2nd rounding digit (the first rounding digit may be 4 or 9).
  40598. if (+digitsToString(r.d).slice(pr + 1, pr + 15) + 1 == 1e14) {
  40599. r = finalise(r, pr + 1, 0);
  40600. }
  40601. }
  40602. }
  40603. r.s = s;
  40604. external = true;
  40605. Ctor.rounding = rm;
  40606. return finalise(r, pr, rm);
  40607. };
  40608. /*
  40609. * Return a string representing the value of this Decimal rounded to `sd` significant digits
  40610. * using rounding mode `rounding`.
  40611. *
  40612. * Return exponential notation if `sd` is less than the number of digits necessary to represent
  40613. * the integer part of the value in normal notation.
  40614. *
  40615. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40616. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40617. *
  40618. */
  40619. P.toPrecision = function (sd, rm) {
  40620. var str,
  40621. x = this,
  40622. Ctor = x.constructor;
  40623. if (sd === void 0) {
  40624. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40625. } else {
  40626. checkInt32(sd, 1, MAX_DIGITS);
  40627. if (rm === void 0) rm = Ctor.rounding;
  40628. else checkInt32(rm, 0, 8);
  40629. x = finalise(new Ctor(x), sd, rm);
  40630. str = finiteToString(x, sd <= x.e || x.e <= Ctor.toExpNeg, sd);
  40631. }
  40632. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40633. };
  40634. /*
  40635. * Return a new Decimal whose value is the value of this Decimal rounded to a maximum of `sd`
  40636. * significant digits using rounding mode `rm`, or to `precision` and `rounding` respectively if
  40637. * omitted.
  40638. *
  40639. * [sd] {number} Significant digits. Integer, 1 to MAX_DIGITS inclusive.
  40640. * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.
  40641. *
  40642. * 'toSD() digits out of range: {sd}'
  40643. * 'toSD() digits not an integer: {sd}'
  40644. * 'toSD() rounding mode not an integer: {rm}'
  40645. * 'toSD() rounding mode out of range: {rm}'
  40646. *
  40647. */
  40648. P.toSignificantDigits = P.toSD = function (sd, rm) {
  40649. var x = this,
  40650. Ctor = x.constructor;
  40651. if (sd === void 0) {
  40652. sd = Ctor.precision;
  40653. rm = Ctor.rounding;
  40654. } else {
  40655. checkInt32(sd, 1, MAX_DIGITS);
  40656. if (rm === void 0) rm = Ctor.rounding;
  40657. else checkInt32(rm, 0, 8);
  40658. }
  40659. return finalise(new Ctor(x), sd, rm);
  40660. };
  40661. /*
  40662. * Return a string representing the value of this Decimal.
  40663. *
  40664. * Return exponential notation if this Decimal has a positive exponent equal to or greater than
  40665. * `toExpPos`, or a negative exponent equal to or less than `toExpNeg`.
  40666. *
  40667. */
  40668. P.toString = function () {
  40669. var x = this,
  40670. Ctor = x.constructor,
  40671. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40672. return x.isNeg() && !x.isZero() ? '-' + str : str;
  40673. };
  40674. /*
  40675. * Return a new Decimal whose value is the value of this Decimal truncated to a whole number.
  40676. *
  40677. */
  40678. P.truncated = P.trunc = function () {
  40679. return finalise(new this.constructor(this), this.e + 1, 1);
  40680. };
  40681. /*
  40682. * Return a string representing the value of this Decimal.
  40683. * Unlike `toString`, negative zero will include the minus sign.
  40684. *
  40685. */
  40686. P.valueOf = P.toJSON = function () {
  40687. var x = this,
  40688. Ctor = x.constructor,
  40689. str = finiteToString(x, x.e <= Ctor.toExpNeg || x.e >= Ctor.toExpPos);
  40690. return x.isNeg() ? '-' + str : str;
  40691. };
  40692. /*
  40693. // Add aliases to match BigDecimal method names.
  40694. // P.add = P.plus;
  40695. P.subtract = P.minus;
  40696. P.multiply = P.times;
  40697. P.divide = P.div;
  40698. P.remainder = P.mod;
  40699. P.compareTo = P.cmp;
  40700. P.negate = P.neg;
  40701. */
  40702. // Helper functions for Decimal.prototype (P) and/or Decimal methods, and their callers.
  40703. /*
  40704. * digitsToString P.cubeRoot, P.logarithm, P.squareRoot, P.toFraction, P.toPower,
  40705. * finiteToString, naturalExponential, naturalLogarithm
  40706. * checkInt32 P.toDecimalPlaces, P.toExponential, P.toFixed, P.toNearest,
  40707. * P.toPrecision, P.toSignificantDigits, toStringBinary, random
  40708. * checkRoundingDigits P.logarithm, P.toPower, naturalExponential, naturalLogarithm
  40709. * convertBase toStringBinary, parseOther
  40710. * cos P.cos
  40711. * divide P.atanh, P.cubeRoot, P.dividedBy, P.dividedToIntegerBy,
  40712. * P.logarithm, P.modulo, P.squareRoot, P.tan, P.tanh, P.toFraction,
  40713. * P.toNearest, toStringBinary, naturalExponential, naturalLogarithm,
  40714. * taylorSeries, atan2, parseOther
  40715. * finalise P.absoluteValue, P.atan, P.atanh, P.ceil, P.cos, P.cosh,
  40716. * P.cubeRoot, P.dividedToIntegerBy, P.floor, P.logarithm, P.minus,
  40717. * P.modulo, P.negated, P.plus, P.round, P.sin, P.sinh, P.squareRoot,
  40718. * P.tan, P.times, P.toDecimalPlaces, P.toExponential, P.toFixed,
  40719. * P.toNearest, P.toPower, P.toPrecision, P.toSignificantDigits,
  40720. * P.truncated, divide, getLn10, getPi, naturalExponential,
  40721. * naturalLogarithm, ceil, floor, round, trunc
  40722. * finiteToString P.toExponential, P.toFixed, P.toPrecision, P.toString, P.valueOf,
  40723. * toStringBinary
  40724. * getBase10Exponent P.minus, P.plus, P.times, parseOther
  40725. * getLn10 P.logarithm, naturalLogarithm
  40726. * getPi P.acos, P.asin, P.atan, toLessThanHalfPi, atan2
  40727. * getPrecision P.precision, P.toFraction
  40728. * getZeroString digitsToString, finiteToString
  40729. * intPow P.toPower, parseOther
  40730. * isOdd toLessThanHalfPi
  40731. * maxOrMin max, min
  40732. * naturalExponential P.naturalExponential, P.toPower
  40733. * naturalLogarithm P.acosh, P.asinh, P.atanh, P.logarithm, P.naturalLogarithm,
  40734. * P.toPower, naturalExponential
  40735. * nonFiniteToString finiteToString, toStringBinary
  40736. * parseDecimal Decimal
  40737. * parseOther Decimal
  40738. * sin P.sin
  40739. * taylorSeries P.cosh, P.sinh, cos, sin
  40740. * toLessThanHalfPi P.cos, P.sin
  40741. * toStringBinary P.toBinary, P.toHexadecimal, P.toOctal
  40742. * truncate intPow
  40743. *
  40744. * Throws: P.logarithm, P.precision, P.toFraction, checkInt32, getLn10, getPi,
  40745. * naturalLogarithm, config, parseOther, random, Decimal
  40746. */
  40747. function digitsToString(d) {
  40748. var i, k, ws,
  40749. indexOfLastWord = d.length - 1,
  40750. str = '',
  40751. w = d[0];
  40752. if (indexOfLastWord > 0) {
  40753. str += w;
  40754. for (i = 1; i < indexOfLastWord; i++) {
  40755. ws = d[i] + '';
  40756. k = LOG_BASE - ws.length;
  40757. if (k) str += getZeroString(k);
  40758. str += ws;
  40759. }
  40760. w = d[i];
  40761. ws = w + '';
  40762. k = LOG_BASE - ws.length;
  40763. if (k) str += getZeroString(k);
  40764. } else if (w === 0) {
  40765. return '0';
  40766. }
  40767. // Remove trailing zeros of last w.
  40768. for (; w % 10 === 0;) w /= 10;
  40769. return str + w;
  40770. }
  40771. function checkInt32(i, min, max) {
  40772. if (i !== ~~i || i < min || i > max) {
  40773. throw Error(invalidArgument + i);
  40774. }
  40775. }
  40776. /*
  40777. * Check 5 rounding digits if `repeating` is null, 4 otherwise.
  40778. * `repeating == null` if caller is `log` or `pow`,
  40779. * `repeating != null` if caller is `naturalLogarithm` or `naturalExponential`.
  40780. */
  40781. function checkRoundingDigits(d, i, rm, repeating) {
  40782. var di, k, r, rd;
  40783. // Get the length of the first word of the array d.
  40784. for (k = d[0]; k >= 10; k /= 10) --i;
  40785. // Is the rounding digit in the first word of d?
  40786. if (--i < 0) {
  40787. i += LOG_BASE;
  40788. di = 0;
  40789. } else {
  40790. di = Math.ceil((i + 1) / LOG_BASE);
  40791. i %= LOG_BASE;
  40792. }
  40793. // i is the index (0 - 6) of the rounding digit.
  40794. // E.g. if within the word 3487563 the first rounding digit is 5,
  40795. // then i = 4, k = 1000, rd = 3487563 % 1000 = 563
  40796. k = mathpow(10, LOG_BASE - i);
  40797. rd = d[di] % k | 0;
  40798. if (repeating == null) {
  40799. if (i < 3) {
  40800. if (i == 0) rd = rd / 100 | 0;
  40801. else if (i == 1) rd = rd / 10 | 0;
  40802. r = rm < 4 && rd == 99999 || rm > 3 && rd == 49999 || rd == 50000 || rd == 0;
  40803. } else {
  40804. r = (rm < 4 && rd + 1 == k || rm > 3 && rd + 1 == k / 2) &&
  40805. (d[di + 1] / k / 100 | 0) == mathpow(10, i - 2) - 1 ||
  40806. (rd == k / 2 || rd == 0) && (d[di + 1] / k / 100 | 0) == 0;
  40807. }
  40808. } else {
  40809. if (i < 4) {
  40810. if (i == 0) rd = rd / 1000 | 0;
  40811. else if (i == 1) rd = rd / 100 | 0;
  40812. else if (i == 2) rd = rd / 10 | 0;
  40813. r = (repeating || rm < 4) && rd == 9999 || !repeating && rm > 3 && rd == 4999;
  40814. } else {
  40815. r = ((repeating || rm < 4) && rd + 1 == k ||
  40816. (!repeating && rm > 3) && rd + 1 == k / 2) &&
  40817. (d[di + 1] / k / 1000 | 0) == mathpow(10, i - 3) - 1;
  40818. }
  40819. }
  40820. return r;
  40821. }
  40822. // Convert string of `baseIn` to an array of numbers of `baseOut`.
  40823. // Eg. convertBase('255', 10, 16) returns [15, 15].
  40824. // Eg. convertBase('ff', 16, 10) returns [2, 5, 5].
  40825. function convertBase(str, baseIn, baseOut) {
  40826. var j,
  40827. arr = [0],
  40828. arrL,
  40829. i = 0,
  40830. strL = str.length;
  40831. for (; i < strL;) {
  40832. for (arrL = arr.length; arrL--;) arr[arrL] *= baseIn;
  40833. arr[0] += NUMERALS.indexOf(str.charAt(i++));
  40834. for (j = 0; j < arr.length; j++) {
  40835. if (arr[j] > baseOut - 1) {
  40836. if (arr[j + 1] === void 0) arr[j + 1] = 0;
  40837. arr[j + 1] += arr[j] / baseOut | 0;
  40838. arr[j] %= baseOut;
  40839. }
  40840. }
  40841. }
  40842. return arr.reverse();
  40843. }
  40844. /*
  40845. * cos(x) = 1 - x^2/2! + x^4/4! - ...
  40846. * |x| < pi/2
  40847. *
  40848. */
  40849. function cosine(Ctor, x) {
  40850. var k, y,
  40851. len = x.d.length;
  40852. // Argument reduction: cos(4x) = 8*(cos^4(x) - cos^2(x)) + 1
  40853. // i.e. cos(x) = 8*(cos^4(x/4) - cos^2(x/4)) + 1
  40854. // Estimate the optimum number of times to use the argument reduction.
  40855. if (len < 32) {
  40856. k = Math.ceil(len / 3);
  40857. y = Math.pow(4, -k).toString();
  40858. } else {
  40859. k = 16;
  40860. y = '2.3283064365386962890625e-10';
  40861. }
  40862. Ctor.precision += k;
  40863. x = taylorSeries(Ctor, 1, x.times(y), new Ctor(1));
  40864. // Reverse argument reduction
  40865. for (var i = k; i--;) {
  40866. var cos2x = x.times(x);
  40867. x = cos2x.times(cos2x).minus(cos2x).times(8).plus(1);
  40868. }
  40869. Ctor.precision -= k;
  40870. return x;
  40871. }
  40872. /*
  40873. * Perform division in the specified base.
  40874. */
  40875. var divide = (function () {
  40876. // Assumes non-zero x and k, and hence non-zero result.
  40877. function multiplyInteger(x, k, base) {
  40878. var temp,
  40879. carry = 0,
  40880. i = x.length;
  40881. for (x = x.slice(); i--;) {
  40882. temp = x[i] * k + carry;
  40883. x[i] = temp % base | 0;
  40884. carry = temp / base | 0;
  40885. }
  40886. if (carry) x.unshift(carry);
  40887. return x;
  40888. }
  40889. function compare(a, b, aL, bL) {
  40890. var i, r;
  40891. if (aL != bL) {
  40892. r = aL > bL ? 1 : -1;
  40893. } else {
  40894. for (i = r = 0; i < aL; i++) {
  40895. if (a[i] != b[i]) {
  40896. r = a[i] > b[i] ? 1 : -1;
  40897. break;
  40898. }
  40899. }
  40900. }
  40901. return r;
  40902. }
  40903. function subtract(a, b, aL, base) {
  40904. var i = 0;
  40905. // Subtract b from a.
  40906. for (; aL--;) {
  40907. a[aL] -= i;
  40908. i = a[aL] < b[aL] ? 1 : 0;
  40909. a[aL] = i * base + a[aL] - b[aL];
  40910. }
  40911. // Remove leading zeros.
  40912. for (; !a[0] && a.length > 1;) a.shift();
  40913. }
  40914. return function (x, y, pr, rm, dp, base) {
  40915. var cmp, e, i, k, logBase, more, prod, prodL, q, qd, rem, remL, rem0, sd, t, xi, xL, yd0,
  40916. yL, yz,
  40917. Ctor = x.constructor,
  40918. sign = x.s == y.s ? 1 : -1,
  40919. xd = x.d,
  40920. yd = y.d;
  40921. // Either NaN, Infinity or 0?
  40922. if (!xd || !xd[0] || !yd || !yd[0]) {
  40923. return new Ctor(// Return NaN if either NaN, or both Infinity or 0.
  40924. !x.s || !y.s || (xd ? yd && xd[0] == yd[0] : !yd) ? NaN :
  40925. // Return ±0 if x is 0 or y is ±Infinity, or return ±Infinity as y is 0.
  40926. xd && xd[0] == 0 || !yd ? sign * 0 : sign / 0);
  40927. }
  40928. if (base) {
  40929. logBase = 1;
  40930. e = x.e - y.e;
  40931. } else {
  40932. base = BASE;
  40933. logBase = LOG_BASE;
  40934. e = mathfloor(x.e / logBase) - mathfloor(y.e / logBase);
  40935. }
  40936. yL = yd.length;
  40937. xL = xd.length;
  40938. q = new Ctor(sign);
  40939. qd = q.d = [];
  40940. // Result exponent may be one less than e.
  40941. // The digit array of a Decimal from toStringBinary may have trailing zeros.
  40942. for (i = 0; yd[i] == (xd[i] || 0); i++);
  40943. if (yd[i] > (xd[i] || 0)) e--;
  40944. if (pr == null) {
  40945. sd = pr = Ctor.precision;
  40946. rm = Ctor.rounding;
  40947. } else if (dp) {
  40948. sd = pr + (x.e - y.e) + 1;
  40949. } else {
  40950. sd = pr;
  40951. }
  40952. if (sd < 0) {
  40953. qd.push(1);
  40954. more = true;
  40955. } else {
  40956. // Convert precision in number of base 10 digits to base 1e7 digits.
  40957. sd = sd / logBase + 2 | 0;
  40958. i = 0;
  40959. // divisor < 1e7
  40960. if (yL == 1) {
  40961. k = 0;
  40962. yd = yd[0];
  40963. sd++;
  40964. // k is the carry.
  40965. for (; (i < xL || k) && sd--; i++) {
  40966. t = k * base + (xd[i] || 0);
  40967. qd[i] = t / yd | 0;
  40968. k = t % yd | 0;
  40969. }
  40970. more = k || i < xL;
  40971. // divisor >= 1e7
  40972. } else {
  40973. // Normalise xd and yd so highest order digit of yd is >= base/2
  40974. k = base / (yd[0] + 1) | 0;
  40975. if (k > 1) {
  40976. yd = multiplyInteger(yd, k, base);
  40977. xd = multiplyInteger(xd, k, base);
  40978. yL = yd.length;
  40979. xL = xd.length;
  40980. }
  40981. xi = yL;
  40982. rem = xd.slice(0, yL);
  40983. remL = rem.length;
  40984. // Add zeros to make remainder as long as divisor.
  40985. for (; remL < yL;) rem[remL++] = 0;
  40986. yz = yd.slice();
  40987. yz.unshift(0);
  40988. yd0 = yd[0];
  40989. if (yd[1] >= base / 2) ++yd0;
  40990. do {
  40991. k = 0;
  40992. // Compare divisor and remainder.
  40993. cmp = compare(yd, rem, yL, remL);
  40994. // If divisor < remainder.
  40995. if (cmp < 0) {
  40996. // Calculate trial digit, k.
  40997. rem0 = rem[0];
  40998. if (yL != remL) rem0 = rem0 * base + (rem[1] || 0);
  40999. // k will be how many times the divisor goes into the current remainder.
  41000. k = rem0 / yd0 | 0;
  41001. // Algorithm:
  41002. // 1. product = divisor * trial digit (k)
  41003. // 2. if product > remainder: product -= divisor, k--
  41004. // 3. remainder -= product
  41005. // 4. if product was < remainder at 2:
  41006. // 5. compare new remainder and divisor
  41007. // 6. If remainder > divisor: remainder -= divisor, k++
  41008. if (k > 1) {
  41009. if (k >= base) k = base - 1;
  41010. // product = divisor * trial digit.
  41011. prod = multiplyInteger(yd, k, base);
  41012. prodL = prod.length;
  41013. remL = rem.length;
  41014. // Compare product and remainder.
  41015. cmp = compare(prod, rem, prodL, remL);
  41016. // product > remainder.
  41017. if (cmp == 1) {
  41018. k--;
  41019. // Subtract divisor from product.
  41020. subtract(prod, yL < prodL ? yz : yd, prodL, base);
  41021. }
  41022. } else {
  41023. // cmp is -1.
  41024. // If k is 0, there is no need to compare yd and rem again below, so change cmp to 1
  41025. // to avoid it. If k is 1 there is a need to compare yd and rem again below.
  41026. if (k == 0) cmp = k = 1;
  41027. prod = yd.slice();
  41028. }
  41029. prodL = prod.length;
  41030. if (prodL < remL) prod.unshift(0);
  41031. // Subtract product from remainder.
  41032. subtract(rem, prod, remL, base);
  41033. // If product was < previous remainder.
  41034. if (cmp == -1) {
  41035. remL = rem.length;
  41036. // Compare divisor and new remainder.
  41037. cmp = compare(yd, rem, yL, remL);
  41038. // If divisor < new remainder, subtract divisor from remainder.
  41039. if (cmp < 1) {
  41040. k++;
  41041. // Subtract divisor from remainder.
  41042. subtract(rem, yL < remL ? yz : yd, remL, base);
  41043. }
  41044. }
  41045. remL = rem.length;
  41046. } else if (cmp === 0) {
  41047. k++;
  41048. rem = [0];
  41049. } // if cmp === 1, k will be 0
  41050. // Add the next digit, k, to the result array.
  41051. qd[i++] = k;
  41052. // Update the remainder.
  41053. if (cmp && rem[0]) {
  41054. rem[remL++] = xd[xi] || 0;
  41055. } else {
  41056. rem = [xd[xi]];
  41057. remL = 1;
  41058. }
  41059. } while ((xi++ < xL || rem[0] !== void 0) && sd--);
  41060. more = rem[0] !== void 0;
  41061. }
  41062. // Leading zero?
  41063. if (!qd[0]) qd.shift();
  41064. }
  41065. // logBase is 1 when divide is being used for base conversion.
  41066. if (logBase == 1) {
  41067. q.e = e;
  41068. inexact = more;
  41069. } else {
  41070. // To calculate q.e, first get the number of digits of qd[0].
  41071. for (i = 1, k = qd[0]; k >= 10; k /= 10) i++;
  41072. q.e = i + e * logBase - 1;
  41073. finalise(q, dp ? pr + q.e + 1 : pr, rm, more);
  41074. }
  41075. return q;
  41076. };
  41077. })();
  41078. /*
  41079. * Round `x` to `sd` significant digits using rounding mode `rm`.
  41080. * Check for over/under-flow.
  41081. */
  41082. function finalise(x, sd, rm, isTruncated) {
  41083. var digits, i, j, k, rd, roundUp, w, xd, xdi,
  41084. Ctor = x.constructor;
  41085. // Don't round if sd is null or undefined.
  41086. out: if (sd != null) {
  41087. xd = x.d;
  41088. // Infinity/NaN.
  41089. if (!xd) return x;
  41090. // rd: the rounding digit, i.e. the digit after the digit that may be rounded up.
  41091. // w: the word of xd containing rd, a base 1e7 number.
  41092. // xdi: the index of w within xd.
  41093. // digits: the number of digits of w.
  41094. // i: what would be the index of rd within w if all the numbers were 7 digits long (i.e. if
  41095. // they had leading zeros)
  41096. // j: if > 0, the actual index of rd within w (if < 0, rd is a leading zero).
  41097. // Get the length of the first word of the digits array xd.
  41098. for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
  41099. i = sd - digits;
  41100. // Is the rounding digit in the first word of xd?
  41101. if (i < 0) {
  41102. i += LOG_BASE;
  41103. j = sd;
  41104. w = xd[xdi = 0];
  41105. // Get the rounding digit at index j of w.
  41106. rd = w / mathpow(10, digits - j - 1) % 10 | 0;
  41107. } else {
  41108. xdi = Math.ceil((i + 1) / LOG_BASE);
  41109. k = xd.length;
  41110. if (xdi >= k) {
  41111. if (isTruncated) {
  41112. // Needed by `naturalExponential`, `naturalLogarithm` and `squareRoot`.
  41113. for (; k++ <= xdi;) xd.push(0);
  41114. w = rd = 0;
  41115. digits = 1;
  41116. i %= LOG_BASE;
  41117. j = i - LOG_BASE + 1;
  41118. } else {
  41119. break out;
  41120. }
  41121. } else {
  41122. w = k = xd[xdi];
  41123. // Get the number of digits of w.
  41124. for (digits = 1; k >= 10; k /= 10) digits++;
  41125. // Get the index of rd within w.
  41126. i %= LOG_BASE;
  41127. // Get the index of rd within w, adjusted for leading zeros.
  41128. // The number of leading zeros of w is given by LOG_BASE - digits.
  41129. j = i - LOG_BASE + digits;
  41130. // Get the rounding digit at index j of w.
  41131. rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
  41132. }
  41133. }
  41134. // Are there any non-zero digits after the rounding digit?
  41135. isTruncated = isTruncated || sd < 0 ||
  41136. xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
  41137. // The expression `w % mathpow(10, digits - j - 1)` returns all the digits of w to the right
  41138. // of the digit at (left-to-right) index j, e.g. if w is 908714 and j is 2, the expression
  41139. // will give 714.
  41140. roundUp = rm < 4
  41141. ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2))
  41142. : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 &&
  41143. // Check whether the digit to the left of the rounding digit is odd.
  41144. ((i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10) & 1 ||
  41145. rm == (x.s < 0 ? 8 : 7));
  41146. if (sd < 1 || !xd[0]) {
  41147. xd.length = 0;
  41148. if (roundUp) {
  41149. // Convert sd to decimal places.
  41150. sd -= x.e + 1;
  41151. // 1, 0.1, 0.01, 0.001, 0.0001 etc.
  41152. xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
  41153. x.e = -sd || 0;
  41154. } else {
  41155. // Zero.
  41156. xd[0] = x.e = 0;
  41157. }
  41158. return x;
  41159. }
  41160. // Remove excess digits.
  41161. if (i == 0) {
  41162. xd.length = xdi;
  41163. k = 1;
  41164. xdi--;
  41165. } else {
  41166. xd.length = xdi + 1;
  41167. k = mathpow(10, LOG_BASE - i);
  41168. // E.g. 56700 becomes 56000 if 7 is the rounding digit.
  41169. // j > 0 means i > number of leading zeros of w.
  41170. xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
  41171. }
  41172. if (roundUp) {
  41173. for (;;) {
  41174. // Is the digit to be rounded up in the first word of xd?
  41175. if (xdi == 0) {
  41176. // i will be the length of xd[0] before k is added.
  41177. for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
  41178. j = xd[0] += k;
  41179. for (k = 1; j >= 10; j /= 10) k++;
  41180. // if i != k the length has increased.
  41181. if (i != k) {
  41182. x.e++;
  41183. if (xd[0] == BASE) xd[0] = 1;
  41184. }
  41185. break;
  41186. } else {
  41187. xd[xdi] += k;
  41188. if (xd[xdi] != BASE) break;
  41189. xd[xdi--] = 0;
  41190. k = 1;
  41191. }
  41192. }
  41193. }
  41194. // Remove trailing zeros.
  41195. for (i = xd.length; xd[--i] === 0;) xd.pop();
  41196. }
  41197. if (external) {
  41198. // Overflow?
  41199. if (x.e > Ctor.maxE) {
  41200. // Infinity.
  41201. x.d = null;
  41202. x.e = NaN;
  41203. // Underflow?
  41204. } else if (x.e < Ctor.minE) {
  41205. // Zero.
  41206. x.e = 0;
  41207. x.d = [0];
  41208. // Ctor.underflow = true;
  41209. } // else Ctor.underflow = false;
  41210. }
  41211. return x;
  41212. }
  41213. function finiteToString(x, isExp, sd) {
  41214. if (!x.isFinite()) return nonFiniteToString(x);
  41215. var k,
  41216. e = x.e,
  41217. str = digitsToString(x.d),
  41218. len = str.length;
  41219. if (isExp) {
  41220. if (sd && (k = sd - len) > 0) {
  41221. str = str.charAt(0) + '.' + str.slice(1) + getZeroString(k);
  41222. } else if (len > 1) {
  41223. str = str.charAt(0) + '.' + str.slice(1);
  41224. }
  41225. str = str + (x.e < 0 ? 'e' : 'e+') + x.e;
  41226. } else if (e < 0) {
  41227. str = '0.' + getZeroString(-e - 1) + str;
  41228. if (sd && (k = sd - len) > 0) str += getZeroString(k);
  41229. } else if (e >= len) {
  41230. str += getZeroString(e + 1 - len);
  41231. if (sd && (k = sd - e - 1) > 0) str = str + '.' + getZeroString(k);
  41232. } else {
  41233. if ((k = e + 1) < len) str = str.slice(0, k) + '.' + str.slice(k);
  41234. if (sd && (k = sd - len) > 0) {
  41235. if (e + 1 === len) str += '.';
  41236. str += getZeroString(k);
  41237. }
  41238. }
  41239. return str;
  41240. }
  41241. // Calculate the base 10 exponent from the base 1e7 exponent.
  41242. function getBase10Exponent(digits, e) {
  41243. var w = digits[0];
  41244. // Add the number of digits of the first word of the digits array.
  41245. for ( e *= LOG_BASE; w >= 10; w /= 10) e++;
  41246. return e;
  41247. }
  41248. function getLn10(Ctor, sd, pr) {
  41249. if (sd > LN10_PRECISION) {
  41250. // Reset global state in case the exception is caught.
  41251. external = true;
  41252. if (pr) Ctor.precision = pr;
  41253. throw Error(precisionLimitExceeded);
  41254. }
  41255. return finalise(new Ctor(LN10), sd, 1, true);
  41256. }
  41257. function getPi(Ctor, sd, rm) {
  41258. if (sd > PI_PRECISION) throw Error(precisionLimitExceeded);
  41259. return finalise(new Ctor(PI), sd, rm, true);
  41260. }
  41261. function getPrecision(digits) {
  41262. var w = digits.length - 1,
  41263. len = w * LOG_BASE + 1;
  41264. w = digits[w];
  41265. // If non-zero...
  41266. if (w) {
  41267. // Subtract the number of trailing zeros of the last word.
  41268. for (; w % 10 == 0; w /= 10) len--;
  41269. // Add the number of digits of the first word.
  41270. for (w = digits[0]; w >= 10; w /= 10) len++;
  41271. }
  41272. return len;
  41273. }
  41274. function getZeroString(k) {
  41275. var zs = '';
  41276. for (; k--;) zs += '0';
  41277. return zs;
  41278. }
  41279. /*
  41280. * Return a new Decimal whose value is the value of Decimal `x` to the power `n`, where `n` is an
  41281. * integer of type number.
  41282. *
  41283. * Implements 'exponentiation by squaring'. Called by `pow` and `parseOther`.
  41284. *
  41285. */
  41286. function intPow(Ctor, x, n, pr) {
  41287. var isTruncated,
  41288. r = new Ctor(1),
  41289. // Max n of 9007199254740991 takes 53 loop iterations.
  41290. // Maximum digits array length; leaves [28, 34] guard digits.
  41291. k = Math.ceil(pr / LOG_BASE + 4);
  41292. external = false;
  41293. for (;;) {
  41294. if (n % 2) {
  41295. r = r.times(x);
  41296. if (truncate(r.d, k)) isTruncated = true;
  41297. }
  41298. n = mathfloor(n / 2);
  41299. if (n === 0) {
  41300. // To ensure correct rounding when r.d is truncated, increment the last word if it is zero.
  41301. n = r.d.length - 1;
  41302. if (isTruncated && r.d[n] === 0) ++r.d[n];
  41303. break;
  41304. }
  41305. x = x.times(x);
  41306. truncate(x.d, k);
  41307. }
  41308. external = true;
  41309. return r;
  41310. }
  41311. function isOdd(n) {
  41312. return n.d[n.d.length - 1] & 1;
  41313. }
  41314. /*
  41315. * Handle `max` and `min`. `ltgt` is 'lt' or 'gt'.
  41316. */
  41317. function maxOrMin(Ctor, args, ltgt) {
  41318. var y,
  41319. x = new Ctor(args[0]),
  41320. i = 0;
  41321. for (; ++i < args.length;) {
  41322. y = new Ctor(args[i]);
  41323. if (!y.s) {
  41324. x = y;
  41325. break;
  41326. } else if (x[ltgt](y)) {
  41327. x = y;
  41328. }
  41329. }
  41330. return x;
  41331. }
  41332. /*
  41333. * Return a new Decimal whose value is the natural exponential of `x` rounded to `sd` significant
  41334. * digits.
  41335. *
  41336. * Taylor/Maclaurin series.
  41337. *
  41338. * exp(x) = x^0/0! + x^1/1! + x^2/2! + x^3/3! + ...
  41339. *
  41340. * Argument reduction:
  41341. * Repeat x = x / 32, k += 5, until |x| < 0.1
  41342. * exp(x) = exp(x / 2^k)^(2^k)
  41343. *
  41344. * Previously, the argument was initially reduced by
  41345. * exp(x) = exp(r) * 10^k where r = x - k * ln10, k = floor(x / ln10)
  41346. * to first put r in the range [0, ln10], before dividing by 32 until |x| < 0.1, but this was
  41347. * found to be slower than just dividing repeatedly by 32 as above.
  41348. *
  41349. * Max integer argument: exp('20723265836946413') = 6.3e+9000000000000000
  41350. * Min integer argument: exp('-20723265836946411') = 1.2e-9000000000000000
  41351. * (Math object integer min/max: Math.exp(709) = 8.2e+307, Math.exp(-745) = 5e-324)
  41352. *
  41353. * exp(Infinity) = Infinity
  41354. * exp(-Infinity) = 0
  41355. * exp(NaN) = NaN
  41356. * exp(±0) = 1
  41357. *
  41358. * exp(x) is non-terminating for any finite, non-zero x.
  41359. *
  41360. * The result will always be correctly rounded.
  41361. *
  41362. */
  41363. function naturalExponential(x, sd) {
  41364. var denominator, guard, j, pow, sum, t, wpr,
  41365. rep = 0,
  41366. i = 0,
  41367. k = 0,
  41368. Ctor = x.constructor,
  41369. rm = Ctor.rounding,
  41370. pr = Ctor.precision;
  41371. // 0/NaN/Infinity?
  41372. if (!x.d || !x.d[0] || x.e > 17) {
  41373. return new Ctor(x.d
  41374. ? !x.d[0] ? 1 : x.s < 0 ? 0 : 1 / 0
  41375. : x.s ? x.s < 0 ? 0 : x : 0 / 0);
  41376. }
  41377. if (sd == null) {
  41378. external = false;
  41379. wpr = pr;
  41380. } else {
  41381. wpr = sd;
  41382. }
  41383. t = new Ctor(0.03125);
  41384. // while abs(x) >= 0.1
  41385. while (x.e > -2) {
  41386. // x = x / 2^5
  41387. x = x.times(t);
  41388. k += 5;
  41389. }
  41390. // Use 2 * log10(2^k) + 5 (empirically derived) to estimate the increase in precision
  41391. // necessary to ensure the first 4 rounding digits are correct.
  41392. guard = Math.log(mathpow(2, k)) / Math.LN10 * 2 + 5 | 0;
  41393. wpr += guard;
  41394. denominator = pow = sum = new Ctor(1);
  41395. Ctor.precision = wpr;
  41396. for (;;) {
  41397. pow = finalise(pow.times(x), wpr, 1);
  41398. denominator = denominator.times(++i);
  41399. t = sum.plus(divide(pow, denominator, wpr, 1));
  41400. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  41401. j = k;
  41402. while (j--) sum = finalise(sum.times(sum), wpr, 1);
  41403. // Check to see if the first 4 rounding digits are [49]999.
  41404. // If so, repeat the summation with a higher precision, otherwise
  41405. // e.g. with precision: 18, rounding: 1
  41406. // exp(18.404272462595034083567793919843761) = 98372560.1229999999 (should be 98372560.123)
  41407. // `wpr - guard` is the index of first rounding digit.
  41408. if (sd == null) {
  41409. if (rep < 3 && checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  41410. Ctor.precision = wpr += 10;
  41411. denominator = pow = t = new Ctor(1);
  41412. i = 0;
  41413. rep++;
  41414. } else {
  41415. return finalise(sum, Ctor.precision = pr, rm, external = true);
  41416. }
  41417. } else {
  41418. Ctor.precision = pr;
  41419. return sum;
  41420. }
  41421. }
  41422. sum = t;
  41423. }
  41424. }
  41425. /*
  41426. * Return a new Decimal whose value is the natural logarithm of `x` rounded to `sd` significant
  41427. * digits.
  41428. *
  41429. * ln(-n) = NaN
  41430. * ln(0) = -Infinity
  41431. * ln(-0) = -Infinity
  41432. * ln(1) = 0
  41433. * ln(Infinity) = Infinity
  41434. * ln(-Infinity) = NaN
  41435. * ln(NaN) = NaN
  41436. *
  41437. * ln(n) (n != 1) is non-terminating.
  41438. *
  41439. */
  41440. function naturalLogarithm(y, sd) {
  41441. var c, c0, denominator, e, numerator, rep, sum, t, wpr, x1, x2,
  41442. n = 1,
  41443. guard = 10,
  41444. x = y,
  41445. xd = x.d,
  41446. Ctor = x.constructor,
  41447. rm = Ctor.rounding,
  41448. pr = Ctor.precision;
  41449. // Is x negative or Infinity, NaN, 0 or 1?
  41450. if (x.s < 0 || !xd || !xd[0] || !x.e && xd[0] == 1 && xd.length == 1) {
  41451. return new Ctor(xd && !xd[0] ? -1 / 0 : x.s != 1 ? NaN : xd ? 0 : x);
  41452. }
  41453. if (sd == null) {
  41454. external = false;
  41455. wpr = pr;
  41456. } else {
  41457. wpr = sd;
  41458. }
  41459. Ctor.precision = wpr += guard;
  41460. c = digitsToString(xd);
  41461. c0 = c.charAt(0);
  41462. if (Math.abs(e = x.e) < 1.5e15) {
  41463. // Argument reduction.
  41464. // The series converges faster the closer the argument is to 1, so using
  41465. // ln(a^b) = b * ln(a), ln(a) = ln(a^b) / b
  41466. // multiply the argument by itself until the leading digits of the significand are 7, 8, 9,
  41467. // 10, 11, 12 or 13, recording the number of multiplications so the sum of the series can
  41468. // later be divided by this number, then separate out the power of 10 using
  41469. // ln(a*10^b) = ln(a) + b*ln(10).
  41470. // max n is 21 (gives 0.9, 1.0 or 1.1) (9e15 / 21 = 4.2e14).
  41471. //while (c0 < 9 && c0 != 1 || c0 == 1 && c.charAt(1) > 1) {
  41472. // max n is 6 (gives 0.7 - 1.3)
  41473. while (c0 < 7 && c0 != 1 || c0 == 1 && c.charAt(1) > 3) {
  41474. x = x.times(y);
  41475. c = digitsToString(x.d);
  41476. c0 = c.charAt(0);
  41477. n++;
  41478. }
  41479. e = x.e;
  41480. if (c0 > 1) {
  41481. x = new Ctor('0.' + c);
  41482. e++;
  41483. } else {
  41484. x = new Ctor(c0 + '.' + c.slice(1));
  41485. }
  41486. } else {
  41487. // The argument reduction method above may result in overflow if the argument y is a massive
  41488. // number with exponent >= 1500000000000000 (9e15 / 6 = 1.5e15), so instead recall this
  41489. // function using ln(x*10^e) = ln(x) + e*ln(10).
  41490. t = getLn10(Ctor, wpr + 2, pr).times(e + '');
  41491. x = naturalLogarithm(new Ctor(c0 + '.' + c.slice(1)), wpr - guard).plus(t);
  41492. Ctor.precision = pr;
  41493. return sd == null ? finalise(x, pr, rm, external = true) : x;
  41494. }
  41495. // x1 is x reduced to a value near 1.
  41496. x1 = x;
  41497. // Taylor series.
  41498. // ln(y) = ln((1 + x)/(1 - x)) = 2(x + x^3/3 + x^5/5 + x^7/7 + ...)
  41499. // where x = (y - 1)/(y + 1) (|x| < 1)
  41500. sum = numerator = x = divide(x.minus(1), x.plus(1), wpr, 1);
  41501. x2 = finalise(x.times(x), wpr, 1);
  41502. denominator = 3;
  41503. for (;;) {
  41504. numerator = finalise(numerator.times(x2), wpr, 1);
  41505. t = sum.plus(divide(numerator, new Ctor(denominator), wpr, 1));
  41506. if (digitsToString(t.d).slice(0, wpr) === digitsToString(sum.d).slice(0, wpr)) {
  41507. sum = sum.times(2);
  41508. // Reverse the argument reduction. Check that e is not 0 because, besides preventing an
  41509. // unnecessary calculation, -0 + 0 = +0 and to ensure correct rounding -0 needs to stay -0.
  41510. if (e !== 0) sum = sum.plus(getLn10(Ctor, wpr + 2, pr).times(e + ''));
  41511. sum = divide(sum, new Ctor(n), wpr, 1);
  41512. // Is rm > 3 and the first 4 rounding digits 4999, or rm < 4 (or the summation has
  41513. // been repeated previously) and the first 4 rounding digits 9999?
  41514. // If so, restart the summation with a higher precision, otherwise
  41515. // e.g. with precision: 12, rounding: 1
  41516. // ln(135520028.6126091714265381533) = 18.7246299999 when it should be 18.72463.
  41517. // `wpr - guard` is the index of first rounding digit.
  41518. if (sd == null) {
  41519. if (checkRoundingDigits(sum.d, wpr - guard, rm, rep)) {
  41520. Ctor.precision = wpr += guard;
  41521. t = numerator = x = divide(x1.minus(1), x1.plus(1), wpr, 1);
  41522. x2 = finalise(x.times(x), wpr, 1);
  41523. denominator = rep = 1;
  41524. } else {
  41525. return finalise(sum, Ctor.precision = pr, rm, external = true);
  41526. }
  41527. } else {
  41528. Ctor.precision = pr;
  41529. return sum;
  41530. }
  41531. }
  41532. sum = t;
  41533. denominator += 2;
  41534. }
  41535. }
  41536. // ±Infinity, NaN.
  41537. function nonFiniteToString(x) {
  41538. // Unsigned.
  41539. return String(x.s * x.s / 0);
  41540. }
  41541. /*
  41542. * Parse the value of a new Decimal `x` from string `str`.
  41543. */
  41544. function parseDecimal(x, str) {
  41545. var e, i, len;
  41546. // Decimal point?
  41547. if ((e = str.indexOf('.')) > -1) str = str.replace('.', '');
  41548. // Exponential form?
  41549. if ((i = str.search(/e/i)) > 0) {
  41550. // Determine exponent.
  41551. if (e < 0) e = i;
  41552. e += +str.slice(i + 1);
  41553. str = str.substring(0, i);
  41554. } else if (e < 0) {
  41555. // Integer.
  41556. e = str.length;
  41557. }
  41558. // Determine leading zeros.
  41559. for (i = 0; str.charCodeAt(i) === 48; i++);
  41560. // Determine trailing zeros.
  41561. for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
  41562. str = str.slice(i, len);
  41563. if (str) {
  41564. len -= i;
  41565. x.e = e = e - i - 1;
  41566. x.d = [];
  41567. // Transform base
  41568. // e is the base 10 exponent.
  41569. // i is where to slice str to get the first word of the digits array.
  41570. i = (e + 1) % LOG_BASE;
  41571. if (e < 0) i += LOG_BASE;
  41572. if (i < len) {
  41573. if (i) x.d.push(+str.slice(0, i));
  41574. for (len -= LOG_BASE; i < len;) x.d.push(+str.slice(i, i += LOG_BASE));
  41575. str = str.slice(i);
  41576. i = LOG_BASE - str.length;
  41577. } else {
  41578. i -= len;
  41579. }
  41580. for (; i--;) str += '0';
  41581. x.d.push(+str);
  41582. if (external) {
  41583. // Overflow?
  41584. if (x.e > x.constructor.maxE) {
  41585. // Infinity.
  41586. x.d = null;
  41587. x.e = NaN;
  41588. // Underflow?
  41589. } else if (x.e < x.constructor.minE) {
  41590. // Zero.
  41591. x.e = 0;
  41592. x.d = [0];
  41593. // x.constructor.underflow = true;
  41594. } // else x.constructor.underflow = false;
  41595. }
  41596. } else {
  41597. // Zero.
  41598. x.e = 0;
  41599. x.d = [0];
  41600. }
  41601. return x;
  41602. }
  41603. /*
  41604. * Parse the value of a new Decimal `x` from a string `str`, which is not a decimal value.
  41605. */
  41606. function parseOther(x, str) {
  41607. var base, Ctor, divisor, i, isFloat, len, p, xd, xe;
  41608. if (str === 'Infinity' || str === 'NaN') {
  41609. if (!+str) x.s = NaN;
  41610. x.e = NaN;
  41611. x.d = null;
  41612. return x;
  41613. }
  41614. if (isHex.test(str)) {
  41615. base = 16;
  41616. str = str.toLowerCase();
  41617. } else if (isBinary.test(str)) {
  41618. base = 2;
  41619. } else if (isOctal.test(str)) {
  41620. base = 8;
  41621. } else {
  41622. throw Error(invalidArgument + str);
  41623. }
  41624. // Is there a binary exponent part?
  41625. i = str.search(/p/i);
  41626. if (i > 0) {
  41627. p = +str.slice(i + 1);
  41628. str = str.substring(2, i);
  41629. } else {
  41630. str = str.slice(2);
  41631. }
  41632. // Convert `str` as an integer then divide the result by `base` raised to a power such that the
  41633. // fraction part will be restored.
  41634. i = str.indexOf('.');
  41635. isFloat = i >= 0;
  41636. Ctor = x.constructor;
  41637. if (isFloat) {
  41638. str = str.replace('.', '');
  41639. len = str.length;
  41640. i = len - i;
  41641. // log[10](16) = 1.2041... , log[10](88) = 1.9444....
  41642. divisor = intPow(Ctor, new Ctor(base), i, i * 2);
  41643. }
  41644. xd = convertBase(str, base, BASE);
  41645. xe = xd.length - 1;
  41646. // Remove trailing zeros.
  41647. for (i = xe; xd[i] === 0; --i) xd.pop();
  41648. if (i < 0) return new Ctor(x.s * 0);
  41649. x.e = getBase10Exponent(xd, xe);
  41650. x.d = xd;
  41651. external = false;
  41652. // At what precision to perform the division to ensure exact conversion?
  41653. // maxDecimalIntegerPartDigitCount = ceil(log[10](b) * otherBaseIntegerPartDigitCount)
  41654. // log[10](2) = 0.30103, log[10](8) = 0.90309, log[10](16) = 1.20412
  41655. // E.g. ceil(1.2 * 3) = 4, so up to 4 decimal digits are needed to represent 3 hex int digits.
  41656. // maxDecimalFractionPartDigitCount = {Hex:4|Oct:3|Bin:1} * otherBaseFractionPartDigitCount
  41657. // Therefore using 4 * the number of digits of str will always be enough.
  41658. if (isFloat) x = divide(x, divisor, len * 4);
  41659. // Multiply by the binary exponent part if present.
  41660. if (p) x = x.times(Math.abs(p) < 54 ? Math.pow(2, p) : Decimal.pow(2, p));
  41661. external = true;
  41662. return x;
  41663. }
  41664. /*
  41665. * sin(x) = x - x^3/3! + x^5/5! - ...
  41666. * |x| < pi/2
  41667. *
  41668. */
  41669. function sine(Ctor, x) {
  41670. var k,
  41671. len = x.d.length;
  41672. if (len < 3) return taylorSeries(Ctor, 2, x, x);
  41673. // Argument reduction: sin(5x) = 16*sin^5(x) - 20*sin^3(x) + 5*sin(x)
  41674. // i.e. sin(x) = 16*sin^5(x/5) - 20*sin^3(x/5) + 5*sin(x/5)
  41675. // and sin(x) = sin(x/5)(5 + sin^2(x/5)(16sin^2(x/5) - 20))
  41676. // Estimate the optimum number of times to use the argument reduction.
  41677. k = 1.4 * Math.sqrt(len);
  41678. k = k > 16 ? 16 : k | 0;
  41679. // Max k before Math.pow precision loss is 22
  41680. x = x.times(Math.pow(5, -k));
  41681. x = taylorSeries(Ctor, 2, x, x);
  41682. // Reverse argument reduction
  41683. var sin2_x,
  41684. d5 = new Ctor(5),
  41685. d16 = new Ctor(16),
  41686. d20 = new Ctor(20);
  41687. for (; k--;) {
  41688. sin2_x = x.times(x);
  41689. x = x.times(d5.plus(sin2_x.times(d16.times(sin2_x).minus(d20))));
  41690. }
  41691. return x;
  41692. }
  41693. // Calculate Taylor series for `cos`, `cosh`, `sin` and `sinh`.
  41694. function taylorSeries(Ctor, n, x, y, isHyperbolic) {
  41695. var j, t, u, x2,
  41696. i = 1,
  41697. pr = Ctor.precision,
  41698. k = Math.ceil(pr / LOG_BASE);
  41699. external = false;
  41700. x2 = x.times(x);
  41701. u = new Ctor(y);
  41702. for (;;) {
  41703. t = divide(u.times(x2), new Ctor(n++ * n++), pr, 1);
  41704. u = isHyperbolic ? y.plus(t) : y.minus(t);
  41705. y = divide(t.times(x2), new Ctor(n++ * n++), pr, 1);
  41706. t = u.plus(y);
  41707. if (t.d[k] !== void 0) {
  41708. for (j = k; t.d[j] === u.d[j] && j--;);
  41709. if (j == -1) break;
  41710. }
  41711. j = u;
  41712. u = y;
  41713. y = t;
  41714. t = j;
  41715. i++;
  41716. }
  41717. external = true;
  41718. t.d.length = k + 1;
  41719. return t;
  41720. }
  41721. // Return the absolute value of `x` reduced to less than or equal to half pi.
  41722. function toLessThanHalfPi(Ctor, x) {
  41723. var t,
  41724. isNeg = x.s < 0,
  41725. pi = getPi(Ctor, Ctor.precision, 1),
  41726. halfPi = pi.times(0.5);
  41727. x = x.abs();
  41728. if (x.lte(halfPi)) {
  41729. quadrant = isNeg ? 4 : 1;
  41730. return x;
  41731. }
  41732. t = x.divToInt(pi);
  41733. if (t.isZero()) {
  41734. quadrant = isNeg ? 3 : 2;
  41735. } else {
  41736. x = x.minus(t.times(pi));
  41737. // 0 <= x < pi
  41738. if (x.lte(halfPi)) {
  41739. quadrant = isOdd(t) ? (isNeg ? 2 : 3) : (isNeg ? 4 : 1);
  41740. return x;
  41741. }
  41742. quadrant = isOdd(t) ? (isNeg ? 1 : 4) : (isNeg ? 3 : 2);
  41743. }
  41744. return x.minus(pi).abs();
  41745. }
  41746. /*
  41747. * Return the value of Decimal `x` as a string in base `baseOut`.
  41748. *
  41749. * If the optional `sd` argument is present include a binary exponent suffix.
  41750. */
  41751. function toStringBinary(x, baseOut, sd, rm) {
  41752. var base, e, i, k, len, roundUp, str, xd, y,
  41753. Ctor = x.constructor,
  41754. isExp = sd !== void 0;
  41755. if (isExp) {
  41756. checkInt32(sd, 1, MAX_DIGITS);
  41757. if (rm === void 0) rm = Ctor.rounding;
  41758. else checkInt32(rm, 0, 8);
  41759. } else {
  41760. sd = Ctor.precision;
  41761. rm = Ctor.rounding;
  41762. }
  41763. if (!x.isFinite()) {
  41764. str = nonFiniteToString(x);
  41765. } else {
  41766. str = finiteToString(x);
  41767. i = str.indexOf('.');
  41768. // Use exponential notation according to `toExpPos` and `toExpNeg`? No, but if required:
  41769. // maxBinaryExponent = floor((decimalExponent + 1) * log[2](10))
  41770. // minBinaryExponent = floor(decimalExponent * log[2](10))
  41771. // log[2](10) = 3.321928094887362347870319429489390175864
  41772. if (isExp) {
  41773. base = 2;
  41774. if (baseOut == 16) {
  41775. sd = sd * 4 - 3;
  41776. } else if (baseOut == 8) {
  41777. sd = sd * 3 - 2;
  41778. }
  41779. } else {
  41780. base = baseOut;
  41781. }
  41782. // Convert the number as an integer then divide the result by its base raised to a power such
  41783. // that the fraction part will be restored.
  41784. // Non-integer.
  41785. if (i >= 0) {
  41786. str = str.replace('.', '');
  41787. y = new Ctor(1);
  41788. y.e = str.length - i;
  41789. y.d = convertBase(finiteToString(y), 10, base);
  41790. y.e = y.d.length;
  41791. }
  41792. xd = convertBase(str, 10, base);
  41793. e = len = xd.length;
  41794. // Remove trailing zeros.
  41795. for (; xd[--len] == 0;) xd.pop();
  41796. if (!xd[0]) {
  41797. str = isExp ? '0p+0' : '0';
  41798. } else {
  41799. if (i < 0) {
  41800. e--;
  41801. } else {
  41802. x = new Ctor(x);
  41803. x.d = xd;
  41804. x.e = e;
  41805. x = divide(x, y, sd, rm, 0, base);
  41806. xd = x.d;
  41807. e = x.e;
  41808. roundUp = inexact;
  41809. }
  41810. // The rounding digit, i.e. the digit after the digit that may be rounded up.
  41811. i = xd[sd];
  41812. k = base / 2;
  41813. roundUp = roundUp || xd[sd + 1] !== void 0;
  41814. roundUp = rm < 4
  41815. ? (i !== void 0 || roundUp) && (rm === 0 || rm === (x.s < 0 ? 3 : 2))
  41816. : i > k || i === k && (rm === 4 || roundUp || rm === 6 && xd[sd - 1] & 1 ||
  41817. rm === (x.s < 0 ? 8 : 7));
  41818. xd.length = sd;
  41819. if (roundUp) {
  41820. // Rounding up may mean the previous digit has to be rounded up and so on.
  41821. for (; ++xd[--sd] > base - 1;) {
  41822. xd[sd] = 0;
  41823. if (!sd) {
  41824. ++e;
  41825. xd.unshift(1);
  41826. }
  41827. }
  41828. }
  41829. // Determine trailing zeros.
  41830. for (len = xd.length; !xd[len - 1]; --len);
  41831. // E.g. [4, 11, 15] becomes 4bf.
  41832. for (i = 0, str = ''; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41833. // Add binary exponent suffix?
  41834. if (isExp) {
  41835. if (len > 1) {
  41836. if (baseOut == 16 || baseOut == 8) {
  41837. i = baseOut == 16 ? 4 : 3;
  41838. for (--len; len % i; len++) str += '0';
  41839. xd = convertBase(str, base, baseOut);
  41840. for (len = xd.length; !xd[len - 1]; --len);
  41841. // xd[0] will always be be 1
  41842. for (i = 1, str = '1.'; i < len; i++) str += NUMERALS.charAt(xd[i]);
  41843. } else {
  41844. str = str.charAt(0) + '.' + str.slice(1);
  41845. }
  41846. }
  41847. str = str + (e < 0 ? 'p' : 'p+') + e;
  41848. } else if (e < 0) {
  41849. for (; ++e;) str = '0' + str;
  41850. str = '0.' + str;
  41851. } else {
  41852. if (++e > len) for (e -= len; e-- ;) str += '0';
  41853. else if (e < len) str = str.slice(0, e) + '.' + str.slice(e);
  41854. }
  41855. }
  41856. str = (baseOut == 16 ? '0x' : baseOut == 2 ? '0b' : baseOut == 8 ? '0o' : '') + str;
  41857. }
  41858. return x.s < 0 ? '-' + str : str;
  41859. }
  41860. // Does not strip trailing zeros.
  41861. function truncate(arr, len) {
  41862. if (arr.length > len) {
  41863. arr.length = len;
  41864. return true;
  41865. }
  41866. }
  41867. // Decimal methods
  41868. /*
  41869. * abs
  41870. * acos
  41871. * acosh
  41872. * add
  41873. * asin
  41874. * asinh
  41875. * atan
  41876. * atanh
  41877. * atan2
  41878. * cbrt
  41879. * ceil
  41880. * clone
  41881. * config
  41882. * cos
  41883. * cosh
  41884. * div
  41885. * exp
  41886. * floor
  41887. * hypot
  41888. * ln
  41889. * log
  41890. * log2
  41891. * log10
  41892. * max
  41893. * min
  41894. * mod
  41895. * mul
  41896. * pow
  41897. * random
  41898. * round
  41899. * set
  41900. * sign
  41901. * sin
  41902. * sinh
  41903. * sqrt
  41904. * sub
  41905. * tan
  41906. * tanh
  41907. * trunc
  41908. */
  41909. /*
  41910. * Return a new Decimal whose value is the absolute value of `x`.
  41911. *
  41912. * x {number|string|Decimal}
  41913. *
  41914. */
  41915. function abs(x) {
  41916. return new this(x).abs();
  41917. }
  41918. /*
  41919. * Return a new Decimal whose value is the arccosine in radians of `x`.
  41920. *
  41921. * x {number|string|Decimal}
  41922. *
  41923. */
  41924. function acos(x) {
  41925. return new this(x).acos();
  41926. }
  41927. /*
  41928. * Return a new Decimal whose value is the inverse of the hyperbolic cosine of `x`, rounded to
  41929. * `precision` significant digits using rounding mode `rounding`.
  41930. *
  41931. * x {number|string|Decimal} A value in radians.
  41932. *
  41933. */
  41934. function acosh(x) {
  41935. return new this(x).acosh();
  41936. }
  41937. /*
  41938. * Return a new Decimal whose value is the sum of `x` and `y`, rounded to `precision` significant
  41939. * digits using rounding mode `rounding`.
  41940. *
  41941. * x {number|string|Decimal}
  41942. * y {number|string|Decimal}
  41943. *
  41944. */
  41945. function add(x, y) {
  41946. return new this(x).plus(y);
  41947. }
  41948. /*
  41949. * Return a new Decimal whose value is the arcsine in radians of `x`, rounded to `precision`
  41950. * significant digits using rounding mode `rounding`.
  41951. *
  41952. * x {number|string|Decimal}
  41953. *
  41954. */
  41955. function asin(x) {
  41956. return new this(x).asin();
  41957. }
  41958. /*
  41959. * Return a new Decimal whose value is the inverse of the hyperbolic sine of `x`, rounded to
  41960. * `precision` significant digits using rounding mode `rounding`.
  41961. *
  41962. * x {number|string|Decimal} A value in radians.
  41963. *
  41964. */
  41965. function asinh(x) {
  41966. return new this(x).asinh();
  41967. }
  41968. /*
  41969. * Return a new Decimal whose value is the arctangent in radians of `x`, rounded to `precision`
  41970. * significant digits using rounding mode `rounding`.
  41971. *
  41972. * x {number|string|Decimal}
  41973. *
  41974. */
  41975. function atan(x) {
  41976. return new this(x).atan();
  41977. }
  41978. /*
  41979. * Return a new Decimal whose value is the inverse of the hyperbolic tangent of `x`, rounded to
  41980. * `precision` significant digits using rounding mode `rounding`.
  41981. *
  41982. * x {number|string|Decimal} A value in radians.
  41983. *
  41984. */
  41985. function atanh(x) {
  41986. return new this(x).atanh();
  41987. }
  41988. /*
  41989. * Return a new Decimal whose value is the arctangent in radians of `y/x` in the range -pi to pi
  41990. * (inclusive), rounded to `precision` significant digits using rounding mode `rounding`.
  41991. *
  41992. * Domain: [-Infinity, Infinity]
  41993. * Range: [-pi, pi]
  41994. *
  41995. * y {number|string|Decimal} The y-coordinate.
  41996. * x {number|string|Decimal} The x-coordinate.
  41997. *
  41998. * atan2(±0, -0) = ±pi
  41999. * atan2(±0, +0) = ±0
  42000. * atan2(±0, -x) = ±pi for x > 0
  42001. * atan2(±0, x) = ±0 for x > 0
  42002. * atan2(-y, ±0) = -pi/2 for y > 0
  42003. * atan2(y, ±0) = pi/2 for y > 0
  42004. * atan2(±y, -Infinity) = ±pi for finite y > 0
  42005. * atan2(±y, +Infinity) = ±0 for finite y > 0
  42006. * atan2(±Infinity, x) = ±pi/2 for finite x
  42007. * atan2(±Infinity, -Infinity) = ±3*pi/4
  42008. * atan2(±Infinity, +Infinity) = ±pi/4
  42009. * atan2(NaN, x) = NaN
  42010. * atan2(y, NaN) = NaN
  42011. *
  42012. */
  42013. function atan2(y, x) {
  42014. y = new this(y);
  42015. x = new this(x);
  42016. var r,
  42017. pr = this.precision,
  42018. rm = this.rounding,
  42019. wpr = pr + 4;
  42020. // Either NaN
  42021. if (!y.s || !x.s) {
  42022. r = new this(NaN);
  42023. // Both ±Infinity
  42024. } else if (!y.d && !x.d) {
  42025. r = getPi(this, wpr, 1).times(x.s > 0 ? 0.25 : 0.75);
  42026. r.s = y.s;
  42027. // x is ±Infinity or y is ±0
  42028. } else if (!x.d || y.isZero()) {
  42029. r = x.s < 0 ? getPi(this, pr, rm) : new this(0);
  42030. r.s = y.s;
  42031. // y is ±Infinity or x is ±0
  42032. } else if (!y.d || x.isZero()) {
  42033. r = getPi(this, wpr, 1).times(0.5);
  42034. r.s = y.s;
  42035. // Both non-zero and finite
  42036. } else if (x.s < 0) {
  42037. this.precision = wpr;
  42038. this.rounding = 1;
  42039. r = this.atan(divide(y, x, wpr, 1));
  42040. x = getPi(this, wpr, 1);
  42041. this.precision = pr;
  42042. this.rounding = rm;
  42043. r = y.s < 0 ? r.minus(x) : r.plus(x);
  42044. } else {
  42045. r = this.atan(divide(y, x, wpr, 1));
  42046. }
  42047. return r;
  42048. }
  42049. /*
  42050. * Return a new Decimal whose value is the cube root of `x`, rounded to `precision` significant
  42051. * digits using rounding mode `rounding`.
  42052. *
  42053. * x {number|string|Decimal}
  42054. *
  42055. */
  42056. function cbrt(x) {
  42057. return new this(x).cbrt();
  42058. }
  42059. /*
  42060. * Return a new Decimal whose value is `x` rounded to an integer using `ROUND_CEIL`.
  42061. *
  42062. * x {number|string|Decimal}
  42063. *
  42064. */
  42065. function ceil(x) {
  42066. return finalise(x = new this(x), x.e + 1, 2);
  42067. }
  42068. /*
  42069. * Configure global settings for a Decimal constructor.
  42070. *
  42071. * `obj` is an object with one or more of the following properties,
  42072. *
  42073. * precision {number}
  42074. * rounding {number}
  42075. * toExpNeg {number}
  42076. * toExpPos {number}
  42077. * maxE {number}
  42078. * minE {number}
  42079. * modulo {number}
  42080. * crypto {boolean|number}
  42081. * defaults {true}
  42082. *
  42083. * E.g. Decimal.config({ precision: 20, rounding: 4 })
  42084. *
  42085. */
  42086. function config(obj) {
  42087. if (!obj || typeof obj !== 'object') throw Error(decimalError + 'Object expected');
  42088. var i, p, v,
  42089. useDefaults = obj.defaults === true,
  42090. ps = [
  42091. 'precision', 1, MAX_DIGITS,
  42092. 'rounding', 0, 8,
  42093. 'toExpNeg', -EXP_LIMIT, 0,
  42094. 'toExpPos', 0, EXP_LIMIT,
  42095. 'maxE', 0, EXP_LIMIT,
  42096. 'minE', -EXP_LIMIT, 0,
  42097. 'modulo', 0, 9
  42098. ];
  42099. for (i = 0; i < ps.length; i += 3) {
  42100. if (p = ps[i], useDefaults) this[p] = DEFAULTS[p];
  42101. if ((v = obj[p]) !== void 0) {
  42102. if (mathfloor(v) === v && v >= ps[i + 1] && v <= ps[i + 2]) this[p] = v;
  42103. else throw Error(invalidArgument + p + ': ' + v);
  42104. }
  42105. }
  42106. if (p = 'crypto', useDefaults) this[p] = DEFAULTS[p];
  42107. if ((v = obj[p]) !== void 0) {
  42108. if (v === true || v === false || v === 0 || v === 1) {
  42109. if (v) {
  42110. if (typeof crypto != 'undefined' && crypto &&
  42111. (crypto.getRandomValues || crypto.randomBytes)) {
  42112. this[p] = true;
  42113. } else {
  42114. throw Error(cryptoUnavailable);
  42115. }
  42116. } else {
  42117. this[p] = false;
  42118. }
  42119. } else {
  42120. throw Error(invalidArgument + p + ': ' + v);
  42121. }
  42122. }
  42123. return this;
  42124. }
  42125. /*
  42126. * Return a new Decimal whose value is the cosine of `x`, rounded to `precision` significant
  42127. * digits using rounding mode `rounding`.
  42128. *
  42129. * x {number|string|Decimal} A value in radians.
  42130. *
  42131. */
  42132. function cos(x) {
  42133. return new this(x).cos();
  42134. }
  42135. /*
  42136. * Return a new Decimal whose value is the hyperbolic cosine of `x`, rounded to precision
  42137. * significant digits using rounding mode `rounding`.
  42138. *
  42139. * x {number|string|Decimal} A value in radians.
  42140. *
  42141. */
  42142. function cosh(x) {
  42143. return new this(x).cosh();
  42144. }
  42145. /*
  42146. * Create and return a Decimal constructor with the same configuration properties as this Decimal
  42147. * constructor.
  42148. *
  42149. */
  42150. function clone(obj) {
  42151. var i, p, ps;
  42152. /*
  42153. * The Decimal constructor and exported function.
  42154. * Return a new Decimal instance.
  42155. *
  42156. * v {number|string|Decimal} A numeric value.
  42157. *
  42158. */
  42159. function Decimal(v) {
  42160. var e, i, t,
  42161. x = this;
  42162. // Decimal called without new.
  42163. if (!(x instanceof Decimal)) return new Decimal(v);
  42164. // Retain a reference to this Decimal constructor, and shadow Decimal.prototype.constructor
  42165. // which points to Object.
  42166. x.constructor = Decimal;
  42167. // Duplicate.
  42168. if (v instanceof Decimal) {
  42169. x.s = v.s;
  42170. if (external) {
  42171. if (!v.d || v.e > Decimal.maxE) {
  42172. // Infinity.
  42173. x.e = NaN;
  42174. x.d = null;
  42175. } else if (v.e < Decimal.minE) {
  42176. // Zero.
  42177. x.e = 0;
  42178. x.d = [0];
  42179. } else {
  42180. x.e = v.e;
  42181. x.d = v.d.slice();
  42182. }
  42183. } else {
  42184. x.e = v.e;
  42185. x.d = v.d ? v.d.slice() : v.d;
  42186. }
  42187. return;
  42188. }
  42189. t = typeof v;
  42190. if (t === 'number') {
  42191. if (v === 0) {
  42192. x.s = 1 / v < 0 ? -1 : 1;
  42193. x.e = 0;
  42194. x.d = [0];
  42195. return;
  42196. }
  42197. if (v < 0) {
  42198. v = -v;
  42199. x.s = -1;
  42200. } else {
  42201. x.s = 1;
  42202. }
  42203. // Fast path for small integers.
  42204. if (v === ~~v && v < 1e7) {
  42205. for (e = 0, i = v; i >= 10; i /= 10) e++;
  42206. if (external) {
  42207. if (e > Decimal.maxE) {
  42208. x.e = NaN;
  42209. x.d = null;
  42210. } else if (e < Decimal.minE) {
  42211. x.e = 0;
  42212. x.d = [0];
  42213. } else {
  42214. x.e = e;
  42215. x.d = [v];
  42216. }
  42217. } else {
  42218. x.e = e;
  42219. x.d = [v];
  42220. }
  42221. return;
  42222. // Infinity, NaN.
  42223. } else if (v * 0 !== 0) {
  42224. if (!v) x.s = NaN;
  42225. x.e = NaN;
  42226. x.d = null;
  42227. return;
  42228. }
  42229. return parseDecimal(x, v.toString());
  42230. } else if (t !== 'string') {
  42231. throw Error(invalidArgument + v);
  42232. }
  42233. // Minus sign?
  42234. if (v.charCodeAt(0) === 45) {
  42235. v = v.slice(1);
  42236. x.s = -1;
  42237. } else {
  42238. x.s = 1;
  42239. }
  42240. return isDecimal.test(v) ? parseDecimal(x, v) : parseOther(x, v);
  42241. }
  42242. Decimal.prototype = P;
  42243. Decimal.ROUND_UP = 0;
  42244. Decimal.ROUND_DOWN = 1;
  42245. Decimal.ROUND_CEIL = 2;
  42246. Decimal.ROUND_FLOOR = 3;
  42247. Decimal.ROUND_HALF_UP = 4;
  42248. Decimal.ROUND_HALF_DOWN = 5;
  42249. Decimal.ROUND_HALF_EVEN = 6;
  42250. Decimal.ROUND_HALF_CEIL = 7;
  42251. Decimal.ROUND_HALF_FLOOR = 8;
  42252. Decimal.EUCLID = 9;
  42253. Decimal.config = Decimal.set = config;
  42254. Decimal.clone = clone;
  42255. Decimal.isDecimal = isDecimalInstance;
  42256. Decimal.abs = abs;
  42257. Decimal.acos = acos;
  42258. Decimal.acosh = acosh; // ES6
  42259. Decimal.add = add;
  42260. Decimal.asin = asin;
  42261. Decimal.asinh = asinh; // ES6
  42262. Decimal.atan = atan;
  42263. Decimal.atanh = atanh; // ES6
  42264. Decimal.atan2 = atan2;
  42265. Decimal.cbrt = cbrt; // ES6
  42266. Decimal.ceil = ceil;
  42267. Decimal.cos = cos;
  42268. Decimal.cosh = cosh; // ES6
  42269. Decimal.div = div;
  42270. Decimal.exp = exp;
  42271. Decimal.floor = floor;
  42272. Decimal.hypot = hypot; // ES6
  42273. Decimal.ln = ln;
  42274. Decimal.log = log;
  42275. Decimal.log10 = log10; // ES6
  42276. Decimal.log2 = log2; // ES6
  42277. Decimal.max = max;
  42278. Decimal.min = min;
  42279. Decimal.mod = mod;
  42280. Decimal.mul = mul;
  42281. Decimal.pow = pow;
  42282. Decimal.random = random;
  42283. Decimal.round = round;
  42284. Decimal.sign = sign; // ES6
  42285. Decimal.sin = sin;
  42286. Decimal.sinh = sinh; // ES6
  42287. Decimal.sqrt = sqrt;
  42288. Decimal.sub = sub;
  42289. Decimal.tan = tan;
  42290. Decimal.tanh = tanh; // ES6
  42291. Decimal.trunc = trunc; // ES6
  42292. if (obj === void 0) obj = {};
  42293. if (obj) {
  42294. if (obj.defaults !== true) {
  42295. ps = ['precision', 'rounding', 'toExpNeg', 'toExpPos', 'maxE', 'minE', 'modulo', 'crypto'];
  42296. for (i = 0; i < ps.length;) if (!obj.hasOwnProperty(p = ps[i++])) obj[p] = this[p];
  42297. }
  42298. }
  42299. Decimal.config(obj);
  42300. return Decimal;
  42301. }
  42302. /*
  42303. * Return a new Decimal whose value is `x` divided by `y`, rounded to `precision` significant
  42304. * digits using rounding mode `rounding`.
  42305. *
  42306. * x {number|string|Decimal}
  42307. * y {number|string|Decimal}
  42308. *
  42309. */
  42310. function div(x, y) {
  42311. return new this(x).div(y);
  42312. }
  42313. /*
  42314. * Return a new Decimal whose value is the natural exponential of `x`, rounded to `precision`
  42315. * significant digits using rounding mode `rounding`.
  42316. *
  42317. * x {number|string|Decimal} The power to which to raise the base of the natural log.
  42318. *
  42319. */
  42320. function exp(x) {
  42321. return new this(x).exp();
  42322. }
  42323. /*
  42324. * Return a new Decimal whose value is `x` round to an integer using `ROUND_FLOOR`.
  42325. *
  42326. * x {number|string|Decimal}
  42327. *
  42328. */
  42329. function floor(x) {
  42330. return finalise(x = new this(x), x.e + 1, 3);
  42331. }
  42332. /*
  42333. * Return a new Decimal whose value is the square root of the sum of the squares of the arguments,
  42334. * rounded to `precision` significant digits using rounding mode `rounding`.
  42335. *
  42336. * hypot(a, b, ...) = sqrt(a^2 + b^2 + ...)
  42337. *
  42338. */
  42339. function hypot() {
  42340. var i, n,
  42341. t = new this(0);
  42342. external = false;
  42343. for (i = 0; i < arguments.length;) {
  42344. n = new this(arguments[i++]);
  42345. if (!n.d) {
  42346. if (n.s) {
  42347. external = true;
  42348. return new this(1 / 0);
  42349. }
  42350. t = n;
  42351. } else if (t.d) {
  42352. t = t.plus(n.times(n));
  42353. }
  42354. }
  42355. external = true;
  42356. return t.sqrt();
  42357. }
  42358. /*
  42359. * Return true if object is a Decimal instance (where Decimal is any Decimal constructor),
  42360. * otherwise return false.
  42361. *
  42362. */
  42363. function isDecimalInstance(obj) {
  42364. return obj instanceof Decimal || obj && obj.name === '[object Decimal]' || false;
  42365. }
  42366. /*
  42367. * Return a new Decimal whose value is the natural logarithm of `x`, rounded to `precision`
  42368. * significant digits using rounding mode `rounding`.
  42369. *
  42370. * x {number|string|Decimal}
  42371. *
  42372. */
  42373. function ln(x) {
  42374. return new this(x).ln();
  42375. }
  42376. /*
  42377. * Return a new Decimal whose value is the log of `x` to the base `y`, or to base 10 if no base
  42378. * is specified, rounded to `precision` significant digits using rounding mode `rounding`.
  42379. *
  42380. * log[y](x)
  42381. *
  42382. * x {number|string|Decimal} The argument of the logarithm.
  42383. * y {number|string|Decimal} The base of the logarithm.
  42384. *
  42385. */
  42386. function log(x, y) {
  42387. return new this(x).log(y);
  42388. }
  42389. /*
  42390. * Return a new Decimal whose value is the base 2 logarithm of `x`, rounded to `precision`
  42391. * significant digits using rounding mode `rounding`.
  42392. *
  42393. * x {number|string|Decimal}
  42394. *
  42395. */
  42396. function log2(x) {
  42397. return new this(x).log(2);
  42398. }
  42399. /*
  42400. * Return a new Decimal whose value is the base 10 logarithm of `x`, rounded to `precision`
  42401. * significant digits using rounding mode `rounding`.
  42402. *
  42403. * x {number|string|Decimal}
  42404. *
  42405. */
  42406. function log10(x) {
  42407. return new this(x).log(10);
  42408. }
  42409. /*
  42410. * Return a new Decimal whose value is the maximum of the arguments.
  42411. *
  42412. * arguments {number|string|Decimal}
  42413. *
  42414. */
  42415. function max() {
  42416. return maxOrMin(this, arguments, 'lt');
  42417. }
  42418. /*
  42419. * Return a new Decimal whose value is the minimum of the arguments.
  42420. *
  42421. * arguments {number|string|Decimal}
  42422. *
  42423. */
  42424. function min() {
  42425. return maxOrMin(this, arguments, 'gt');
  42426. }
  42427. /*
  42428. * Return a new Decimal whose value is `x` modulo `y`, rounded to `precision` significant digits
  42429. * using rounding mode `rounding`.
  42430. *
  42431. * x {number|string|Decimal}
  42432. * y {number|string|Decimal}
  42433. *
  42434. */
  42435. function mod(x, y) {
  42436. return new this(x).mod(y);
  42437. }
  42438. /*
  42439. * Return a new Decimal whose value is `x` multiplied by `y`, rounded to `precision` significant
  42440. * digits using rounding mode `rounding`.
  42441. *
  42442. * x {number|string|Decimal}
  42443. * y {number|string|Decimal}
  42444. *
  42445. */
  42446. function mul(x, y) {
  42447. return new this(x).mul(y);
  42448. }
  42449. /*
  42450. * Return a new Decimal whose value is `x` raised to the power `y`, rounded to precision
  42451. * significant digits using rounding mode `rounding`.
  42452. *
  42453. * x {number|string|Decimal} The base.
  42454. * y {number|string|Decimal} The exponent.
  42455. *
  42456. */
  42457. function pow(x, y) {
  42458. return new this(x).pow(y);
  42459. }
  42460. /*
  42461. * Returns a new Decimal with a random value equal to or greater than 0 and less than 1, and with
  42462. * `sd`, or `Decimal.precision` if `sd` is omitted, significant digits (or less if trailing zeros
  42463. * are produced).
  42464. *
  42465. * [sd] {number} Significant digits. Integer, 0 to MAX_DIGITS inclusive.
  42466. *
  42467. */
  42468. function random(sd) {
  42469. var d, e, k, n,
  42470. i = 0,
  42471. r = new this(1),
  42472. rd = [];
  42473. if (sd === void 0) sd = this.precision;
  42474. else checkInt32(sd, 1, MAX_DIGITS);
  42475. k = Math.ceil(sd / LOG_BASE);
  42476. if (!this.crypto) {
  42477. for (; i < k;) rd[i++] = Math.random() * 1e7 | 0;
  42478. // Browsers supporting crypto.getRandomValues.
  42479. } else if (crypto.getRandomValues) {
  42480. d = crypto.getRandomValues(new Uint32Array(k));
  42481. for (; i < k;) {
  42482. n = d[i];
  42483. // 0 <= n < 4294967296
  42484. // Probability n >= 4.29e9, is 4967296 / 4294967296 = 0.00116 (1 in 865).
  42485. if (n >= 4.29e9) {
  42486. d[i] = crypto.getRandomValues(new Uint32Array(1))[0];
  42487. } else {
  42488. // 0 <= n <= 4289999999
  42489. // 0 <= (n % 1e7) <= 9999999
  42490. rd[i++] = n % 1e7;
  42491. }
  42492. }
  42493. // Node.js supporting crypto.randomBytes.
  42494. } else if (crypto.randomBytes) {
  42495. // buffer
  42496. d = crypto.randomBytes(k *= 4);
  42497. for (; i < k;) {
  42498. // 0 <= n < 2147483648
  42499. n = d[i] + (d[i + 1] << 8) + (d[i + 2] << 16) + ((d[i + 3] & 0x7f) << 24);
  42500. // Probability n >= 2.14e9, is 7483648 / 2147483648 = 0.0035 (1 in 286).
  42501. if (n >= 2.14e9) {
  42502. crypto.randomBytes(4).copy(d, i);
  42503. } else {
  42504. // 0 <= n <= 2139999999
  42505. // 0 <= (n % 1e7) <= 9999999
  42506. rd.push(n % 1e7);
  42507. i += 4;
  42508. }
  42509. }
  42510. i = k / 4;
  42511. } else {
  42512. throw Error(cryptoUnavailable);
  42513. }
  42514. k = rd[--i];
  42515. sd %= LOG_BASE;
  42516. // Convert trailing digits to zeros according to sd.
  42517. if (k && sd) {
  42518. n = mathpow(10, LOG_BASE - sd);
  42519. rd[i] = (k / n | 0) * n;
  42520. }
  42521. // Remove trailing words which are zero.
  42522. for (; rd[i] === 0; i--) rd.pop();
  42523. // Zero?
  42524. if (i < 0) {
  42525. e = 0;
  42526. rd = [0];
  42527. } else {
  42528. e = -1;
  42529. // Remove leading words which are zero and adjust exponent accordingly.
  42530. for (; rd[0] === 0; e -= LOG_BASE) rd.shift();
  42531. // Count the digits of the first word of rd to determine leading zeros.
  42532. for (k = 1, n = rd[0]; n >= 10; n /= 10) k++;
  42533. // Adjust the exponent for leading zeros of the first word of rd.
  42534. if (k < LOG_BASE) e -= LOG_BASE - k;
  42535. }
  42536. r.e = e;
  42537. r.d = rd;
  42538. return r;
  42539. }
  42540. /*
  42541. * Return a new Decimal whose value is `x` rounded to an integer using rounding mode `rounding`.
  42542. *
  42543. * To emulate `Math.round`, set rounding to 7 (ROUND_HALF_CEIL).
  42544. *
  42545. * x {number|string|Decimal}
  42546. *
  42547. */
  42548. function round(x) {
  42549. return finalise(x = new this(x), x.e + 1, this.rounding);
  42550. }
  42551. /*
  42552. * Return
  42553. * 1 if x > 0,
  42554. * -1 if x < 0,
  42555. * 0 if x is 0,
  42556. * -0 if x is -0,
  42557. * NaN otherwise
  42558. *
  42559. */
  42560. function sign(x) {
  42561. x = new this(x);
  42562. return x.d ? (x.d[0] ? x.s : 0 * x.s) : x.s || NaN;
  42563. }
  42564. /*
  42565. * Return a new Decimal whose value is the sine of `x`, rounded to `precision` significant digits
  42566. * using rounding mode `rounding`.
  42567. *
  42568. * x {number|string|Decimal} A value in radians.
  42569. *
  42570. */
  42571. function sin(x) {
  42572. return new this(x).sin();
  42573. }
  42574. /*
  42575. * Return a new Decimal whose value is the hyperbolic sine of `x`, rounded to `precision`
  42576. * significant digits using rounding mode `rounding`.
  42577. *
  42578. * x {number|string|Decimal} A value in radians.
  42579. *
  42580. */
  42581. function sinh(x) {
  42582. return new this(x).sinh();
  42583. }
  42584. /*
  42585. * Return a new Decimal whose value is the square root of `x`, rounded to `precision` significant
  42586. * digits using rounding mode `rounding`.
  42587. *
  42588. * x {number|string|Decimal}
  42589. *
  42590. */
  42591. function sqrt(x) {
  42592. return new this(x).sqrt();
  42593. }
  42594. /*
  42595. * Return a new Decimal whose value is `x` minus `y`, rounded to `precision` significant digits
  42596. * using rounding mode `rounding`.
  42597. *
  42598. * x {number|string|Decimal}
  42599. * y {number|string|Decimal}
  42600. *
  42601. */
  42602. function sub(x, y) {
  42603. return new this(x).sub(y);
  42604. }
  42605. /*
  42606. * Return a new Decimal whose value is the tangent of `x`, rounded to `precision` significant
  42607. * digits using rounding mode `rounding`.
  42608. *
  42609. * x {number|string|Decimal} A value in radians.
  42610. *
  42611. */
  42612. function tan(x) {
  42613. return new this(x).tan();
  42614. }
  42615. /*
  42616. * Return a new Decimal whose value is the hyperbolic tangent of `x`, rounded to `precision`
  42617. * significant digits using rounding mode `rounding`.
  42618. *
  42619. * x {number|string|Decimal} A value in radians.
  42620. *
  42621. */
  42622. function tanh(x) {
  42623. return new this(x).tanh();
  42624. }
  42625. /*
  42626. * Return a new Decimal whose value is `x` truncated to an integer.
  42627. *
  42628. * x {number|string|Decimal}
  42629. *
  42630. */
  42631. function trunc(x) {
  42632. return finalise(x = new this(x), x.e + 1, 1);
  42633. }
  42634. // Create and configure initial Decimal constructor.
  42635. Decimal = clone(DEFAULTS);
  42636. Decimal['default'] = Decimal.Decimal = Decimal;
  42637. // Create the internal constants from their string values.
  42638. LN10 = new Decimal(LN10);
  42639. PI = new Decimal(PI);
  42640. // Export.
  42641. // AMD.
  42642. if (true) {
  42643. !(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {
  42644. return Decimal;
  42645. }).call(exports, __webpack_require__, exports, module),
  42646. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  42647. // Node and other environments that support module.exports.
  42648. } else {}
  42649. })(this);
  42650. /***/ }),
  42651. /***/ "./node_modules/jquery/dist/jquery.js":
  42652. /*!********************************************!*\
  42653. !*** ./node_modules/jquery/dist/jquery.js ***!
  42654. \********************************************/
  42655. /*! no static exports found */
  42656. /***/ (function(module, exports, __webpack_require__) {
  42657. var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
  42658. * jQuery JavaScript Library v3.3.1
  42659. * https://jquery.com/
  42660. *
  42661. * Includes Sizzle.js
  42662. * https://sizzlejs.com/
  42663. *
  42664. * Copyright JS Foundation and other contributors
  42665. * Released under the MIT license
  42666. * https://jquery.org/license
  42667. *
  42668. * Date: 2018-01-20T17:24Z
  42669. */
  42670. ( function( global, factory ) {
  42671. "use strict";
  42672. if ( true && typeof module.exports === "object" ) {
  42673. // For CommonJS and CommonJS-like environments where a proper `window`
  42674. // is present, execute the factory and get jQuery.
  42675. // For environments that do not have a `window` with a `document`
  42676. // (such as Node.js), expose a factory as module.exports.
  42677. // This accentuates the need for the creation of a real `window`.
  42678. // e.g. var jQuery = require("jquery")(window);
  42679. // See ticket #14549 for more info.
  42680. module.exports = global.document ?
  42681. factory( global, true ) :
  42682. function( w ) {
  42683. if ( !w.document ) {
  42684. throw new Error( "jQuery requires a window with a document" );
  42685. }
  42686. return factory( w );
  42687. };
  42688. } else {
  42689. factory( global );
  42690. }
  42691. // Pass this if window is not defined yet
  42692. } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) {
  42693. // Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1
  42694. // throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode
  42695. // arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common
  42696. // enough that all such attempts are guarded in a try block.
  42697. "use strict";
  42698. var arr = [];
  42699. var document = window.document;
  42700. var getProto = Object.getPrototypeOf;
  42701. var slice = arr.slice;
  42702. var concat = arr.concat;
  42703. var push = arr.push;
  42704. var indexOf = arr.indexOf;
  42705. var class2type = {};
  42706. var toString = class2type.toString;
  42707. var hasOwn = class2type.hasOwnProperty;
  42708. var fnToString = hasOwn.toString;
  42709. var ObjectFunctionString = fnToString.call( Object );
  42710. var support = {};
  42711. var isFunction = function isFunction( obj ) {
  42712. // Support: Chrome <=57, Firefox <=52
  42713. // In some browsers, typeof returns "function" for HTML <object> elements
  42714. // (i.e., `typeof document.createElement( "object" ) === "function"`).
  42715. // We don't want to classify *any* DOM node as a function.
  42716. return typeof obj === "function" && typeof obj.nodeType !== "number";
  42717. };
  42718. var isWindow = function isWindow( obj ) {
  42719. return obj != null && obj === obj.window;
  42720. };
  42721. var preservedScriptAttributes = {
  42722. type: true,
  42723. src: true,
  42724. noModule: true
  42725. };
  42726. function DOMEval( code, doc, node ) {
  42727. doc = doc || document;
  42728. var i,
  42729. script = doc.createElement( "script" );
  42730. script.text = code;
  42731. if ( node ) {
  42732. for ( i in preservedScriptAttributes ) {
  42733. if ( node[ i ] ) {
  42734. script[ i ] = node[ i ];
  42735. }
  42736. }
  42737. }
  42738. doc.head.appendChild( script ).parentNode.removeChild( script );
  42739. }
  42740. function toType( obj ) {
  42741. if ( obj == null ) {
  42742. return obj + "";
  42743. }
  42744. // Support: Android <=2.3 only (functionish RegExp)
  42745. return typeof obj === "object" || typeof obj === "function" ?
  42746. class2type[ toString.call( obj ) ] || "object" :
  42747. typeof obj;
  42748. }
  42749. /* global Symbol */
  42750. // Defining this global in .eslintrc.json would create a danger of using the global
  42751. // unguarded in another place, it seems safer to define global only for this module
  42752. var
  42753. version = "3.3.1",
  42754. // Define a local copy of jQuery
  42755. jQuery = function( selector, context ) {
  42756. // The jQuery object is actually just the init constructor 'enhanced'
  42757. // Need init if jQuery is called (just allow error to be thrown if not included)
  42758. return new jQuery.fn.init( selector, context );
  42759. },
  42760. // Support: Android <=4.0 only
  42761. // Make sure we trim BOM and NBSP
  42762. rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;
  42763. jQuery.fn = jQuery.prototype = {
  42764. // The current version of jQuery being used
  42765. jquery: version,
  42766. constructor: jQuery,
  42767. // The default length of a jQuery object is 0
  42768. length: 0,
  42769. toArray: function() {
  42770. return slice.call( this );
  42771. },
  42772. // Get the Nth element in the matched element set OR
  42773. // Get the whole matched element set as a clean array
  42774. get: function( num ) {
  42775. // Return all the elements in a clean array
  42776. if ( num == null ) {
  42777. return slice.call( this );
  42778. }
  42779. // Return just the one element from the set
  42780. return num < 0 ? this[ num + this.length ] : this[ num ];
  42781. },
  42782. // Take an array of elements and push it onto the stack
  42783. // (returning the new matched element set)
  42784. pushStack: function( elems ) {
  42785. // Build a new jQuery matched element set
  42786. var ret = jQuery.merge( this.constructor(), elems );
  42787. // Add the old object onto the stack (as a reference)
  42788. ret.prevObject = this;
  42789. // Return the newly-formed element set
  42790. return ret;
  42791. },
  42792. // Execute a callback for every element in the matched set.
  42793. each: function( callback ) {
  42794. return jQuery.each( this, callback );
  42795. },
  42796. map: function( callback ) {
  42797. return this.pushStack( jQuery.map( this, function( elem, i ) {
  42798. return callback.call( elem, i, elem );
  42799. } ) );
  42800. },
  42801. slice: function() {
  42802. return this.pushStack( slice.apply( this, arguments ) );
  42803. },
  42804. first: function() {
  42805. return this.eq( 0 );
  42806. },
  42807. last: function() {
  42808. return this.eq( -1 );
  42809. },
  42810. eq: function( i ) {
  42811. var len = this.length,
  42812. j = +i + ( i < 0 ? len : 0 );
  42813. return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] );
  42814. },
  42815. end: function() {
  42816. return this.prevObject || this.constructor();
  42817. },
  42818. // For internal use only.
  42819. // Behaves like an Array's method, not like a jQuery method.
  42820. push: push,
  42821. sort: arr.sort,
  42822. splice: arr.splice
  42823. };
  42824. jQuery.extend = jQuery.fn.extend = function() {
  42825. var options, name, src, copy, copyIsArray, clone,
  42826. target = arguments[ 0 ] || {},
  42827. i = 1,
  42828. length = arguments.length,
  42829. deep = false;
  42830. // Handle a deep copy situation
  42831. if ( typeof target === "boolean" ) {
  42832. deep = target;
  42833. // Skip the boolean and the target
  42834. target = arguments[ i ] || {};
  42835. i++;
  42836. }
  42837. // Handle case when target is a string or something (possible in deep copy)
  42838. if ( typeof target !== "object" && !isFunction( target ) ) {
  42839. target = {};
  42840. }
  42841. // Extend jQuery itself if only one argument is passed
  42842. if ( i === length ) {
  42843. target = this;
  42844. i--;
  42845. }
  42846. for ( ; i < length; i++ ) {
  42847. // Only deal with non-null/undefined values
  42848. if ( ( options = arguments[ i ] ) != null ) {
  42849. // Extend the base object
  42850. for ( name in options ) {
  42851. src = target[ name ];
  42852. copy = options[ name ];
  42853. // Prevent never-ending loop
  42854. if ( target === copy ) {
  42855. continue;
  42856. }
  42857. // Recurse if we're merging plain objects or arrays
  42858. if ( deep && copy && ( jQuery.isPlainObject( copy ) ||
  42859. ( copyIsArray = Array.isArray( copy ) ) ) ) {
  42860. if ( copyIsArray ) {
  42861. copyIsArray = false;
  42862. clone = src && Array.isArray( src ) ? src : [];
  42863. } else {
  42864. clone = src && jQuery.isPlainObject( src ) ? src : {};
  42865. }
  42866. // Never move original objects, clone them
  42867. target[ name ] = jQuery.extend( deep, clone, copy );
  42868. // Don't bring in undefined values
  42869. } else if ( copy !== undefined ) {
  42870. target[ name ] = copy;
  42871. }
  42872. }
  42873. }
  42874. }
  42875. // Return the modified object
  42876. return target;
  42877. };
  42878. jQuery.extend( {
  42879. // Unique for each copy of jQuery on the page
  42880. expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ),
  42881. // Assume jQuery is ready without the ready module
  42882. isReady: true,
  42883. error: function( msg ) {
  42884. throw new Error( msg );
  42885. },
  42886. noop: function() {},
  42887. isPlainObject: function( obj ) {
  42888. var proto, Ctor;
  42889. // Detect obvious negatives
  42890. // Use toString instead of jQuery.type to catch host objects
  42891. if ( !obj || toString.call( obj ) !== "[object Object]" ) {
  42892. return false;
  42893. }
  42894. proto = getProto( obj );
  42895. // Objects with no prototype (e.g., `Object.create( null )`) are plain
  42896. if ( !proto ) {
  42897. return true;
  42898. }
  42899. // Objects with prototype are plain iff they were constructed by a global Object function
  42900. Ctor = hasOwn.call( proto, "constructor" ) && proto.constructor;
  42901. return typeof Ctor === "function" && fnToString.call( Ctor ) === ObjectFunctionString;
  42902. },
  42903. isEmptyObject: function( obj ) {
  42904. /* eslint-disable no-unused-vars */
  42905. // See https://github.com/eslint/eslint/issues/6125
  42906. var name;
  42907. for ( name in obj ) {
  42908. return false;
  42909. }
  42910. return true;
  42911. },
  42912. // Evaluates a script in a global context
  42913. globalEval: function( code ) {
  42914. DOMEval( code );
  42915. },
  42916. each: function( obj, callback ) {
  42917. var length, i = 0;
  42918. if ( isArrayLike( obj ) ) {
  42919. length = obj.length;
  42920. for ( ; i < length; i++ ) {
  42921. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42922. break;
  42923. }
  42924. }
  42925. } else {
  42926. for ( i in obj ) {
  42927. if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) {
  42928. break;
  42929. }
  42930. }
  42931. }
  42932. return obj;
  42933. },
  42934. // Support: Android <=4.0 only
  42935. trim: function( text ) {
  42936. return text == null ?
  42937. "" :
  42938. ( text + "" ).replace( rtrim, "" );
  42939. },
  42940. // results is for internal usage only
  42941. makeArray: function( arr, results ) {
  42942. var ret = results || [];
  42943. if ( arr != null ) {
  42944. if ( isArrayLike( Object( arr ) ) ) {
  42945. jQuery.merge( ret,
  42946. typeof arr === "string" ?
  42947. [ arr ] : arr
  42948. );
  42949. } else {
  42950. push.call( ret, arr );
  42951. }
  42952. }
  42953. return ret;
  42954. },
  42955. inArray: function( elem, arr, i ) {
  42956. return arr == null ? -1 : indexOf.call( arr, elem, i );
  42957. },
  42958. // Support: Android <=4.0 only, PhantomJS 1 only
  42959. // push.apply(_, arraylike) throws on ancient WebKit
  42960. merge: function( first, second ) {
  42961. var len = +second.length,
  42962. j = 0,
  42963. i = first.length;
  42964. for ( ; j < len; j++ ) {
  42965. first[ i++ ] = second[ j ];
  42966. }
  42967. first.length = i;
  42968. return first;
  42969. },
  42970. grep: function( elems, callback, invert ) {
  42971. var callbackInverse,
  42972. matches = [],
  42973. i = 0,
  42974. length = elems.length,
  42975. callbackExpect = !invert;
  42976. // Go through the array, only saving the items
  42977. // that pass the validator function
  42978. for ( ; i < length; i++ ) {
  42979. callbackInverse = !callback( elems[ i ], i );
  42980. if ( callbackInverse !== callbackExpect ) {
  42981. matches.push( elems[ i ] );
  42982. }
  42983. }
  42984. return matches;
  42985. },
  42986. // arg is for internal usage only
  42987. map: function( elems, callback, arg ) {
  42988. var length, value,
  42989. i = 0,
  42990. ret = [];
  42991. // Go through the array, translating each of the items to their new values
  42992. if ( isArrayLike( elems ) ) {
  42993. length = elems.length;
  42994. for ( ; i < length; i++ ) {
  42995. value = callback( elems[ i ], i, arg );
  42996. if ( value != null ) {
  42997. ret.push( value );
  42998. }
  42999. }
  43000. // Go through every key on the object,
  43001. } else {
  43002. for ( i in elems ) {
  43003. value = callback( elems[ i ], i, arg );
  43004. if ( value != null ) {
  43005. ret.push( value );
  43006. }
  43007. }
  43008. }
  43009. // Flatten any nested arrays
  43010. return concat.apply( [], ret );
  43011. },
  43012. // A global GUID counter for objects
  43013. guid: 1,
  43014. // jQuery.support is not used in Core but other projects attach their
  43015. // properties to it so it needs to exist.
  43016. support: support
  43017. } );
  43018. if ( typeof Symbol === "function" ) {
  43019. jQuery.fn[ Symbol.iterator ] = arr[ Symbol.iterator ];
  43020. }
  43021. // Populate the class2type map
  43022. jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ),
  43023. function( i, name ) {
  43024. class2type[ "[object " + name + "]" ] = name.toLowerCase();
  43025. } );
  43026. function isArrayLike( obj ) {
  43027. // Support: real iOS 8.2 only (not reproducible in simulator)
  43028. // `in` check used to prevent JIT error (gh-2145)
  43029. // hasOwn isn't used here due to false negatives
  43030. // regarding Nodelist length in IE
  43031. var length = !!obj && "length" in obj && obj.length,
  43032. type = toType( obj );
  43033. if ( isFunction( obj ) || isWindow( obj ) ) {
  43034. return false;
  43035. }
  43036. return type === "array" || length === 0 ||
  43037. typeof length === "number" && length > 0 && ( length - 1 ) in obj;
  43038. }
  43039. var Sizzle =
  43040. /*!
  43041. * Sizzle CSS Selector Engine v2.3.3
  43042. * https://sizzlejs.com/
  43043. *
  43044. * Copyright jQuery Foundation and other contributors
  43045. * Released under the MIT license
  43046. * http://jquery.org/license
  43047. *
  43048. * Date: 2016-08-08
  43049. */
  43050. (function( window ) {
  43051. var i,
  43052. support,
  43053. Expr,
  43054. getText,
  43055. isXML,
  43056. tokenize,
  43057. compile,
  43058. select,
  43059. outermostContext,
  43060. sortInput,
  43061. hasDuplicate,
  43062. // Local document vars
  43063. setDocument,
  43064. document,
  43065. docElem,
  43066. documentIsHTML,
  43067. rbuggyQSA,
  43068. rbuggyMatches,
  43069. matches,
  43070. contains,
  43071. // Instance-specific data
  43072. expando = "sizzle" + 1 * new Date(),
  43073. preferredDoc = window.document,
  43074. dirruns = 0,
  43075. done = 0,
  43076. classCache = createCache(),
  43077. tokenCache = createCache(),
  43078. compilerCache = createCache(),
  43079. sortOrder = function( a, b ) {
  43080. if ( a === b ) {
  43081. hasDuplicate = true;
  43082. }
  43083. return 0;
  43084. },
  43085. // Instance methods
  43086. hasOwn = ({}).hasOwnProperty,
  43087. arr = [],
  43088. pop = arr.pop,
  43089. push_native = arr.push,
  43090. push = arr.push,
  43091. slice = arr.slice,
  43092. // Use a stripped-down indexOf as it's faster than native
  43093. // https://jsperf.com/thor-indexof-vs-for/5
  43094. indexOf = function( list, elem ) {
  43095. var i = 0,
  43096. len = list.length;
  43097. for ( ; i < len; i++ ) {
  43098. if ( list[i] === elem ) {
  43099. return i;
  43100. }
  43101. }
  43102. return -1;
  43103. },
  43104. booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",
  43105. // Regular expressions
  43106. // http://www.w3.org/TR/css3-selectors/#whitespace
  43107. whitespace = "[\\x20\\t\\r\\n\\f]",
  43108. // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier
  43109. identifier = "(?:\\\\.|[\\w-]|[^\0-\\xa0])+",
  43110. // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors
  43111. attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace +
  43112. // Operator (capture 2)
  43113. "*([*^$|!~]?=)" + whitespace +
  43114. // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]"
  43115. "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace +
  43116. "*\\]",
  43117. pseudos = ":(" + identifier + ")(?:\\((" +
  43118. // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments:
  43119. // 1. quoted (capture 3; capture 4 or capture 5)
  43120. "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" +
  43121. // 2. simple (capture 6)
  43122. "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" +
  43123. // 3. anything else (capture 2)
  43124. ".*" +
  43125. ")\\)|)",
  43126. // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter
  43127. rwhitespace = new RegExp( whitespace + "+", "g" ),
  43128. rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ),
  43129. rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ),
  43130. rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ),
  43131. rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ),
  43132. rpseudo = new RegExp( pseudos ),
  43133. ridentifier = new RegExp( "^" + identifier + "$" ),
  43134. matchExpr = {
  43135. "ID": new RegExp( "^#(" + identifier + ")" ),
  43136. "CLASS": new RegExp( "^\\.(" + identifier + ")" ),
  43137. "TAG": new RegExp( "^(" + identifier + "|[*])" ),
  43138. "ATTR": new RegExp( "^" + attributes ),
  43139. "PSEUDO": new RegExp( "^" + pseudos ),
  43140. "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace +
  43141. "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace +
  43142. "*(\\d+)|))" + whitespace + "*\\)|)", "i" ),
  43143. "bool": new RegExp( "^(?:" + booleans + ")$", "i" ),
  43144. // For use in libraries implementing .is()
  43145. // We use this for POS matching in `select`
  43146. "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" +
  43147. whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" )
  43148. },
  43149. rinputs = /^(?:input|select|textarea|button)$/i,
  43150. rheader = /^h\d$/i,
  43151. rnative = /^[^{]+\{\s*\[native \w/,
  43152. // Easily-parseable/retrievable ID or TAG or CLASS selectors
  43153. rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,
  43154. rsibling = /[+~]/,
  43155. // CSS escapes
  43156. // http://www.w3.org/TR/CSS21/syndata.html#escaped-characters
  43157. runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ),
  43158. funescape = function( _, escaped, escapedWhitespace ) {
  43159. var high = "0x" + escaped - 0x10000;
  43160. // NaN means non-codepoint
  43161. // Support: Firefox<24
  43162. // Workaround erroneous numeric interpretation of +"0x"
  43163. return high !== high || escapedWhitespace ?
  43164. escaped :
  43165. high < 0 ?
  43166. // BMP codepoint
  43167. String.fromCharCode( high + 0x10000 ) :
  43168. // Supplemental Plane codepoint (surrogate pair)
  43169. String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 );
  43170. },
  43171. // CSS string/identifier serialization
  43172. // https://drafts.csswg.org/cssom/#common-serializing-idioms
  43173. rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,
  43174. fcssescape = function( ch, asCodePoint ) {
  43175. if ( asCodePoint ) {
  43176. // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  43177. if ( ch === "\0" ) {
  43178. return "\uFFFD";
  43179. }
  43180. // Control characters and (dependent upon position) numbers get escaped as code points
  43181. return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  43182. }
  43183. // Other potentially-special ASCII characters get backslash-escaped
  43184. return "\\" + ch;
  43185. },
  43186. // Used for iframes
  43187. // See setDocument()
  43188. // Removing the function wrapper causes a "Permission Denied"
  43189. // error in IE
  43190. unloadHandler = function() {
  43191. setDocument();
  43192. },
  43193. disabledAncestor = addCombinator(
  43194. function( elem ) {
  43195. return elem.disabled === true && ("form" in elem || "label" in elem);
  43196. },
  43197. { dir: "parentNode", next: "legend" }
  43198. );
  43199. // Optimize for push.apply( _, NodeList )
  43200. try {
  43201. push.apply(
  43202. (arr = slice.call( preferredDoc.childNodes )),
  43203. preferredDoc.childNodes
  43204. );
  43205. // Support: Android<4.0
  43206. // Detect silently failing push.apply
  43207. arr[ preferredDoc.childNodes.length ].nodeType;
  43208. } catch ( e ) {
  43209. push = { apply: arr.length ?
  43210. // Leverage slice if possible
  43211. function( target, els ) {
  43212. push_native.apply( target, slice.call(els) );
  43213. } :
  43214. // Support: IE<9
  43215. // Otherwise append directly
  43216. function( target, els ) {
  43217. var j = target.length,
  43218. i = 0;
  43219. // Can't trust NodeList.length
  43220. while ( (target[j++] = els[i++]) ) {}
  43221. target.length = j - 1;
  43222. }
  43223. };
  43224. }
  43225. function Sizzle( selector, context, results, seed ) {
  43226. var m, i, elem, nid, match, groups, newSelector,
  43227. newContext = context && context.ownerDocument,
  43228. // nodeType defaults to 9, since context defaults to document
  43229. nodeType = context ? context.nodeType : 9;
  43230. results = results || [];
  43231. // Return early from calls with invalid selector or context
  43232. if ( typeof selector !== "string" || !selector ||
  43233. nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) {
  43234. return results;
  43235. }
  43236. // Try to shortcut find operations (as opposed to filters) in HTML documents
  43237. if ( !seed ) {
  43238. if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) {
  43239. setDocument( context );
  43240. }
  43241. context = context || document;
  43242. if ( documentIsHTML ) {
  43243. // If the selector is sufficiently simple, try using a "get*By*" DOM method
  43244. // (excepting DocumentFragment context, where the methods don't exist)
  43245. if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) {
  43246. // ID selector
  43247. if ( (m = match[1]) ) {
  43248. // Document context
  43249. if ( nodeType === 9 ) {
  43250. if ( (elem = context.getElementById( m )) ) {
  43251. // Support: IE, Opera, Webkit
  43252. // TODO: identify versions
  43253. // getElementById can match elements by name instead of ID
  43254. if ( elem.id === m ) {
  43255. results.push( elem );
  43256. return results;
  43257. }
  43258. } else {
  43259. return results;
  43260. }
  43261. // Element context
  43262. } else {
  43263. // Support: IE, Opera, Webkit
  43264. // TODO: identify versions
  43265. // getElementById can match elements by name instead of ID
  43266. if ( newContext && (elem = newContext.getElementById( m )) &&
  43267. contains( context, elem ) &&
  43268. elem.id === m ) {
  43269. results.push( elem );
  43270. return results;
  43271. }
  43272. }
  43273. // Type selector
  43274. } else if ( match[2] ) {
  43275. push.apply( results, context.getElementsByTagName( selector ) );
  43276. return results;
  43277. // Class selector
  43278. } else if ( (m = match[3]) && support.getElementsByClassName &&
  43279. context.getElementsByClassName ) {
  43280. push.apply( results, context.getElementsByClassName( m ) );
  43281. return results;
  43282. }
  43283. }
  43284. // Take advantage of querySelectorAll
  43285. if ( support.qsa &&
  43286. !compilerCache[ selector + " " ] &&
  43287. (!rbuggyQSA || !rbuggyQSA.test( selector )) ) {
  43288. if ( nodeType !== 1 ) {
  43289. newContext = context;
  43290. newSelector = selector;
  43291. // qSA looks outside Element context, which is not what we want
  43292. // Thanks to Andrew Dupont for this workaround technique
  43293. // Support: IE <=8
  43294. // Exclude object elements
  43295. } else if ( context.nodeName.toLowerCase() !== "object" ) {
  43296. // Capture the context ID, setting it first if necessary
  43297. if ( (nid = context.getAttribute( "id" )) ) {
  43298. nid = nid.replace( rcssescape, fcssescape );
  43299. } else {
  43300. context.setAttribute( "id", (nid = expando) );
  43301. }
  43302. // Prefix every selector in the list
  43303. groups = tokenize( selector );
  43304. i = groups.length;
  43305. while ( i-- ) {
  43306. groups[i] = "#" + nid + " " + toSelector( groups[i] );
  43307. }
  43308. newSelector = groups.join( "," );
  43309. // Expand context for sibling selectors
  43310. newContext = rsibling.test( selector ) && testContext( context.parentNode ) ||
  43311. context;
  43312. }
  43313. if ( newSelector ) {
  43314. try {
  43315. push.apply( results,
  43316. newContext.querySelectorAll( newSelector )
  43317. );
  43318. return results;
  43319. } catch ( qsaError ) {
  43320. } finally {
  43321. if ( nid === expando ) {
  43322. context.removeAttribute( "id" );
  43323. }
  43324. }
  43325. }
  43326. }
  43327. }
  43328. }
  43329. // All others
  43330. return select( selector.replace( rtrim, "$1" ), context, results, seed );
  43331. }
  43332. /**
  43333. * Create key-value caches of limited size
  43334. * @returns {function(string, object)} Returns the Object data after storing it on itself with
  43335. * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength)
  43336. * deleting the oldest entry
  43337. */
  43338. function createCache() {
  43339. var keys = [];
  43340. function cache( key, value ) {
  43341. // Use (key + " ") to avoid collision with native prototype properties (see Issue #157)
  43342. if ( keys.push( key + " " ) > Expr.cacheLength ) {
  43343. // Only keep the most recent entries
  43344. delete cache[ keys.shift() ];
  43345. }
  43346. return (cache[ key + " " ] = value);
  43347. }
  43348. return cache;
  43349. }
  43350. /**
  43351. * Mark a function for special use by Sizzle
  43352. * @param {Function} fn The function to mark
  43353. */
  43354. function markFunction( fn ) {
  43355. fn[ expando ] = true;
  43356. return fn;
  43357. }
  43358. /**
  43359. * Support testing using an element
  43360. * @param {Function} fn Passed the created element and returns a boolean result
  43361. */
  43362. function assert( fn ) {
  43363. var el = document.createElement("fieldset");
  43364. try {
  43365. return !!fn( el );
  43366. } catch (e) {
  43367. return false;
  43368. } finally {
  43369. // Remove from its parent by default
  43370. if ( el.parentNode ) {
  43371. el.parentNode.removeChild( el );
  43372. }
  43373. // release memory in IE
  43374. el = null;
  43375. }
  43376. }
  43377. /**
  43378. * Adds the same handler for all of the specified attrs
  43379. * @param {String} attrs Pipe-separated list of attributes
  43380. * @param {Function} handler The method that will be applied
  43381. */
  43382. function addHandle( attrs, handler ) {
  43383. var arr = attrs.split("|"),
  43384. i = arr.length;
  43385. while ( i-- ) {
  43386. Expr.attrHandle[ arr[i] ] = handler;
  43387. }
  43388. }
  43389. /**
  43390. * Checks document order of two siblings
  43391. * @param {Element} a
  43392. * @param {Element} b
  43393. * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b
  43394. */
  43395. function siblingCheck( a, b ) {
  43396. var cur = b && a,
  43397. diff = cur && a.nodeType === 1 && b.nodeType === 1 &&
  43398. a.sourceIndex - b.sourceIndex;
  43399. // Use IE sourceIndex if available on both nodes
  43400. if ( diff ) {
  43401. return diff;
  43402. }
  43403. // Check if b follows a
  43404. if ( cur ) {
  43405. while ( (cur = cur.nextSibling) ) {
  43406. if ( cur === b ) {
  43407. return -1;
  43408. }
  43409. }
  43410. }
  43411. return a ? 1 : -1;
  43412. }
  43413. /**
  43414. * Returns a function to use in pseudos for input types
  43415. * @param {String} type
  43416. */
  43417. function createInputPseudo( type ) {
  43418. return function( elem ) {
  43419. var name = elem.nodeName.toLowerCase();
  43420. return name === "input" && elem.type === type;
  43421. };
  43422. }
  43423. /**
  43424. * Returns a function to use in pseudos for buttons
  43425. * @param {String} type
  43426. */
  43427. function createButtonPseudo( type ) {
  43428. return function( elem ) {
  43429. var name = elem.nodeName.toLowerCase();
  43430. return (name === "input" || name === "button") && elem.type === type;
  43431. };
  43432. }
  43433. /**
  43434. * Returns a function to use in pseudos for :enabled/:disabled
  43435. * @param {Boolean} disabled true for :disabled; false for :enabled
  43436. */
  43437. function createDisabledPseudo( disabled ) {
  43438. // Known :disabled false positives: fieldset[disabled] > legend:nth-of-type(n+2) :can-disable
  43439. return function( elem ) {
  43440. // Only certain elements can match :enabled or :disabled
  43441. // https://html.spec.whatwg.org/multipage/scripting.html#selector-enabled
  43442. // https://html.spec.whatwg.org/multipage/scripting.html#selector-disabled
  43443. if ( "form" in elem ) {
  43444. // Check for inherited disabledness on relevant non-disabled elements:
  43445. // * listed form-associated elements in a disabled fieldset
  43446. // https://html.spec.whatwg.org/multipage/forms.html#category-listed
  43447. // https://html.spec.whatwg.org/multipage/forms.html#concept-fe-disabled
  43448. // * option elements in a disabled optgroup
  43449. // https://html.spec.whatwg.org/multipage/forms.html#concept-option-disabled
  43450. // All such elements have a "form" property.
  43451. if ( elem.parentNode && elem.disabled === false ) {
  43452. // Option elements defer to a parent optgroup if present
  43453. if ( "label" in elem ) {
  43454. if ( "label" in elem.parentNode ) {
  43455. return elem.parentNode.disabled === disabled;
  43456. } else {
  43457. return elem.disabled === disabled;
  43458. }
  43459. }
  43460. // Support: IE 6 - 11
  43461. // Use the isDisabled shortcut property to check for disabled fieldset ancestors
  43462. return elem.isDisabled === disabled ||
  43463. // Where there is no isDisabled, check manually
  43464. /* jshint -W018 */
  43465. elem.isDisabled !== !disabled &&
  43466. disabledAncestor( elem ) === disabled;
  43467. }
  43468. return elem.disabled === disabled;
  43469. // Try to winnow out elements that can't be disabled before trusting the disabled property.
  43470. // Some victims get caught in our net (label, legend, menu, track), but it shouldn't
  43471. // even exist on them, let alone have a boolean value.
  43472. } else if ( "label" in elem ) {
  43473. return elem.disabled === disabled;
  43474. }
  43475. // Remaining elements are neither :enabled nor :disabled
  43476. return false;
  43477. };
  43478. }
  43479. /**
  43480. * Returns a function to use in pseudos for positionals
  43481. * @param {Function} fn
  43482. */
  43483. function createPositionalPseudo( fn ) {
  43484. return markFunction(function( argument ) {
  43485. argument = +argument;
  43486. return markFunction(function( seed, matches ) {
  43487. var j,
  43488. matchIndexes = fn( [], seed.length, argument ),
  43489. i = matchIndexes.length;
  43490. // Match elements found at the specified indexes
  43491. while ( i-- ) {
  43492. if ( seed[ (j = matchIndexes[i]) ] ) {
  43493. seed[j] = !(matches[j] = seed[j]);
  43494. }
  43495. }
  43496. });
  43497. });
  43498. }
  43499. /**
  43500. * Checks a node for validity as a Sizzle context
  43501. * @param {Element|Object=} context
  43502. * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value
  43503. */
  43504. function testContext( context ) {
  43505. return context && typeof context.getElementsByTagName !== "undefined" && context;
  43506. }
  43507. // Expose support vars for convenience
  43508. support = Sizzle.support = {};
  43509. /**
  43510. * Detects XML nodes
  43511. * @param {Element|Object} elem An element or a document
  43512. * @returns {Boolean} True iff elem is a non-HTML XML node
  43513. */
  43514. isXML = Sizzle.isXML = function( elem ) {
  43515. // documentElement is verified for cases where it doesn't yet exist
  43516. // (such as loading iframes in IE - #4833)
  43517. var documentElement = elem && (elem.ownerDocument || elem).documentElement;
  43518. return documentElement ? documentElement.nodeName !== "HTML" : false;
  43519. };
  43520. /**
  43521. * Sets document-related variables once based on the current document
  43522. * @param {Element|Object} [doc] An element or document object to use to set the document
  43523. * @returns {Object} Returns the current document
  43524. */
  43525. setDocument = Sizzle.setDocument = function( node ) {
  43526. var hasCompare, subWindow,
  43527. doc = node ? node.ownerDocument || node : preferredDoc;
  43528. // Return early if doc is invalid or already selected
  43529. if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) {
  43530. return document;
  43531. }
  43532. // Update global variables
  43533. document = doc;
  43534. docElem = document.documentElement;
  43535. documentIsHTML = !isXML( document );
  43536. // Support: IE 9-11, Edge
  43537. // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936)
  43538. if ( preferredDoc !== document &&
  43539. (subWindow = document.defaultView) && subWindow.top !== subWindow ) {
  43540. // Support: IE 11, Edge
  43541. if ( subWindow.addEventListener ) {
  43542. subWindow.addEventListener( "unload", unloadHandler, false );
  43543. // Support: IE 9 - 10 only
  43544. } else if ( subWindow.attachEvent ) {
  43545. subWindow.attachEvent( "onunload", unloadHandler );
  43546. }
  43547. }
  43548. /* Attributes
  43549. ---------------------------------------------------------------------- */
  43550. // Support: IE<8
  43551. // Verify that getAttribute really returns attributes and not properties
  43552. // (excepting IE8 booleans)
  43553. support.attributes = assert(function( el ) {
  43554. el.className = "i";
  43555. return !el.getAttribute("className");
  43556. });
  43557. /* getElement(s)By*
  43558. ---------------------------------------------------------------------- */
  43559. // Check if getElementsByTagName("*") returns only elements
  43560. support.getElementsByTagName = assert(function( el ) {
  43561. el.appendChild( document.createComment("") );
  43562. return !el.getElementsByTagName("*").length;
  43563. });
  43564. // Support: IE<9
  43565. support.getElementsByClassName = rnative.test( document.getElementsByClassName );
  43566. // Support: IE<10
  43567. // Check if getElementById returns elements by name
  43568. // The broken getElementById methods don't pick up programmatically-set names,
  43569. // so use a roundabout getElementsByName test
  43570. support.getById = assert(function( el ) {
  43571. docElem.appendChild( el ).id = expando;
  43572. return !document.getElementsByName || !document.getElementsByName( expando ).length;
  43573. });
  43574. // ID filter and find
  43575. if ( support.getById ) {
  43576. Expr.filter["ID"] = function( id ) {
  43577. var attrId = id.replace( runescape, funescape );
  43578. return function( elem ) {
  43579. return elem.getAttribute("id") === attrId;
  43580. };
  43581. };
  43582. Expr.find["ID"] = function( id, context ) {
  43583. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43584. var elem = context.getElementById( id );
  43585. return elem ? [ elem ] : [];
  43586. }
  43587. };
  43588. } else {
  43589. Expr.filter["ID"] = function( id ) {
  43590. var attrId = id.replace( runescape, funescape );
  43591. return function( elem ) {
  43592. var node = typeof elem.getAttributeNode !== "undefined" &&
  43593. elem.getAttributeNode("id");
  43594. return node && node.value === attrId;
  43595. };
  43596. };
  43597. // Support: IE 6 - 7 only
  43598. // getElementById is not reliable as a find shortcut
  43599. Expr.find["ID"] = function( id, context ) {
  43600. if ( typeof context.getElementById !== "undefined" && documentIsHTML ) {
  43601. var node, i, elems,
  43602. elem = context.getElementById( id );
  43603. if ( elem ) {
  43604. // Verify the id attribute
  43605. node = elem.getAttributeNode("id");
  43606. if ( node && node.value === id ) {
  43607. return [ elem ];
  43608. }
  43609. // Fall back on getElementsByName
  43610. elems = context.getElementsByName( id );
  43611. i = 0;
  43612. while ( (elem = elems[i++]) ) {
  43613. node = elem.getAttributeNode("id");
  43614. if ( node && node.value === id ) {
  43615. return [ elem ];
  43616. }
  43617. }
  43618. }
  43619. return [];
  43620. }
  43621. };
  43622. }
  43623. // Tag
  43624. Expr.find["TAG"] = support.getElementsByTagName ?
  43625. function( tag, context ) {
  43626. if ( typeof context.getElementsByTagName !== "undefined" ) {
  43627. return context.getElementsByTagName( tag );
  43628. // DocumentFragment nodes don't have gEBTN
  43629. } else if ( support.qsa ) {
  43630. return context.querySelectorAll( tag );
  43631. }
  43632. } :
  43633. function( tag, context ) {
  43634. var elem,
  43635. tmp = [],
  43636. i = 0,
  43637. // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too
  43638. results = context.getElementsByTagName( tag );
  43639. // Filter out possible comments
  43640. if ( tag === "*" ) {
  43641. while ( (elem = results[i++]) ) {
  43642. if ( elem.nodeType === 1 ) {
  43643. tmp.push( elem );
  43644. }
  43645. }
  43646. return tmp;
  43647. }
  43648. return results;
  43649. };
  43650. // Class
  43651. Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) {
  43652. if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) {
  43653. return context.getElementsByClassName( className );
  43654. }
  43655. };
  43656. /* QSA/matchesSelector
  43657. ---------------------------------------------------------------------- */
  43658. // QSA and matchesSelector support
  43659. // matchesSelector(:active) reports false when true (IE9/Opera 11.5)
  43660. rbuggyMatches = [];
  43661. // qSa(:focus) reports false when true (Chrome 21)
  43662. // We allow this because of a bug in IE8/9 that throws an error
  43663. // whenever `document.activeElement` is accessed on an iframe
  43664. // So, we allow :focus to pass through QSA all the time to avoid the IE error
  43665. // See https://bugs.jquery.com/ticket/13378
  43666. rbuggyQSA = [];
  43667. if ( (support.qsa = rnative.test( document.querySelectorAll )) ) {
  43668. // Build QSA regex
  43669. // Regex strategy adopted from Diego Perini
  43670. assert(function( el ) {
  43671. // Select is set to empty string on purpose
  43672. // This is to test IE's treatment of not explicitly
  43673. // setting a boolean content attribute,
  43674. // since its presence should be enough
  43675. // https://bugs.jquery.com/ticket/12359
  43676. docElem.appendChild( el ).innerHTML = "<a id='" + expando + "'></a>" +
  43677. "<select id='" + expando + "-\r\\' msallowcapture=''>" +
  43678. "<option selected=''></option></select>";
  43679. // Support: IE8, Opera 11-12.16
  43680. // Nothing should be selected when empty strings follow ^= or $= or *=
  43681. // The test attribute must be unknown in Opera but "safe" for WinRT
  43682. // https://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section
  43683. if ( el.querySelectorAll("[msallowcapture^='']").length ) {
  43684. rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" );
  43685. }
  43686. // Support: IE8
  43687. // Boolean attributes and "value" are not treated correctly
  43688. if ( !el.querySelectorAll("[selected]").length ) {
  43689. rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" );
  43690. }
  43691. // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+
  43692. if ( !el.querySelectorAll( "[id~=" + expando + "-]" ).length ) {
  43693. rbuggyQSA.push("~=");
  43694. }
  43695. // Webkit/Opera - :checked should return selected option elements
  43696. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  43697. // IE8 throws error here and will not see later tests
  43698. if ( !el.querySelectorAll(":checked").length ) {
  43699. rbuggyQSA.push(":checked");
  43700. }
  43701. // Support: Safari 8+, iOS 8+
  43702. // https://bugs.webkit.org/show_bug.cgi?id=136851
  43703. // In-page `selector#id sibling-combinator selector` fails
  43704. if ( !el.querySelectorAll( "a#" + expando + "+*" ).length ) {
  43705. rbuggyQSA.push(".#.+[+~]");
  43706. }
  43707. });
  43708. assert(function( el ) {
  43709. el.innerHTML = "<a href='' disabled='disabled'></a>" +
  43710. "<select disabled='disabled'><option/></select>";
  43711. // Support: Windows 8 Native Apps
  43712. // The type and name attributes are restricted during .innerHTML assignment
  43713. var input = document.createElement("input");
  43714. input.setAttribute( "type", "hidden" );
  43715. el.appendChild( input ).setAttribute( "name", "D" );
  43716. // Support: IE8
  43717. // Enforce case-sensitivity of name attribute
  43718. if ( el.querySelectorAll("[name=d]").length ) {
  43719. rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" );
  43720. }
  43721. // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled)
  43722. // IE8 throws error here and will not see later tests
  43723. if ( el.querySelectorAll(":enabled").length !== 2 ) {
  43724. rbuggyQSA.push( ":enabled", ":disabled" );
  43725. }
  43726. // Support: IE9-11+
  43727. // IE's :disabled selector does not pick up the children of disabled fieldsets
  43728. docElem.appendChild( el ).disabled = true;
  43729. if ( el.querySelectorAll(":disabled").length !== 2 ) {
  43730. rbuggyQSA.push( ":enabled", ":disabled" );
  43731. }
  43732. // Opera 10-11 does not throw on post-comma invalid pseudos
  43733. el.querySelectorAll("*,:x");
  43734. rbuggyQSA.push(",.*:");
  43735. });
  43736. }
  43737. if ( (support.matchesSelector = rnative.test( (matches = docElem.matches ||
  43738. docElem.webkitMatchesSelector ||
  43739. docElem.mozMatchesSelector ||
  43740. docElem.oMatchesSelector ||
  43741. docElem.msMatchesSelector) )) ) {
  43742. assert(function( el ) {
  43743. // Check to see if it's possible to do matchesSelector
  43744. // on a disconnected node (IE 9)
  43745. support.disconnectedMatch = matches.call( el, "*" );
  43746. // This should fail with an exception
  43747. // Gecko does not error, returns false instead
  43748. matches.call( el, "[s!='']:x" );
  43749. rbuggyMatches.push( "!=", pseudos );
  43750. });
  43751. }
  43752. rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") );
  43753. rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") );
  43754. /* Contains
  43755. ---------------------------------------------------------------------- */
  43756. hasCompare = rnative.test( docElem.compareDocumentPosition );
  43757. // Element contains another
  43758. // Purposefully self-exclusive
  43759. // As in, an element does not contain itself
  43760. contains = hasCompare || rnative.test( docElem.contains ) ?
  43761. function( a, b ) {
  43762. var adown = a.nodeType === 9 ? a.documentElement : a,
  43763. bup = b && b.parentNode;
  43764. return a === bup || !!( bup && bup.nodeType === 1 && (
  43765. adown.contains ?
  43766. adown.contains( bup ) :
  43767. a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16
  43768. ));
  43769. } :
  43770. function( a, b ) {
  43771. if ( b ) {
  43772. while ( (b = b.parentNode) ) {
  43773. if ( b === a ) {
  43774. return true;
  43775. }
  43776. }
  43777. }
  43778. return false;
  43779. };
  43780. /* Sorting
  43781. ---------------------------------------------------------------------- */
  43782. // Document order sorting
  43783. sortOrder = hasCompare ?
  43784. function( a, b ) {
  43785. // Flag for duplicate removal
  43786. if ( a === b ) {
  43787. hasDuplicate = true;
  43788. return 0;
  43789. }
  43790. // Sort on method existence if only one input has compareDocumentPosition
  43791. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  43792. if ( compare ) {
  43793. return compare;
  43794. }
  43795. // Calculate position if both inputs belong to the same document
  43796. compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ?
  43797. a.compareDocumentPosition( b ) :
  43798. // Otherwise we know they are disconnected
  43799. 1;
  43800. // Disconnected nodes
  43801. if ( compare & 1 ||
  43802. (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) {
  43803. // Choose the first element that is related to our preferred document
  43804. if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) {
  43805. return -1;
  43806. }
  43807. if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) {
  43808. return 1;
  43809. }
  43810. // Maintain original order
  43811. return sortInput ?
  43812. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43813. 0;
  43814. }
  43815. return compare & 4 ? -1 : 1;
  43816. } :
  43817. function( a, b ) {
  43818. // Exit early if the nodes are identical
  43819. if ( a === b ) {
  43820. hasDuplicate = true;
  43821. return 0;
  43822. }
  43823. var cur,
  43824. i = 0,
  43825. aup = a.parentNode,
  43826. bup = b.parentNode,
  43827. ap = [ a ],
  43828. bp = [ b ];
  43829. // Parentless nodes are either documents or disconnected
  43830. if ( !aup || !bup ) {
  43831. return a === document ? -1 :
  43832. b === document ? 1 :
  43833. aup ? -1 :
  43834. bup ? 1 :
  43835. sortInput ?
  43836. ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) :
  43837. 0;
  43838. // If the nodes are siblings, we can do a quick check
  43839. } else if ( aup === bup ) {
  43840. return siblingCheck( a, b );
  43841. }
  43842. // Otherwise we need full lists of their ancestors for comparison
  43843. cur = a;
  43844. while ( (cur = cur.parentNode) ) {
  43845. ap.unshift( cur );
  43846. }
  43847. cur = b;
  43848. while ( (cur = cur.parentNode) ) {
  43849. bp.unshift( cur );
  43850. }
  43851. // Walk down the tree looking for a discrepancy
  43852. while ( ap[i] === bp[i] ) {
  43853. i++;
  43854. }
  43855. return i ?
  43856. // Do a sibling check if the nodes have a common ancestor
  43857. siblingCheck( ap[i], bp[i] ) :
  43858. // Otherwise nodes in our document sort first
  43859. ap[i] === preferredDoc ? -1 :
  43860. bp[i] === preferredDoc ? 1 :
  43861. 0;
  43862. };
  43863. return document;
  43864. };
  43865. Sizzle.matches = function( expr, elements ) {
  43866. return Sizzle( expr, null, null, elements );
  43867. };
  43868. Sizzle.matchesSelector = function( elem, expr ) {
  43869. // Set document vars if needed
  43870. if ( ( elem.ownerDocument || elem ) !== document ) {
  43871. setDocument( elem );
  43872. }
  43873. // Make sure that attribute selectors are quoted
  43874. expr = expr.replace( rattributeQuotes, "='$1']" );
  43875. if ( support.matchesSelector && documentIsHTML &&
  43876. !compilerCache[ expr + " " ] &&
  43877. ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) &&
  43878. ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) {
  43879. try {
  43880. var ret = matches.call( elem, expr );
  43881. // IE 9's matchesSelector returns false on disconnected nodes
  43882. if ( ret || support.disconnectedMatch ||
  43883. // As well, disconnected nodes are said to be in a document
  43884. // fragment in IE 9
  43885. elem.document && elem.document.nodeType !== 11 ) {
  43886. return ret;
  43887. }
  43888. } catch (e) {}
  43889. }
  43890. return Sizzle( expr, document, null, [ elem ] ).length > 0;
  43891. };
  43892. Sizzle.contains = function( context, elem ) {
  43893. // Set document vars if needed
  43894. if ( ( context.ownerDocument || context ) !== document ) {
  43895. setDocument( context );
  43896. }
  43897. return contains( context, elem );
  43898. };
  43899. Sizzle.attr = function( elem, name ) {
  43900. // Set document vars if needed
  43901. if ( ( elem.ownerDocument || elem ) !== document ) {
  43902. setDocument( elem );
  43903. }
  43904. var fn = Expr.attrHandle[ name.toLowerCase() ],
  43905. // Don't get fooled by Object.prototype properties (jQuery #13807)
  43906. val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ?
  43907. fn( elem, name, !documentIsHTML ) :
  43908. undefined;
  43909. return val !== undefined ?
  43910. val :
  43911. support.attributes || !documentIsHTML ?
  43912. elem.getAttribute( name ) :
  43913. (val = elem.getAttributeNode(name)) && val.specified ?
  43914. val.value :
  43915. null;
  43916. };
  43917. Sizzle.escape = function( sel ) {
  43918. return (sel + "").replace( rcssescape, fcssescape );
  43919. };
  43920. Sizzle.error = function( msg ) {
  43921. throw new Error( "Syntax error, unrecognized expression: " + msg );
  43922. };
  43923. /**
  43924. * Document sorting and removing duplicates
  43925. * @param {ArrayLike} results
  43926. */
  43927. Sizzle.uniqueSort = function( results ) {
  43928. var elem,
  43929. duplicates = [],
  43930. j = 0,
  43931. i = 0;
  43932. // Unless we *know* we can detect duplicates, assume their presence
  43933. hasDuplicate = !support.detectDuplicates;
  43934. sortInput = !support.sortStable && results.slice( 0 );
  43935. results.sort( sortOrder );
  43936. if ( hasDuplicate ) {
  43937. while ( (elem = results[i++]) ) {
  43938. if ( elem === results[ i ] ) {
  43939. j = duplicates.push( i );
  43940. }
  43941. }
  43942. while ( j-- ) {
  43943. results.splice( duplicates[ j ], 1 );
  43944. }
  43945. }
  43946. // Clear input after sorting to release objects
  43947. // See https://github.com/jquery/sizzle/pull/225
  43948. sortInput = null;
  43949. return results;
  43950. };
  43951. /**
  43952. * Utility function for retrieving the text value of an array of DOM nodes
  43953. * @param {Array|Element} elem
  43954. */
  43955. getText = Sizzle.getText = function( elem ) {
  43956. var node,
  43957. ret = "",
  43958. i = 0,
  43959. nodeType = elem.nodeType;
  43960. if ( !nodeType ) {
  43961. // If no nodeType, this is expected to be an array
  43962. while ( (node = elem[i++]) ) {
  43963. // Do not traverse comment nodes
  43964. ret += getText( node );
  43965. }
  43966. } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) {
  43967. // Use textContent for elements
  43968. // innerText usage removed for consistency of new lines (jQuery #11153)
  43969. if ( typeof elem.textContent === "string" ) {
  43970. return elem.textContent;
  43971. } else {
  43972. // Traverse its children
  43973. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  43974. ret += getText( elem );
  43975. }
  43976. }
  43977. } else if ( nodeType === 3 || nodeType === 4 ) {
  43978. return elem.nodeValue;
  43979. }
  43980. // Do not include comment or processing instruction nodes
  43981. return ret;
  43982. };
  43983. Expr = Sizzle.selectors = {
  43984. // Can be adjusted by the user
  43985. cacheLength: 50,
  43986. createPseudo: markFunction,
  43987. match: matchExpr,
  43988. attrHandle: {},
  43989. find: {},
  43990. relative: {
  43991. ">": { dir: "parentNode", first: true },
  43992. " ": { dir: "parentNode" },
  43993. "+": { dir: "previousSibling", first: true },
  43994. "~": { dir: "previousSibling" }
  43995. },
  43996. preFilter: {
  43997. "ATTR": function( match ) {
  43998. match[1] = match[1].replace( runescape, funescape );
  43999. // Move the given value to match[3] whether quoted or unquoted
  44000. match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape );
  44001. if ( match[2] === "~=" ) {
  44002. match[3] = " " + match[3] + " ";
  44003. }
  44004. return match.slice( 0, 4 );
  44005. },
  44006. "CHILD": function( match ) {
  44007. /* matches from matchExpr["CHILD"]
  44008. 1 type (only|nth|...)
  44009. 2 what (child|of-type)
  44010. 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...)
  44011. 4 xn-component of xn+y argument ([+-]?\d*n|)
  44012. 5 sign of xn-component
  44013. 6 x of xn-component
  44014. 7 sign of y-component
  44015. 8 y of y-component
  44016. */
  44017. match[1] = match[1].toLowerCase();
  44018. if ( match[1].slice( 0, 3 ) === "nth" ) {
  44019. // nth-* requires argument
  44020. if ( !match[3] ) {
  44021. Sizzle.error( match[0] );
  44022. }
  44023. // numeric x and y parameters for Expr.filter.CHILD
  44024. // remember that false/true cast respectively to 0/1
  44025. match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) );
  44026. match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" );
  44027. // other types prohibit arguments
  44028. } else if ( match[3] ) {
  44029. Sizzle.error( match[0] );
  44030. }
  44031. return match;
  44032. },
  44033. "PSEUDO": function( match ) {
  44034. var excess,
  44035. unquoted = !match[6] && match[2];
  44036. if ( matchExpr["CHILD"].test( match[0] ) ) {
  44037. return null;
  44038. }
  44039. // Accept quoted arguments as-is
  44040. if ( match[3] ) {
  44041. match[2] = match[4] || match[5] || "";
  44042. // Strip excess characters from unquoted arguments
  44043. } else if ( unquoted && rpseudo.test( unquoted ) &&
  44044. // Get excess from tokenize (recursively)
  44045. (excess = tokenize( unquoted, true )) &&
  44046. // advance to the next closing parenthesis
  44047. (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) {
  44048. // excess is a negative index
  44049. match[0] = match[0].slice( 0, excess );
  44050. match[2] = unquoted.slice( 0, excess );
  44051. }
  44052. // Return only captures needed by the pseudo filter method (type and argument)
  44053. return match.slice( 0, 3 );
  44054. }
  44055. },
  44056. filter: {
  44057. "TAG": function( nodeNameSelector ) {
  44058. var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase();
  44059. return nodeNameSelector === "*" ?
  44060. function() { return true; } :
  44061. function( elem ) {
  44062. return elem.nodeName && elem.nodeName.toLowerCase() === nodeName;
  44063. };
  44064. },
  44065. "CLASS": function( className ) {
  44066. var pattern = classCache[ className + " " ];
  44067. return pattern ||
  44068. (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) &&
  44069. classCache( className, function( elem ) {
  44070. return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" );
  44071. });
  44072. },
  44073. "ATTR": function( name, operator, check ) {
  44074. return function( elem ) {
  44075. var result = Sizzle.attr( elem, name );
  44076. if ( result == null ) {
  44077. return operator === "!=";
  44078. }
  44079. if ( !operator ) {
  44080. return true;
  44081. }
  44082. result += "";
  44083. return operator === "=" ? result === check :
  44084. operator === "!=" ? result !== check :
  44085. operator === "^=" ? check && result.indexOf( check ) === 0 :
  44086. operator === "*=" ? check && result.indexOf( check ) > -1 :
  44087. operator === "$=" ? check && result.slice( -check.length ) === check :
  44088. operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 :
  44089. operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" :
  44090. false;
  44091. };
  44092. },
  44093. "CHILD": function( type, what, argument, first, last ) {
  44094. var simple = type.slice( 0, 3 ) !== "nth",
  44095. forward = type.slice( -4 ) !== "last",
  44096. ofType = what === "of-type";
  44097. return first === 1 && last === 0 ?
  44098. // Shortcut for :nth-*(n)
  44099. function( elem ) {
  44100. return !!elem.parentNode;
  44101. } :
  44102. function( elem, context, xml ) {
  44103. var cache, uniqueCache, outerCache, node, nodeIndex, start,
  44104. dir = simple !== forward ? "nextSibling" : "previousSibling",
  44105. parent = elem.parentNode,
  44106. name = ofType && elem.nodeName.toLowerCase(),
  44107. useCache = !xml && !ofType,
  44108. diff = false;
  44109. if ( parent ) {
  44110. // :(first|last|only)-(child|of-type)
  44111. if ( simple ) {
  44112. while ( dir ) {
  44113. node = elem;
  44114. while ( (node = node[ dir ]) ) {
  44115. if ( ofType ?
  44116. node.nodeName.toLowerCase() === name :
  44117. node.nodeType === 1 ) {
  44118. return false;
  44119. }
  44120. }
  44121. // Reverse direction for :only-* (if we haven't yet done so)
  44122. start = dir = type === "only" && !start && "nextSibling";
  44123. }
  44124. return true;
  44125. }
  44126. start = [ forward ? parent.firstChild : parent.lastChild ];
  44127. // non-xml :nth-child(...) stores cache data on `parent`
  44128. if ( forward && useCache ) {
  44129. // Seek `elem` from a previously-cached index
  44130. // ...in a gzip-friendly way
  44131. node = parent;
  44132. outerCache = node[ expando ] || (node[ expando ] = {});
  44133. // Support: IE <9 only
  44134. // Defend against cloned attroperties (jQuery gh-1709)
  44135. uniqueCache = outerCache[ node.uniqueID ] ||
  44136. (outerCache[ node.uniqueID ] = {});
  44137. cache = uniqueCache[ type ] || [];
  44138. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  44139. diff = nodeIndex && cache[ 2 ];
  44140. node = nodeIndex && parent.childNodes[ nodeIndex ];
  44141. while ( (node = ++nodeIndex && node && node[ dir ] ||
  44142. // Fallback to seeking `elem` from the start
  44143. (diff = nodeIndex = 0) || start.pop()) ) {
  44144. // When found, cache indexes on `parent` and break
  44145. if ( node.nodeType === 1 && ++diff && node === elem ) {
  44146. uniqueCache[ type ] = [ dirruns, nodeIndex, diff ];
  44147. break;
  44148. }
  44149. }
  44150. } else {
  44151. // Use previously-cached element index if available
  44152. if ( useCache ) {
  44153. // ...in a gzip-friendly way
  44154. node = elem;
  44155. outerCache = node[ expando ] || (node[ expando ] = {});
  44156. // Support: IE <9 only
  44157. // Defend against cloned attroperties (jQuery gh-1709)
  44158. uniqueCache = outerCache[ node.uniqueID ] ||
  44159. (outerCache[ node.uniqueID ] = {});
  44160. cache = uniqueCache[ type ] || [];
  44161. nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ];
  44162. diff = nodeIndex;
  44163. }
  44164. // xml :nth-child(...)
  44165. // or :nth-last-child(...) or :nth(-last)?-of-type(...)
  44166. if ( diff === false ) {
  44167. // Use the same loop as above to seek `elem` from the start
  44168. while ( (node = ++nodeIndex && node && node[ dir ] ||
  44169. (diff = nodeIndex = 0) || start.pop()) ) {
  44170. if ( ( ofType ?
  44171. node.nodeName.toLowerCase() === name :
  44172. node.nodeType === 1 ) &&
  44173. ++diff ) {
  44174. // Cache the index of each encountered element
  44175. if ( useCache ) {
  44176. outerCache = node[ expando ] || (node[ expando ] = {});
  44177. // Support: IE <9 only
  44178. // Defend against cloned attroperties (jQuery gh-1709)
  44179. uniqueCache = outerCache[ node.uniqueID ] ||
  44180. (outerCache[ node.uniqueID ] = {});
  44181. uniqueCache[ type ] = [ dirruns, diff ];
  44182. }
  44183. if ( node === elem ) {
  44184. break;
  44185. }
  44186. }
  44187. }
  44188. }
  44189. }
  44190. // Incorporate the offset, then check against cycle size
  44191. diff -= last;
  44192. return diff === first || ( diff % first === 0 && diff / first >= 0 );
  44193. }
  44194. };
  44195. },
  44196. "PSEUDO": function( pseudo, argument ) {
  44197. // pseudo-class names are case-insensitive
  44198. // http://www.w3.org/TR/selectors/#pseudo-classes
  44199. // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters
  44200. // Remember that setFilters inherits from pseudos
  44201. var args,
  44202. fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] ||
  44203. Sizzle.error( "unsupported pseudo: " + pseudo );
  44204. // The user may use createPseudo to indicate that
  44205. // arguments are needed to create the filter function
  44206. // just as Sizzle does
  44207. if ( fn[ expando ] ) {
  44208. return fn( argument );
  44209. }
  44210. // But maintain support for old signatures
  44211. if ( fn.length > 1 ) {
  44212. args = [ pseudo, pseudo, "", argument ];
  44213. return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ?
  44214. markFunction(function( seed, matches ) {
  44215. var idx,
  44216. matched = fn( seed, argument ),
  44217. i = matched.length;
  44218. while ( i-- ) {
  44219. idx = indexOf( seed, matched[i] );
  44220. seed[ idx ] = !( matches[ idx ] = matched[i] );
  44221. }
  44222. }) :
  44223. function( elem ) {
  44224. return fn( elem, 0, args );
  44225. };
  44226. }
  44227. return fn;
  44228. }
  44229. },
  44230. pseudos: {
  44231. // Potentially complex pseudos
  44232. "not": markFunction(function( selector ) {
  44233. // Trim the selector passed to compile
  44234. // to avoid treating leading and trailing
  44235. // spaces as combinators
  44236. var input = [],
  44237. results = [],
  44238. matcher = compile( selector.replace( rtrim, "$1" ) );
  44239. return matcher[ expando ] ?
  44240. markFunction(function( seed, matches, context, xml ) {
  44241. var elem,
  44242. unmatched = matcher( seed, null, xml, [] ),
  44243. i = seed.length;
  44244. // Match elements unmatched by `matcher`
  44245. while ( i-- ) {
  44246. if ( (elem = unmatched[i]) ) {
  44247. seed[i] = !(matches[i] = elem);
  44248. }
  44249. }
  44250. }) :
  44251. function( elem, context, xml ) {
  44252. input[0] = elem;
  44253. matcher( input, null, xml, results );
  44254. // Don't keep the element (issue #299)
  44255. input[0] = null;
  44256. return !results.pop();
  44257. };
  44258. }),
  44259. "has": markFunction(function( selector ) {
  44260. return function( elem ) {
  44261. return Sizzle( selector, elem ).length > 0;
  44262. };
  44263. }),
  44264. "contains": markFunction(function( text ) {
  44265. text = text.replace( runescape, funescape );
  44266. return function( elem ) {
  44267. return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1;
  44268. };
  44269. }),
  44270. // "Whether an element is represented by a :lang() selector
  44271. // is based solely on the element's language value
  44272. // being equal to the identifier C,
  44273. // or beginning with the identifier C immediately followed by "-".
  44274. // The matching of C against the element's language value is performed case-insensitively.
  44275. // The identifier C does not have to be a valid language name."
  44276. // http://www.w3.org/TR/selectors/#lang-pseudo
  44277. "lang": markFunction( function( lang ) {
  44278. // lang value must be a valid identifier
  44279. if ( !ridentifier.test(lang || "") ) {
  44280. Sizzle.error( "unsupported lang: " + lang );
  44281. }
  44282. lang = lang.replace( runescape, funescape ).toLowerCase();
  44283. return function( elem ) {
  44284. var elemLang;
  44285. do {
  44286. if ( (elemLang = documentIsHTML ?
  44287. elem.lang :
  44288. elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) {
  44289. elemLang = elemLang.toLowerCase();
  44290. return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0;
  44291. }
  44292. } while ( (elem = elem.parentNode) && elem.nodeType === 1 );
  44293. return false;
  44294. };
  44295. }),
  44296. // Miscellaneous
  44297. "target": function( elem ) {
  44298. var hash = window.location && window.location.hash;
  44299. return hash && hash.slice( 1 ) === elem.id;
  44300. },
  44301. "root": function( elem ) {
  44302. return elem === docElem;
  44303. },
  44304. "focus": function( elem ) {
  44305. return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex);
  44306. },
  44307. // Boolean properties
  44308. "enabled": createDisabledPseudo( false ),
  44309. "disabled": createDisabledPseudo( true ),
  44310. "checked": function( elem ) {
  44311. // In CSS3, :checked should return both checked and selected elements
  44312. // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked
  44313. var nodeName = elem.nodeName.toLowerCase();
  44314. return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected);
  44315. },
  44316. "selected": function( elem ) {
  44317. // Accessing this property makes selected-by-default
  44318. // options in Safari work properly
  44319. if ( elem.parentNode ) {
  44320. elem.parentNode.selectedIndex;
  44321. }
  44322. return elem.selected === true;
  44323. },
  44324. // Contents
  44325. "empty": function( elem ) {
  44326. // http://www.w3.org/TR/selectors/#empty-pseudo
  44327. // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5),
  44328. // but not by others (comment: 8; processing instruction: 7; etc.)
  44329. // nodeType < 6 works because attributes (2) do not appear as children
  44330. for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) {
  44331. if ( elem.nodeType < 6 ) {
  44332. return false;
  44333. }
  44334. }
  44335. return true;
  44336. },
  44337. "parent": function( elem ) {
  44338. return !Expr.pseudos["empty"]( elem );
  44339. },
  44340. // Element/input types
  44341. "header": function( elem ) {
  44342. return rheader.test( elem.nodeName );
  44343. },
  44344. "input": function( elem ) {
  44345. return rinputs.test( elem.nodeName );
  44346. },
  44347. "button": function( elem ) {
  44348. var name = elem.nodeName.toLowerCase();
  44349. return name === "input" && elem.type === "button" || name === "button";
  44350. },
  44351. "text": function( elem ) {
  44352. var attr;
  44353. return elem.nodeName.toLowerCase() === "input" &&
  44354. elem.type === "text" &&
  44355. // Support: IE<8
  44356. // New HTML5 attribute values (e.g., "search") appear with elem.type === "text"
  44357. ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" );
  44358. },
  44359. // Position-in-collection
  44360. "first": createPositionalPseudo(function() {
  44361. return [ 0 ];
  44362. }),
  44363. "last": createPositionalPseudo(function( matchIndexes, length ) {
  44364. return [ length - 1 ];
  44365. }),
  44366. "eq": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44367. return [ argument < 0 ? argument + length : argument ];
  44368. }),
  44369. "even": createPositionalPseudo(function( matchIndexes, length ) {
  44370. var i = 0;
  44371. for ( ; i < length; i += 2 ) {
  44372. matchIndexes.push( i );
  44373. }
  44374. return matchIndexes;
  44375. }),
  44376. "odd": createPositionalPseudo(function( matchIndexes, length ) {
  44377. var i = 1;
  44378. for ( ; i < length; i += 2 ) {
  44379. matchIndexes.push( i );
  44380. }
  44381. return matchIndexes;
  44382. }),
  44383. "lt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44384. var i = argument < 0 ? argument + length : argument;
  44385. for ( ; --i >= 0; ) {
  44386. matchIndexes.push( i );
  44387. }
  44388. return matchIndexes;
  44389. }),
  44390. "gt": createPositionalPseudo(function( matchIndexes, length, argument ) {
  44391. var i = argument < 0 ? argument + length : argument;
  44392. for ( ; ++i < length; ) {
  44393. matchIndexes.push( i );
  44394. }
  44395. return matchIndexes;
  44396. })
  44397. }
  44398. };
  44399. Expr.pseudos["nth"] = Expr.pseudos["eq"];
  44400. // Add button/input type pseudos
  44401. for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) {
  44402. Expr.pseudos[ i ] = createInputPseudo( i );
  44403. }
  44404. for ( i in { submit: true, reset: true } ) {
  44405. Expr.pseudos[ i ] = createButtonPseudo( i );
  44406. }
  44407. // Easy API for creating new setFilters
  44408. function setFilters() {}
  44409. setFilters.prototype = Expr.filters = Expr.pseudos;
  44410. Expr.setFilters = new setFilters();
  44411. tokenize = Sizzle.tokenize = function( selector, parseOnly ) {
  44412. var matched, match, tokens, type,
  44413. soFar, groups, preFilters,
  44414. cached = tokenCache[ selector + " " ];
  44415. if ( cached ) {
  44416. return parseOnly ? 0 : cached.slice( 0 );
  44417. }
  44418. soFar = selector;
  44419. groups = [];
  44420. preFilters = Expr.preFilter;
  44421. while ( soFar ) {
  44422. // Comma and first run
  44423. if ( !matched || (match = rcomma.exec( soFar )) ) {
  44424. if ( match ) {
  44425. // Don't consume trailing commas as valid
  44426. soFar = soFar.slice( match[0].length ) || soFar;
  44427. }
  44428. groups.push( (tokens = []) );
  44429. }
  44430. matched = false;
  44431. // Combinators
  44432. if ( (match = rcombinators.exec( soFar )) ) {
  44433. matched = match.shift();
  44434. tokens.push({
  44435. value: matched,
  44436. // Cast descendant combinators to space
  44437. type: match[0].replace( rtrim, " " )
  44438. });
  44439. soFar = soFar.slice( matched.length );
  44440. }
  44441. // Filters
  44442. for ( type in Expr.filter ) {
  44443. if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] ||
  44444. (match = preFilters[ type ]( match ))) ) {
  44445. matched = match.shift();
  44446. tokens.push({
  44447. value: matched,
  44448. type: type,
  44449. matches: match
  44450. });
  44451. soFar = soFar.slice( matched.length );
  44452. }
  44453. }
  44454. if ( !matched ) {
  44455. break;
  44456. }
  44457. }
  44458. // Return the length of the invalid excess
  44459. // if we're just parsing
  44460. // Otherwise, throw an error or return tokens
  44461. return parseOnly ?
  44462. soFar.length :
  44463. soFar ?
  44464. Sizzle.error( selector ) :
  44465. // Cache the tokens
  44466. tokenCache( selector, groups ).slice( 0 );
  44467. };
  44468. function toSelector( tokens ) {
  44469. var i = 0,
  44470. len = tokens.length,
  44471. selector = "";
  44472. for ( ; i < len; i++ ) {
  44473. selector += tokens[i].value;
  44474. }
  44475. return selector;
  44476. }
  44477. function addCombinator( matcher, combinator, base ) {
  44478. var dir = combinator.dir,
  44479. skip = combinator.next,
  44480. key = skip || dir,
  44481. checkNonElements = base && key === "parentNode",
  44482. doneName = done++;
  44483. return combinator.first ?
  44484. // Check against closest ancestor/preceding element
  44485. function( elem, context, xml ) {
  44486. while ( (elem = elem[ dir ]) ) {
  44487. if ( elem.nodeType === 1 || checkNonElements ) {
  44488. return matcher( elem, context, xml );
  44489. }
  44490. }
  44491. return false;
  44492. } :
  44493. // Check against all ancestor/preceding elements
  44494. function( elem, context, xml ) {
  44495. var oldCache, uniqueCache, outerCache,
  44496. newCache = [ dirruns, doneName ];
  44497. // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching
  44498. if ( xml ) {
  44499. while ( (elem = elem[ dir ]) ) {
  44500. if ( elem.nodeType === 1 || checkNonElements ) {
  44501. if ( matcher( elem, context, xml ) ) {
  44502. return true;
  44503. }
  44504. }
  44505. }
  44506. } else {
  44507. while ( (elem = elem[ dir ]) ) {
  44508. if ( elem.nodeType === 1 || checkNonElements ) {
  44509. outerCache = elem[ expando ] || (elem[ expando ] = {});
  44510. // Support: IE <9 only
  44511. // Defend against cloned attroperties (jQuery gh-1709)
  44512. uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {});
  44513. if ( skip && skip === elem.nodeName.toLowerCase() ) {
  44514. elem = elem[ dir ] || elem;
  44515. } else if ( (oldCache = uniqueCache[ key ]) &&
  44516. oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) {
  44517. // Assign to newCache so results back-propagate to previous elements
  44518. return (newCache[ 2 ] = oldCache[ 2 ]);
  44519. } else {
  44520. // Reuse newcache so results back-propagate to previous elements
  44521. uniqueCache[ key ] = newCache;
  44522. // A match means we're done; a fail means we have to keep checking
  44523. if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) {
  44524. return true;
  44525. }
  44526. }
  44527. }
  44528. }
  44529. }
  44530. return false;
  44531. };
  44532. }
  44533. function elementMatcher( matchers ) {
  44534. return matchers.length > 1 ?
  44535. function( elem, context, xml ) {
  44536. var i = matchers.length;
  44537. while ( i-- ) {
  44538. if ( !matchers[i]( elem, context, xml ) ) {
  44539. return false;
  44540. }
  44541. }
  44542. return true;
  44543. } :
  44544. matchers[0];
  44545. }
  44546. function multipleContexts( selector, contexts, results ) {
  44547. var i = 0,
  44548. len = contexts.length;
  44549. for ( ; i < len; i++ ) {
  44550. Sizzle( selector, contexts[i], results );
  44551. }
  44552. return results;
  44553. }
  44554. function condense( unmatched, map, filter, context, xml ) {
  44555. var elem,
  44556. newUnmatched = [],
  44557. i = 0,
  44558. len = unmatched.length,
  44559. mapped = map != null;
  44560. for ( ; i < len; i++ ) {
  44561. if ( (elem = unmatched[i]) ) {
  44562. if ( !filter || filter( elem, context, xml ) ) {
  44563. newUnmatched.push( elem );
  44564. if ( mapped ) {
  44565. map.push( i );
  44566. }
  44567. }
  44568. }
  44569. }
  44570. return newUnmatched;
  44571. }
  44572. function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) {
  44573. if ( postFilter && !postFilter[ expando ] ) {
  44574. postFilter = setMatcher( postFilter );
  44575. }
  44576. if ( postFinder && !postFinder[ expando ] ) {
  44577. postFinder = setMatcher( postFinder, postSelector );
  44578. }
  44579. return markFunction(function( seed, results, context, xml ) {
  44580. var temp, i, elem,
  44581. preMap = [],
  44582. postMap = [],
  44583. preexisting = results.length,
  44584. // Get initial elements from seed or context
  44585. elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ),
  44586. // Prefilter to get matcher input, preserving a map for seed-results synchronization
  44587. matcherIn = preFilter && ( seed || !selector ) ?
  44588. condense( elems, preMap, preFilter, context, xml ) :
  44589. elems,
  44590. matcherOut = matcher ?
  44591. // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results,
  44592. postFinder || ( seed ? preFilter : preexisting || postFilter ) ?
  44593. // ...intermediate processing is necessary
  44594. [] :
  44595. // ...otherwise use results directly
  44596. results :
  44597. matcherIn;
  44598. // Find primary matches
  44599. if ( matcher ) {
  44600. matcher( matcherIn, matcherOut, context, xml );
  44601. }
  44602. // Apply postFilter
  44603. if ( postFilter ) {
  44604. temp = condense( matcherOut, postMap );
  44605. postFilter( temp, [], context, xml );
  44606. // Un-match failing elements by moving them back to matcherIn
  44607. i = temp.length;
  44608. while ( i-- ) {
  44609. if ( (elem = temp[i]) ) {
  44610. matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem);
  44611. }
  44612. }
  44613. }
  44614. if ( seed ) {
  44615. if ( postFinder || preFilter ) {
  44616. if ( postFinder ) {
  44617. // Get the final matcherOut by condensing this intermediate into postFinder contexts
  44618. temp = [];
  44619. i = matcherOut.length;
  44620. while ( i-- ) {
  44621. if ( (elem = matcherOut[i]) ) {
  44622. // Restore matcherIn since elem is not yet a final match
  44623. temp.push( (matcherIn[i] = elem) );
  44624. }
  44625. }
  44626. postFinder( null, (matcherOut = []), temp, xml );
  44627. }
  44628. // Move matched elements from seed to results to keep them synchronized
  44629. i = matcherOut.length;
  44630. while ( i-- ) {
  44631. if ( (elem = matcherOut[i]) &&
  44632. (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) {
  44633. seed[temp] = !(results[temp] = elem);
  44634. }
  44635. }
  44636. }
  44637. // Add elements to results, through postFinder if defined
  44638. } else {
  44639. matcherOut = condense(
  44640. matcherOut === results ?
  44641. matcherOut.splice( preexisting, matcherOut.length ) :
  44642. matcherOut
  44643. );
  44644. if ( postFinder ) {
  44645. postFinder( null, results, matcherOut, xml );
  44646. } else {
  44647. push.apply( results, matcherOut );
  44648. }
  44649. }
  44650. });
  44651. }
  44652. function matcherFromTokens( tokens ) {
  44653. var checkContext, matcher, j,
  44654. len = tokens.length,
  44655. leadingRelative = Expr.relative[ tokens[0].type ],
  44656. implicitRelative = leadingRelative || Expr.relative[" "],
  44657. i = leadingRelative ? 1 : 0,
  44658. // The foundational matcher ensures that elements are reachable from top-level context(s)
  44659. matchContext = addCombinator( function( elem ) {
  44660. return elem === checkContext;
  44661. }, implicitRelative, true ),
  44662. matchAnyContext = addCombinator( function( elem ) {
  44663. return indexOf( checkContext, elem ) > -1;
  44664. }, implicitRelative, true ),
  44665. matchers = [ function( elem, context, xml ) {
  44666. var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || (
  44667. (checkContext = context).nodeType ?
  44668. matchContext( elem, context, xml ) :
  44669. matchAnyContext( elem, context, xml ) );
  44670. // Avoid hanging onto element (issue #299)
  44671. checkContext = null;
  44672. return ret;
  44673. } ];
  44674. for ( ; i < len; i++ ) {
  44675. if ( (matcher = Expr.relative[ tokens[i].type ]) ) {
  44676. matchers = [ addCombinator(elementMatcher( matchers ), matcher) ];
  44677. } else {
  44678. matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches );
  44679. // Return special upon seeing a positional matcher
  44680. if ( matcher[ expando ] ) {
  44681. // Find the next relative operator (if any) for proper handling
  44682. j = ++i;
  44683. for ( ; j < len; j++ ) {
  44684. if ( Expr.relative[ tokens[j].type ] ) {
  44685. break;
  44686. }
  44687. }
  44688. return setMatcher(
  44689. i > 1 && elementMatcher( matchers ),
  44690. i > 1 && toSelector(
  44691. // If the preceding token was a descendant combinator, insert an implicit any-element `*`
  44692. tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" })
  44693. ).replace( rtrim, "$1" ),
  44694. matcher,
  44695. i < j && matcherFromTokens( tokens.slice( i, j ) ),
  44696. j < len && matcherFromTokens( (tokens = tokens.slice( j )) ),
  44697. j < len && toSelector( tokens )
  44698. );
  44699. }
  44700. matchers.push( matcher );
  44701. }
  44702. }
  44703. return elementMatcher( matchers );
  44704. }
  44705. function matcherFromGroupMatchers( elementMatchers, setMatchers ) {
  44706. var bySet = setMatchers.length > 0,
  44707. byElement = elementMatchers.length > 0,
  44708. superMatcher = function( seed, context, xml, results, outermost ) {
  44709. var elem, j, matcher,
  44710. matchedCount = 0,
  44711. i = "0",
  44712. unmatched = seed && [],
  44713. setMatched = [],
  44714. contextBackup = outermostContext,
  44715. // We must always have either seed elements or outermost context
  44716. elems = seed || byElement && Expr.find["TAG"]( "*", outermost ),
  44717. // Use integer dirruns iff this is the outermost matcher
  44718. dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1),
  44719. len = elems.length;
  44720. if ( outermost ) {
  44721. outermostContext = context === document || context || outermost;
  44722. }
  44723. // Add elements passing elementMatchers directly to results
  44724. // Support: IE<9, Safari
  44725. // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id
  44726. for ( ; i !== len && (elem = elems[i]) != null; i++ ) {
  44727. if ( byElement && elem ) {
  44728. j = 0;
  44729. if ( !context && elem.ownerDocument !== document ) {
  44730. setDocument( elem );
  44731. xml = !documentIsHTML;
  44732. }
  44733. while ( (matcher = elementMatchers[j++]) ) {
  44734. if ( matcher( elem, context || document, xml) ) {
  44735. results.push( elem );
  44736. break;
  44737. }
  44738. }
  44739. if ( outermost ) {
  44740. dirruns = dirrunsUnique;
  44741. }
  44742. }
  44743. // Track unmatched elements for set filters
  44744. if ( bySet ) {
  44745. // They will have gone through all possible matchers
  44746. if ( (elem = !matcher && elem) ) {
  44747. matchedCount--;
  44748. }
  44749. // Lengthen the array for every element, matched or not
  44750. if ( seed ) {
  44751. unmatched.push( elem );
  44752. }
  44753. }
  44754. }
  44755. // `i` is now the count of elements visited above, and adding it to `matchedCount`
  44756. // makes the latter nonnegative.
  44757. matchedCount += i;
  44758. // Apply set filters to unmatched elements
  44759. // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount`
  44760. // equals `i`), unless we didn't visit _any_ elements in the above loop because we have
  44761. // no element matchers and no seed.
  44762. // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that
  44763. // case, which will result in a "00" `matchedCount` that differs from `i` but is also
  44764. // numerically zero.
  44765. if ( bySet && i !== matchedCount ) {
  44766. j = 0;
  44767. while ( (matcher = setMatchers[j++]) ) {
  44768. matcher( unmatched, setMatched, context, xml );
  44769. }
  44770. if ( seed ) {
  44771. // Reintegrate element matches to eliminate the need for sorting
  44772. if ( matchedCount > 0 ) {
  44773. while ( i-- ) {
  44774. if ( !(unmatched[i] || setMatched[i]) ) {
  44775. setMatched[i] = pop.call( results );
  44776. }
  44777. }
  44778. }
  44779. // Discard index placeholder values to get only actual matches
  44780. setMatched = condense( setMatched );
  44781. }
  44782. // Add matches to results
  44783. push.apply( results, setMatched );
  44784. // Seedless set matches succeeding multiple successful matchers stipulate sorting
  44785. if ( outermost && !seed && setMatched.length > 0 &&
  44786. ( matchedCount + setMatchers.length ) > 1 ) {
  44787. Sizzle.uniqueSort( results );
  44788. }
  44789. }
  44790. // Override manipulation of globals by nested matchers
  44791. if ( outermost ) {
  44792. dirruns = dirrunsUnique;
  44793. outermostContext = contextBackup;
  44794. }
  44795. return unmatched;
  44796. };
  44797. return bySet ?
  44798. markFunction( superMatcher ) :
  44799. superMatcher;
  44800. }
  44801. compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) {
  44802. var i,
  44803. setMatchers = [],
  44804. elementMatchers = [],
  44805. cached = compilerCache[ selector + " " ];
  44806. if ( !cached ) {
  44807. // Generate a function of recursive functions that can be used to check each element
  44808. if ( !match ) {
  44809. match = tokenize( selector );
  44810. }
  44811. i = match.length;
  44812. while ( i-- ) {
  44813. cached = matcherFromTokens( match[i] );
  44814. if ( cached[ expando ] ) {
  44815. setMatchers.push( cached );
  44816. } else {
  44817. elementMatchers.push( cached );
  44818. }
  44819. }
  44820. // Cache the compiled function
  44821. cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) );
  44822. // Save selector and tokenization
  44823. cached.selector = selector;
  44824. }
  44825. return cached;
  44826. };
  44827. /**
  44828. * A low-level selection function that works with Sizzle's compiled
  44829. * selector functions
  44830. * @param {String|Function} selector A selector or a pre-compiled
  44831. * selector function built with Sizzle.compile
  44832. * @param {Element} context
  44833. * @param {Array} [results]
  44834. * @param {Array} [seed] A set of elements to match against
  44835. */
  44836. select = Sizzle.select = function( selector, context, results, seed ) {
  44837. var i, tokens, token, type, find,
  44838. compiled = typeof selector === "function" && selector,
  44839. match = !seed && tokenize( (selector = compiled.selector || selector) );
  44840. results = results || [];
  44841. // Try to minimize operations if there is only one selector in the list and no seed
  44842. // (the latter of which guarantees us context)
  44843. if ( match.length === 1 ) {
  44844. // Reduce context if the leading compound selector is an ID
  44845. tokens = match[0] = match[0].slice( 0 );
  44846. if ( tokens.length > 2 && (token = tokens[0]).type === "ID" &&
  44847. context.nodeType === 9 && documentIsHTML && Expr.relative[ tokens[1].type ] ) {
  44848. context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0];
  44849. if ( !context ) {
  44850. return results;
  44851. // Precompiled matchers will still verify ancestry, so step up a level
  44852. } else if ( compiled ) {
  44853. context = context.parentNode;
  44854. }
  44855. selector = selector.slice( tokens.shift().value.length );
  44856. }
  44857. // Fetch a seed set for right-to-left matching
  44858. i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length;
  44859. while ( i-- ) {
  44860. token = tokens[i];
  44861. // Abort if we hit a combinator
  44862. if ( Expr.relative[ (type = token.type) ] ) {
  44863. break;
  44864. }
  44865. if ( (find = Expr.find[ type ]) ) {
  44866. // Search, expanding context for leading sibling combinators
  44867. if ( (seed = find(
  44868. token.matches[0].replace( runescape, funescape ),
  44869. rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context
  44870. )) ) {
  44871. // If seed is empty or no tokens remain, we can return early
  44872. tokens.splice( i, 1 );
  44873. selector = seed.length && toSelector( tokens );
  44874. if ( !selector ) {
  44875. push.apply( results, seed );
  44876. return results;
  44877. }
  44878. break;
  44879. }
  44880. }
  44881. }
  44882. }
  44883. // Compile and execute a filtering function if one is not provided
  44884. // Provide `match` to avoid retokenization if we modified the selector above
  44885. ( compiled || compile( selector, match ) )(
  44886. seed,
  44887. context,
  44888. !documentIsHTML,
  44889. results,
  44890. !context || rsibling.test( selector ) && testContext( context.parentNode ) || context
  44891. );
  44892. return results;
  44893. };
  44894. // One-time assignments
  44895. // Sort stability
  44896. support.sortStable = expando.split("").sort( sortOrder ).join("") === expando;
  44897. // Support: Chrome 14-35+
  44898. // Always assume duplicates if they aren't passed to the comparison function
  44899. support.detectDuplicates = !!hasDuplicate;
  44900. // Initialize against the default document
  44901. setDocument();
  44902. // Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27)
  44903. // Detached nodes confoundingly follow *each other*
  44904. support.sortDetached = assert(function( el ) {
  44905. // Should return 1, but returns 4 (following)
  44906. return el.compareDocumentPosition( document.createElement("fieldset") ) & 1;
  44907. });
  44908. // Support: IE<8
  44909. // Prevent attribute/property "interpolation"
  44910. // https://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx
  44911. if ( !assert(function( el ) {
  44912. el.innerHTML = "<a href='#'></a>";
  44913. return el.firstChild.getAttribute("href") === "#" ;
  44914. }) ) {
  44915. addHandle( "type|href|height|width", function( elem, name, isXML ) {
  44916. if ( !isXML ) {
  44917. return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 );
  44918. }
  44919. });
  44920. }
  44921. // Support: IE<9
  44922. // Use defaultValue in place of getAttribute("value")
  44923. if ( !support.attributes || !assert(function( el ) {
  44924. el.innerHTML = "<input/>";
  44925. el.firstChild.setAttribute( "value", "" );
  44926. return el.firstChild.getAttribute( "value" ) === "";
  44927. }) ) {
  44928. addHandle( "value", function( elem, name, isXML ) {
  44929. if ( !isXML && elem.nodeName.toLowerCase() === "input" ) {
  44930. return elem.defaultValue;
  44931. }
  44932. });
  44933. }
  44934. // Support: IE<9
  44935. // Use getAttributeNode to fetch booleans when getAttribute lies
  44936. if ( !assert(function( el ) {
  44937. return el.getAttribute("disabled") == null;
  44938. }) ) {
  44939. addHandle( booleans, function( elem, name, isXML ) {
  44940. var val;
  44941. if ( !isXML ) {
  44942. return elem[ name ] === true ? name.toLowerCase() :
  44943. (val = elem.getAttributeNode( name )) && val.specified ?
  44944. val.value :
  44945. null;
  44946. }
  44947. });
  44948. }
  44949. return Sizzle;
  44950. })( window );
  44951. jQuery.find = Sizzle;
  44952. jQuery.expr = Sizzle.selectors;
  44953. // Deprecated
  44954. jQuery.expr[ ":" ] = jQuery.expr.pseudos;
  44955. jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort;
  44956. jQuery.text = Sizzle.getText;
  44957. jQuery.isXMLDoc = Sizzle.isXML;
  44958. jQuery.contains = Sizzle.contains;
  44959. jQuery.escapeSelector = Sizzle.escape;
  44960. var dir = function( elem, dir, until ) {
  44961. var matched = [],
  44962. truncate = until !== undefined;
  44963. while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) {
  44964. if ( elem.nodeType === 1 ) {
  44965. if ( truncate && jQuery( elem ).is( until ) ) {
  44966. break;
  44967. }
  44968. matched.push( elem );
  44969. }
  44970. }
  44971. return matched;
  44972. };
  44973. var siblings = function( n, elem ) {
  44974. var matched = [];
  44975. for ( ; n; n = n.nextSibling ) {
  44976. if ( n.nodeType === 1 && n !== elem ) {
  44977. matched.push( n );
  44978. }
  44979. }
  44980. return matched;
  44981. };
  44982. var rneedsContext = jQuery.expr.match.needsContext;
  44983. function nodeName( elem, name ) {
  44984. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  44985. };
  44986. var rsingleTag = ( /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i );
  44987. // Implement the identical functionality for filter and not
  44988. function winnow( elements, qualifier, not ) {
  44989. if ( isFunction( qualifier ) ) {
  44990. return jQuery.grep( elements, function( elem, i ) {
  44991. return !!qualifier.call( elem, i, elem ) !== not;
  44992. } );
  44993. }
  44994. // Single element
  44995. if ( qualifier.nodeType ) {
  44996. return jQuery.grep( elements, function( elem ) {
  44997. return ( elem === qualifier ) !== not;
  44998. } );
  44999. }
  45000. // Arraylike of elements (jQuery, arguments, Array)
  45001. if ( typeof qualifier !== "string" ) {
  45002. return jQuery.grep( elements, function( elem ) {
  45003. return ( indexOf.call( qualifier, elem ) > -1 ) !== not;
  45004. } );
  45005. }
  45006. // Filtered directly for both simple and complex selectors
  45007. return jQuery.filter( qualifier, elements, not );
  45008. }
  45009. jQuery.filter = function( expr, elems, not ) {
  45010. var elem = elems[ 0 ];
  45011. if ( not ) {
  45012. expr = ":not(" + expr + ")";
  45013. }
  45014. if ( elems.length === 1 && elem.nodeType === 1 ) {
  45015. return jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [];
  45016. }
  45017. return jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) {
  45018. return elem.nodeType === 1;
  45019. } ) );
  45020. };
  45021. jQuery.fn.extend( {
  45022. find: function( selector ) {
  45023. var i, ret,
  45024. len = this.length,
  45025. self = this;
  45026. if ( typeof selector !== "string" ) {
  45027. return this.pushStack( jQuery( selector ).filter( function() {
  45028. for ( i = 0; i < len; i++ ) {
  45029. if ( jQuery.contains( self[ i ], this ) ) {
  45030. return true;
  45031. }
  45032. }
  45033. } ) );
  45034. }
  45035. ret = this.pushStack( [] );
  45036. for ( i = 0; i < len; i++ ) {
  45037. jQuery.find( selector, self[ i ], ret );
  45038. }
  45039. return len > 1 ? jQuery.uniqueSort( ret ) : ret;
  45040. },
  45041. filter: function( selector ) {
  45042. return this.pushStack( winnow( this, selector || [], false ) );
  45043. },
  45044. not: function( selector ) {
  45045. return this.pushStack( winnow( this, selector || [], true ) );
  45046. },
  45047. is: function( selector ) {
  45048. return !!winnow(
  45049. this,
  45050. // If this is a positional/relative selector, check membership in the returned set
  45051. // so $("p:first").is("p:last") won't return true for a doc with two "p".
  45052. typeof selector === "string" && rneedsContext.test( selector ) ?
  45053. jQuery( selector ) :
  45054. selector || [],
  45055. false
  45056. ).length;
  45057. }
  45058. } );
  45059. // Initialize a jQuery object
  45060. // A central reference to the root jQuery(document)
  45061. var rootjQuery,
  45062. // A simple way to check for HTML strings
  45063. // Prioritize #id over <tag> to avoid XSS via location.hash (#9521)
  45064. // Strict HTML recognition (#11290: must start with <)
  45065. // Shortcut simple #id case for speed
  45066. rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,
  45067. init = jQuery.fn.init = function( selector, context, root ) {
  45068. var match, elem;
  45069. // HANDLE: $(""), $(null), $(undefined), $(false)
  45070. if ( !selector ) {
  45071. return this;
  45072. }
  45073. // Method init() accepts an alternate rootjQuery
  45074. // so migrate can support jQuery.sub (gh-2101)
  45075. root = root || rootjQuery;
  45076. // Handle HTML strings
  45077. if ( typeof selector === "string" ) {
  45078. if ( selector[ 0 ] === "<" &&
  45079. selector[ selector.length - 1 ] === ">" &&
  45080. selector.length >= 3 ) {
  45081. // Assume that strings that start and end with <> are HTML and skip the regex check
  45082. match = [ null, selector, null ];
  45083. } else {
  45084. match = rquickExpr.exec( selector );
  45085. }
  45086. // Match html or make sure no context is specified for #id
  45087. if ( match && ( match[ 1 ] || !context ) ) {
  45088. // HANDLE: $(html) -> $(array)
  45089. if ( match[ 1 ] ) {
  45090. context = context instanceof jQuery ? context[ 0 ] : context;
  45091. // Option to run scripts is true for back-compat
  45092. // Intentionally let the error be thrown if parseHTML is not present
  45093. jQuery.merge( this, jQuery.parseHTML(
  45094. match[ 1 ],
  45095. context && context.nodeType ? context.ownerDocument || context : document,
  45096. true
  45097. ) );
  45098. // HANDLE: $(html, props)
  45099. if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) {
  45100. for ( match in context ) {
  45101. // Properties of context are called as methods if possible
  45102. if ( isFunction( this[ match ] ) ) {
  45103. this[ match ]( context[ match ] );
  45104. // ...and otherwise set as attributes
  45105. } else {
  45106. this.attr( match, context[ match ] );
  45107. }
  45108. }
  45109. }
  45110. return this;
  45111. // HANDLE: $(#id)
  45112. } else {
  45113. elem = document.getElementById( match[ 2 ] );
  45114. if ( elem ) {
  45115. // Inject the element directly into the jQuery object
  45116. this[ 0 ] = elem;
  45117. this.length = 1;
  45118. }
  45119. return this;
  45120. }
  45121. // HANDLE: $(expr, $(...))
  45122. } else if ( !context || context.jquery ) {
  45123. return ( context || root ).find( selector );
  45124. // HANDLE: $(expr, context)
  45125. // (which is just equivalent to: $(context).find(expr)
  45126. } else {
  45127. return this.constructor( context ).find( selector );
  45128. }
  45129. // HANDLE: $(DOMElement)
  45130. } else if ( selector.nodeType ) {
  45131. this[ 0 ] = selector;
  45132. this.length = 1;
  45133. return this;
  45134. // HANDLE: $(function)
  45135. // Shortcut for document ready
  45136. } else if ( isFunction( selector ) ) {
  45137. return root.ready !== undefined ?
  45138. root.ready( selector ) :
  45139. // Execute immediately if ready is not present
  45140. selector( jQuery );
  45141. }
  45142. return jQuery.makeArray( selector, this );
  45143. };
  45144. // Give the init function the jQuery prototype for later instantiation
  45145. init.prototype = jQuery.fn;
  45146. // Initialize central reference
  45147. rootjQuery = jQuery( document );
  45148. var rparentsprev = /^(?:parents|prev(?:Until|All))/,
  45149. // Methods guaranteed to produce a unique set when starting from a unique set
  45150. guaranteedUnique = {
  45151. children: true,
  45152. contents: true,
  45153. next: true,
  45154. prev: true
  45155. };
  45156. jQuery.fn.extend( {
  45157. has: function( target ) {
  45158. var targets = jQuery( target, this ),
  45159. l = targets.length;
  45160. return this.filter( function() {
  45161. var i = 0;
  45162. for ( ; i < l; i++ ) {
  45163. if ( jQuery.contains( this, targets[ i ] ) ) {
  45164. return true;
  45165. }
  45166. }
  45167. } );
  45168. },
  45169. closest: function( selectors, context ) {
  45170. var cur,
  45171. i = 0,
  45172. l = this.length,
  45173. matched = [],
  45174. targets = typeof selectors !== "string" && jQuery( selectors );
  45175. // Positional selectors never match, since there's no _selection_ context
  45176. if ( !rneedsContext.test( selectors ) ) {
  45177. for ( ; i < l; i++ ) {
  45178. for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) {
  45179. // Always skip document fragments
  45180. if ( cur.nodeType < 11 && ( targets ?
  45181. targets.index( cur ) > -1 :
  45182. // Don't pass non-elements to Sizzle
  45183. cur.nodeType === 1 &&
  45184. jQuery.find.matchesSelector( cur, selectors ) ) ) {
  45185. matched.push( cur );
  45186. break;
  45187. }
  45188. }
  45189. }
  45190. }
  45191. return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched );
  45192. },
  45193. // Determine the position of an element within the set
  45194. index: function( elem ) {
  45195. // No argument, return index in parent
  45196. if ( !elem ) {
  45197. return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1;
  45198. }
  45199. // Index in selector
  45200. if ( typeof elem === "string" ) {
  45201. return indexOf.call( jQuery( elem ), this[ 0 ] );
  45202. }
  45203. // Locate the position of the desired element
  45204. return indexOf.call( this,
  45205. // If it receives a jQuery object, the first element is used
  45206. elem.jquery ? elem[ 0 ] : elem
  45207. );
  45208. },
  45209. add: function( selector, context ) {
  45210. return this.pushStack(
  45211. jQuery.uniqueSort(
  45212. jQuery.merge( this.get(), jQuery( selector, context ) )
  45213. )
  45214. );
  45215. },
  45216. addBack: function( selector ) {
  45217. return this.add( selector == null ?
  45218. this.prevObject : this.prevObject.filter( selector )
  45219. );
  45220. }
  45221. } );
  45222. function sibling( cur, dir ) {
  45223. while ( ( cur = cur[ dir ] ) && cur.nodeType !== 1 ) {}
  45224. return cur;
  45225. }
  45226. jQuery.each( {
  45227. parent: function( elem ) {
  45228. var parent = elem.parentNode;
  45229. return parent && parent.nodeType !== 11 ? parent : null;
  45230. },
  45231. parents: function( elem ) {
  45232. return dir( elem, "parentNode" );
  45233. },
  45234. parentsUntil: function( elem, i, until ) {
  45235. return dir( elem, "parentNode", until );
  45236. },
  45237. next: function( elem ) {
  45238. return sibling( elem, "nextSibling" );
  45239. },
  45240. prev: function( elem ) {
  45241. return sibling( elem, "previousSibling" );
  45242. },
  45243. nextAll: function( elem ) {
  45244. return dir( elem, "nextSibling" );
  45245. },
  45246. prevAll: function( elem ) {
  45247. return dir( elem, "previousSibling" );
  45248. },
  45249. nextUntil: function( elem, i, until ) {
  45250. return dir( elem, "nextSibling", until );
  45251. },
  45252. prevUntil: function( elem, i, until ) {
  45253. return dir( elem, "previousSibling", until );
  45254. },
  45255. siblings: function( elem ) {
  45256. return siblings( ( elem.parentNode || {} ).firstChild, elem );
  45257. },
  45258. children: function( elem ) {
  45259. return siblings( elem.firstChild );
  45260. },
  45261. contents: function( elem ) {
  45262. if ( nodeName( elem, "iframe" ) ) {
  45263. return elem.contentDocument;
  45264. }
  45265. // Support: IE 9 - 11 only, iOS 7 only, Android Browser <=4.3 only
  45266. // Treat the template element as a regular one in browsers that
  45267. // don't support it.
  45268. if ( nodeName( elem, "template" ) ) {
  45269. elem = elem.content || elem;
  45270. }
  45271. return jQuery.merge( [], elem.childNodes );
  45272. }
  45273. }, function( name, fn ) {
  45274. jQuery.fn[ name ] = function( until, selector ) {
  45275. var matched = jQuery.map( this, fn, until );
  45276. if ( name.slice( -5 ) !== "Until" ) {
  45277. selector = until;
  45278. }
  45279. if ( selector && typeof selector === "string" ) {
  45280. matched = jQuery.filter( selector, matched );
  45281. }
  45282. if ( this.length > 1 ) {
  45283. // Remove duplicates
  45284. if ( !guaranteedUnique[ name ] ) {
  45285. jQuery.uniqueSort( matched );
  45286. }
  45287. // Reverse order for parents* and prev-derivatives
  45288. if ( rparentsprev.test( name ) ) {
  45289. matched.reverse();
  45290. }
  45291. }
  45292. return this.pushStack( matched );
  45293. };
  45294. } );
  45295. var rnothtmlwhite = ( /[^\x20\t\r\n\f]+/g );
  45296. // Convert String-formatted options into Object-formatted ones
  45297. function createOptions( options ) {
  45298. var object = {};
  45299. jQuery.each( options.match( rnothtmlwhite ) || [], function( _, flag ) {
  45300. object[ flag ] = true;
  45301. } );
  45302. return object;
  45303. }
  45304. /*
  45305. * Create a callback list using the following parameters:
  45306. *
  45307. * options: an optional list of space-separated options that will change how
  45308. * the callback list behaves or a more traditional option object
  45309. *
  45310. * By default a callback list will act like an event callback list and can be
  45311. * "fired" multiple times.
  45312. *
  45313. * Possible options:
  45314. *
  45315. * once: will ensure the callback list can only be fired once (like a Deferred)
  45316. *
  45317. * memory: will keep track of previous values and will call any callback added
  45318. * after the list has been fired right away with the latest "memorized"
  45319. * values (like a Deferred)
  45320. *
  45321. * unique: will ensure a callback can only be added once (no duplicate in the list)
  45322. *
  45323. * stopOnFalse: interrupt callings when a callback returns false
  45324. *
  45325. */
  45326. jQuery.Callbacks = function( options ) {
  45327. // Convert options from String-formatted to Object-formatted if needed
  45328. // (we check in cache first)
  45329. options = typeof options === "string" ?
  45330. createOptions( options ) :
  45331. jQuery.extend( {}, options );
  45332. var // Flag to know if list is currently firing
  45333. firing,
  45334. // Last fire value for non-forgettable lists
  45335. memory,
  45336. // Flag to know if list was already fired
  45337. fired,
  45338. // Flag to prevent firing
  45339. locked,
  45340. // Actual callback list
  45341. list = [],
  45342. // Queue of execution data for repeatable lists
  45343. queue = [],
  45344. // Index of currently firing callback (modified by add/remove as needed)
  45345. firingIndex = -1,
  45346. // Fire callbacks
  45347. fire = function() {
  45348. // Enforce single-firing
  45349. locked = locked || options.once;
  45350. // Execute callbacks for all pending executions,
  45351. // respecting firingIndex overrides and runtime changes
  45352. fired = firing = true;
  45353. for ( ; queue.length; firingIndex = -1 ) {
  45354. memory = queue.shift();
  45355. while ( ++firingIndex < list.length ) {
  45356. // Run callback and check for early termination
  45357. if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false &&
  45358. options.stopOnFalse ) {
  45359. // Jump to end and forget the data so .add doesn't re-fire
  45360. firingIndex = list.length;
  45361. memory = false;
  45362. }
  45363. }
  45364. }
  45365. // Forget the data if we're done with it
  45366. if ( !options.memory ) {
  45367. memory = false;
  45368. }
  45369. firing = false;
  45370. // Clean up if we're done firing for good
  45371. if ( locked ) {
  45372. // Keep an empty list if we have data for future add calls
  45373. if ( memory ) {
  45374. list = [];
  45375. // Otherwise, this object is spent
  45376. } else {
  45377. list = "";
  45378. }
  45379. }
  45380. },
  45381. // Actual Callbacks object
  45382. self = {
  45383. // Add a callback or a collection of callbacks to the list
  45384. add: function() {
  45385. if ( list ) {
  45386. // If we have memory from a past run, we should fire after adding
  45387. if ( memory && !firing ) {
  45388. firingIndex = list.length - 1;
  45389. queue.push( memory );
  45390. }
  45391. ( function add( args ) {
  45392. jQuery.each( args, function( _, arg ) {
  45393. if ( isFunction( arg ) ) {
  45394. if ( !options.unique || !self.has( arg ) ) {
  45395. list.push( arg );
  45396. }
  45397. } else if ( arg && arg.length && toType( arg ) !== "string" ) {
  45398. // Inspect recursively
  45399. add( arg );
  45400. }
  45401. } );
  45402. } )( arguments );
  45403. if ( memory && !firing ) {
  45404. fire();
  45405. }
  45406. }
  45407. return this;
  45408. },
  45409. // Remove a callback from the list
  45410. remove: function() {
  45411. jQuery.each( arguments, function( _, arg ) {
  45412. var index;
  45413. while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) {
  45414. list.splice( index, 1 );
  45415. // Handle firing indexes
  45416. if ( index <= firingIndex ) {
  45417. firingIndex--;
  45418. }
  45419. }
  45420. } );
  45421. return this;
  45422. },
  45423. // Check if a given callback is in the list.
  45424. // If no argument is given, return whether or not list has callbacks attached.
  45425. has: function( fn ) {
  45426. return fn ?
  45427. jQuery.inArray( fn, list ) > -1 :
  45428. list.length > 0;
  45429. },
  45430. // Remove all callbacks from the list
  45431. empty: function() {
  45432. if ( list ) {
  45433. list = [];
  45434. }
  45435. return this;
  45436. },
  45437. // Disable .fire and .add
  45438. // Abort any current/pending executions
  45439. // Clear all callbacks and values
  45440. disable: function() {
  45441. locked = queue = [];
  45442. list = memory = "";
  45443. return this;
  45444. },
  45445. disabled: function() {
  45446. return !list;
  45447. },
  45448. // Disable .fire
  45449. // Also disable .add unless we have memory (since it would have no effect)
  45450. // Abort any pending executions
  45451. lock: function() {
  45452. locked = queue = [];
  45453. if ( !memory && !firing ) {
  45454. list = memory = "";
  45455. }
  45456. return this;
  45457. },
  45458. locked: function() {
  45459. return !!locked;
  45460. },
  45461. // Call all callbacks with the given context and arguments
  45462. fireWith: function( context, args ) {
  45463. if ( !locked ) {
  45464. args = args || [];
  45465. args = [ context, args.slice ? args.slice() : args ];
  45466. queue.push( args );
  45467. if ( !firing ) {
  45468. fire();
  45469. }
  45470. }
  45471. return this;
  45472. },
  45473. // Call all the callbacks with the given arguments
  45474. fire: function() {
  45475. self.fireWith( this, arguments );
  45476. return this;
  45477. },
  45478. // To know if the callbacks have already been called at least once
  45479. fired: function() {
  45480. return !!fired;
  45481. }
  45482. };
  45483. return self;
  45484. };
  45485. function Identity( v ) {
  45486. return v;
  45487. }
  45488. function Thrower( ex ) {
  45489. throw ex;
  45490. }
  45491. function adoptValue( value, resolve, reject, noValue ) {
  45492. var method;
  45493. try {
  45494. // Check for promise aspect first to privilege synchronous behavior
  45495. if ( value && isFunction( ( method = value.promise ) ) ) {
  45496. method.call( value ).done( resolve ).fail( reject );
  45497. // Other thenables
  45498. } else if ( value && isFunction( ( method = value.then ) ) ) {
  45499. method.call( value, resolve, reject );
  45500. // Other non-thenables
  45501. } else {
  45502. // Control `resolve` arguments by letting Array#slice cast boolean `noValue` to integer:
  45503. // * false: [ value ].slice( 0 ) => resolve( value )
  45504. // * true: [ value ].slice( 1 ) => resolve()
  45505. resolve.apply( undefined, [ value ].slice( noValue ) );
  45506. }
  45507. // For Promises/A+, convert exceptions into rejections
  45508. // Since jQuery.when doesn't unwrap thenables, we can skip the extra checks appearing in
  45509. // Deferred#then to conditionally suppress rejection.
  45510. } catch ( value ) {
  45511. // Support: Android 4.0 only
  45512. // Strict mode functions invoked without .call/.apply get global-object context
  45513. reject.apply( undefined, [ value ] );
  45514. }
  45515. }
  45516. jQuery.extend( {
  45517. Deferred: function( func ) {
  45518. var tuples = [
  45519. // action, add listener, callbacks,
  45520. // ... .then handlers, argument index, [final state]
  45521. [ "notify", "progress", jQuery.Callbacks( "memory" ),
  45522. jQuery.Callbacks( "memory" ), 2 ],
  45523. [ "resolve", "done", jQuery.Callbacks( "once memory" ),
  45524. jQuery.Callbacks( "once memory" ), 0, "resolved" ],
  45525. [ "reject", "fail", jQuery.Callbacks( "once memory" ),
  45526. jQuery.Callbacks( "once memory" ), 1, "rejected" ]
  45527. ],
  45528. state = "pending",
  45529. promise = {
  45530. state: function() {
  45531. return state;
  45532. },
  45533. always: function() {
  45534. deferred.done( arguments ).fail( arguments );
  45535. return this;
  45536. },
  45537. "catch": function( fn ) {
  45538. return promise.then( null, fn );
  45539. },
  45540. // Keep pipe for back-compat
  45541. pipe: function( /* fnDone, fnFail, fnProgress */ ) {
  45542. var fns = arguments;
  45543. return jQuery.Deferred( function( newDefer ) {
  45544. jQuery.each( tuples, function( i, tuple ) {
  45545. // Map tuples (progress, done, fail) to arguments (done, fail, progress)
  45546. var fn = isFunction( fns[ tuple[ 4 ] ] ) && fns[ tuple[ 4 ] ];
  45547. // deferred.progress(function() { bind to newDefer or newDefer.notify })
  45548. // deferred.done(function() { bind to newDefer or newDefer.resolve })
  45549. // deferred.fail(function() { bind to newDefer or newDefer.reject })
  45550. deferred[ tuple[ 1 ] ]( function() {
  45551. var returned = fn && fn.apply( this, arguments );
  45552. if ( returned && isFunction( returned.promise ) ) {
  45553. returned.promise()
  45554. .progress( newDefer.notify )
  45555. .done( newDefer.resolve )
  45556. .fail( newDefer.reject );
  45557. } else {
  45558. newDefer[ tuple[ 0 ] + "With" ](
  45559. this,
  45560. fn ? [ returned ] : arguments
  45561. );
  45562. }
  45563. } );
  45564. } );
  45565. fns = null;
  45566. } ).promise();
  45567. },
  45568. then: function( onFulfilled, onRejected, onProgress ) {
  45569. var maxDepth = 0;
  45570. function resolve( depth, deferred, handler, special ) {
  45571. return function() {
  45572. var that = this,
  45573. args = arguments,
  45574. mightThrow = function() {
  45575. var returned, then;
  45576. // Support: Promises/A+ section 2.3.3.3.3
  45577. // https://promisesaplus.com/#point-59
  45578. // Ignore double-resolution attempts
  45579. if ( depth < maxDepth ) {
  45580. return;
  45581. }
  45582. returned = handler.apply( that, args );
  45583. // Support: Promises/A+ section 2.3.1
  45584. // https://promisesaplus.com/#point-48
  45585. if ( returned === deferred.promise() ) {
  45586. throw new TypeError( "Thenable self-resolution" );
  45587. }
  45588. // Support: Promises/A+ sections 2.3.3.1, 3.5
  45589. // https://promisesaplus.com/#point-54
  45590. // https://promisesaplus.com/#point-75
  45591. // Retrieve `then` only once
  45592. then = returned &&
  45593. // Support: Promises/A+ section 2.3.4
  45594. // https://promisesaplus.com/#point-64
  45595. // Only check objects and functions for thenability
  45596. ( typeof returned === "object" ||
  45597. typeof returned === "function" ) &&
  45598. returned.then;
  45599. // Handle a returned thenable
  45600. if ( isFunction( then ) ) {
  45601. // Special processors (notify) just wait for resolution
  45602. if ( special ) {
  45603. then.call(
  45604. returned,
  45605. resolve( maxDepth, deferred, Identity, special ),
  45606. resolve( maxDepth, deferred, Thrower, special )
  45607. );
  45608. // Normal processors (resolve) also hook into progress
  45609. } else {
  45610. // ...and disregard older resolution values
  45611. maxDepth++;
  45612. then.call(
  45613. returned,
  45614. resolve( maxDepth, deferred, Identity, special ),
  45615. resolve( maxDepth, deferred, Thrower, special ),
  45616. resolve( maxDepth, deferred, Identity,
  45617. deferred.notifyWith )
  45618. );
  45619. }
  45620. // Handle all other returned values
  45621. } else {
  45622. // Only substitute handlers pass on context
  45623. // and multiple values (non-spec behavior)
  45624. if ( handler !== Identity ) {
  45625. that = undefined;
  45626. args = [ returned ];
  45627. }
  45628. // Process the value(s)
  45629. // Default process is resolve
  45630. ( special || deferred.resolveWith )( that, args );
  45631. }
  45632. },
  45633. // Only normal processors (resolve) catch and reject exceptions
  45634. process = special ?
  45635. mightThrow :
  45636. function() {
  45637. try {
  45638. mightThrow();
  45639. } catch ( e ) {
  45640. if ( jQuery.Deferred.exceptionHook ) {
  45641. jQuery.Deferred.exceptionHook( e,
  45642. process.stackTrace );
  45643. }
  45644. // Support: Promises/A+ section 2.3.3.3.4.1
  45645. // https://promisesaplus.com/#point-61
  45646. // Ignore post-resolution exceptions
  45647. if ( depth + 1 >= maxDepth ) {
  45648. // Only substitute handlers pass on context
  45649. // and multiple values (non-spec behavior)
  45650. if ( handler !== Thrower ) {
  45651. that = undefined;
  45652. args = [ e ];
  45653. }
  45654. deferred.rejectWith( that, args );
  45655. }
  45656. }
  45657. };
  45658. // Support: Promises/A+ section 2.3.3.3.1
  45659. // https://promisesaplus.com/#point-57
  45660. // Re-resolve promises immediately to dodge false rejection from
  45661. // subsequent errors
  45662. if ( depth ) {
  45663. process();
  45664. } else {
  45665. // Call an optional hook to record the stack, in case of exception
  45666. // since it's otherwise lost when execution goes async
  45667. if ( jQuery.Deferred.getStackHook ) {
  45668. process.stackTrace = jQuery.Deferred.getStackHook();
  45669. }
  45670. window.setTimeout( process );
  45671. }
  45672. };
  45673. }
  45674. return jQuery.Deferred( function( newDefer ) {
  45675. // progress_handlers.add( ... )
  45676. tuples[ 0 ][ 3 ].add(
  45677. resolve(
  45678. 0,
  45679. newDefer,
  45680. isFunction( onProgress ) ?
  45681. onProgress :
  45682. Identity,
  45683. newDefer.notifyWith
  45684. )
  45685. );
  45686. // fulfilled_handlers.add( ... )
  45687. tuples[ 1 ][ 3 ].add(
  45688. resolve(
  45689. 0,
  45690. newDefer,
  45691. isFunction( onFulfilled ) ?
  45692. onFulfilled :
  45693. Identity
  45694. )
  45695. );
  45696. // rejected_handlers.add( ... )
  45697. tuples[ 2 ][ 3 ].add(
  45698. resolve(
  45699. 0,
  45700. newDefer,
  45701. isFunction( onRejected ) ?
  45702. onRejected :
  45703. Thrower
  45704. )
  45705. );
  45706. } ).promise();
  45707. },
  45708. // Get a promise for this deferred
  45709. // If obj is provided, the promise aspect is added to the object
  45710. promise: function( obj ) {
  45711. return obj != null ? jQuery.extend( obj, promise ) : promise;
  45712. }
  45713. },
  45714. deferred = {};
  45715. // Add list-specific methods
  45716. jQuery.each( tuples, function( i, tuple ) {
  45717. var list = tuple[ 2 ],
  45718. stateString = tuple[ 5 ];
  45719. // promise.progress = list.add
  45720. // promise.done = list.add
  45721. // promise.fail = list.add
  45722. promise[ tuple[ 1 ] ] = list.add;
  45723. // Handle state
  45724. if ( stateString ) {
  45725. list.add(
  45726. function() {
  45727. // state = "resolved" (i.e., fulfilled)
  45728. // state = "rejected"
  45729. state = stateString;
  45730. },
  45731. // rejected_callbacks.disable
  45732. // fulfilled_callbacks.disable
  45733. tuples[ 3 - i ][ 2 ].disable,
  45734. // rejected_handlers.disable
  45735. // fulfilled_handlers.disable
  45736. tuples[ 3 - i ][ 3 ].disable,
  45737. // progress_callbacks.lock
  45738. tuples[ 0 ][ 2 ].lock,
  45739. // progress_handlers.lock
  45740. tuples[ 0 ][ 3 ].lock
  45741. );
  45742. }
  45743. // progress_handlers.fire
  45744. // fulfilled_handlers.fire
  45745. // rejected_handlers.fire
  45746. list.add( tuple[ 3 ].fire );
  45747. // deferred.notify = function() { deferred.notifyWith(...) }
  45748. // deferred.resolve = function() { deferred.resolveWith(...) }
  45749. // deferred.reject = function() { deferred.rejectWith(...) }
  45750. deferred[ tuple[ 0 ] ] = function() {
  45751. deferred[ tuple[ 0 ] + "With" ]( this === deferred ? undefined : this, arguments );
  45752. return this;
  45753. };
  45754. // deferred.notifyWith = list.fireWith
  45755. // deferred.resolveWith = list.fireWith
  45756. // deferred.rejectWith = list.fireWith
  45757. deferred[ tuple[ 0 ] + "With" ] = list.fireWith;
  45758. } );
  45759. // Make the deferred a promise
  45760. promise.promise( deferred );
  45761. // Call given func if any
  45762. if ( func ) {
  45763. func.call( deferred, deferred );
  45764. }
  45765. // All done!
  45766. return deferred;
  45767. },
  45768. // Deferred helper
  45769. when: function( singleValue ) {
  45770. var
  45771. // count of uncompleted subordinates
  45772. remaining = arguments.length,
  45773. // count of unprocessed arguments
  45774. i = remaining,
  45775. // subordinate fulfillment data
  45776. resolveContexts = Array( i ),
  45777. resolveValues = slice.call( arguments ),
  45778. // the master Deferred
  45779. master = jQuery.Deferred(),
  45780. // subordinate callback factory
  45781. updateFunc = function( i ) {
  45782. return function( value ) {
  45783. resolveContexts[ i ] = this;
  45784. resolveValues[ i ] = arguments.length > 1 ? slice.call( arguments ) : value;
  45785. if ( !( --remaining ) ) {
  45786. master.resolveWith( resolveContexts, resolveValues );
  45787. }
  45788. };
  45789. };
  45790. // Single- and empty arguments are adopted like Promise.resolve
  45791. if ( remaining <= 1 ) {
  45792. adoptValue( singleValue, master.done( updateFunc( i ) ).resolve, master.reject,
  45793. !remaining );
  45794. // Use .then() to unwrap secondary thenables (cf. gh-3000)
  45795. if ( master.state() === "pending" ||
  45796. isFunction( resolveValues[ i ] && resolveValues[ i ].then ) ) {
  45797. return master.then();
  45798. }
  45799. }
  45800. // Multiple arguments are aggregated like Promise.all array elements
  45801. while ( i-- ) {
  45802. adoptValue( resolveValues[ i ], updateFunc( i ), master.reject );
  45803. }
  45804. return master.promise();
  45805. }
  45806. } );
  45807. // These usually indicate a programmer mistake during development,
  45808. // warn about them ASAP rather than swallowing them by default.
  45809. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  45810. jQuery.Deferred.exceptionHook = function( error, stack ) {
  45811. // Support: IE 8 - 9 only
  45812. // Console exists when dev tools are open, which can happen at any time
  45813. if ( window.console && window.console.warn && error && rerrorNames.test( error.name ) ) {
  45814. window.console.warn( "jQuery.Deferred exception: " + error.message, error.stack, stack );
  45815. }
  45816. };
  45817. jQuery.readyException = function( error ) {
  45818. window.setTimeout( function() {
  45819. throw error;
  45820. } );
  45821. };
  45822. // The deferred used on DOM ready
  45823. var readyList = jQuery.Deferred();
  45824. jQuery.fn.ready = function( fn ) {
  45825. readyList
  45826. .then( fn )
  45827. // Wrap jQuery.readyException in a function so that the lookup
  45828. // happens at the time of error handling instead of callback
  45829. // registration.
  45830. .catch( function( error ) {
  45831. jQuery.readyException( error );
  45832. } );
  45833. return this;
  45834. };
  45835. jQuery.extend( {
  45836. // Is the DOM ready to be used? Set to true once it occurs.
  45837. isReady: false,
  45838. // A counter to track how many items to wait for before
  45839. // the ready event fires. See #6781
  45840. readyWait: 1,
  45841. // Handle when the DOM is ready
  45842. ready: function( wait ) {
  45843. // Abort if there are pending holds or we're already ready
  45844. if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) {
  45845. return;
  45846. }
  45847. // Remember that the DOM is ready
  45848. jQuery.isReady = true;
  45849. // If a normal DOM Ready event fired, decrement, and wait if need be
  45850. if ( wait !== true && --jQuery.readyWait > 0 ) {
  45851. return;
  45852. }
  45853. // If there are functions bound, to execute
  45854. readyList.resolveWith( document, [ jQuery ] );
  45855. }
  45856. } );
  45857. jQuery.ready.then = readyList.then;
  45858. // The ready event handler and self cleanup method
  45859. function completed() {
  45860. document.removeEventListener( "DOMContentLoaded", completed );
  45861. window.removeEventListener( "load", completed );
  45862. jQuery.ready();
  45863. }
  45864. // Catch cases where $(document).ready() is called
  45865. // after the browser event has already occurred.
  45866. // Support: IE <=9 - 10 only
  45867. // Older IE sometimes signals "interactive" too soon
  45868. if ( document.readyState === "complete" ||
  45869. ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) {
  45870. // Handle it asynchronously to allow scripts the opportunity to delay ready
  45871. window.setTimeout( jQuery.ready );
  45872. } else {
  45873. // Use the handy event callback
  45874. document.addEventListener( "DOMContentLoaded", completed );
  45875. // A fallback to window.onload, that will always work
  45876. window.addEventListener( "load", completed );
  45877. }
  45878. // Multifunctional method to get and set values of a collection
  45879. // The value/s can optionally be executed if it's a function
  45880. var access = function( elems, fn, key, value, chainable, emptyGet, raw ) {
  45881. var i = 0,
  45882. len = elems.length,
  45883. bulk = key == null;
  45884. // Sets many values
  45885. if ( toType( key ) === "object" ) {
  45886. chainable = true;
  45887. for ( i in key ) {
  45888. access( elems, fn, i, key[ i ], true, emptyGet, raw );
  45889. }
  45890. // Sets one value
  45891. } else if ( value !== undefined ) {
  45892. chainable = true;
  45893. if ( !isFunction( value ) ) {
  45894. raw = true;
  45895. }
  45896. if ( bulk ) {
  45897. // Bulk operations run against the entire set
  45898. if ( raw ) {
  45899. fn.call( elems, value );
  45900. fn = null;
  45901. // ...except when executing function values
  45902. } else {
  45903. bulk = fn;
  45904. fn = function( elem, key, value ) {
  45905. return bulk.call( jQuery( elem ), value );
  45906. };
  45907. }
  45908. }
  45909. if ( fn ) {
  45910. for ( ; i < len; i++ ) {
  45911. fn(
  45912. elems[ i ], key, raw ?
  45913. value :
  45914. value.call( elems[ i ], i, fn( elems[ i ], key ) )
  45915. );
  45916. }
  45917. }
  45918. }
  45919. if ( chainable ) {
  45920. return elems;
  45921. }
  45922. // Gets
  45923. if ( bulk ) {
  45924. return fn.call( elems );
  45925. }
  45926. return len ? fn( elems[ 0 ], key ) : emptyGet;
  45927. };
  45928. // Matches dashed string for camelizing
  45929. var rmsPrefix = /^-ms-/,
  45930. rdashAlpha = /-([a-z])/g;
  45931. // Used by camelCase as callback to replace()
  45932. function fcamelCase( all, letter ) {
  45933. return letter.toUpperCase();
  45934. }
  45935. // Convert dashed to camelCase; used by the css and data modules
  45936. // Support: IE <=9 - 11, Edge 12 - 15
  45937. // Microsoft forgot to hump their vendor prefix (#9572)
  45938. function camelCase( string ) {
  45939. return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase );
  45940. }
  45941. var acceptData = function( owner ) {
  45942. // Accepts only:
  45943. // - Node
  45944. // - Node.ELEMENT_NODE
  45945. // - Node.DOCUMENT_NODE
  45946. // - Object
  45947. // - Any
  45948. return owner.nodeType === 1 || owner.nodeType === 9 || !( +owner.nodeType );
  45949. };
  45950. function Data() {
  45951. this.expando = jQuery.expando + Data.uid++;
  45952. }
  45953. Data.uid = 1;
  45954. Data.prototype = {
  45955. cache: function( owner ) {
  45956. // Check if the owner object already has a cache
  45957. var value = owner[ this.expando ];
  45958. // If not, create one
  45959. if ( !value ) {
  45960. value = {};
  45961. // We can accept data for non-element nodes in modern browsers,
  45962. // but we should not, see #8335.
  45963. // Always return an empty object.
  45964. if ( acceptData( owner ) ) {
  45965. // If it is a node unlikely to be stringify-ed or looped over
  45966. // use plain assignment
  45967. if ( owner.nodeType ) {
  45968. owner[ this.expando ] = value;
  45969. // Otherwise secure it in a non-enumerable property
  45970. // configurable must be true to allow the property to be
  45971. // deleted when data is removed
  45972. } else {
  45973. Object.defineProperty( owner, this.expando, {
  45974. value: value,
  45975. configurable: true
  45976. } );
  45977. }
  45978. }
  45979. }
  45980. return value;
  45981. },
  45982. set: function( owner, data, value ) {
  45983. var prop,
  45984. cache = this.cache( owner );
  45985. // Handle: [ owner, key, value ] args
  45986. // Always use camelCase key (gh-2257)
  45987. if ( typeof data === "string" ) {
  45988. cache[ camelCase( data ) ] = value;
  45989. // Handle: [ owner, { properties } ] args
  45990. } else {
  45991. // Copy the properties one-by-one to the cache object
  45992. for ( prop in data ) {
  45993. cache[ camelCase( prop ) ] = data[ prop ];
  45994. }
  45995. }
  45996. return cache;
  45997. },
  45998. get: function( owner, key ) {
  45999. return key === undefined ?
  46000. this.cache( owner ) :
  46001. // Always use camelCase key (gh-2257)
  46002. owner[ this.expando ] && owner[ this.expando ][ camelCase( key ) ];
  46003. },
  46004. access: function( owner, key, value ) {
  46005. // In cases where either:
  46006. //
  46007. // 1. No key was specified
  46008. // 2. A string key was specified, but no value provided
  46009. //
  46010. // Take the "read" path and allow the get method to determine
  46011. // which value to return, respectively either:
  46012. //
  46013. // 1. The entire cache object
  46014. // 2. The data stored at the key
  46015. //
  46016. if ( key === undefined ||
  46017. ( ( key && typeof key === "string" ) && value === undefined ) ) {
  46018. return this.get( owner, key );
  46019. }
  46020. // When the key is not a string, or both a key and value
  46021. // are specified, set or extend (existing objects) with either:
  46022. //
  46023. // 1. An object of properties
  46024. // 2. A key and value
  46025. //
  46026. this.set( owner, key, value );
  46027. // Since the "set" path can have two possible entry points
  46028. // return the expected data based on which path was taken[*]
  46029. return value !== undefined ? value : key;
  46030. },
  46031. remove: function( owner, key ) {
  46032. var i,
  46033. cache = owner[ this.expando ];
  46034. if ( cache === undefined ) {
  46035. return;
  46036. }
  46037. if ( key !== undefined ) {
  46038. // Support array or space separated string of keys
  46039. if ( Array.isArray( key ) ) {
  46040. // If key is an array of keys...
  46041. // We always set camelCase keys, so remove that.
  46042. key = key.map( camelCase );
  46043. } else {
  46044. key = camelCase( key );
  46045. // If a key with the spaces exists, use it.
  46046. // Otherwise, create an array by matching non-whitespace
  46047. key = key in cache ?
  46048. [ key ] :
  46049. ( key.match( rnothtmlwhite ) || [] );
  46050. }
  46051. i = key.length;
  46052. while ( i-- ) {
  46053. delete cache[ key[ i ] ];
  46054. }
  46055. }
  46056. // Remove the expando if there's no more data
  46057. if ( key === undefined || jQuery.isEmptyObject( cache ) ) {
  46058. // Support: Chrome <=35 - 45
  46059. // Webkit & Blink performance suffers when deleting properties
  46060. // from DOM nodes, so set to undefined instead
  46061. // https://bugs.chromium.org/p/chromium/issues/detail?id=378607 (bug restricted)
  46062. if ( owner.nodeType ) {
  46063. owner[ this.expando ] = undefined;
  46064. } else {
  46065. delete owner[ this.expando ];
  46066. }
  46067. }
  46068. },
  46069. hasData: function( owner ) {
  46070. var cache = owner[ this.expando ];
  46071. return cache !== undefined && !jQuery.isEmptyObject( cache );
  46072. }
  46073. };
  46074. var dataPriv = new Data();
  46075. var dataUser = new Data();
  46076. // Implementation Summary
  46077. //
  46078. // 1. Enforce API surface and semantic compatibility with 1.9.x branch
  46079. // 2. Improve the module's maintainability by reducing the storage
  46080. // paths to a single mechanism.
  46081. // 3. Use the same single mechanism to support "private" and "user" data.
  46082. // 4. _Never_ expose "private" data to user code (TODO: Drop _data, _removeData)
  46083. // 5. Avoid exposing implementation details on user objects (eg. expando properties)
  46084. // 6. Provide a clear path for implementation upgrade to WeakMap in 2014
  46085. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,
  46086. rmultiDash = /[A-Z]/g;
  46087. function getData( data ) {
  46088. if ( data === "true" ) {
  46089. return true;
  46090. }
  46091. if ( data === "false" ) {
  46092. return false;
  46093. }
  46094. if ( data === "null" ) {
  46095. return null;
  46096. }
  46097. // Only convert to a number if it doesn't change the string
  46098. if ( data === +data + "" ) {
  46099. return +data;
  46100. }
  46101. if ( rbrace.test( data ) ) {
  46102. return JSON.parse( data );
  46103. }
  46104. return data;
  46105. }
  46106. function dataAttr( elem, key, data ) {
  46107. var name;
  46108. // If nothing was found internally, try to fetch any
  46109. // data from the HTML5 data-* attribute
  46110. if ( data === undefined && elem.nodeType === 1 ) {
  46111. name = "data-" + key.replace( rmultiDash, "-$&" ).toLowerCase();
  46112. data = elem.getAttribute( name );
  46113. if ( typeof data === "string" ) {
  46114. try {
  46115. data = getData( data );
  46116. } catch ( e ) {}
  46117. // Make sure we set the data so it isn't changed later
  46118. dataUser.set( elem, key, data );
  46119. } else {
  46120. data = undefined;
  46121. }
  46122. }
  46123. return data;
  46124. }
  46125. jQuery.extend( {
  46126. hasData: function( elem ) {
  46127. return dataUser.hasData( elem ) || dataPriv.hasData( elem );
  46128. },
  46129. data: function( elem, name, data ) {
  46130. return dataUser.access( elem, name, data );
  46131. },
  46132. removeData: function( elem, name ) {
  46133. dataUser.remove( elem, name );
  46134. },
  46135. // TODO: Now that all calls to _data and _removeData have been replaced
  46136. // with direct calls to dataPriv methods, these can be deprecated.
  46137. _data: function( elem, name, data ) {
  46138. return dataPriv.access( elem, name, data );
  46139. },
  46140. _removeData: function( elem, name ) {
  46141. dataPriv.remove( elem, name );
  46142. }
  46143. } );
  46144. jQuery.fn.extend( {
  46145. data: function( key, value ) {
  46146. var i, name, data,
  46147. elem = this[ 0 ],
  46148. attrs = elem && elem.attributes;
  46149. // Gets all values
  46150. if ( key === undefined ) {
  46151. if ( this.length ) {
  46152. data = dataUser.get( elem );
  46153. if ( elem.nodeType === 1 && !dataPriv.get( elem, "hasDataAttrs" ) ) {
  46154. i = attrs.length;
  46155. while ( i-- ) {
  46156. // Support: IE 11 only
  46157. // The attrs elements can be null (#14894)
  46158. if ( attrs[ i ] ) {
  46159. name = attrs[ i ].name;
  46160. if ( name.indexOf( "data-" ) === 0 ) {
  46161. name = camelCase( name.slice( 5 ) );
  46162. dataAttr( elem, name, data[ name ] );
  46163. }
  46164. }
  46165. }
  46166. dataPriv.set( elem, "hasDataAttrs", true );
  46167. }
  46168. }
  46169. return data;
  46170. }
  46171. // Sets multiple values
  46172. if ( typeof key === "object" ) {
  46173. return this.each( function() {
  46174. dataUser.set( this, key );
  46175. } );
  46176. }
  46177. return access( this, function( value ) {
  46178. var data;
  46179. // The calling jQuery object (element matches) is not empty
  46180. // (and therefore has an element appears at this[ 0 ]) and the
  46181. // `value` parameter was not undefined. An empty jQuery object
  46182. // will result in `undefined` for elem = this[ 0 ] which will
  46183. // throw an exception if an attempt to read a data cache is made.
  46184. if ( elem && value === undefined ) {
  46185. // Attempt to get data from the cache
  46186. // The key will always be camelCased in Data
  46187. data = dataUser.get( elem, key );
  46188. if ( data !== undefined ) {
  46189. return data;
  46190. }
  46191. // Attempt to "discover" the data in
  46192. // HTML5 custom data-* attrs
  46193. data = dataAttr( elem, key );
  46194. if ( data !== undefined ) {
  46195. return data;
  46196. }
  46197. // We tried really hard, but the data doesn't exist.
  46198. return;
  46199. }
  46200. // Set the data...
  46201. this.each( function() {
  46202. // We always store the camelCased key
  46203. dataUser.set( this, key, value );
  46204. } );
  46205. }, null, value, arguments.length > 1, null, true );
  46206. },
  46207. removeData: function( key ) {
  46208. return this.each( function() {
  46209. dataUser.remove( this, key );
  46210. } );
  46211. }
  46212. } );
  46213. jQuery.extend( {
  46214. queue: function( elem, type, data ) {
  46215. var queue;
  46216. if ( elem ) {
  46217. type = ( type || "fx" ) + "queue";
  46218. queue = dataPriv.get( elem, type );
  46219. // Speed up dequeue by getting out quickly if this is just a lookup
  46220. if ( data ) {
  46221. if ( !queue || Array.isArray( data ) ) {
  46222. queue = dataPriv.access( elem, type, jQuery.makeArray( data ) );
  46223. } else {
  46224. queue.push( data );
  46225. }
  46226. }
  46227. return queue || [];
  46228. }
  46229. },
  46230. dequeue: function( elem, type ) {
  46231. type = type || "fx";
  46232. var queue = jQuery.queue( elem, type ),
  46233. startLength = queue.length,
  46234. fn = queue.shift(),
  46235. hooks = jQuery._queueHooks( elem, type ),
  46236. next = function() {
  46237. jQuery.dequeue( elem, type );
  46238. };
  46239. // If the fx queue is dequeued, always remove the progress sentinel
  46240. if ( fn === "inprogress" ) {
  46241. fn = queue.shift();
  46242. startLength--;
  46243. }
  46244. if ( fn ) {
  46245. // Add a progress sentinel to prevent the fx queue from being
  46246. // automatically dequeued
  46247. if ( type === "fx" ) {
  46248. queue.unshift( "inprogress" );
  46249. }
  46250. // Clear up the last queue stop function
  46251. delete hooks.stop;
  46252. fn.call( elem, next, hooks );
  46253. }
  46254. if ( !startLength && hooks ) {
  46255. hooks.empty.fire();
  46256. }
  46257. },
  46258. // Not public - generate a queueHooks object, or return the current one
  46259. _queueHooks: function( elem, type ) {
  46260. var key = type + "queueHooks";
  46261. return dataPriv.get( elem, key ) || dataPriv.access( elem, key, {
  46262. empty: jQuery.Callbacks( "once memory" ).add( function() {
  46263. dataPriv.remove( elem, [ type + "queue", key ] );
  46264. } )
  46265. } );
  46266. }
  46267. } );
  46268. jQuery.fn.extend( {
  46269. queue: function( type, data ) {
  46270. var setter = 2;
  46271. if ( typeof type !== "string" ) {
  46272. data = type;
  46273. type = "fx";
  46274. setter--;
  46275. }
  46276. if ( arguments.length < setter ) {
  46277. return jQuery.queue( this[ 0 ], type );
  46278. }
  46279. return data === undefined ?
  46280. this :
  46281. this.each( function() {
  46282. var queue = jQuery.queue( this, type, data );
  46283. // Ensure a hooks for this queue
  46284. jQuery._queueHooks( this, type );
  46285. if ( type === "fx" && queue[ 0 ] !== "inprogress" ) {
  46286. jQuery.dequeue( this, type );
  46287. }
  46288. } );
  46289. },
  46290. dequeue: function( type ) {
  46291. return this.each( function() {
  46292. jQuery.dequeue( this, type );
  46293. } );
  46294. },
  46295. clearQueue: function( type ) {
  46296. return this.queue( type || "fx", [] );
  46297. },
  46298. // Get a promise resolved when queues of a certain type
  46299. // are emptied (fx is the type by default)
  46300. promise: function( type, obj ) {
  46301. var tmp,
  46302. count = 1,
  46303. defer = jQuery.Deferred(),
  46304. elements = this,
  46305. i = this.length,
  46306. resolve = function() {
  46307. if ( !( --count ) ) {
  46308. defer.resolveWith( elements, [ elements ] );
  46309. }
  46310. };
  46311. if ( typeof type !== "string" ) {
  46312. obj = type;
  46313. type = undefined;
  46314. }
  46315. type = type || "fx";
  46316. while ( i-- ) {
  46317. tmp = dataPriv.get( elements[ i ], type + "queueHooks" );
  46318. if ( tmp && tmp.empty ) {
  46319. count++;
  46320. tmp.empty.add( resolve );
  46321. }
  46322. }
  46323. resolve();
  46324. return defer.promise( obj );
  46325. }
  46326. } );
  46327. var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source;
  46328. var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" );
  46329. var cssExpand = [ "Top", "Right", "Bottom", "Left" ];
  46330. var isHiddenWithinTree = function( elem, el ) {
  46331. // isHiddenWithinTree might be called from jQuery#filter function;
  46332. // in that case, element will be second argument
  46333. elem = el || elem;
  46334. // Inline style trumps all
  46335. return elem.style.display === "none" ||
  46336. elem.style.display === "" &&
  46337. // Otherwise, check computed style
  46338. // Support: Firefox <=43 - 45
  46339. // Disconnected elements can have computed display: none, so first confirm that elem is
  46340. // in the document.
  46341. jQuery.contains( elem.ownerDocument, elem ) &&
  46342. jQuery.css( elem, "display" ) === "none";
  46343. };
  46344. var swap = function( elem, options, callback, args ) {
  46345. var ret, name,
  46346. old = {};
  46347. // Remember the old values, and insert the new ones
  46348. for ( name in options ) {
  46349. old[ name ] = elem.style[ name ];
  46350. elem.style[ name ] = options[ name ];
  46351. }
  46352. ret = callback.apply( elem, args || [] );
  46353. // Revert the old values
  46354. for ( name in options ) {
  46355. elem.style[ name ] = old[ name ];
  46356. }
  46357. return ret;
  46358. };
  46359. function adjustCSS( elem, prop, valueParts, tween ) {
  46360. var adjusted, scale,
  46361. maxIterations = 20,
  46362. currentValue = tween ?
  46363. function() {
  46364. return tween.cur();
  46365. } :
  46366. function() {
  46367. return jQuery.css( elem, prop, "" );
  46368. },
  46369. initial = currentValue(),
  46370. unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ),
  46371. // Starting value computation is required for potential unit mismatches
  46372. initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) &&
  46373. rcssNum.exec( jQuery.css( elem, prop ) );
  46374. if ( initialInUnit && initialInUnit[ 3 ] !== unit ) {
  46375. // Support: Firefox <=54
  46376. // Halve the iteration target value to prevent interference from CSS upper bounds (gh-2144)
  46377. initial = initial / 2;
  46378. // Trust units reported by jQuery.css
  46379. unit = unit || initialInUnit[ 3 ];
  46380. // Iteratively approximate from a nonzero starting point
  46381. initialInUnit = +initial || 1;
  46382. while ( maxIterations-- ) {
  46383. // Evaluate and update our best guess (doubling guesses that zero out).
  46384. // Finish if the scale equals or crosses 1 (making the old*new product non-positive).
  46385. jQuery.style( elem, prop, initialInUnit + unit );
  46386. if ( ( 1 - scale ) * ( 1 - ( scale = currentValue() / initial || 0.5 ) ) <= 0 ) {
  46387. maxIterations = 0;
  46388. }
  46389. initialInUnit = initialInUnit / scale;
  46390. }
  46391. initialInUnit = initialInUnit * 2;
  46392. jQuery.style( elem, prop, initialInUnit + unit );
  46393. // Make sure we update the tween properties later on
  46394. valueParts = valueParts || [];
  46395. }
  46396. if ( valueParts ) {
  46397. initialInUnit = +initialInUnit || +initial || 0;
  46398. // Apply relative offset (+=/-=) if specified
  46399. adjusted = valueParts[ 1 ] ?
  46400. initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] :
  46401. +valueParts[ 2 ];
  46402. if ( tween ) {
  46403. tween.unit = unit;
  46404. tween.start = initialInUnit;
  46405. tween.end = adjusted;
  46406. }
  46407. }
  46408. return adjusted;
  46409. }
  46410. var defaultDisplayMap = {};
  46411. function getDefaultDisplay( elem ) {
  46412. var temp,
  46413. doc = elem.ownerDocument,
  46414. nodeName = elem.nodeName,
  46415. display = defaultDisplayMap[ nodeName ];
  46416. if ( display ) {
  46417. return display;
  46418. }
  46419. temp = doc.body.appendChild( doc.createElement( nodeName ) );
  46420. display = jQuery.css( temp, "display" );
  46421. temp.parentNode.removeChild( temp );
  46422. if ( display === "none" ) {
  46423. display = "block";
  46424. }
  46425. defaultDisplayMap[ nodeName ] = display;
  46426. return display;
  46427. }
  46428. function showHide( elements, show ) {
  46429. var display, elem,
  46430. values = [],
  46431. index = 0,
  46432. length = elements.length;
  46433. // Determine new display value for elements that need to change
  46434. for ( ; index < length; index++ ) {
  46435. elem = elements[ index ];
  46436. if ( !elem.style ) {
  46437. continue;
  46438. }
  46439. display = elem.style.display;
  46440. if ( show ) {
  46441. // Since we force visibility upon cascade-hidden elements, an immediate (and slow)
  46442. // check is required in this first loop unless we have a nonempty display value (either
  46443. // inline or about-to-be-restored)
  46444. if ( display === "none" ) {
  46445. values[ index ] = dataPriv.get( elem, "display" ) || null;
  46446. if ( !values[ index ] ) {
  46447. elem.style.display = "";
  46448. }
  46449. }
  46450. if ( elem.style.display === "" && isHiddenWithinTree( elem ) ) {
  46451. values[ index ] = getDefaultDisplay( elem );
  46452. }
  46453. } else {
  46454. if ( display !== "none" ) {
  46455. values[ index ] = "none";
  46456. // Remember what we're overwriting
  46457. dataPriv.set( elem, "display", display );
  46458. }
  46459. }
  46460. }
  46461. // Set the display of the elements in a second loop to avoid constant reflow
  46462. for ( index = 0; index < length; index++ ) {
  46463. if ( values[ index ] != null ) {
  46464. elements[ index ].style.display = values[ index ];
  46465. }
  46466. }
  46467. return elements;
  46468. }
  46469. jQuery.fn.extend( {
  46470. show: function() {
  46471. return showHide( this, true );
  46472. },
  46473. hide: function() {
  46474. return showHide( this );
  46475. },
  46476. toggle: function( state ) {
  46477. if ( typeof state === "boolean" ) {
  46478. return state ? this.show() : this.hide();
  46479. }
  46480. return this.each( function() {
  46481. if ( isHiddenWithinTree( this ) ) {
  46482. jQuery( this ).show();
  46483. } else {
  46484. jQuery( this ).hide();
  46485. }
  46486. } );
  46487. }
  46488. } );
  46489. var rcheckableType = ( /^(?:checkbox|radio)$/i );
  46490. var rtagName = ( /<([a-z][^\/\0>\x20\t\r\n\f]+)/i );
  46491. var rscriptType = ( /^$|^module$|\/(?:java|ecma)script/i );
  46492. // We have to close these tags to support XHTML (#13200)
  46493. var wrapMap = {
  46494. // Support: IE <=9 only
  46495. option: [ 1, "<select multiple='multiple'>", "</select>" ],
  46496. // XHTML parsers do not magically insert elements in the
  46497. // same way that tag soup parsers do. So we cannot shorten
  46498. // this by omitting <tbody> or other required elements.
  46499. thead: [ 1, "<table>", "</table>" ],
  46500. col: [ 2, "<table><colgroup>", "</colgroup></table>" ],
  46501. tr: [ 2, "<table><tbody>", "</tbody></table>" ],
  46502. td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
  46503. _default: [ 0, "", "" ]
  46504. };
  46505. // Support: IE <=9 only
  46506. wrapMap.optgroup = wrapMap.option;
  46507. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  46508. wrapMap.th = wrapMap.td;
  46509. function getAll( context, tag ) {
  46510. // Support: IE <=9 - 11 only
  46511. // Use typeof to avoid zero-argument method invocation on host objects (#15151)
  46512. var ret;
  46513. if ( typeof context.getElementsByTagName !== "undefined" ) {
  46514. ret = context.getElementsByTagName( tag || "*" );
  46515. } else if ( typeof context.querySelectorAll !== "undefined" ) {
  46516. ret = context.querySelectorAll( tag || "*" );
  46517. } else {
  46518. ret = [];
  46519. }
  46520. if ( tag === undefined || tag && nodeName( context, tag ) ) {
  46521. return jQuery.merge( [ context ], ret );
  46522. }
  46523. return ret;
  46524. }
  46525. // Mark scripts as having already been evaluated
  46526. function setGlobalEval( elems, refElements ) {
  46527. var i = 0,
  46528. l = elems.length;
  46529. for ( ; i < l; i++ ) {
  46530. dataPriv.set(
  46531. elems[ i ],
  46532. "globalEval",
  46533. !refElements || dataPriv.get( refElements[ i ], "globalEval" )
  46534. );
  46535. }
  46536. }
  46537. var rhtml = /<|&#?\w+;/;
  46538. function buildFragment( elems, context, scripts, selection, ignored ) {
  46539. var elem, tmp, tag, wrap, contains, j,
  46540. fragment = context.createDocumentFragment(),
  46541. nodes = [],
  46542. i = 0,
  46543. l = elems.length;
  46544. for ( ; i < l; i++ ) {
  46545. elem = elems[ i ];
  46546. if ( elem || elem === 0 ) {
  46547. // Add nodes directly
  46548. if ( toType( elem ) === "object" ) {
  46549. // Support: Android <=4.0 only, PhantomJS 1 only
  46550. // push.apply(_, arraylike) throws on ancient WebKit
  46551. jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
  46552. // Convert non-html into a text node
  46553. } else if ( !rhtml.test( elem ) ) {
  46554. nodes.push( context.createTextNode( elem ) );
  46555. // Convert html into DOM nodes
  46556. } else {
  46557. tmp = tmp || fragment.appendChild( context.createElement( "div" ) );
  46558. // Deserialize a standard representation
  46559. tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
  46560. wrap = wrapMap[ tag ] || wrapMap._default;
  46561. tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
  46562. // Descend through wrappers to the right content
  46563. j = wrap[ 0 ];
  46564. while ( j-- ) {
  46565. tmp = tmp.lastChild;
  46566. }
  46567. // Support: Android <=4.0 only, PhantomJS 1 only
  46568. // push.apply(_, arraylike) throws on ancient WebKit
  46569. jQuery.merge( nodes, tmp.childNodes );
  46570. // Remember the top-level container
  46571. tmp = fragment.firstChild;
  46572. // Ensure the created nodes are orphaned (#12392)
  46573. tmp.textContent = "";
  46574. }
  46575. }
  46576. }
  46577. // Remove wrapper from fragment
  46578. fragment.textContent = "";
  46579. i = 0;
  46580. while ( ( elem = nodes[ i++ ] ) ) {
  46581. // Skip elements already in the context collection (trac-4087)
  46582. if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
  46583. if ( ignored ) {
  46584. ignored.push( elem );
  46585. }
  46586. continue;
  46587. }
  46588. contains = jQuery.contains( elem.ownerDocument, elem );
  46589. // Append to fragment
  46590. tmp = getAll( fragment.appendChild( elem ), "script" );
  46591. // Preserve script evaluation history
  46592. if ( contains ) {
  46593. setGlobalEval( tmp );
  46594. }
  46595. // Capture executables
  46596. if ( scripts ) {
  46597. j = 0;
  46598. while ( ( elem = tmp[ j++ ] ) ) {
  46599. if ( rscriptType.test( elem.type || "" ) ) {
  46600. scripts.push( elem );
  46601. }
  46602. }
  46603. }
  46604. }
  46605. return fragment;
  46606. }
  46607. ( function() {
  46608. var fragment = document.createDocumentFragment(),
  46609. div = fragment.appendChild( document.createElement( "div" ) ),
  46610. input = document.createElement( "input" );
  46611. // Support: Android 4.0 - 4.3 only
  46612. // Check state lost if the name is set (#11217)
  46613. // Support: Windows Web Apps (WWA)
  46614. // `name` and `type` must use .setAttribute for WWA (#14901)
  46615. input.setAttribute( "type", "radio" );
  46616. input.setAttribute( "checked", "checked" );
  46617. input.setAttribute( "name", "t" );
  46618. div.appendChild( input );
  46619. // Support: Android <=4.1 only
  46620. // Older WebKit doesn't clone checked state correctly in fragments
  46621. support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
  46622. // Support: IE <=11 only
  46623. // Make sure textarea (and checkbox) defaultValue is properly cloned
  46624. div.innerHTML = "<textarea>x</textarea>";
  46625. support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
  46626. } )();
  46627. var documentElement = document.documentElement;
  46628. var
  46629. rkeyEvent = /^key/,
  46630. rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/,
  46631. rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  46632. function returnTrue() {
  46633. return true;
  46634. }
  46635. function returnFalse() {
  46636. return false;
  46637. }
  46638. // Support: IE <=9 only
  46639. // See #13393 for more info
  46640. function safeActiveElement() {
  46641. try {
  46642. return document.activeElement;
  46643. } catch ( err ) { }
  46644. }
  46645. function on( elem, types, selector, data, fn, one ) {
  46646. var origFn, type;
  46647. // Types can be a map of types/handlers
  46648. if ( typeof types === "object" ) {
  46649. // ( types-Object, selector, data )
  46650. if ( typeof selector !== "string" ) {
  46651. // ( types-Object, data )
  46652. data = data || selector;
  46653. selector = undefined;
  46654. }
  46655. for ( type in types ) {
  46656. on( elem, type, selector, data, types[ type ], one );
  46657. }
  46658. return elem;
  46659. }
  46660. if ( data == null && fn == null ) {
  46661. // ( types, fn )
  46662. fn = selector;
  46663. data = selector = undefined;
  46664. } else if ( fn == null ) {
  46665. if ( typeof selector === "string" ) {
  46666. // ( types, selector, fn )
  46667. fn = data;
  46668. data = undefined;
  46669. } else {
  46670. // ( types, data, fn )
  46671. fn = data;
  46672. data = selector;
  46673. selector = undefined;
  46674. }
  46675. }
  46676. if ( fn === false ) {
  46677. fn = returnFalse;
  46678. } else if ( !fn ) {
  46679. return elem;
  46680. }
  46681. if ( one === 1 ) {
  46682. origFn = fn;
  46683. fn = function( event ) {
  46684. // Can use an empty set, since event contains the info
  46685. jQuery().off( event );
  46686. return origFn.apply( this, arguments );
  46687. };
  46688. // Use same guid so caller can remove using origFn
  46689. fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ );
  46690. }
  46691. return elem.each( function() {
  46692. jQuery.event.add( this, types, fn, data, selector );
  46693. } );
  46694. }
  46695. /*
  46696. * Helper functions for managing events -- not part of the public interface.
  46697. * Props to Dean Edwards' addEvent library for many of the ideas.
  46698. */
  46699. jQuery.event = {
  46700. global: {},
  46701. add: function( elem, types, handler, data, selector ) {
  46702. var handleObjIn, eventHandle, tmp,
  46703. events, t, handleObj,
  46704. special, handlers, type, namespaces, origType,
  46705. elemData = dataPriv.get( elem );
  46706. // Don't attach events to noData or text/comment nodes (but allow plain objects)
  46707. if ( !elemData ) {
  46708. return;
  46709. }
  46710. // Caller can pass in an object of custom data in lieu of the handler
  46711. if ( handler.handler ) {
  46712. handleObjIn = handler;
  46713. handler = handleObjIn.handler;
  46714. selector = handleObjIn.selector;
  46715. }
  46716. // Ensure that invalid selectors throw exceptions at attach time
  46717. // Evaluate against documentElement in case elem is a non-element node (e.g., document)
  46718. if ( selector ) {
  46719. jQuery.find.matchesSelector( documentElement, selector );
  46720. }
  46721. // Make sure that the handler has a unique ID, used to find/remove it later
  46722. if ( !handler.guid ) {
  46723. handler.guid = jQuery.guid++;
  46724. }
  46725. // Init the element's event structure and main handler, if this is the first
  46726. if ( !( events = elemData.events ) ) {
  46727. events = elemData.events = {};
  46728. }
  46729. if ( !( eventHandle = elemData.handle ) ) {
  46730. eventHandle = elemData.handle = function( e ) {
  46731. // Discard the second event of a jQuery.event.trigger() and
  46732. // when an event is called after a page has unloaded
  46733. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ?
  46734. jQuery.event.dispatch.apply( elem, arguments ) : undefined;
  46735. };
  46736. }
  46737. // Handle multiple events separated by a space
  46738. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46739. t = types.length;
  46740. while ( t-- ) {
  46741. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46742. type = origType = tmp[ 1 ];
  46743. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46744. // There *must* be a type, no attaching namespace-only handlers
  46745. if ( !type ) {
  46746. continue;
  46747. }
  46748. // If event changes its type, use the special event handlers for the changed type
  46749. special = jQuery.event.special[ type ] || {};
  46750. // If selector defined, determine special event api type, otherwise given type
  46751. type = ( selector ? special.delegateType : special.bindType ) || type;
  46752. // Update special based on newly reset type
  46753. special = jQuery.event.special[ type ] || {};
  46754. // handleObj is passed to all event handlers
  46755. handleObj = jQuery.extend( {
  46756. type: type,
  46757. origType: origType,
  46758. data: data,
  46759. handler: handler,
  46760. guid: handler.guid,
  46761. selector: selector,
  46762. needsContext: selector && jQuery.expr.match.needsContext.test( selector ),
  46763. namespace: namespaces.join( "." )
  46764. }, handleObjIn );
  46765. // Init the event handler queue if we're the first
  46766. if ( !( handlers = events[ type ] ) ) {
  46767. handlers = events[ type ] = [];
  46768. handlers.delegateCount = 0;
  46769. // Only use addEventListener if the special events handler returns false
  46770. if ( !special.setup ||
  46771. special.setup.call( elem, data, namespaces, eventHandle ) === false ) {
  46772. if ( elem.addEventListener ) {
  46773. elem.addEventListener( type, eventHandle );
  46774. }
  46775. }
  46776. }
  46777. if ( special.add ) {
  46778. special.add.call( elem, handleObj );
  46779. if ( !handleObj.handler.guid ) {
  46780. handleObj.handler.guid = handler.guid;
  46781. }
  46782. }
  46783. // Add to the element's handler list, delegates in front
  46784. if ( selector ) {
  46785. handlers.splice( handlers.delegateCount++, 0, handleObj );
  46786. } else {
  46787. handlers.push( handleObj );
  46788. }
  46789. // Keep track of which events have ever been used, for event optimization
  46790. jQuery.event.global[ type ] = true;
  46791. }
  46792. },
  46793. // Detach an event or set of events from an element
  46794. remove: function( elem, types, handler, selector, mappedTypes ) {
  46795. var j, origCount, tmp,
  46796. events, t, handleObj,
  46797. special, handlers, type, namespaces, origType,
  46798. elemData = dataPriv.hasData( elem ) && dataPriv.get( elem );
  46799. if ( !elemData || !( events = elemData.events ) ) {
  46800. return;
  46801. }
  46802. // Once for each type.namespace in types; type may be omitted
  46803. types = ( types || "" ).match( rnothtmlwhite ) || [ "" ];
  46804. t = types.length;
  46805. while ( t-- ) {
  46806. tmp = rtypenamespace.exec( types[ t ] ) || [];
  46807. type = origType = tmp[ 1 ];
  46808. namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort();
  46809. // Unbind all events (on this namespace, if provided) for the element
  46810. if ( !type ) {
  46811. for ( type in events ) {
  46812. jQuery.event.remove( elem, type + types[ t ], handler, selector, true );
  46813. }
  46814. continue;
  46815. }
  46816. special = jQuery.event.special[ type ] || {};
  46817. type = ( selector ? special.delegateType : special.bindType ) || type;
  46818. handlers = events[ type ] || [];
  46819. tmp = tmp[ 2 ] &&
  46820. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" );
  46821. // Remove matching events
  46822. origCount = j = handlers.length;
  46823. while ( j-- ) {
  46824. handleObj = handlers[ j ];
  46825. if ( ( mappedTypes || origType === handleObj.origType ) &&
  46826. ( !handler || handler.guid === handleObj.guid ) &&
  46827. ( !tmp || tmp.test( handleObj.namespace ) ) &&
  46828. ( !selector || selector === handleObj.selector ||
  46829. selector === "**" && handleObj.selector ) ) {
  46830. handlers.splice( j, 1 );
  46831. if ( handleObj.selector ) {
  46832. handlers.delegateCount--;
  46833. }
  46834. if ( special.remove ) {
  46835. special.remove.call( elem, handleObj );
  46836. }
  46837. }
  46838. }
  46839. // Remove generic event handler if we removed something and no more handlers exist
  46840. // (avoids potential for endless recursion during removal of special event handlers)
  46841. if ( origCount && !handlers.length ) {
  46842. if ( !special.teardown ||
  46843. special.teardown.call( elem, namespaces, elemData.handle ) === false ) {
  46844. jQuery.removeEvent( elem, type, elemData.handle );
  46845. }
  46846. delete events[ type ];
  46847. }
  46848. }
  46849. // Remove data and the expando if it's no longer used
  46850. if ( jQuery.isEmptyObject( events ) ) {
  46851. dataPriv.remove( elem, "handle events" );
  46852. }
  46853. },
  46854. dispatch: function( nativeEvent ) {
  46855. // Make a writable jQuery.Event from the native event object
  46856. var event = jQuery.event.fix( nativeEvent );
  46857. var i, j, ret, matched, handleObj, handlerQueue,
  46858. args = new Array( arguments.length ),
  46859. handlers = ( dataPriv.get( this, "events" ) || {} )[ event.type ] || [],
  46860. special = jQuery.event.special[ event.type ] || {};
  46861. // Use the fix-ed jQuery.Event rather than the (read-only) native event
  46862. args[ 0 ] = event;
  46863. for ( i = 1; i < arguments.length; i++ ) {
  46864. args[ i ] = arguments[ i ];
  46865. }
  46866. event.delegateTarget = this;
  46867. // Call the preDispatch hook for the mapped type, and let it bail if desired
  46868. if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) {
  46869. return;
  46870. }
  46871. // Determine handlers
  46872. handlerQueue = jQuery.event.handlers.call( this, event, handlers );
  46873. // Run delegates first; they may want to stop propagation beneath us
  46874. i = 0;
  46875. while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) {
  46876. event.currentTarget = matched.elem;
  46877. j = 0;
  46878. while ( ( handleObj = matched.handlers[ j++ ] ) &&
  46879. !event.isImmediatePropagationStopped() ) {
  46880. // Triggered event must either 1) have no namespace, or 2) have namespace(s)
  46881. // a subset or equal to those in the bound event (both can have no namespace).
  46882. if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) {
  46883. event.handleObj = handleObj;
  46884. event.data = handleObj.data;
  46885. ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle ||
  46886. handleObj.handler ).apply( matched.elem, args );
  46887. if ( ret !== undefined ) {
  46888. if ( ( event.result = ret ) === false ) {
  46889. event.preventDefault();
  46890. event.stopPropagation();
  46891. }
  46892. }
  46893. }
  46894. }
  46895. }
  46896. // Call the postDispatch hook for the mapped type
  46897. if ( special.postDispatch ) {
  46898. special.postDispatch.call( this, event );
  46899. }
  46900. return event.result;
  46901. },
  46902. handlers: function( event, handlers ) {
  46903. var i, handleObj, sel, matchedHandlers, matchedSelectors,
  46904. handlerQueue = [],
  46905. delegateCount = handlers.delegateCount,
  46906. cur = event.target;
  46907. // Find delegate handlers
  46908. if ( delegateCount &&
  46909. // Support: IE <=9
  46910. // Black-hole SVG <use> instance trees (trac-13180)
  46911. cur.nodeType &&
  46912. // Support: Firefox <=42
  46913. // Suppress spec-violating clicks indicating a non-primary pointer button (trac-3861)
  46914. // https://www.w3.org/TR/DOM-Level-3-Events/#event-type-click
  46915. // Support: IE 11 only
  46916. // ...but not arrow key "clicks" of radio inputs, which can have `button` -1 (gh-2343)
  46917. !( event.type === "click" && event.button >= 1 ) ) {
  46918. for ( ; cur !== this; cur = cur.parentNode || this ) {
  46919. // Don't check non-elements (#13208)
  46920. // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764)
  46921. if ( cur.nodeType === 1 && !( event.type === "click" && cur.disabled === true ) ) {
  46922. matchedHandlers = [];
  46923. matchedSelectors = {};
  46924. for ( i = 0; i < delegateCount; i++ ) {
  46925. handleObj = handlers[ i ];
  46926. // Don't conflict with Object.prototype properties (#13203)
  46927. sel = handleObj.selector + " ";
  46928. if ( matchedSelectors[ sel ] === undefined ) {
  46929. matchedSelectors[ sel ] = handleObj.needsContext ?
  46930. jQuery( sel, this ).index( cur ) > -1 :
  46931. jQuery.find( sel, this, null, [ cur ] ).length;
  46932. }
  46933. if ( matchedSelectors[ sel ] ) {
  46934. matchedHandlers.push( handleObj );
  46935. }
  46936. }
  46937. if ( matchedHandlers.length ) {
  46938. handlerQueue.push( { elem: cur, handlers: matchedHandlers } );
  46939. }
  46940. }
  46941. }
  46942. }
  46943. // Add the remaining (directly-bound) handlers
  46944. cur = this;
  46945. if ( delegateCount < handlers.length ) {
  46946. handlerQueue.push( { elem: cur, handlers: handlers.slice( delegateCount ) } );
  46947. }
  46948. return handlerQueue;
  46949. },
  46950. addProp: function( name, hook ) {
  46951. Object.defineProperty( jQuery.Event.prototype, name, {
  46952. enumerable: true,
  46953. configurable: true,
  46954. get: isFunction( hook ) ?
  46955. function() {
  46956. if ( this.originalEvent ) {
  46957. return hook( this.originalEvent );
  46958. }
  46959. } :
  46960. function() {
  46961. if ( this.originalEvent ) {
  46962. return this.originalEvent[ name ];
  46963. }
  46964. },
  46965. set: function( value ) {
  46966. Object.defineProperty( this, name, {
  46967. enumerable: true,
  46968. configurable: true,
  46969. writable: true,
  46970. value: value
  46971. } );
  46972. }
  46973. } );
  46974. },
  46975. fix: function( originalEvent ) {
  46976. return originalEvent[ jQuery.expando ] ?
  46977. originalEvent :
  46978. new jQuery.Event( originalEvent );
  46979. },
  46980. special: {
  46981. load: {
  46982. // Prevent triggered image.load events from bubbling to window.load
  46983. noBubble: true
  46984. },
  46985. focus: {
  46986. // Fire native event if possible so blur/focus sequence is correct
  46987. trigger: function() {
  46988. if ( this !== safeActiveElement() && this.focus ) {
  46989. this.focus();
  46990. return false;
  46991. }
  46992. },
  46993. delegateType: "focusin"
  46994. },
  46995. blur: {
  46996. trigger: function() {
  46997. if ( this === safeActiveElement() && this.blur ) {
  46998. this.blur();
  46999. return false;
  47000. }
  47001. },
  47002. delegateType: "focusout"
  47003. },
  47004. click: {
  47005. // For checkbox, fire native event so checked state will be right
  47006. trigger: function() {
  47007. if ( this.type === "checkbox" && this.click && nodeName( this, "input" ) ) {
  47008. this.click();
  47009. return false;
  47010. }
  47011. },
  47012. // For cross-browser consistency, don't fire native .click() on links
  47013. _default: function( event ) {
  47014. return nodeName( event.target, "a" );
  47015. }
  47016. },
  47017. beforeunload: {
  47018. postDispatch: function( event ) {
  47019. // Support: Firefox 20+
  47020. // Firefox doesn't alert if the returnValue field is not set.
  47021. if ( event.result !== undefined && event.originalEvent ) {
  47022. event.originalEvent.returnValue = event.result;
  47023. }
  47024. }
  47025. }
  47026. }
  47027. };
  47028. jQuery.removeEvent = function( elem, type, handle ) {
  47029. // This "if" is needed for plain objects
  47030. if ( elem.removeEventListener ) {
  47031. elem.removeEventListener( type, handle );
  47032. }
  47033. };
  47034. jQuery.Event = function( src, props ) {
  47035. // Allow instantiation without the 'new' keyword
  47036. if ( !( this instanceof jQuery.Event ) ) {
  47037. return new jQuery.Event( src, props );
  47038. }
  47039. // Event object
  47040. if ( src && src.type ) {
  47041. this.originalEvent = src;
  47042. this.type = src.type;
  47043. // Events bubbling up the document may have been marked as prevented
  47044. // by a handler lower down the tree; reflect the correct value.
  47045. this.isDefaultPrevented = src.defaultPrevented ||
  47046. src.defaultPrevented === undefined &&
  47047. // Support: Android <=2.3 only
  47048. src.returnValue === false ?
  47049. returnTrue :
  47050. returnFalse;
  47051. // Create target properties
  47052. // Support: Safari <=6 - 7 only
  47053. // Target should not be a text node (#504, #13143)
  47054. this.target = ( src.target && src.target.nodeType === 3 ) ?
  47055. src.target.parentNode :
  47056. src.target;
  47057. this.currentTarget = src.currentTarget;
  47058. this.relatedTarget = src.relatedTarget;
  47059. // Event type
  47060. } else {
  47061. this.type = src;
  47062. }
  47063. // Put explicitly provided properties onto the event object
  47064. if ( props ) {
  47065. jQuery.extend( this, props );
  47066. }
  47067. // Create a timestamp if incoming event doesn't have one
  47068. this.timeStamp = src && src.timeStamp || Date.now();
  47069. // Mark it as fixed
  47070. this[ jQuery.expando ] = true;
  47071. };
  47072. // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding
  47073. // https://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html
  47074. jQuery.Event.prototype = {
  47075. constructor: jQuery.Event,
  47076. isDefaultPrevented: returnFalse,
  47077. isPropagationStopped: returnFalse,
  47078. isImmediatePropagationStopped: returnFalse,
  47079. isSimulated: false,
  47080. preventDefault: function() {
  47081. var e = this.originalEvent;
  47082. this.isDefaultPrevented = returnTrue;
  47083. if ( e && !this.isSimulated ) {
  47084. e.preventDefault();
  47085. }
  47086. },
  47087. stopPropagation: function() {
  47088. var e = this.originalEvent;
  47089. this.isPropagationStopped = returnTrue;
  47090. if ( e && !this.isSimulated ) {
  47091. e.stopPropagation();
  47092. }
  47093. },
  47094. stopImmediatePropagation: function() {
  47095. var e = this.originalEvent;
  47096. this.isImmediatePropagationStopped = returnTrue;
  47097. if ( e && !this.isSimulated ) {
  47098. e.stopImmediatePropagation();
  47099. }
  47100. this.stopPropagation();
  47101. }
  47102. };
  47103. // Includes all common event props including KeyEvent and MouseEvent specific props
  47104. jQuery.each( {
  47105. altKey: true,
  47106. bubbles: true,
  47107. cancelable: true,
  47108. changedTouches: true,
  47109. ctrlKey: true,
  47110. detail: true,
  47111. eventPhase: true,
  47112. metaKey: true,
  47113. pageX: true,
  47114. pageY: true,
  47115. shiftKey: true,
  47116. view: true,
  47117. "char": true,
  47118. charCode: true,
  47119. key: true,
  47120. keyCode: true,
  47121. button: true,
  47122. buttons: true,
  47123. clientX: true,
  47124. clientY: true,
  47125. offsetX: true,
  47126. offsetY: true,
  47127. pointerId: true,
  47128. pointerType: true,
  47129. screenX: true,
  47130. screenY: true,
  47131. targetTouches: true,
  47132. toElement: true,
  47133. touches: true,
  47134. which: function( event ) {
  47135. var button = event.button;
  47136. // Add which for key events
  47137. if ( event.which == null && rkeyEvent.test( event.type ) ) {
  47138. return event.charCode != null ? event.charCode : event.keyCode;
  47139. }
  47140. // Add which for click: 1 === left; 2 === middle; 3 === right
  47141. if ( !event.which && button !== undefined && rmouseEvent.test( event.type ) ) {
  47142. if ( button & 1 ) {
  47143. return 1;
  47144. }
  47145. if ( button & 2 ) {
  47146. return 3;
  47147. }
  47148. if ( button & 4 ) {
  47149. return 2;
  47150. }
  47151. return 0;
  47152. }
  47153. return event.which;
  47154. }
  47155. }, jQuery.event.addProp );
  47156. // Create mouseenter/leave events using mouseover/out and event-time checks
  47157. // so that event delegation works in jQuery.
  47158. // Do the same for pointerenter/pointerleave and pointerover/pointerout
  47159. //
  47160. // Support: Safari 7 only
  47161. // Safari sends mouseenter too often; see:
  47162. // https://bugs.chromium.org/p/chromium/issues/detail?id=470258
  47163. // for the description of the bug (it existed in older Chrome versions as well).
  47164. jQuery.each( {
  47165. mouseenter: "mouseover",
  47166. mouseleave: "mouseout",
  47167. pointerenter: "pointerover",
  47168. pointerleave: "pointerout"
  47169. }, function( orig, fix ) {
  47170. jQuery.event.special[ orig ] = {
  47171. delegateType: fix,
  47172. bindType: fix,
  47173. handle: function( event ) {
  47174. var ret,
  47175. target = this,
  47176. related = event.relatedTarget,
  47177. handleObj = event.handleObj;
  47178. // For mouseenter/leave call the handler if related is outside the target.
  47179. // NB: No relatedTarget if the mouse left/entered the browser window
  47180. if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) {
  47181. event.type = handleObj.origType;
  47182. ret = handleObj.handler.apply( this, arguments );
  47183. event.type = fix;
  47184. }
  47185. return ret;
  47186. }
  47187. };
  47188. } );
  47189. jQuery.fn.extend( {
  47190. on: function( types, selector, data, fn ) {
  47191. return on( this, types, selector, data, fn );
  47192. },
  47193. one: function( types, selector, data, fn ) {
  47194. return on( this, types, selector, data, fn, 1 );
  47195. },
  47196. off: function( types, selector, fn ) {
  47197. var handleObj, type;
  47198. if ( types && types.preventDefault && types.handleObj ) {
  47199. // ( event ) dispatched jQuery.Event
  47200. handleObj = types.handleObj;
  47201. jQuery( types.delegateTarget ).off(
  47202. handleObj.namespace ?
  47203. handleObj.origType + "." + handleObj.namespace :
  47204. handleObj.origType,
  47205. handleObj.selector,
  47206. handleObj.handler
  47207. );
  47208. return this;
  47209. }
  47210. if ( typeof types === "object" ) {
  47211. // ( types-object [, selector] )
  47212. for ( type in types ) {
  47213. this.off( type, selector, types[ type ] );
  47214. }
  47215. return this;
  47216. }
  47217. if ( selector === false || typeof selector === "function" ) {
  47218. // ( types [, fn] )
  47219. fn = selector;
  47220. selector = undefined;
  47221. }
  47222. if ( fn === false ) {
  47223. fn = returnFalse;
  47224. }
  47225. return this.each( function() {
  47226. jQuery.event.remove( this, types, fn, selector );
  47227. } );
  47228. }
  47229. } );
  47230. var
  47231. /* eslint-disable max-len */
  47232. // See https://github.com/eslint/eslint/issues/3229
  47233. rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,
  47234. /* eslint-enable */
  47235. // Support: IE <=10 - 11, Edge 12 - 13 only
  47236. // In IE/Edge using regex groups here causes severe slowdowns.
  47237. // See https://connect.microsoft.com/IE/feedback/details/1736512/
  47238. rnoInnerhtml = /<script|<style|<link/i,
  47239. // checked="checked" or checked
  47240. rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i,
  47241. rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;
  47242. // Prefer a tbody over its parent table for containing new rows
  47243. function manipulationTarget( elem, content ) {
  47244. if ( nodeName( elem, "table" ) &&
  47245. nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ) {
  47246. return jQuery( elem ).children( "tbody" )[ 0 ] || elem;
  47247. }
  47248. return elem;
  47249. }
  47250. // Replace/restore the type attribute of script elements for safe DOM manipulation
  47251. function disableScript( elem ) {
  47252. elem.type = ( elem.getAttribute( "type" ) !== null ) + "/" + elem.type;
  47253. return elem;
  47254. }
  47255. function restoreScript( elem ) {
  47256. if ( ( elem.type || "" ).slice( 0, 5 ) === "true/" ) {
  47257. elem.type = elem.type.slice( 5 );
  47258. } else {
  47259. elem.removeAttribute( "type" );
  47260. }
  47261. return elem;
  47262. }
  47263. function cloneCopyEvent( src, dest ) {
  47264. var i, l, type, pdataOld, pdataCur, udataOld, udataCur, events;
  47265. if ( dest.nodeType !== 1 ) {
  47266. return;
  47267. }
  47268. // 1. Copy private data: events, handlers, etc.
  47269. if ( dataPriv.hasData( src ) ) {
  47270. pdataOld = dataPriv.access( src );
  47271. pdataCur = dataPriv.set( dest, pdataOld );
  47272. events = pdataOld.events;
  47273. if ( events ) {
  47274. delete pdataCur.handle;
  47275. pdataCur.events = {};
  47276. for ( type in events ) {
  47277. for ( i = 0, l = events[ type ].length; i < l; i++ ) {
  47278. jQuery.event.add( dest, type, events[ type ][ i ] );
  47279. }
  47280. }
  47281. }
  47282. }
  47283. // 2. Copy user data
  47284. if ( dataUser.hasData( src ) ) {
  47285. udataOld = dataUser.access( src );
  47286. udataCur = jQuery.extend( {}, udataOld );
  47287. dataUser.set( dest, udataCur );
  47288. }
  47289. }
  47290. // Fix IE bugs, see support tests
  47291. function fixInput( src, dest ) {
  47292. var nodeName = dest.nodeName.toLowerCase();
  47293. // Fails to persist the checked state of a cloned checkbox or radio button.
  47294. if ( nodeName === "input" && rcheckableType.test( src.type ) ) {
  47295. dest.checked = src.checked;
  47296. // Fails to return the selected option to the default selected state when cloning options
  47297. } else if ( nodeName === "input" || nodeName === "textarea" ) {
  47298. dest.defaultValue = src.defaultValue;
  47299. }
  47300. }
  47301. function domManip( collection, args, callback, ignored ) {
  47302. // Flatten any nested arrays
  47303. args = concat.apply( [], args );
  47304. var fragment, first, scripts, hasScripts, node, doc,
  47305. i = 0,
  47306. l = collection.length,
  47307. iNoClone = l - 1,
  47308. value = args[ 0 ],
  47309. valueIsFunction = isFunction( value );
  47310. // We can't cloneNode fragments that contain checked, in WebKit
  47311. if ( valueIsFunction ||
  47312. ( l > 1 && typeof value === "string" &&
  47313. !support.checkClone && rchecked.test( value ) ) ) {
  47314. return collection.each( function( index ) {
  47315. var self = collection.eq( index );
  47316. if ( valueIsFunction ) {
  47317. args[ 0 ] = value.call( this, index, self.html() );
  47318. }
  47319. domManip( self, args, callback, ignored );
  47320. } );
  47321. }
  47322. if ( l ) {
  47323. fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored );
  47324. first = fragment.firstChild;
  47325. if ( fragment.childNodes.length === 1 ) {
  47326. fragment = first;
  47327. }
  47328. // Require either new content or an interest in ignored elements to invoke the callback
  47329. if ( first || ignored ) {
  47330. scripts = jQuery.map( getAll( fragment, "script" ), disableScript );
  47331. hasScripts = scripts.length;
  47332. // Use the original fragment for the last item
  47333. // instead of the first because it can end up
  47334. // being emptied incorrectly in certain situations (#8070).
  47335. for ( ; i < l; i++ ) {
  47336. node = fragment;
  47337. if ( i !== iNoClone ) {
  47338. node = jQuery.clone( node, true, true );
  47339. // Keep references to cloned scripts for later restoration
  47340. if ( hasScripts ) {
  47341. // Support: Android <=4.0 only, PhantomJS 1 only
  47342. // push.apply(_, arraylike) throws on ancient WebKit
  47343. jQuery.merge( scripts, getAll( node, "script" ) );
  47344. }
  47345. }
  47346. callback.call( collection[ i ], node, i );
  47347. }
  47348. if ( hasScripts ) {
  47349. doc = scripts[ scripts.length - 1 ].ownerDocument;
  47350. // Reenable scripts
  47351. jQuery.map( scripts, restoreScript );
  47352. // Evaluate executable scripts on first document insertion
  47353. for ( i = 0; i < hasScripts; i++ ) {
  47354. node = scripts[ i ];
  47355. if ( rscriptType.test( node.type || "" ) &&
  47356. !dataPriv.access( node, "globalEval" ) &&
  47357. jQuery.contains( doc, node ) ) {
  47358. if ( node.src && ( node.type || "" ).toLowerCase() !== "module" ) {
  47359. // Optional AJAX dependency, but won't run scripts if not present
  47360. if ( jQuery._evalUrl ) {
  47361. jQuery._evalUrl( node.src );
  47362. }
  47363. } else {
  47364. DOMEval( node.textContent.replace( rcleanScript, "" ), doc, node );
  47365. }
  47366. }
  47367. }
  47368. }
  47369. }
  47370. }
  47371. return collection;
  47372. }
  47373. function remove( elem, selector, keepData ) {
  47374. var node,
  47375. nodes = selector ? jQuery.filter( selector, elem ) : elem,
  47376. i = 0;
  47377. for ( ; ( node = nodes[ i ] ) != null; i++ ) {
  47378. if ( !keepData && node.nodeType === 1 ) {
  47379. jQuery.cleanData( getAll( node ) );
  47380. }
  47381. if ( node.parentNode ) {
  47382. if ( keepData && jQuery.contains( node.ownerDocument, node ) ) {
  47383. setGlobalEval( getAll( node, "script" ) );
  47384. }
  47385. node.parentNode.removeChild( node );
  47386. }
  47387. }
  47388. return elem;
  47389. }
  47390. jQuery.extend( {
  47391. htmlPrefilter: function( html ) {
  47392. return html.replace( rxhtmlTag, "<$1></$2>" );
  47393. },
  47394. clone: function( elem, dataAndEvents, deepDataAndEvents ) {
  47395. var i, l, srcElements, destElements,
  47396. clone = elem.cloneNode( true ),
  47397. inPage = jQuery.contains( elem.ownerDocument, elem );
  47398. // Fix IE cloning issues
  47399. if ( !support.noCloneChecked && ( elem.nodeType === 1 || elem.nodeType === 11 ) &&
  47400. !jQuery.isXMLDoc( elem ) ) {
  47401. // We eschew Sizzle here for performance reasons: https://jsperf.com/getall-vs-sizzle/2
  47402. destElements = getAll( clone );
  47403. srcElements = getAll( elem );
  47404. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  47405. fixInput( srcElements[ i ], destElements[ i ] );
  47406. }
  47407. }
  47408. // Copy the events from the original to the clone
  47409. if ( dataAndEvents ) {
  47410. if ( deepDataAndEvents ) {
  47411. srcElements = srcElements || getAll( elem );
  47412. destElements = destElements || getAll( clone );
  47413. for ( i = 0, l = srcElements.length; i < l; i++ ) {
  47414. cloneCopyEvent( srcElements[ i ], destElements[ i ] );
  47415. }
  47416. } else {
  47417. cloneCopyEvent( elem, clone );
  47418. }
  47419. }
  47420. // Preserve script evaluation history
  47421. destElements = getAll( clone, "script" );
  47422. if ( destElements.length > 0 ) {
  47423. setGlobalEval( destElements, !inPage && getAll( elem, "script" ) );
  47424. }
  47425. // Return the cloned set
  47426. return clone;
  47427. },
  47428. cleanData: function( elems ) {
  47429. var data, elem, type,
  47430. special = jQuery.event.special,
  47431. i = 0;
  47432. for ( ; ( elem = elems[ i ] ) !== undefined; i++ ) {
  47433. if ( acceptData( elem ) ) {
  47434. if ( ( data = elem[ dataPriv.expando ] ) ) {
  47435. if ( data.events ) {
  47436. for ( type in data.events ) {
  47437. if ( special[ type ] ) {
  47438. jQuery.event.remove( elem, type );
  47439. // This is a shortcut to avoid jQuery.event.remove's overhead
  47440. } else {
  47441. jQuery.removeEvent( elem, type, data.handle );
  47442. }
  47443. }
  47444. }
  47445. // Support: Chrome <=35 - 45+
  47446. // Assign undefined instead of using delete, see Data#remove
  47447. elem[ dataPriv.expando ] = undefined;
  47448. }
  47449. if ( elem[ dataUser.expando ] ) {
  47450. // Support: Chrome <=35 - 45+
  47451. // Assign undefined instead of using delete, see Data#remove
  47452. elem[ dataUser.expando ] = undefined;
  47453. }
  47454. }
  47455. }
  47456. }
  47457. } );
  47458. jQuery.fn.extend( {
  47459. detach: function( selector ) {
  47460. return remove( this, selector, true );
  47461. },
  47462. remove: function( selector ) {
  47463. return remove( this, selector );
  47464. },
  47465. text: function( value ) {
  47466. return access( this, function( value ) {
  47467. return value === undefined ?
  47468. jQuery.text( this ) :
  47469. this.empty().each( function() {
  47470. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47471. this.textContent = value;
  47472. }
  47473. } );
  47474. }, null, value, arguments.length );
  47475. },
  47476. append: function() {
  47477. return domManip( this, arguments, function( elem ) {
  47478. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47479. var target = manipulationTarget( this, elem );
  47480. target.appendChild( elem );
  47481. }
  47482. } );
  47483. },
  47484. prepend: function() {
  47485. return domManip( this, arguments, function( elem ) {
  47486. if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) {
  47487. var target = manipulationTarget( this, elem );
  47488. target.insertBefore( elem, target.firstChild );
  47489. }
  47490. } );
  47491. },
  47492. before: function() {
  47493. return domManip( this, arguments, function( elem ) {
  47494. if ( this.parentNode ) {
  47495. this.parentNode.insertBefore( elem, this );
  47496. }
  47497. } );
  47498. },
  47499. after: function() {
  47500. return domManip( this, arguments, function( elem ) {
  47501. if ( this.parentNode ) {
  47502. this.parentNode.insertBefore( elem, this.nextSibling );
  47503. }
  47504. } );
  47505. },
  47506. empty: function() {
  47507. var elem,
  47508. i = 0;
  47509. for ( ; ( elem = this[ i ] ) != null; i++ ) {
  47510. if ( elem.nodeType === 1 ) {
  47511. // Prevent memory leaks
  47512. jQuery.cleanData( getAll( elem, false ) );
  47513. // Remove any remaining nodes
  47514. elem.textContent = "";
  47515. }
  47516. }
  47517. return this;
  47518. },
  47519. clone: function( dataAndEvents, deepDataAndEvents ) {
  47520. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  47521. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  47522. return this.map( function() {
  47523. return jQuery.clone( this, dataAndEvents, deepDataAndEvents );
  47524. } );
  47525. },
  47526. html: function( value ) {
  47527. return access( this, function( value ) {
  47528. var elem = this[ 0 ] || {},
  47529. i = 0,
  47530. l = this.length;
  47531. if ( value === undefined && elem.nodeType === 1 ) {
  47532. return elem.innerHTML;
  47533. }
  47534. // See if we can take a shortcut and just use innerHTML
  47535. if ( typeof value === "string" && !rnoInnerhtml.test( value ) &&
  47536. !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) {
  47537. value = jQuery.htmlPrefilter( value );
  47538. try {
  47539. for ( ; i < l; i++ ) {
  47540. elem = this[ i ] || {};
  47541. // Remove element nodes and prevent memory leaks
  47542. if ( elem.nodeType === 1 ) {
  47543. jQuery.cleanData( getAll( elem, false ) );
  47544. elem.innerHTML = value;
  47545. }
  47546. }
  47547. elem = 0;
  47548. // If using innerHTML throws an exception, use the fallback method
  47549. } catch ( e ) {}
  47550. }
  47551. if ( elem ) {
  47552. this.empty().append( value );
  47553. }
  47554. }, null, value, arguments.length );
  47555. },
  47556. replaceWith: function() {
  47557. var ignored = [];
  47558. // Make the changes, replacing each non-ignored context element with the new content
  47559. return domManip( this, arguments, function( elem ) {
  47560. var parent = this.parentNode;
  47561. if ( jQuery.inArray( this, ignored ) < 0 ) {
  47562. jQuery.cleanData( getAll( this ) );
  47563. if ( parent ) {
  47564. parent.replaceChild( elem, this );
  47565. }
  47566. }
  47567. // Force callback invocation
  47568. }, ignored );
  47569. }
  47570. } );
  47571. jQuery.each( {
  47572. appendTo: "append",
  47573. prependTo: "prepend",
  47574. insertBefore: "before",
  47575. insertAfter: "after",
  47576. replaceAll: "replaceWith"
  47577. }, function( name, original ) {
  47578. jQuery.fn[ name ] = function( selector ) {
  47579. var elems,
  47580. ret = [],
  47581. insert = jQuery( selector ),
  47582. last = insert.length - 1,
  47583. i = 0;
  47584. for ( ; i <= last; i++ ) {
  47585. elems = i === last ? this : this.clone( true );
  47586. jQuery( insert[ i ] )[ original ]( elems );
  47587. // Support: Android <=4.0 only, PhantomJS 1 only
  47588. // .get() because push.apply(_, arraylike) throws on ancient WebKit
  47589. push.apply( ret, elems.get() );
  47590. }
  47591. return this.pushStack( ret );
  47592. };
  47593. } );
  47594. var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" );
  47595. var getStyles = function( elem ) {
  47596. // Support: IE <=11 only, Firefox <=30 (#15098, #14150)
  47597. // IE throws on elements created in popups
  47598. // FF meanwhile throws on frame elements through "defaultView.getComputedStyle"
  47599. var view = elem.ownerDocument.defaultView;
  47600. if ( !view || !view.opener ) {
  47601. view = window;
  47602. }
  47603. return view.getComputedStyle( elem );
  47604. };
  47605. var rboxStyle = new RegExp( cssExpand.join( "|" ), "i" );
  47606. ( function() {
  47607. // Executing both pixelPosition & boxSizingReliable tests require only one layout
  47608. // so they're executed at the same time to save the second computation.
  47609. function computeStyleTests() {
  47610. // This is a singleton, we need to execute it only once
  47611. if ( !div ) {
  47612. return;
  47613. }
  47614. container.style.cssText = "position:absolute;left:-11111px;width:60px;" +
  47615. "margin-top:1px;padding:0;border:0";
  47616. div.style.cssText =
  47617. "position:relative;display:block;box-sizing:border-box;overflow:scroll;" +
  47618. "margin:auto;border:1px;padding:1px;" +
  47619. "width:60%;top:1%";
  47620. documentElement.appendChild( container ).appendChild( div );
  47621. var divStyle = window.getComputedStyle( div );
  47622. pixelPositionVal = divStyle.top !== "1%";
  47623. // Support: Android 4.0 - 4.3 only, Firefox <=3 - 44
  47624. reliableMarginLeftVal = roundPixelMeasures( divStyle.marginLeft ) === 12;
  47625. // Support: Android 4.0 - 4.3 only, Safari <=9.1 - 10.1, iOS <=7.0 - 9.3
  47626. // Some styles come back with percentage values, even though they shouldn't
  47627. div.style.right = "60%";
  47628. pixelBoxStylesVal = roundPixelMeasures( divStyle.right ) === 36;
  47629. // Support: IE 9 - 11 only
  47630. // Detect misreporting of content dimensions for box-sizing:border-box elements
  47631. boxSizingReliableVal = roundPixelMeasures( divStyle.width ) === 36;
  47632. // Support: IE 9 only
  47633. // Detect overflow:scroll screwiness (gh-3699)
  47634. div.style.position = "absolute";
  47635. scrollboxSizeVal = div.offsetWidth === 36 || "absolute";
  47636. documentElement.removeChild( container );
  47637. // Nullify the div so it wouldn't be stored in the memory and
  47638. // it will also be a sign that checks already performed
  47639. div = null;
  47640. }
  47641. function roundPixelMeasures( measure ) {
  47642. return Math.round( parseFloat( measure ) );
  47643. }
  47644. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal,
  47645. reliableMarginLeftVal,
  47646. container = document.createElement( "div" ),
  47647. div = document.createElement( "div" );
  47648. // Finish early in limited (non-browser) environments
  47649. if ( !div.style ) {
  47650. return;
  47651. }
  47652. // Support: IE <=9 - 11 only
  47653. // Style of cloned element affects source element cloned (#8908)
  47654. div.style.backgroundClip = "content-box";
  47655. div.cloneNode( true ).style.backgroundClip = "";
  47656. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  47657. jQuery.extend( support, {
  47658. boxSizingReliable: function() {
  47659. computeStyleTests();
  47660. return boxSizingReliableVal;
  47661. },
  47662. pixelBoxStyles: function() {
  47663. computeStyleTests();
  47664. return pixelBoxStylesVal;
  47665. },
  47666. pixelPosition: function() {
  47667. computeStyleTests();
  47668. return pixelPositionVal;
  47669. },
  47670. reliableMarginLeft: function() {
  47671. computeStyleTests();
  47672. return reliableMarginLeftVal;
  47673. },
  47674. scrollboxSize: function() {
  47675. computeStyleTests();
  47676. return scrollboxSizeVal;
  47677. }
  47678. } );
  47679. } )();
  47680. function curCSS( elem, name, computed ) {
  47681. var width, minWidth, maxWidth, ret,
  47682. // Support: Firefox 51+
  47683. // Retrieving style before computed somehow
  47684. // fixes an issue with getting wrong values
  47685. // on detached elements
  47686. style = elem.style;
  47687. computed = computed || getStyles( elem );
  47688. // getPropertyValue is needed for:
  47689. // .css('filter') (IE 9 only, #12537)
  47690. // .css('--customProperty) (#3144)
  47691. if ( computed ) {
  47692. ret = computed.getPropertyValue( name ) || computed[ name ];
  47693. if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) {
  47694. ret = jQuery.style( elem, name );
  47695. }
  47696. // A tribute to the "awesome hack by Dean Edwards"
  47697. // Android Browser returns percentage for some values,
  47698. // but width seems to be reliably pixels.
  47699. // This is against the CSSOM draft spec:
  47700. // https://drafts.csswg.org/cssom/#resolved-values
  47701. if ( !support.pixelBoxStyles() && rnumnonpx.test( ret ) && rboxStyle.test( name ) ) {
  47702. // Remember the original values
  47703. width = style.width;
  47704. minWidth = style.minWidth;
  47705. maxWidth = style.maxWidth;
  47706. // Put in the new values to get a computed value out
  47707. style.minWidth = style.maxWidth = style.width = ret;
  47708. ret = computed.width;
  47709. // Revert the changed values
  47710. style.width = width;
  47711. style.minWidth = minWidth;
  47712. style.maxWidth = maxWidth;
  47713. }
  47714. }
  47715. return ret !== undefined ?
  47716. // Support: IE <=9 - 11 only
  47717. // IE returns zIndex value as an integer.
  47718. ret + "" :
  47719. ret;
  47720. }
  47721. function addGetHookIf( conditionFn, hookFn ) {
  47722. // Define the hook, we'll check on the first run if it's really needed.
  47723. return {
  47724. get: function() {
  47725. if ( conditionFn() ) {
  47726. // Hook not needed (or it's not possible to use it due
  47727. // to missing dependency), remove it.
  47728. delete this.get;
  47729. return;
  47730. }
  47731. // Hook needed; redefine it so that the support test is not executed again.
  47732. return ( this.get = hookFn ).apply( this, arguments );
  47733. }
  47734. };
  47735. }
  47736. var
  47737. // Swappable if display is none or starts with table
  47738. // except "table", "table-cell", or "table-caption"
  47739. // See here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
  47740. rdisplayswap = /^(none|table(?!-c[ea]).+)/,
  47741. rcustomProp = /^--/,
  47742. cssShow = { position: "absolute", visibility: "hidden", display: "block" },
  47743. cssNormalTransform = {
  47744. letterSpacing: "0",
  47745. fontWeight: "400"
  47746. },
  47747. cssPrefixes = [ "Webkit", "Moz", "ms" ],
  47748. emptyStyle = document.createElement( "div" ).style;
  47749. // Return a css property mapped to a potentially vendor prefixed property
  47750. function vendorPropName( name ) {
  47751. // Shortcut for names that are not vendor prefixed
  47752. if ( name in emptyStyle ) {
  47753. return name;
  47754. }
  47755. // Check for vendor prefixed names
  47756. var capName = name[ 0 ].toUpperCase() + name.slice( 1 ),
  47757. i = cssPrefixes.length;
  47758. while ( i-- ) {
  47759. name = cssPrefixes[ i ] + capName;
  47760. if ( name in emptyStyle ) {
  47761. return name;
  47762. }
  47763. }
  47764. }
  47765. // Return a property mapped along what jQuery.cssProps suggests or to
  47766. // a vendor prefixed property.
  47767. function finalPropName( name ) {
  47768. var ret = jQuery.cssProps[ name ];
  47769. if ( !ret ) {
  47770. ret = jQuery.cssProps[ name ] = vendorPropName( name ) || name;
  47771. }
  47772. return ret;
  47773. }
  47774. function setPositiveNumber( elem, value, subtract ) {
  47775. // Any relative (+/-) values have already been
  47776. // normalized at this point
  47777. var matches = rcssNum.exec( value );
  47778. return matches ?
  47779. // Guard against undefined "subtract", e.g., when used as in cssHooks
  47780. Math.max( 0, matches[ 2 ] - ( subtract || 0 ) ) + ( matches[ 3 ] || "px" ) :
  47781. value;
  47782. }
  47783. function boxModelAdjustment( elem, dimension, box, isBorderBox, styles, computedVal ) {
  47784. var i = dimension === "width" ? 1 : 0,
  47785. extra = 0,
  47786. delta = 0;
  47787. // Adjustment may not be necessary
  47788. if ( box === ( isBorderBox ? "border" : "content" ) ) {
  47789. return 0;
  47790. }
  47791. for ( ; i < 4; i += 2 ) {
  47792. // Both box models exclude margin
  47793. if ( box === "margin" ) {
  47794. delta += jQuery.css( elem, box + cssExpand[ i ], true, styles );
  47795. }
  47796. // If we get here with a content-box, we're seeking "padding" or "border" or "margin"
  47797. if ( !isBorderBox ) {
  47798. // Add padding
  47799. delta += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47800. // For "border" or "margin", add border
  47801. if ( box !== "padding" ) {
  47802. delta += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47803. // But still keep track of it otherwise
  47804. } else {
  47805. extra += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47806. }
  47807. // If we get here with a border-box (content + padding + border), we're seeking "content" or
  47808. // "padding" or "margin"
  47809. } else {
  47810. // For "content", subtract padding
  47811. if ( box === "content" ) {
  47812. delta -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles );
  47813. }
  47814. // For "content" or "padding", subtract border
  47815. if ( box !== "margin" ) {
  47816. delta -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles );
  47817. }
  47818. }
  47819. }
  47820. // Account for positive content-box scroll gutter when requested by providing computedVal
  47821. if ( !isBorderBox && computedVal >= 0 ) {
  47822. // offsetWidth/offsetHeight is a rounded sum of content, padding, scroll gutter, and border
  47823. // Assuming integer scroll gutter, subtract the rest and round down
  47824. delta += Math.max( 0, Math.ceil(
  47825. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  47826. computedVal -
  47827. delta -
  47828. extra -
  47829. 0.5
  47830. ) );
  47831. }
  47832. return delta;
  47833. }
  47834. function getWidthOrHeight( elem, dimension, extra ) {
  47835. // Start with computed style
  47836. var styles = getStyles( elem ),
  47837. val = curCSS( elem, dimension, styles ),
  47838. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  47839. valueIsBorderBox = isBorderBox;
  47840. // Support: Firefox <=54
  47841. // Return a confounding non-pixel value or feign ignorance, as appropriate.
  47842. if ( rnumnonpx.test( val ) ) {
  47843. if ( !extra ) {
  47844. return val;
  47845. }
  47846. val = "auto";
  47847. }
  47848. // Check for style in case a browser which returns unreliable values
  47849. // for getComputedStyle silently falls back to the reliable elem.style
  47850. valueIsBorderBox = valueIsBorderBox &&
  47851. ( support.boxSizingReliable() || val === elem.style[ dimension ] );
  47852. // Fall back to offsetWidth/offsetHeight when value is "auto"
  47853. // This happens for inline elements with no explicit setting (gh-3571)
  47854. // Support: Android <=4.1 - 4.3 only
  47855. // Also use offsetWidth/offsetHeight for misreported inline dimensions (gh-3602)
  47856. if ( val === "auto" ||
  47857. !parseFloat( val ) && jQuery.css( elem, "display", false, styles ) === "inline" ) {
  47858. val = elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ];
  47859. // offsetWidth/offsetHeight provide border-box values
  47860. valueIsBorderBox = true;
  47861. }
  47862. // Normalize "" and auto
  47863. val = parseFloat( val ) || 0;
  47864. // Adjust for the element's box model
  47865. return ( val +
  47866. boxModelAdjustment(
  47867. elem,
  47868. dimension,
  47869. extra || ( isBorderBox ? "border" : "content" ),
  47870. valueIsBorderBox,
  47871. styles,
  47872. // Provide the current computed size to request scroll gutter calculation (gh-3589)
  47873. val
  47874. )
  47875. ) + "px";
  47876. }
  47877. jQuery.extend( {
  47878. // Add in style property hooks for overriding the default
  47879. // behavior of getting and setting a style property
  47880. cssHooks: {
  47881. opacity: {
  47882. get: function( elem, computed ) {
  47883. if ( computed ) {
  47884. // We should always get a number back from opacity
  47885. var ret = curCSS( elem, "opacity" );
  47886. return ret === "" ? "1" : ret;
  47887. }
  47888. }
  47889. }
  47890. },
  47891. // Don't automatically add "px" to these possibly-unitless properties
  47892. cssNumber: {
  47893. "animationIterationCount": true,
  47894. "columnCount": true,
  47895. "fillOpacity": true,
  47896. "flexGrow": true,
  47897. "flexShrink": true,
  47898. "fontWeight": true,
  47899. "lineHeight": true,
  47900. "opacity": true,
  47901. "order": true,
  47902. "orphans": true,
  47903. "widows": true,
  47904. "zIndex": true,
  47905. "zoom": true
  47906. },
  47907. // Add in properties whose names you wish to fix before
  47908. // setting or getting the value
  47909. cssProps: {},
  47910. // Get and set the style property on a DOM Node
  47911. style: function( elem, name, value, extra ) {
  47912. // Don't set styles on text and comment nodes
  47913. if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) {
  47914. return;
  47915. }
  47916. // Make sure that we're working with the right name
  47917. var ret, type, hooks,
  47918. origName = camelCase( name ),
  47919. isCustomProp = rcustomProp.test( name ),
  47920. style = elem.style;
  47921. // Make sure that we're working with the right name. We don't
  47922. // want to query the value if it is a CSS custom property
  47923. // since they are user-defined.
  47924. if ( !isCustomProp ) {
  47925. name = finalPropName( origName );
  47926. }
  47927. // Gets hook for the prefixed version, then unprefixed version
  47928. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47929. // Check if we're setting a value
  47930. if ( value !== undefined ) {
  47931. type = typeof value;
  47932. // Convert "+=" or "-=" to relative numbers (#7345)
  47933. if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) {
  47934. value = adjustCSS( elem, name, ret );
  47935. // Fixes bug #9237
  47936. type = "number";
  47937. }
  47938. // Make sure that null and NaN values aren't set (#7116)
  47939. if ( value == null || value !== value ) {
  47940. return;
  47941. }
  47942. // If a number was passed in, add the unit (except for certain CSS properties)
  47943. if ( type === "number" ) {
  47944. value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" );
  47945. }
  47946. // background-* props affect original clone's values
  47947. if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) {
  47948. style[ name ] = "inherit";
  47949. }
  47950. // If a hook was provided, use that value, otherwise just set the specified value
  47951. if ( !hooks || !( "set" in hooks ) ||
  47952. ( value = hooks.set( elem, value, extra ) ) !== undefined ) {
  47953. if ( isCustomProp ) {
  47954. style.setProperty( name, value );
  47955. } else {
  47956. style[ name ] = value;
  47957. }
  47958. }
  47959. } else {
  47960. // If a hook was provided get the non-computed value from there
  47961. if ( hooks && "get" in hooks &&
  47962. ( ret = hooks.get( elem, false, extra ) ) !== undefined ) {
  47963. return ret;
  47964. }
  47965. // Otherwise just get the value from the style object
  47966. return style[ name ];
  47967. }
  47968. },
  47969. css: function( elem, name, extra, styles ) {
  47970. var val, num, hooks,
  47971. origName = camelCase( name ),
  47972. isCustomProp = rcustomProp.test( name );
  47973. // Make sure that we're working with the right name. We don't
  47974. // want to modify the value if it is a CSS custom property
  47975. // since they are user-defined.
  47976. if ( !isCustomProp ) {
  47977. name = finalPropName( origName );
  47978. }
  47979. // Try prefixed name followed by the unprefixed name
  47980. hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ];
  47981. // If a hook was provided get the computed value from there
  47982. if ( hooks && "get" in hooks ) {
  47983. val = hooks.get( elem, true, extra );
  47984. }
  47985. // Otherwise, if a way to get the computed value exists, use that
  47986. if ( val === undefined ) {
  47987. val = curCSS( elem, name, styles );
  47988. }
  47989. // Convert "normal" to computed value
  47990. if ( val === "normal" && name in cssNormalTransform ) {
  47991. val = cssNormalTransform[ name ];
  47992. }
  47993. // Make numeric if forced or a qualifier was provided and val looks numeric
  47994. if ( extra === "" || extra ) {
  47995. num = parseFloat( val );
  47996. return extra === true || isFinite( num ) ? num || 0 : val;
  47997. }
  47998. return val;
  47999. }
  48000. } );
  48001. jQuery.each( [ "height", "width" ], function( i, dimension ) {
  48002. jQuery.cssHooks[ dimension ] = {
  48003. get: function( elem, computed, extra ) {
  48004. if ( computed ) {
  48005. // Certain elements can have dimension info if we invisibly show them
  48006. // but it must have a current display style that would benefit
  48007. return rdisplayswap.test( jQuery.css( elem, "display" ) ) &&
  48008. // Support: Safari 8+
  48009. // Table columns in Safari have non-zero offsetWidth & zero
  48010. // getBoundingClientRect().width unless display is changed.
  48011. // Support: IE <=11 only
  48012. // Running getBoundingClientRect on a disconnected node
  48013. // in IE throws an error.
  48014. ( !elem.getClientRects().length || !elem.getBoundingClientRect().width ) ?
  48015. swap( elem, cssShow, function() {
  48016. return getWidthOrHeight( elem, dimension, extra );
  48017. } ) :
  48018. getWidthOrHeight( elem, dimension, extra );
  48019. }
  48020. },
  48021. set: function( elem, value, extra ) {
  48022. var matches,
  48023. styles = getStyles( elem ),
  48024. isBorderBox = jQuery.css( elem, "boxSizing", false, styles ) === "border-box",
  48025. subtract = extra && boxModelAdjustment(
  48026. elem,
  48027. dimension,
  48028. extra,
  48029. isBorderBox,
  48030. styles
  48031. );
  48032. // Account for unreliable border-box dimensions by comparing offset* to computed and
  48033. // faking a content-box to get border and padding (gh-3699)
  48034. if ( isBorderBox && support.scrollboxSize() === styles.position ) {
  48035. subtract -= Math.ceil(
  48036. elem[ "offset" + dimension[ 0 ].toUpperCase() + dimension.slice( 1 ) ] -
  48037. parseFloat( styles[ dimension ] ) -
  48038. boxModelAdjustment( elem, dimension, "border", false, styles ) -
  48039. 0.5
  48040. );
  48041. }
  48042. // Convert to pixels if value adjustment is needed
  48043. if ( subtract && ( matches = rcssNum.exec( value ) ) &&
  48044. ( matches[ 3 ] || "px" ) !== "px" ) {
  48045. elem.style[ dimension ] = value;
  48046. value = jQuery.css( elem, dimension );
  48047. }
  48048. return setPositiveNumber( elem, value, subtract );
  48049. }
  48050. };
  48051. } );
  48052. jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft,
  48053. function( elem, computed ) {
  48054. if ( computed ) {
  48055. return ( parseFloat( curCSS( elem, "marginLeft" ) ) ||
  48056. elem.getBoundingClientRect().left -
  48057. swap( elem, { marginLeft: 0 }, function() {
  48058. return elem.getBoundingClientRect().left;
  48059. } )
  48060. ) + "px";
  48061. }
  48062. }
  48063. );
  48064. // These hooks are used by animate to expand properties
  48065. jQuery.each( {
  48066. margin: "",
  48067. padding: "",
  48068. border: "Width"
  48069. }, function( prefix, suffix ) {
  48070. jQuery.cssHooks[ prefix + suffix ] = {
  48071. expand: function( value ) {
  48072. var i = 0,
  48073. expanded = {},
  48074. // Assumes a single number if not a string
  48075. parts = typeof value === "string" ? value.split( " " ) : [ value ];
  48076. for ( ; i < 4; i++ ) {
  48077. expanded[ prefix + cssExpand[ i ] + suffix ] =
  48078. parts[ i ] || parts[ i - 2 ] || parts[ 0 ];
  48079. }
  48080. return expanded;
  48081. }
  48082. };
  48083. if ( prefix !== "margin" ) {
  48084. jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber;
  48085. }
  48086. } );
  48087. jQuery.fn.extend( {
  48088. css: function( name, value ) {
  48089. return access( this, function( elem, name, value ) {
  48090. var styles, len,
  48091. map = {},
  48092. i = 0;
  48093. if ( Array.isArray( name ) ) {
  48094. styles = getStyles( elem );
  48095. len = name.length;
  48096. for ( ; i < len; i++ ) {
  48097. map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles );
  48098. }
  48099. return map;
  48100. }
  48101. return value !== undefined ?
  48102. jQuery.style( elem, name, value ) :
  48103. jQuery.css( elem, name );
  48104. }, name, value, arguments.length > 1 );
  48105. }
  48106. } );
  48107. function Tween( elem, options, prop, end, easing ) {
  48108. return new Tween.prototype.init( elem, options, prop, end, easing );
  48109. }
  48110. jQuery.Tween = Tween;
  48111. Tween.prototype = {
  48112. constructor: Tween,
  48113. init: function( elem, options, prop, end, easing, unit ) {
  48114. this.elem = elem;
  48115. this.prop = prop;
  48116. this.easing = easing || jQuery.easing._default;
  48117. this.options = options;
  48118. this.start = this.now = this.cur();
  48119. this.end = end;
  48120. this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" );
  48121. },
  48122. cur: function() {
  48123. var hooks = Tween.propHooks[ this.prop ];
  48124. return hooks && hooks.get ?
  48125. hooks.get( this ) :
  48126. Tween.propHooks._default.get( this );
  48127. },
  48128. run: function( percent ) {
  48129. var eased,
  48130. hooks = Tween.propHooks[ this.prop ];
  48131. if ( this.options.duration ) {
  48132. this.pos = eased = jQuery.easing[ this.easing ](
  48133. percent, this.options.duration * percent, 0, 1, this.options.duration
  48134. );
  48135. } else {
  48136. this.pos = eased = percent;
  48137. }
  48138. this.now = ( this.end - this.start ) * eased + this.start;
  48139. if ( this.options.step ) {
  48140. this.options.step.call( this.elem, this.now, this );
  48141. }
  48142. if ( hooks && hooks.set ) {
  48143. hooks.set( this );
  48144. } else {
  48145. Tween.propHooks._default.set( this );
  48146. }
  48147. return this;
  48148. }
  48149. };
  48150. Tween.prototype.init.prototype = Tween.prototype;
  48151. Tween.propHooks = {
  48152. _default: {
  48153. get: function( tween ) {
  48154. var result;
  48155. // Use a property on the element directly when it is not a DOM element,
  48156. // or when there is no matching style property that exists.
  48157. if ( tween.elem.nodeType !== 1 ||
  48158. tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) {
  48159. return tween.elem[ tween.prop ];
  48160. }
  48161. // Passing an empty string as a 3rd parameter to .css will automatically
  48162. // attempt a parseFloat and fallback to a string if the parse fails.
  48163. // Simple values such as "10px" are parsed to Float;
  48164. // complex values such as "rotate(1rad)" are returned as-is.
  48165. result = jQuery.css( tween.elem, tween.prop, "" );
  48166. // Empty strings, null, undefined and "auto" are converted to 0.
  48167. return !result || result === "auto" ? 0 : result;
  48168. },
  48169. set: function( tween ) {
  48170. // Use step hook for back compat.
  48171. // Use cssHook if its there.
  48172. // Use .style if available and use plain properties where available.
  48173. if ( jQuery.fx.step[ tween.prop ] ) {
  48174. jQuery.fx.step[ tween.prop ]( tween );
  48175. } else if ( tween.elem.nodeType === 1 &&
  48176. ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null ||
  48177. jQuery.cssHooks[ tween.prop ] ) ) {
  48178. jQuery.style( tween.elem, tween.prop, tween.now + tween.unit );
  48179. } else {
  48180. tween.elem[ tween.prop ] = tween.now;
  48181. }
  48182. }
  48183. }
  48184. };
  48185. // Support: IE <=9 only
  48186. // Panic based approach to setting things on disconnected nodes
  48187. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  48188. set: function( tween ) {
  48189. if ( tween.elem.nodeType && tween.elem.parentNode ) {
  48190. tween.elem[ tween.prop ] = tween.now;
  48191. }
  48192. }
  48193. };
  48194. jQuery.easing = {
  48195. linear: function( p ) {
  48196. return p;
  48197. },
  48198. swing: function( p ) {
  48199. return 0.5 - Math.cos( p * Math.PI ) / 2;
  48200. },
  48201. _default: "swing"
  48202. };
  48203. jQuery.fx = Tween.prototype.init;
  48204. // Back compat <1.8 extension point
  48205. jQuery.fx.step = {};
  48206. var
  48207. fxNow, inProgress,
  48208. rfxtypes = /^(?:toggle|show|hide)$/,
  48209. rrun = /queueHooks$/;
  48210. function schedule() {
  48211. if ( inProgress ) {
  48212. if ( document.hidden === false && window.requestAnimationFrame ) {
  48213. window.requestAnimationFrame( schedule );
  48214. } else {
  48215. window.setTimeout( schedule, jQuery.fx.interval );
  48216. }
  48217. jQuery.fx.tick();
  48218. }
  48219. }
  48220. // Animations created synchronously will run synchronously
  48221. function createFxNow() {
  48222. window.setTimeout( function() {
  48223. fxNow = undefined;
  48224. } );
  48225. return ( fxNow = Date.now() );
  48226. }
  48227. // Generate parameters to create a standard animation
  48228. function genFx( type, includeWidth ) {
  48229. var which,
  48230. i = 0,
  48231. attrs = { height: type };
  48232. // If we include width, step value is 1 to do all cssExpand values,
  48233. // otherwise step value is 2 to skip over Left and Right
  48234. includeWidth = includeWidth ? 1 : 0;
  48235. for ( ; i < 4; i += 2 - includeWidth ) {
  48236. which = cssExpand[ i ];
  48237. attrs[ "margin" + which ] = attrs[ "padding" + which ] = type;
  48238. }
  48239. if ( includeWidth ) {
  48240. attrs.opacity = attrs.width = type;
  48241. }
  48242. return attrs;
  48243. }
  48244. function createTween( value, prop, animation ) {
  48245. var tween,
  48246. collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ),
  48247. index = 0,
  48248. length = collection.length;
  48249. for ( ; index < length; index++ ) {
  48250. if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) {
  48251. // We're done with this property
  48252. return tween;
  48253. }
  48254. }
  48255. }
  48256. function defaultPrefilter( elem, props, opts ) {
  48257. var prop, value, toggle, hooks, oldfire, propTween, restoreDisplay, display,
  48258. isBox = "width" in props || "height" in props,
  48259. anim = this,
  48260. orig = {},
  48261. style = elem.style,
  48262. hidden = elem.nodeType && isHiddenWithinTree( elem ),
  48263. dataShow = dataPriv.get( elem, "fxshow" );
  48264. // Queue-skipping animations hijack the fx hooks
  48265. if ( !opts.queue ) {
  48266. hooks = jQuery._queueHooks( elem, "fx" );
  48267. if ( hooks.unqueued == null ) {
  48268. hooks.unqueued = 0;
  48269. oldfire = hooks.empty.fire;
  48270. hooks.empty.fire = function() {
  48271. if ( !hooks.unqueued ) {
  48272. oldfire();
  48273. }
  48274. };
  48275. }
  48276. hooks.unqueued++;
  48277. anim.always( function() {
  48278. // Ensure the complete handler is called before this completes
  48279. anim.always( function() {
  48280. hooks.unqueued--;
  48281. if ( !jQuery.queue( elem, "fx" ).length ) {
  48282. hooks.empty.fire();
  48283. }
  48284. } );
  48285. } );
  48286. }
  48287. // Detect show/hide animations
  48288. for ( prop in props ) {
  48289. value = props[ prop ];
  48290. if ( rfxtypes.test( value ) ) {
  48291. delete props[ prop ];
  48292. toggle = toggle || value === "toggle";
  48293. if ( value === ( hidden ? "hide" : "show" ) ) {
  48294. // Pretend to be hidden if this is a "show" and
  48295. // there is still data from a stopped show/hide
  48296. if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) {
  48297. hidden = true;
  48298. // Ignore all other no-op show/hide data
  48299. } else {
  48300. continue;
  48301. }
  48302. }
  48303. orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop );
  48304. }
  48305. }
  48306. // Bail out if this is a no-op like .hide().hide()
  48307. propTween = !jQuery.isEmptyObject( props );
  48308. if ( !propTween && jQuery.isEmptyObject( orig ) ) {
  48309. return;
  48310. }
  48311. // Restrict "overflow" and "display" styles during box animations
  48312. if ( isBox && elem.nodeType === 1 ) {
  48313. // Support: IE <=9 - 11, Edge 12 - 15
  48314. // Record all 3 overflow attributes because IE does not infer the shorthand
  48315. // from identically-valued overflowX and overflowY and Edge just mirrors
  48316. // the overflowX value there.
  48317. opts.overflow = [ style.overflow, style.overflowX, style.overflowY ];
  48318. // Identify a display type, preferring old show/hide data over the CSS cascade
  48319. restoreDisplay = dataShow && dataShow.display;
  48320. if ( restoreDisplay == null ) {
  48321. restoreDisplay = dataPriv.get( elem, "display" );
  48322. }
  48323. display = jQuery.css( elem, "display" );
  48324. if ( display === "none" ) {
  48325. if ( restoreDisplay ) {
  48326. display = restoreDisplay;
  48327. } else {
  48328. // Get nonempty value(s) by temporarily forcing visibility
  48329. showHide( [ elem ], true );
  48330. restoreDisplay = elem.style.display || restoreDisplay;
  48331. display = jQuery.css( elem, "display" );
  48332. showHide( [ elem ] );
  48333. }
  48334. }
  48335. // Animate inline elements as inline-block
  48336. if ( display === "inline" || display === "inline-block" && restoreDisplay != null ) {
  48337. if ( jQuery.css( elem, "float" ) === "none" ) {
  48338. // Restore the original display value at the end of pure show/hide animations
  48339. if ( !propTween ) {
  48340. anim.done( function() {
  48341. style.display = restoreDisplay;
  48342. } );
  48343. if ( restoreDisplay == null ) {
  48344. display = style.display;
  48345. restoreDisplay = display === "none" ? "" : display;
  48346. }
  48347. }
  48348. style.display = "inline-block";
  48349. }
  48350. }
  48351. }
  48352. if ( opts.overflow ) {
  48353. style.overflow = "hidden";
  48354. anim.always( function() {
  48355. style.overflow = opts.overflow[ 0 ];
  48356. style.overflowX = opts.overflow[ 1 ];
  48357. style.overflowY = opts.overflow[ 2 ];
  48358. } );
  48359. }
  48360. // Implement show/hide animations
  48361. propTween = false;
  48362. for ( prop in orig ) {
  48363. // General show/hide setup for this element animation
  48364. if ( !propTween ) {
  48365. if ( dataShow ) {
  48366. if ( "hidden" in dataShow ) {
  48367. hidden = dataShow.hidden;
  48368. }
  48369. } else {
  48370. dataShow = dataPriv.access( elem, "fxshow", { display: restoreDisplay } );
  48371. }
  48372. // Store hidden/visible for toggle so `.stop().toggle()` "reverses"
  48373. if ( toggle ) {
  48374. dataShow.hidden = !hidden;
  48375. }
  48376. // Show elements before animating them
  48377. if ( hidden ) {
  48378. showHide( [ elem ], true );
  48379. }
  48380. /* eslint-disable no-loop-func */
  48381. anim.done( function() {
  48382. /* eslint-enable no-loop-func */
  48383. // The final step of a "hide" animation is actually hiding the element
  48384. if ( !hidden ) {
  48385. showHide( [ elem ] );
  48386. }
  48387. dataPriv.remove( elem, "fxshow" );
  48388. for ( prop in orig ) {
  48389. jQuery.style( elem, prop, orig[ prop ] );
  48390. }
  48391. } );
  48392. }
  48393. // Per-property setup
  48394. propTween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim );
  48395. if ( !( prop in dataShow ) ) {
  48396. dataShow[ prop ] = propTween.start;
  48397. if ( hidden ) {
  48398. propTween.end = propTween.start;
  48399. propTween.start = 0;
  48400. }
  48401. }
  48402. }
  48403. }
  48404. function propFilter( props, specialEasing ) {
  48405. var index, name, easing, value, hooks;
  48406. // camelCase, specialEasing and expand cssHook pass
  48407. for ( index in props ) {
  48408. name = camelCase( index );
  48409. easing = specialEasing[ name ];
  48410. value = props[ index ];
  48411. if ( Array.isArray( value ) ) {
  48412. easing = value[ 1 ];
  48413. value = props[ index ] = value[ 0 ];
  48414. }
  48415. if ( index !== name ) {
  48416. props[ name ] = value;
  48417. delete props[ index ];
  48418. }
  48419. hooks = jQuery.cssHooks[ name ];
  48420. if ( hooks && "expand" in hooks ) {
  48421. value = hooks.expand( value );
  48422. delete props[ name ];
  48423. // Not quite $.extend, this won't overwrite existing keys.
  48424. // Reusing 'index' because we have the correct "name"
  48425. for ( index in value ) {
  48426. if ( !( index in props ) ) {
  48427. props[ index ] = value[ index ];
  48428. specialEasing[ index ] = easing;
  48429. }
  48430. }
  48431. } else {
  48432. specialEasing[ name ] = easing;
  48433. }
  48434. }
  48435. }
  48436. function Animation( elem, properties, options ) {
  48437. var result,
  48438. stopped,
  48439. index = 0,
  48440. length = Animation.prefilters.length,
  48441. deferred = jQuery.Deferred().always( function() {
  48442. // Don't match elem in the :animated selector
  48443. delete tick.elem;
  48444. } ),
  48445. tick = function() {
  48446. if ( stopped ) {
  48447. return false;
  48448. }
  48449. var currentTime = fxNow || createFxNow(),
  48450. remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ),
  48451. // Support: Android 2.3 only
  48452. // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497)
  48453. temp = remaining / animation.duration || 0,
  48454. percent = 1 - temp,
  48455. index = 0,
  48456. length = animation.tweens.length;
  48457. for ( ; index < length; index++ ) {
  48458. animation.tweens[ index ].run( percent );
  48459. }
  48460. deferred.notifyWith( elem, [ animation, percent, remaining ] );
  48461. // If there's more to do, yield
  48462. if ( percent < 1 && length ) {
  48463. return remaining;
  48464. }
  48465. // If this was an empty animation, synthesize a final progress notification
  48466. if ( !length ) {
  48467. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  48468. }
  48469. // Resolve the animation and report its conclusion
  48470. deferred.resolveWith( elem, [ animation ] );
  48471. return false;
  48472. },
  48473. animation = deferred.promise( {
  48474. elem: elem,
  48475. props: jQuery.extend( {}, properties ),
  48476. opts: jQuery.extend( true, {
  48477. specialEasing: {},
  48478. easing: jQuery.easing._default
  48479. }, options ),
  48480. originalProperties: properties,
  48481. originalOptions: options,
  48482. startTime: fxNow || createFxNow(),
  48483. duration: options.duration,
  48484. tweens: [],
  48485. createTween: function( prop, end ) {
  48486. var tween = jQuery.Tween( elem, animation.opts, prop, end,
  48487. animation.opts.specialEasing[ prop ] || animation.opts.easing );
  48488. animation.tweens.push( tween );
  48489. return tween;
  48490. },
  48491. stop: function( gotoEnd ) {
  48492. var index = 0,
  48493. // If we are going to the end, we want to run all the tweens
  48494. // otherwise we skip this part
  48495. length = gotoEnd ? animation.tweens.length : 0;
  48496. if ( stopped ) {
  48497. return this;
  48498. }
  48499. stopped = true;
  48500. for ( ; index < length; index++ ) {
  48501. animation.tweens[ index ].run( 1 );
  48502. }
  48503. // Resolve when we played the last frame; otherwise, reject
  48504. if ( gotoEnd ) {
  48505. deferred.notifyWith( elem, [ animation, 1, 0 ] );
  48506. deferred.resolveWith( elem, [ animation, gotoEnd ] );
  48507. } else {
  48508. deferred.rejectWith( elem, [ animation, gotoEnd ] );
  48509. }
  48510. return this;
  48511. }
  48512. } ),
  48513. props = animation.props;
  48514. propFilter( props, animation.opts.specialEasing );
  48515. for ( ; index < length; index++ ) {
  48516. result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts );
  48517. if ( result ) {
  48518. if ( isFunction( result.stop ) ) {
  48519. jQuery._queueHooks( animation.elem, animation.opts.queue ).stop =
  48520. result.stop.bind( result );
  48521. }
  48522. return result;
  48523. }
  48524. }
  48525. jQuery.map( props, createTween, animation );
  48526. if ( isFunction( animation.opts.start ) ) {
  48527. animation.opts.start.call( elem, animation );
  48528. }
  48529. // Attach callbacks from options
  48530. animation
  48531. .progress( animation.opts.progress )
  48532. .done( animation.opts.done, animation.opts.complete )
  48533. .fail( animation.opts.fail )
  48534. .always( animation.opts.always );
  48535. jQuery.fx.timer(
  48536. jQuery.extend( tick, {
  48537. elem: elem,
  48538. anim: animation,
  48539. queue: animation.opts.queue
  48540. } )
  48541. );
  48542. return animation;
  48543. }
  48544. jQuery.Animation = jQuery.extend( Animation, {
  48545. tweeners: {
  48546. "*": [ function( prop, value ) {
  48547. var tween = this.createTween( prop, value );
  48548. adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween );
  48549. return tween;
  48550. } ]
  48551. },
  48552. tweener: function( props, callback ) {
  48553. if ( isFunction( props ) ) {
  48554. callback = props;
  48555. props = [ "*" ];
  48556. } else {
  48557. props = props.match( rnothtmlwhite );
  48558. }
  48559. var prop,
  48560. index = 0,
  48561. length = props.length;
  48562. for ( ; index < length; index++ ) {
  48563. prop = props[ index ];
  48564. Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || [];
  48565. Animation.tweeners[ prop ].unshift( callback );
  48566. }
  48567. },
  48568. prefilters: [ defaultPrefilter ],
  48569. prefilter: function( callback, prepend ) {
  48570. if ( prepend ) {
  48571. Animation.prefilters.unshift( callback );
  48572. } else {
  48573. Animation.prefilters.push( callback );
  48574. }
  48575. }
  48576. } );
  48577. jQuery.speed = function( speed, easing, fn ) {
  48578. var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : {
  48579. complete: fn || !fn && easing ||
  48580. isFunction( speed ) && speed,
  48581. duration: speed,
  48582. easing: fn && easing || easing && !isFunction( easing ) && easing
  48583. };
  48584. // Go to the end state if fx are off
  48585. if ( jQuery.fx.off ) {
  48586. opt.duration = 0;
  48587. } else {
  48588. if ( typeof opt.duration !== "number" ) {
  48589. if ( opt.duration in jQuery.fx.speeds ) {
  48590. opt.duration = jQuery.fx.speeds[ opt.duration ];
  48591. } else {
  48592. opt.duration = jQuery.fx.speeds._default;
  48593. }
  48594. }
  48595. }
  48596. // Normalize opt.queue - true/undefined/null -> "fx"
  48597. if ( opt.queue == null || opt.queue === true ) {
  48598. opt.queue = "fx";
  48599. }
  48600. // Queueing
  48601. opt.old = opt.complete;
  48602. opt.complete = function() {
  48603. if ( isFunction( opt.old ) ) {
  48604. opt.old.call( this );
  48605. }
  48606. if ( opt.queue ) {
  48607. jQuery.dequeue( this, opt.queue );
  48608. }
  48609. };
  48610. return opt;
  48611. };
  48612. jQuery.fn.extend( {
  48613. fadeTo: function( speed, to, easing, callback ) {
  48614. // Show any hidden elements after setting opacity to 0
  48615. return this.filter( isHiddenWithinTree ).css( "opacity", 0 ).show()
  48616. // Animate to the value specified
  48617. .end().animate( { opacity: to }, speed, easing, callback );
  48618. },
  48619. animate: function( prop, speed, easing, callback ) {
  48620. var empty = jQuery.isEmptyObject( prop ),
  48621. optall = jQuery.speed( speed, easing, callback ),
  48622. doAnimation = function() {
  48623. // Operate on a copy of prop so per-property easing won't be lost
  48624. var anim = Animation( this, jQuery.extend( {}, prop ), optall );
  48625. // Empty animations, or finishing resolves immediately
  48626. if ( empty || dataPriv.get( this, "finish" ) ) {
  48627. anim.stop( true );
  48628. }
  48629. };
  48630. doAnimation.finish = doAnimation;
  48631. return empty || optall.queue === false ?
  48632. this.each( doAnimation ) :
  48633. this.queue( optall.queue, doAnimation );
  48634. },
  48635. stop: function( type, clearQueue, gotoEnd ) {
  48636. var stopQueue = function( hooks ) {
  48637. var stop = hooks.stop;
  48638. delete hooks.stop;
  48639. stop( gotoEnd );
  48640. };
  48641. if ( typeof type !== "string" ) {
  48642. gotoEnd = clearQueue;
  48643. clearQueue = type;
  48644. type = undefined;
  48645. }
  48646. if ( clearQueue && type !== false ) {
  48647. this.queue( type || "fx", [] );
  48648. }
  48649. return this.each( function() {
  48650. var dequeue = true,
  48651. index = type != null && type + "queueHooks",
  48652. timers = jQuery.timers,
  48653. data = dataPriv.get( this );
  48654. if ( index ) {
  48655. if ( data[ index ] && data[ index ].stop ) {
  48656. stopQueue( data[ index ] );
  48657. }
  48658. } else {
  48659. for ( index in data ) {
  48660. if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) {
  48661. stopQueue( data[ index ] );
  48662. }
  48663. }
  48664. }
  48665. for ( index = timers.length; index--; ) {
  48666. if ( timers[ index ].elem === this &&
  48667. ( type == null || timers[ index ].queue === type ) ) {
  48668. timers[ index ].anim.stop( gotoEnd );
  48669. dequeue = false;
  48670. timers.splice( index, 1 );
  48671. }
  48672. }
  48673. // Start the next in the queue if the last step wasn't forced.
  48674. // Timers currently will call their complete callbacks, which
  48675. // will dequeue but only if they were gotoEnd.
  48676. if ( dequeue || !gotoEnd ) {
  48677. jQuery.dequeue( this, type );
  48678. }
  48679. } );
  48680. },
  48681. finish: function( type ) {
  48682. if ( type !== false ) {
  48683. type = type || "fx";
  48684. }
  48685. return this.each( function() {
  48686. var index,
  48687. data = dataPriv.get( this ),
  48688. queue = data[ type + "queue" ],
  48689. hooks = data[ type + "queueHooks" ],
  48690. timers = jQuery.timers,
  48691. length = queue ? queue.length : 0;
  48692. // Enable finishing flag on private data
  48693. data.finish = true;
  48694. // Empty the queue first
  48695. jQuery.queue( this, type, [] );
  48696. if ( hooks && hooks.stop ) {
  48697. hooks.stop.call( this, true );
  48698. }
  48699. // Look for any active animations, and finish them
  48700. for ( index = timers.length; index--; ) {
  48701. if ( timers[ index ].elem === this && timers[ index ].queue === type ) {
  48702. timers[ index ].anim.stop( true );
  48703. timers.splice( index, 1 );
  48704. }
  48705. }
  48706. // Look for any animations in the old queue and finish them
  48707. for ( index = 0; index < length; index++ ) {
  48708. if ( queue[ index ] && queue[ index ].finish ) {
  48709. queue[ index ].finish.call( this );
  48710. }
  48711. }
  48712. // Turn off finishing flag
  48713. delete data.finish;
  48714. } );
  48715. }
  48716. } );
  48717. jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) {
  48718. var cssFn = jQuery.fn[ name ];
  48719. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48720. return speed == null || typeof speed === "boolean" ?
  48721. cssFn.apply( this, arguments ) :
  48722. this.animate( genFx( name, true ), speed, easing, callback );
  48723. };
  48724. } );
  48725. // Generate shortcuts for custom animations
  48726. jQuery.each( {
  48727. slideDown: genFx( "show" ),
  48728. slideUp: genFx( "hide" ),
  48729. slideToggle: genFx( "toggle" ),
  48730. fadeIn: { opacity: "show" },
  48731. fadeOut: { opacity: "hide" },
  48732. fadeToggle: { opacity: "toggle" }
  48733. }, function( name, props ) {
  48734. jQuery.fn[ name ] = function( speed, easing, callback ) {
  48735. return this.animate( props, speed, easing, callback );
  48736. };
  48737. } );
  48738. jQuery.timers = [];
  48739. jQuery.fx.tick = function() {
  48740. var timer,
  48741. i = 0,
  48742. timers = jQuery.timers;
  48743. fxNow = Date.now();
  48744. for ( ; i < timers.length; i++ ) {
  48745. timer = timers[ i ];
  48746. // Run the timer and safely remove it when done (allowing for external removal)
  48747. if ( !timer() && timers[ i ] === timer ) {
  48748. timers.splice( i--, 1 );
  48749. }
  48750. }
  48751. if ( !timers.length ) {
  48752. jQuery.fx.stop();
  48753. }
  48754. fxNow = undefined;
  48755. };
  48756. jQuery.fx.timer = function( timer ) {
  48757. jQuery.timers.push( timer );
  48758. jQuery.fx.start();
  48759. };
  48760. jQuery.fx.interval = 13;
  48761. jQuery.fx.start = function() {
  48762. if ( inProgress ) {
  48763. return;
  48764. }
  48765. inProgress = true;
  48766. schedule();
  48767. };
  48768. jQuery.fx.stop = function() {
  48769. inProgress = null;
  48770. };
  48771. jQuery.fx.speeds = {
  48772. slow: 600,
  48773. fast: 200,
  48774. // Default speed
  48775. _default: 400
  48776. };
  48777. // Based off of the plugin by Clint Helfers, with permission.
  48778. // https://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
  48779. jQuery.fn.delay = function( time, type ) {
  48780. time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time;
  48781. type = type || "fx";
  48782. return this.queue( type, function( next, hooks ) {
  48783. var timeout = window.setTimeout( next, time );
  48784. hooks.stop = function() {
  48785. window.clearTimeout( timeout );
  48786. };
  48787. } );
  48788. };
  48789. ( function() {
  48790. var input = document.createElement( "input" ),
  48791. select = document.createElement( "select" ),
  48792. opt = select.appendChild( document.createElement( "option" ) );
  48793. input.type = "checkbox";
  48794. // Support: Android <=4.3 only
  48795. // Default value for a checkbox should be "on"
  48796. support.checkOn = input.value !== "";
  48797. // Support: IE <=11 only
  48798. // Must access selectedIndex to make default options select
  48799. support.optSelected = opt.selected;
  48800. // Support: IE <=11 only
  48801. // An input loses its value after becoming a radio
  48802. input = document.createElement( "input" );
  48803. input.value = "t";
  48804. input.type = "radio";
  48805. support.radioValue = input.value === "t";
  48806. } )();
  48807. var boolHook,
  48808. attrHandle = jQuery.expr.attrHandle;
  48809. jQuery.fn.extend( {
  48810. attr: function( name, value ) {
  48811. return access( this, jQuery.attr, name, value, arguments.length > 1 );
  48812. },
  48813. removeAttr: function( name ) {
  48814. return this.each( function() {
  48815. jQuery.removeAttr( this, name );
  48816. } );
  48817. }
  48818. } );
  48819. jQuery.extend( {
  48820. attr: function( elem, name, value ) {
  48821. var ret, hooks,
  48822. nType = elem.nodeType;
  48823. // Don't get/set attributes on text, comment and attribute nodes
  48824. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48825. return;
  48826. }
  48827. // Fallback to prop when attributes are not supported
  48828. if ( typeof elem.getAttribute === "undefined" ) {
  48829. return jQuery.prop( elem, name, value );
  48830. }
  48831. // Attribute hooks are determined by the lowercase version
  48832. // Grab necessary hook if one is defined
  48833. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48834. hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
  48835. ( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
  48836. }
  48837. if ( value !== undefined ) {
  48838. if ( value === null ) {
  48839. jQuery.removeAttr( elem, name );
  48840. return;
  48841. }
  48842. if ( hooks && "set" in hooks &&
  48843. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48844. return ret;
  48845. }
  48846. elem.setAttribute( name, value + "" );
  48847. return value;
  48848. }
  48849. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48850. return ret;
  48851. }
  48852. ret = jQuery.find.attr( elem, name );
  48853. // Non-existent attributes return null, we normalize to undefined
  48854. return ret == null ? undefined : ret;
  48855. },
  48856. attrHooks: {
  48857. type: {
  48858. set: function( elem, value ) {
  48859. if ( !support.radioValue && value === "radio" &&
  48860. nodeName( elem, "input" ) ) {
  48861. var val = elem.value;
  48862. elem.setAttribute( "type", value );
  48863. if ( val ) {
  48864. elem.value = val;
  48865. }
  48866. return value;
  48867. }
  48868. }
  48869. }
  48870. },
  48871. removeAttr: function( elem, value ) {
  48872. var name,
  48873. i = 0,
  48874. // Attribute names can contain non-HTML whitespace characters
  48875. // https://html.spec.whatwg.org/multipage/syntax.html#attributes-2
  48876. attrNames = value && value.match( rnothtmlwhite );
  48877. if ( attrNames && elem.nodeType === 1 ) {
  48878. while ( ( name = attrNames[ i++ ] ) ) {
  48879. elem.removeAttribute( name );
  48880. }
  48881. }
  48882. }
  48883. } );
  48884. // Hooks for boolean attributes
  48885. boolHook = {
  48886. set: function( elem, value, name ) {
  48887. if ( value === false ) {
  48888. // Remove boolean attributes when set to false
  48889. jQuery.removeAttr( elem, name );
  48890. } else {
  48891. elem.setAttribute( name, name );
  48892. }
  48893. return name;
  48894. }
  48895. };
  48896. jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
  48897. var getter = attrHandle[ name ] || jQuery.find.attr;
  48898. attrHandle[ name ] = function( elem, name, isXML ) {
  48899. var ret, handle,
  48900. lowercaseName = name.toLowerCase();
  48901. if ( !isXML ) {
  48902. // Avoid an infinite loop by temporarily removing this function from the getter
  48903. handle = attrHandle[ lowercaseName ];
  48904. attrHandle[ lowercaseName ] = ret;
  48905. ret = getter( elem, name, isXML ) != null ?
  48906. lowercaseName :
  48907. null;
  48908. attrHandle[ lowercaseName ] = handle;
  48909. }
  48910. return ret;
  48911. };
  48912. } );
  48913. var rfocusable = /^(?:input|select|textarea|button)$/i,
  48914. rclickable = /^(?:a|area)$/i;
  48915. jQuery.fn.extend( {
  48916. prop: function( name, value ) {
  48917. return access( this, jQuery.prop, name, value, arguments.length > 1 );
  48918. },
  48919. removeProp: function( name ) {
  48920. return this.each( function() {
  48921. delete this[ jQuery.propFix[ name ] || name ];
  48922. } );
  48923. }
  48924. } );
  48925. jQuery.extend( {
  48926. prop: function( elem, name, value ) {
  48927. var ret, hooks,
  48928. nType = elem.nodeType;
  48929. // Don't get/set properties on text, comment and attribute nodes
  48930. if ( nType === 3 || nType === 8 || nType === 2 ) {
  48931. return;
  48932. }
  48933. if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
  48934. // Fix name and attach hooks
  48935. name = jQuery.propFix[ name ] || name;
  48936. hooks = jQuery.propHooks[ name ];
  48937. }
  48938. if ( value !== undefined ) {
  48939. if ( hooks && "set" in hooks &&
  48940. ( ret = hooks.set( elem, value, name ) ) !== undefined ) {
  48941. return ret;
  48942. }
  48943. return ( elem[ name ] = value );
  48944. }
  48945. if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
  48946. return ret;
  48947. }
  48948. return elem[ name ];
  48949. },
  48950. propHooks: {
  48951. tabIndex: {
  48952. get: function( elem ) {
  48953. // Support: IE <=9 - 11 only
  48954. // elem.tabIndex doesn't always return the
  48955. // correct value when it hasn't been explicitly set
  48956. // https://web.archive.org/web/20141116233347/http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/
  48957. // Use proper attribute retrieval(#12072)
  48958. var tabindex = jQuery.find.attr( elem, "tabindex" );
  48959. if ( tabindex ) {
  48960. return parseInt( tabindex, 10 );
  48961. }
  48962. if (
  48963. rfocusable.test( elem.nodeName ) ||
  48964. rclickable.test( elem.nodeName ) &&
  48965. elem.href
  48966. ) {
  48967. return 0;
  48968. }
  48969. return -1;
  48970. }
  48971. }
  48972. },
  48973. propFix: {
  48974. "for": "htmlFor",
  48975. "class": "className"
  48976. }
  48977. } );
  48978. // Support: IE <=11 only
  48979. // Accessing the selectedIndex property
  48980. // forces the browser to respect setting selected
  48981. // on the option
  48982. // The getter ensures a default option is selected
  48983. // when in an optgroup
  48984. // eslint rule "no-unused-expressions" is disabled for this code
  48985. // since it considers such accessions noop
  48986. if ( !support.optSelected ) {
  48987. jQuery.propHooks.selected = {
  48988. get: function( elem ) {
  48989. /* eslint no-unused-expressions: "off" */
  48990. var parent = elem.parentNode;
  48991. if ( parent && parent.parentNode ) {
  48992. parent.parentNode.selectedIndex;
  48993. }
  48994. return null;
  48995. },
  48996. set: function( elem ) {
  48997. /* eslint no-unused-expressions: "off" */
  48998. var parent = elem.parentNode;
  48999. if ( parent ) {
  49000. parent.selectedIndex;
  49001. if ( parent.parentNode ) {
  49002. parent.parentNode.selectedIndex;
  49003. }
  49004. }
  49005. }
  49006. };
  49007. }
  49008. jQuery.each( [
  49009. "tabIndex",
  49010. "readOnly",
  49011. "maxLength",
  49012. "cellSpacing",
  49013. "cellPadding",
  49014. "rowSpan",
  49015. "colSpan",
  49016. "useMap",
  49017. "frameBorder",
  49018. "contentEditable"
  49019. ], function() {
  49020. jQuery.propFix[ this.toLowerCase() ] = this;
  49021. } );
  49022. // Strip and collapse whitespace according to HTML spec
  49023. // https://infra.spec.whatwg.org/#strip-and-collapse-ascii-whitespace
  49024. function stripAndCollapse( value ) {
  49025. var tokens = value.match( rnothtmlwhite ) || [];
  49026. return tokens.join( " " );
  49027. }
  49028. function getClass( elem ) {
  49029. return elem.getAttribute && elem.getAttribute( "class" ) || "";
  49030. }
  49031. function classesToArray( value ) {
  49032. if ( Array.isArray( value ) ) {
  49033. return value;
  49034. }
  49035. if ( typeof value === "string" ) {
  49036. return value.match( rnothtmlwhite ) || [];
  49037. }
  49038. return [];
  49039. }
  49040. jQuery.fn.extend( {
  49041. addClass: function( value ) {
  49042. var classes, elem, cur, curValue, clazz, j, finalValue,
  49043. i = 0;
  49044. if ( isFunction( value ) ) {
  49045. return this.each( function( j ) {
  49046. jQuery( this ).addClass( value.call( this, j, getClass( this ) ) );
  49047. } );
  49048. }
  49049. classes = classesToArray( value );
  49050. if ( classes.length ) {
  49051. while ( ( elem = this[ i++ ] ) ) {
  49052. curValue = getClass( elem );
  49053. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  49054. if ( cur ) {
  49055. j = 0;
  49056. while ( ( clazz = classes[ j++ ] ) ) {
  49057. if ( cur.indexOf( " " + clazz + " " ) < 0 ) {
  49058. cur += clazz + " ";
  49059. }
  49060. }
  49061. // Only assign if different to avoid unneeded rendering.
  49062. finalValue = stripAndCollapse( cur );
  49063. if ( curValue !== finalValue ) {
  49064. elem.setAttribute( "class", finalValue );
  49065. }
  49066. }
  49067. }
  49068. }
  49069. return this;
  49070. },
  49071. removeClass: function( value ) {
  49072. var classes, elem, cur, curValue, clazz, j, finalValue,
  49073. i = 0;
  49074. if ( isFunction( value ) ) {
  49075. return this.each( function( j ) {
  49076. jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) );
  49077. } );
  49078. }
  49079. if ( !arguments.length ) {
  49080. return this.attr( "class", "" );
  49081. }
  49082. classes = classesToArray( value );
  49083. if ( classes.length ) {
  49084. while ( ( elem = this[ i++ ] ) ) {
  49085. curValue = getClass( elem );
  49086. // This expression is here for better compressibility (see addClass)
  49087. cur = elem.nodeType === 1 && ( " " + stripAndCollapse( curValue ) + " " );
  49088. if ( cur ) {
  49089. j = 0;
  49090. while ( ( clazz = classes[ j++ ] ) ) {
  49091. // Remove *all* instances
  49092. while ( cur.indexOf( " " + clazz + " " ) > -1 ) {
  49093. cur = cur.replace( " " + clazz + " ", " " );
  49094. }
  49095. }
  49096. // Only assign if different to avoid unneeded rendering.
  49097. finalValue = stripAndCollapse( cur );
  49098. if ( curValue !== finalValue ) {
  49099. elem.setAttribute( "class", finalValue );
  49100. }
  49101. }
  49102. }
  49103. }
  49104. return this;
  49105. },
  49106. toggleClass: function( value, stateVal ) {
  49107. var type = typeof value,
  49108. isValidValue = type === "string" || Array.isArray( value );
  49109. if ( typeof stateVal === "boolean" && isValidValue ) {
  49110. return stateVal ? this.addClass( value ) : this.removeClass( value );
  49111. }
  49112. if ( isFunction( value ) ) {
  49113. return this.each( function( i ) {
  49114. jQuery( this ).toggleClass(
  49115. value.call( this, i, getClass( this ), stateVal ),
  49116. stateVal
  49117. );
  49118. } );
  49119. }
  49120. return this.each( function() {
  49121. var className, i, self, classNames;
  49122. if ( isValidValue ) {
  49123. // Toggle individual class names
  49124. i = 0;
  49125. self = jQuery( this );
  49126. classNames = classesToArray( value );
  49127. while ( ( className = classNames[ i++ ] ) ) {
  49128. // Check each className given, space separated list
  49129. if ( self.hasClass( className ) ) {
  49130. self.removeClass( className );
  49131. } else {
  49132. self.addClass( className );
  49133. }
  49134. }
  49135. // Toggle whole class name
  49136. } else if ( value === undefined || type === "boolean" ) {
  49137. className = getClass( this );
  49138. if ( className ) {
  49139. // Store className if set
  49140. dataPriv.set( this, "__className__", className );
  49141. }
  49142. // If the element has a class name or if we're passed `false`,
  49143. // then remove the whole classname (if there was one, the above saved it).
  49144. // Otherwise bring back whatever was previously saved (if anything),
  49145. // falling back to the empty string if nothing was stored.
  49146. if ( this.setAttribute ) {
  49147. this.setAttribute( "class",
  49148. className || value === false ?
  49149. "" :
  49150. dataPriv.get( this, "__className__" ) || ""
  49151. );
  49152. }
  49153. }
  49154. } );
  49155. },
  49156. hasClass: function( selector ) {
  49157. var className, elem,
  49158. i = 0;
  49159. className = " " + selector + " ";
  49160. while ( ( elem = this[ i++ ] ) ) {
  49161. if ( elem.nodeType === 1 &&
  49162. ( " " + stripAndCollapse( getClass( elem ) ) + " " ).indexOf( className ) > -1 ) {
  49163. return true;
  49164. }
  49165. }
  49166. return false;
  49167. }
  49168. } );
  49169. var rreturn = /\r/g;
  49170. jQuery.fn.extend( {
  49171. val: function( value ) {
  49172. var hooks, ret, valueIsFunction,
  49173. elem = this[ 0 ];
  49174. if ( !arguments.length ) {
  49175. if ( elem ) {
  49176. hooks = jQuery.valHooks[ elem.type ] ||
  49177. jQuery.valHooks[ elem.nodeName.toLowerCase() ];
  49178. if ( hooks &&
  49179. "get" in hooks &&
  49180. ( ret = hooks.get( elem, "value" ) ) !== undefined
  49181. ) {
  49182. return ret;
  49183. }
  49184. ret = elem.value;
  49185. // Handle most common string cases
  49186. if ( typeof ret === "string" ) {
  49187. return ret.replace( rreturn, "" );
  49188. }
  49189. // Handle cases where value is null/undef or number
  49190. return ret == null ? "" : ret;
  49191. }
  49192. return;
  49193. }
  49194. valueIsFunction = isFunction( value );
  49195. return this.each( function( i ) {
  49196. var val;
  49197. if ( this.nodeType !== 1 ) {
  49198. return;
  49199. }
  49200. if ( valueIsFunction ) {
  49201. val = value.call( this, i, jQuery( this ).val() );
  49202. } else {
  49203. val = value;
  49204. }
  49205. // Treat null/undefined as ""; convert numbers to string
  49206. if ( val == null ) {
  49207. val = "";
  49208. } else if ( typeof val === "number" ) {
  49209. val += "";
  49210. } else if ( Array.isArray( val ) ) {
  49211. val = jQuery.map( val, function( value ) {
  49212. return value == null ? "" : value + "";
  49213. } );
  49214. }
  49215. hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ];
  49216. // If set returns undefined, fall back to normal setting
  49217. if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) {
  49218. this.value = val;
  49219. }
  49220. } );
  49221. }
  49222. } );
  49223. jQuery.extend( {
  49224. valHooks: {
  49225. option: {
  49226. get: function( elem ) {
  49227. var val = jQuery.find.attr( elem, "value" );
  49228. return val != null ?
  49229. val :
  49230. // Support: IE <=10 - 11 only
  49231. // option.text throws exceptions (#14686, #14858)
  49232. // Strip and collapse whitespace
  49233. // https://html.spec.whatwg.org/#strip-and-collapse-whitespace
  49234. stripAndCollapse( jQuery.text( elem ) );
  49235. }
  49236. },
  49237. select: {
  49238. get: function( elem ) {
  49239. var value, option, i,
  49240. options = elem.options,
  49241. index = elem.selectedIndex,
  49242. one = elem.type === "select-one",
  49243. values = one ? null : [],
  49244. max = one ? index + 1 : options.length;
  49245. if ( index < 0 ) {
  49246. i = max;
  49247. } else {
  49248. i = one ? index : 0;
  49249. }
  49250. // Loop through all the selected options
  49251. for ( ; i < max; i++ ) {
  49252. option = options[ i ];
  49253. // Support: IE <=9 only
  49254. // IE8-9 doesn't update selected after form reset (#2551)
  49255. if ( ( option.selected || i === index ) &&
  49256. // Don't return options that are disabled or in a disabled optgroup
  49257. !option.disabled &&
  49258. ( !option.parentNode.disabled ||
  49259. !nodeName( option.parentNode, "optgroup" ) ) ) {
  49260. // Get the specific value for the option
  49261. value = jQuery( option ).val();
  49262. // We don't need an array for one selects
  49263. if ( one ) {
  49264. return value;
  49265. }
  49266. // Multi-Selects return an array
  49267. values.push( value );
  49268. }
  49269. }
  49270. return values;
  49271. },
  49272. set: function( elem, value ) {
  49273. var optionSet, option,
  49274. options = elem.options,
  49275. values = jQuery.makeArray( value ),
  49276. i = options.length;
  49277. while ( i-- ) {
  49278. option = options[ i ];
  49279. /* eslint-disable no-cond-assign */
  49280. if ( option.selected =
  49281. jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1
  49282. ) {
  49283. optionSet = true;
  49284. }
  49285. /* eslint-enable no-cond-assign */
  49286. }
  49287. // Force browsers to behave consistently when non-matching value is set
  49288. if ( !optionSet ) {
  49289. elem.selectedIndex = -1;
  49290. }
  49291. return values;
  49292. }
  49293. }
  49294. }
  49295. } );
  49296. // Radios and checkboxes getter/setter
  49297. jQuery.each( [ "radio", "checkbox" ], function() {
  49298. jQuery.valHooks[ this ] = {
  49299. set: function( elem, value ) {
  49300. if ( Array.isArray( value ) ) {
  49301. return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 );
  49302. }
  49303. }
  49304. };
  49305. if ( !support.checkOn ) {
  49306. jQuery.valHooks[ this ].get = function( elem ) {
  49307. return elem.getAttribute( "value" ) === null ? "on" : elem.value;
  49308. };
  49309. }
  49310. } );
  49311. // Return jQuery for attributes-only inclusion
  49312. support.focusin = "onfocusin" in window;
  49313. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/,
  49314. stopPropagationCallback = function( e ) {
  49315. e.stopPropagation();
  49316. };
  49317. jQuery.extend( jQuery.event, {
  49318. trigger: function( event, data, elem, onlyHandlers ) {
  49319. var i, cur, tmp, bubbleType, ontype, handle, special, lastElement,
  49320. eventPath = [ elem || document ],
  49321. type = hasOwn.call( event, "type" ) ? event.type : event,
  49322. namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : [];
  49323. cur = lastElement = tmp = elem = elem || document;
  49324. // Don't do events on text and comment nodes
  49325. if ( elem.nodeType === 3 || elem.nodeType === 8 ) {
  49326. return;
  49327. }
  49328. // focus/blur morphs to focusin/out; ensure we're not firing them right now
  49329. if ( rfocusMorph.test( type + jQuery.event.triggered ) ) {
  49330. return;
  49331. }
  49332. if ( type.indexOf( "." ) > -1 ) {
  49333. // Namespaced trigger; create a regexp to match event type in handle()
  49334. namespaces = type.split( "." );
  49335. type = namespaces.shift();
  49336. namespaces.sort();
  49337. }
  49338. ontype = type.indexOf( ":" ) < 0 && "on" + type;
  49339. // Caller can pass in a jQuery.Event object, Object, or just an event type string
  49340. event = event[ jQuery.expando ] ?
  49341. event :
  49342. new jQuery.Event( type, typeof event === "object" && event );
  49343. // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true)
  49344. event.isTrigger = onlyHandlers ? 2 : 3;
  49345. event.namespace = namespaces.join( "." );
  49346. event.rnamespace = event.namespace ?
  49347. new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) :
  49348. null;
  49349. // Clean up the event in case it is being reused
  49350. event.result = undefined;
  49351. if ( !event.target ) {
  49352. event.target = elem;
  49353. }
  49354. // Clone any incoming data and prepend the event, creating the handler arg list
  49355. data = data == null ?
  49356. [ event ] :
  49357. jQuery.makeArray( data, [ event ] );
  49358. // Allow special events to draw outside the lines
  49359. special = jQuery.event.special[ type ] || {};
  49360. if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) {
  49361. return;
  49362. }
  49363. // Determine event propagation path in advance, per W3C events spec (#9951)
  49364. // Bubble up to document, then to window; watch for a global ownerDocument var (#9724)
  49365. if ( !onlyHandlers && !special.noBubble && !isWindow( elem ) ) {
  49366. bubbleType = special.delegateType || type;
  49367. if ( !rfocusMorph.test( bubbleType + type ) ) {
  49368. cur = cur.parentNode;
  49369. }
  49370. for ( ; cur; cur = cur.parentNode ) {
  49371. eventPath.push( cur );
  49372. tmp = cur;
  49373. }
  49374. // Only add window if we got to document (e.g., not plain obj or detached DOM)
  49375. if ( tmp === ( elem.ownerDocument || document ) ) {
  49376. eventPath.push( tmp.defaultView || tmp.parentWindow || window );
  49377. }
  49378. }
  49379. // Fire handlers on the event path
  49380. i = 0;
  49381. while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) {
  49382. lastElement = cur;
  49383. event.type = i > 1 ?
  49384. bubbleType :
  49385. special.bindType || type;
  49386. // jQuery handler
  49387. handle = ( dataPriv.get( cur, "events" ) || {} )[ event.type ] &&
  49388. dataPriv.get( cur, "handle" );
  49389. if ( handle ) {
  49390. handle.apply( cur, data );
  49391. }
  49392. // Native handler
  49393. handle = ontype && cur[ ontype ];
  49394. if ( handle && handle.apply && acceptData( cur ) ) {
  49395. event.result = handle.apply( cur, data );
  49396. if ( event.result === false ) {
  49397. event.preventDefault();
  49398. }
  49399. }
  49400. }
  49401. event.type = type;
  49402. // If nobody prevented the default action, do it now
  49403. if ( !onlyHandlers && !event.isDefaultPrevented() ) {
  49404. if ( ( !special._default ||
  49405. special._default.apply( eventPath.pop(), data ) === false ) &&
  49406. acceptData( elem ) ) {
  49407. // Call a native DOM method on the target with the same name as the event.
  49408. // Don't do default actions on window, that's where global variables be (#6170)
  49409. if ( ontype && isFunction( elem[ type ] ) && !isWindow( elem ) ) {
  49410. // Don't re-trigger an onFOO event when we call its FOO() method
  49411. tmp = elem[ ontype ];
  49412. if ( tmp ) {
  49413. elem[ ontype ] = null;
  49414. }
  49415. // Prevent re-triggering of the same event, since we already bubbled it above
  49416. jQuery.event.triggered = type;
  49417. if ( event.isPropagationStopped() ) {
  49418. lastElement.addEventListener( type, stopPropagationCallback );
  49419. }
  49420. elem[ type ]();
  49421. if ( event.isPropagationStopped() ) {
  49422. lastElement.removeEventListener( type, stopPropagationCallback );
  49423. }
  49424. jQuery.event.triggered = undefined;
  49425. if ( tmp ) {
  49426. elem[ ontype ] = tmp;
  49427. }
  49428. }
  49429. }
  49430. }
  49431. return event.result;
  49432. },
  49433. // Piggyback on a donor event to simulate a different one
  49434. // Used only for `focus(in | out)` events
  49435. simulate: function( type, elem, event ) {
  49436. var e = jQuery.extend(
  49437. new jQuery.Event(),
  49438. event,
  49439. {
  49440. type: type,
  49441. isSimulated: true
  49442. }
  49443. );
  49444. jQuery.event.trigger( e, null, elem );
  49445. }
  49446. } );
  49447. jQuery.fn.extend( {
  49448. trigger: function( type, data ) {
  49449. return this.each( function() {
  49450. jQuery.event.trigger( type, data, this );
  49451. } );
  49452. },
  49453. triggerHandler: function( type, data ) {
  49454. var elem = this[ 0 ];
  49455. if ( elem ) {
  49456. return jQuery.event.trigger( type, data, elem, true );
  49457. }
  49458. }
  49459. } );
  49460. // Support: Firefox <=44
  49461. // Firefox doesn't have focus(in | out) events
  49462. // Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787
  49463. //
  49464. // Support: Chrome <=48 - 49, Safari <=9.0 - 9.1
  49465. // focus(in | out) events fire after focus & blur events,
  49466. // which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
  49467. // Related ticket - https://bugs.chromium.org/p/chromium/issues/detail?id=449857
  49468. if ( !support.focusin ) {
  49469. jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) {
  49470. // Attach a single capturing handler on the document while someone wants focusin/focusout
  49471. var handler = function( event ) {
  49472. jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) );
  49473. };
  49474. jQuery.event.special[ fix ] = {
  49475. setup: function() {
  49476. var doc = this.ownerDocument || this,
  49477. attaches = dataPriv.access( doc, fix );
  49478. if ( !attaches ) {
  49479. doc.addEventListener( orig, handler, true );
  49480. }
  49481. dataPriv.access( doc, fix, ( attaches || 0 ) + 1 );
  49482. },
  49483. teardown: function() {
  49484. var doc = this.ownerDocument || this,
  49485. attaches = dataPriv.access( doc, fix ) - 1;
  49486. if ( !attaches ) {
  49487. doc.removeEventListener( orig, handler, true );
  49488. dataPriv.remove( doc, fix );
  49489. } else {
  49490. dataPriv.access( doc, fix, attaches );
  49491. }
  49492. }
  49493. };
  49494. } );
  49495. }
  49496. var location = window.location;
  49497. var nonce = Date.now();
  49498. var rquery = ( /\?/ );
  49499. // Cross-browser xml parsing
  49500. jQuery.parseXML = function( data ) {
  49501. var xml;
  49502. if ( !data || typeof data !== "string" ) {
  49503. return null;
  49504. }
  49505. // Support: IE 9 - 11 only
  49506. // IE throws on parseFromString with invalid input.
  49507. try {
  49508. xml = ( new window.DOMParser() ).parseFromString( data, "text/xml" );
  49509. } catch ( e ) {
  49510. xml = undefined;
  49511. }
  49512. if ( !xml || xml.getElementsByTagName( "parsererror" ).length ) {
  49513. jQuery.error( "Invalid XML: " + data );
  49514. }
  49515. return xml;
  49516. };
  49517. var
  49518. rbracket = /\[\]$/,
  49519. rCRLF = /\r?\n/g,
  49520. rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i,
  49521. rsubmittable = /^(?:input|select|textarea|keygen)/i;
  49522. function buildParams( prefix, obj, traditional, add ) {
  49523. var name;
  49524. if ( Array.isArray( obj ) ) {
  49525. // Serialize array item.
  49526. jQuery.each( obj, function( i, v ) {
  49527. if ( traditional || rbracket.test( prefix ) ) {
  49528. // Treat each array item as a scalar.
  49529. add( prefix, v );
  49530. } else {
  49531. // Item is non-scalar (array or object), encode its numeric index.
  49532. buildParams(
  49533. prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]",
  49534. v,
  49535. traditional,
  49536. add
  49537. );
  49538. }
  49539. } );
  49540. } else if ( !traditional && toType( obj ) === "object" ) {
  49541. // Serialize object item.
  49542. for ( name in obj ) {
  49543. buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add );
  49544. }
  49545. } else {
  49546. // Serialize scalar item.
  49547. add( prefix, obj );
  49548. }
  49549. }
  49550. // Serialize an array of form elements or a set of
  49551. // key/values into a query string
  49552. jQuery.param = function( a, traditional ) {
  49553. var prefix,
  49554. s = [],
  49555. add = function( key, valueOrFunction ) {
  49556. // If value is a function, invoke it and use its return value
  49557. var value = isFunction( valueOrFunction ) ?
  49558. valueOrFunction() :
  49559. valueOrFunction;
  49560. s[ s.length ] = encodeURIComponent( key ) + "=" +
  49561. encodeURIComponent( value == null ? "" : value );
  49562. };
  49563. // If an array was passed in, assume that it is an array of form elements.
  49564. if ( Array.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) {
  49565. // Serialize the form elements
  49566. jQuery.each( a, function() {
  49567. add( this.name, this.value );
  49568. } );
  49569. } else {
  49570. // If traditional, encode the "old" way (the way 1.3.2 or older
  49571. // did it), otherwise encode params recursively.
  49572. for ( prefix in a ) {
  49573. buildParams( prefix, a[ prefix ], traditional, add );
  49574. }
  49575. }
  49576. // Return the resulting serialization
  49577. return s.join( "&" );
  49578. };
  49579. jQuery.fn.extend( {
  49580. serialize: function() {
  49581. return jQuery.param( this.serializeArray() );
  49582. },
  49583. serializeArray: function() {
  49584. return this.map( function() {
  49585. // Can add propHook for "elements" to filter or add form elements
  49586. var elements = jQuery.prop( this, "elements" );
  49587. return elements ? jQuery.makeArray( elements ) : this;
  49588. } )
  49589. .filter( function() {
  49590. var type = this.type;
  49591. // Use .is( ":disabled" ) so that fieldset[disabled] works
  49592. return this.name && !jQuery( this ).is( ":disabled" ) &&
  49593. rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) &&
  49594. ( this.checked || !rcheckableType.test( type ) );
  49595. } )
  49596. .map( function( i, elem ) {
  49597. var val = jQuery( this ).val();
  49598. if ( val == null ) {
  49599. return null;
  49600. }
  49601. if ( Array.isArray( val ) ) {
  49602. return jQuery.map( val, function( val ) {
  49603. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49604. } );
  49605. }
  49606. return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) };
  49607. } ).get();
  49608. }
  49609. } );
  49610. var
  49611. r20 = /%20/g,
  49612. rhash = /#.*$/,
  49613. rantiCache = /([?&])_=[^&]*/,
  49614. rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg,
  49615. // #7653, #8125, #8152: local protocol detection
  49616. rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/,
  49617. rnoContent = /^(?:GET|HEAD)$/,
  49618. rprotocol = /^\/\//,
  49619. /* Prefilters
  49620. * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example)
  49621. * 2) These are called:
  49622. * - BEFORE asking for a transport
  49623. * - AFTER param serialization (s.data is a string if s.processData is true)
  49624. * 3) key is the dataType
  49625. * 4) the catchall symbol "*" can be used
  49626. * 5) execution will start with transport dataType and THEN continue down to "*" if needed
  49627. */
  49628. prefilters = {},
  49629. /* Transports bindings
  49630. * 1) key is the dataType
  49631. * 2) the catchall symbol "*" can be used
  49632. * 3) selection will start with transport dataType and THEN go to "*" if needed
  49633. */
  49634. transports = {},
  49635. // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression
  49636. allTypes = "*/".concat( "*" ),
  49637. // Anchor tag for parsing the document origin
  49638. originAnchor = document.createElement( "a" );
  49639. originAnchor.href = location.href;
  49640. // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport
  49641. function addToPrefiltersOrTransports( structure ) {
  49642. // dataTypeExpression is optional and defaults to "*"
  49643. return function( dataTypeExpression, func ) {
  49644. if ( typeof dataTypeExpression !== "string" ) {
  49645. func = dataTypeExpression;
  49646. dataTypeExpression = "*";
  49647. }
  49648. var dataType,
  49649. i = 0,
  49650. dataTypes = dataTypeExpression.toLowerCase().match( rnothtmlwhite ) || [];
  49651. if ( isFunction( func ) ) {
  49652. // For each dataType in the dataTypeExpression
  49653. while ( ( dataType = dataTypes[ i++ ] ) ) {
  49654. // Prepend if requested
  49655. if ( dataType[ 0 ] === "+" ) {
  49656. dataType = dataType.slice( 1 ) || "*";
  49657. ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func );
  49658. // Otherwise append
  49659. } else {
  49660. ( structure[ dataType ] = structure[ dataType ] || [] ).push( func );
  49661. }
  49662. }
  49663. }
  49664. };
  49665. }
  49666. // Base inspection function for prefilters and transports
  49667. function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) {
  49668. var inspected = {},
  49669. seekingTransport = ( structure === transports );
  49670. function inspect( dataType ) {
  49671. var selected;
  49672. inspected[ dataType ] = true;
  49673. jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) {
  49674. var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR );
  49675. if ( typeof dataTypeOrTransport === "string" &&
  49676. !seekingTransport && !inspected[ dataTypeOrTransport ] ) {
  49677. options.dataTypes.unshift( dataTypeOrTransport );
  49678. inspect( dataTypeOrTransport );
  49679. return false;
  49680. } else if ( seekingTransport ) {
  49681. return !( selected = dataTypeOrTransport );
  49682. }
  49683. } );
  49684. return selected;
  49685. }
  49686. return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" );
  49687. }
  49688. // A special extend for ajax options
  49689. // that takes "flat" options (not to be deep extended)
  49690. // Fixes #9887
  49691. function ajaxExtend( target, src ) {
  49692. var key, deep,
  49693. flatOptions = jQuery.ajaxSettings.flatOptions || {};
  49694. for ( key in src ) {
  49695. if ( src[ key ] !== undefined ) {
  49696. ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ];
  49697. }
  49698. }
  49699. if ( deep ) {
  49700. jQuery.extend( true, target, deep );
  49701. }
  49702. return target;
  49703. }
  49704. /* Handles responses to an ajax request:
  49705. * - finds the right dataType (mediates between content-type and expected dataType)
  49706. * - returns the corresponding response
  49707. */
  49708. function ajaxHandleResponses( s, jqXHR, responses ) {
  49709. var ct, type, finalDataType, firstDataType,
  49710. contents = s.contents,
  49711. dataTypes = s.dataTypes;
  49712. // Remove auto dataType and get content-type in the process
  49713. while ( dataTypes[ 0 ] === "*" ) {
  49714. dataTypes.shift();
  49715. if ( ct === undefined ) {
  49716. ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" );
  49717. }
  49718. }
  49719. // Check if we're dealing with a known content-type
  49720. if ( ct ) {
  49721. for ( type in contents ) {
  49722. if ( contents[ type ] && contents[ type ].test( ct ) ) {
  49723. dataTypes.unshift( type );
  49724. break;
  49725. }
  49726. }
  49727. }
  49728. // Check to see if we have a response for the expected dataType
  49729. if ( dataTypes[ 0 ] in responses ) {
  49730. finalDataType = dataTypes[ 0 ];
  49731. } else {
  49732. // Try convertible dataTypes
  49733. for ( type in responses ) {
  49734. if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) {
  49735. finalDataType = type;
  49736. break;
  49737. }
  49738. if ( !firstDataType ) {
  49739. firstDataType = type;
  49740. }
  49741. }
  49742. // Or just use first one
  49743. finalDataType = finalDataType || firstDataType;
  49744. }
  49745. // If we found a dataType
  49746. // We add the dataType to the list if needed
  49747. // and return the corresponding response
  49748. if ( finalDataType ) {
  49749. if ( finalDataType !== dataTypes[ 0 ] ) {
  49750. dataTypes.unshift( finalDataType );
  49751. }
  49752. return responses[ finalDataType ];
  49753. }
  49754. }
  49755. /* Chain conversions given the request and the original response
  49756. * Also sets the responseXXX fields on the jqXHR instance
  49757. */
  49758. function ajaxConvert( s, response, jqXHR, isSuccess ) {
  49759. var conv2, current, conv, tmp, prev,
  49760. converters = {},
  49761. // Work with a copy of dataTypes in case we need to modify it for conversion
  49762. dataTypes = s.dataTypes.slice();
  49763. // Create converters map with lowercased keys
  49764. if ( dataTypes[ 1 ] ) {
  49765. for ( conv in s.converters ) {
  49766. converters[ conv.toLowerCase() ] = s.converters[ conv ];
  49767. }
  49768. }
  49769. current = dataTypes.shift();
  49770. // Convert to each sequential dataType
  49771. while ( current ) {
  49772. if ( s.responseFields[ current ] ) {
  49773. jqXHR[ s.responseFields[ current ] ] = response;
  49774. }
  49775. // Apply the dataFilter if provided
  49776. if ( !prev && isSuccess && s.dataFilter ) {
  49777. response = s.dataFilter( response, s.dataType );
  49778. }
  49779. prev = current;
  49780. current = dataTypes.shift();
  49781. if ( current ) {
  49782. // There's only work to do if current dataType is non-auto
  49783. if ( current === "*" ) {
  49784. current = prev;
  49785. // Convert response if prev dataType is non-auto and differs from current
  49786. } else if ( prev !== "*" && prev !== current ) {
  49787. // Seek a direct converter
  49788. conv = converters[ prev + " " + current ] || converters[ "* " + current ];
  49789. // If none found, seek a pair
  49790. if ( !conv ) {
  49791. for ( conv2 in converters ) {
  49792. // If conv2 outputs current
  49793. tmp = conv2.split( " " );
  49794. if ( tmp[ 1 ] === current ) {
  49795. // If prev can be converted to accepted input
  49796. conv = converters[ prev + " " + tmp[ 0 ] ] ||
  49797. converters[ "* " + tmp[ 0 ] ];
  49798. if ( conv ) {
  49799. // Condense equivalence converters
  49800. if ( conv === true ) {
  49801. conv = converters[ conv2 ];
  49802. // Otherwise, insert the intermediate dataType
  49803. } else if ( converters[ conv2 ] !== true ) {
  49804. current = tmp[ 0 ];
  49805. dataTypes.unshift( tmp[ 1 ] );
  49806. }
  49807. break;
  49808. }
  49809. }
  49810. }
  49811. }
  49812. // Apply converter (if not an equivalence)
  49813. if ( conv !== true ) {
  49814. // Unless errors are allowed to bubble, catch and return them
  49815. if ( conv && s.throws ) {
  49816. response = conv( response );
  49817. } else {
  49818. try {
  49819. response = conv( response );
  49820. } catch ( e ) {
  49821. return {
  49822. state: "parsererror",
  49823. error: conv ? e : "No conversion from " + prev + " to " + current
  49824. };
  49825. }
  49826. }
  49827. }
  49828. }
  49829. }
  49830. }
  49831. return { state: "success", data: response };
  49832. }
  49833. jQuery.extend( {
  49834. // Counter for holding the number of active queries
  49835. active: 0,
  49836. // Last-Modified header cache for next request
  49837. lastModified: {},
  49838. etag: {},
  49839. ajaxSettings: {
  49840. url: location.href,
  49841. type: "GET",
  49842. isLocal: rlocalProtocol.test( location.protocol ),
  49843. global: true,
  49844. processData: true,
  49845. async: true,
  49846. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  49847. /*
  49848. timeout: 0,
  49849. data: null,
  49850. dataType: null,
  49851. username: null,
  49852. password: null,
  49853. cache: null,
  49854. throws: false,
  49855. traditional: false,
  49856. headers: {},
  49857. */
  49858. accepts: {
  49859. "*": allTypes,
  49860. text: "text/plain",
  49861. html: "text/html",
  49862. xml: "application/xml, text/xml",
  49863. json: "application/json, text/javascript"
  49864. },
  49865. contents: {
  49866. xml: /\bxml\b/,
  49867. html: /\bhtml/,
  49868. json: /\bjson\b/
  49869. },
  49870. responseFields: {
  49871. xml: "responseXML",
  49872. text: "responseText",
  49873. json: "responseJSON"
  49874. },
  49875. // Data converters
  49876. // Keys separate source (or catchall "*") and destination types with a single space
  49877. converters: {
  49878. // Convert anything to text
  49879. "* text": String,
  49880. // Text to html (true = no transformation)
  49881. "text html": true,
  49882. // Evaluate text as a json expression
  49883. "text json": JSON.parse,
  49884. // Parse text as xml
  49885. "text xml": jQuery.parseXML
  49886. },
  49887. // For options that shouldn't be deep extended:
  49888. // you can add your own custom options here if
  49889. // and when you create one that shouldn't be
  49890. // deep extended (see ajaxExtend)
  49891. flatOptions: {
  49892. url: true,
  49893. context: true
  49894. }
  49895. },
  49896. // Creates a full fledged settings object into target
  49897. // with both ajaxSettings and settings fields.
  49898. // If target is omitted, writes into ajaxSettings.
  49899. ajaxSetup: function( target, settings ) {
  49900. return settings ?
  49901. // Building a settings object
  49902. ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) :
  49903. // Extending ajaxSettings
  49904. ajaxExtend( jQuery.ajaxSettings, target );
  49905. },
  49906. ajaxPrefilter: addToPrefiltersOrTransports( prefilters ),
  49907. ajaxTransport: addToPrefiltersOrTransports( transports ),
  49908. // Main method
  49909. ajax: function( url, options ) {
  49910. // If url is an object, simulate pre-1.5 signature
  49911. if ( typeof url === "object" ) {
  49912. options = url;
  49913. url = undefined;
  49914. }
  49915. // Force options to be an object
  49916. options = options || {};
  49917. var transport,
  49918. // URL without anti-cache param
  49919. cacheURL,
  49920. // Response headers
  49921. responseHeadersString,
  49922. responseHeaders,
  49923. // timeout handle
  49924. timeoutTimer,
  49925. // Url cleanup var
  49926. urlAnchor,
  49927. // Request state (becomes false upon send and true upon completion)
  49928. completed,
  49929. // To know if global events are to be dispatched
  49930. fireGlobals,
  49931. // Loop variable
  49932. i,
  49933. // uncached part of the url
  49934. uncached,
  49935. // Create the final options object
  49936. s = jQuery.ajaxSetup( {}, options ),
  49937. // Callbacks context
  49938. callbackContext = s.context || s,
  49939. // Context for global events is callbackContext if it is a DOM node or jQuery collection
  49940. globalEventContext = s.context &&
  49941. ( callbackContext.nodeType || callbackContext.jquery ) ?
  49942. jQuery( callbackContext ) :
  49943. jQuery.event,
  49944. // Deferreds
  49945. deferred = jQuery.Deferred(),
  49946. completeDeferred = jQuery.Callbacks( "once memory" ),
  49947. // Status-dependent callbacks
  49948. statusCode = s.statusCode || {},
  49949. // Headers (they are sent all at once)
  49950. requestHeaders = {},
  49951. requestHeadersNames = {},
  49952. // Default abort message
  49953. strAbort = "canceled",
  49954. // Fake xhr
  49955. jqXHR = {
  49956. readyState: 0,
  49957. // Builds headers hashtable if needed
  49958. getResponseHeader: function( key ) {
  49959. var match;
  49960. if ( completed ) {
  49961. if ( !responseHeaders ) {
  49962. responseHeaders = {};
  49963. while ( ( match = rheaders.exec( responseHeadersString ) ) ) {
  49964. responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ];
  49965. }
  49966. }
  49967. match = responseHeaders[ key.toLowerCase() ];
  49968. }
  49969. return match == null ? null : match;
  49970. },
  49971. // Raw string
  49972. getAllResponseHeaders: function() {
  49973. return completed ? responseHeadersString : null;
  49974. },
  49975. // Caches the header
  49976. setRequestHeader: function( name, value ) {
  49977. if ( completed == null ) {
  49978. name = requestHeadersNames[ name.toLowerCase() ] =
  49979. requestHeadersNames[ name.toLowerCase() ] || name;
  49980. requestHeaders[ name ] = value;
  49981. }
  49982. return this;
  49983. },
  49984. // Overrides response content-type header
  49985. overrideMimeType: function( type ) {
  49986. if ( completed == null ) {
  49987. s.mimeType = type;
  49988. }
  49989. return this;
  49990. },
  49991. // Status-dependent callbacks
  49992. statusCode: function( map ) {
  49993. var code;
  49994. if ( map ) {
  49995. if ( completed ) {
  49996. // Execute the appropriate callbacks
  49997. jqXHR.always( map[ jqXHR.status ] );
  49998. } else {
  49999. // Lazy-add the new callbacks in a way that preserves old ones
  50000. for ( code in map ) {
  50001. statusCode[ code ] = [ statusCode[ code ], map[ code ] ];
  50002. }
  50003. }
  50004. }
  50005. return this;
  50006. },
  50007. // Cancel the request
  50008. abort: function( statusText ) {
  50009. var finalText = statusText || strAbort;
  50010. if ( transport ) {
  50011. transport.abort( finalText );
  50012. }
  50013. done( 0, finalText );
  50014. return this;
  50015. }
  50016. };
  50017. // Attach deferreds
  50018. deferred.promise( jqXHR );
  50019. // Add protocol if not provided (prefilters might expect it)
  50020. // Handle falsy url in the settings object (#10093: consistency with old signature)
  50021. // We also use the url parameter if available
  50022. s.url = ( ( url || s.url || location.href ) + "" )
  50023. .replace( rprotocol, location.protocol + "//" );
  50024. // Alias method option to type as per ticket #12004
  50025. s.type = options.method || options.type || s.method || s.type;
  50026. // Extract dataTypes list
  50027. s.dataTypes = ( s.dataType || "*" ).toLowerCase().match( rnothtmlwhite ) || [ "" ];
  50028. // A cross-domain request is in order when the origin doesn't match the current origin.
  50029. if ( s.crossDomain == null ) {
  50030. urlAnchor = document.createElement( "a" );
  50031. // Support: IE <=8 - 11, Edge 12 - 15
  50032. // IE throws exception on accessing the href property if url is malformed,
  50033. // e.g. http://example.com:80x/
  50034. try {
  50035. urlAnchor.href = s.url;
  50036. // Support: IE <=8 - 11 only
  50037. // Anchor's host property isn't correctly set when s.url is relative
  50038. urlAnchor.href = urlAnchor.href;
  50039. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !==
  50040. urlAnchor.protocol + "//" + urlAnchor.host;
  50041. } catch ( e ) {
  50042. // If there is an error parsing the URL, assume it is crossDomain,
  50043. // it can be rejected by the transport if it is invalid
  50044. s.crossDomain = true;
  50045. }
  50046. }
  50047. // Convert data if not already a string
  50048. if ( s.data && s.processData && typeof s.data !== "string" ) {
  50049. s.data = jQuery.param( s.data, s.traditional );
  50050. }
  50051. // Apply prefilters
  50052. inspectPrefiltersOrTransports( prefilters, s, options, jqXHR );
  50053. // If request was aborted inside a prefilter, stop there
  50054. if ( completed ) {
  50055. return jqXHR;
  50056. }
  50057. // We can fire global events as of now if asked to
  50058. // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118)
  50059. fireGlobals = jQuery.event && s.global;
  50060. // Watch for a new set of requests
  50061. if ( fireGlobals && jQuery.active++ === 0 ) {
  50062. jQuery.event.trigger( "ajaxStart" );
  50063. }
  50064. // Uppercase the type
  50065. s.type = s.type.toUpperCase();
  50066. // Determine if request has content
  50067. s.hasContent = !rnoContent.test( s.type );
  50068. // Save the URL in case we're toying with the If-Modified-Since
  50069. // and/or If-None-Match header later on
  50070. // Remove hash to simplify url manipulation
  50071. cacheURL = s.url.replace( rhash, "" );
  50072. // More options handling for requests with no content
  50073. if ( !s.hasContent ) {
  50074. // Remember the hash so we can put it back
  50075. uncached = s.url.slice( cacheURL.length );
  50076. // If data is available and should be processed, append data to url
  50077. if ( s.data && ( s.processData || typeof s.data === "string" ) ) {
  50078. cacheURL += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data;
  50079. // #9682: remove data so that it's not used in an eventual retry
  50080. delete s.data;
  50081. }
  50082. // Add or update anti-cache param if needed
  50083. if ( s.cache === false ) {
  50084. cacheURL = cacheURL.replace( rantiCache, "$1" );
  50085. uncached = ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ( nonce++ ) + uncached;
  50086. }
  50087. // Put hash and anti-cache on the URL that will be requested (gh-1732)
  50088. s.url = cacheURL + uncached;
  50089. // Change '%20' to '+' if this is encoded form body content (gh-2658)
  50090. } else if ( s.data && s.processData &&
  50091. ( s.contentType || "" ).indexOf( "application/x-www-form-urlencoded" ) === 0 ) {
  50092. s.data = s.data.replace( r20, "+" );
  50093. }
  50094. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  50095. if ( s.ifModified ) {
  50096. if ( jQuery.lastModified[ cacheURL ] ) {
  50097. jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] );
  50098. }
  50099. if ( jQuery.etag[ cacheURL ] ) {
  50100. jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] );
  50101. }
  50102. }
  50103. // Set the correct header, if data is being sent
  50104. if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) {
  50105. jqXHR.setRequestHeader( "Content-Type", s.contentType );
  50106. }
  50107. // Set the Accepts header for the server, depending on the dataType
  50108. jqXHR.setRequestHeader(
  50109. "Accept",
  50110. s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ?
  50111. s.accepts[ s.dataTypes[ 0 ] ] +
  50112. ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) :
  50113. s.accepts[ "*" ]
  50114. );
  50115. // Check for headers option
  50116. for ( i in s.headers ) {
  50117. jqXHR.setRequestHeader( i, s.headers[ i ] );
  50118. }
  50119. // Allow custom headers/mimetypes and early abort
  50120. if ( s.beforeSend &&
  50121. ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || completed ) ) {
  50122. // Abort if not done already and return
  50123. return jqXHR.abort();
  50124. }
  50125. // Aborting is no longer a cancellation
  50126. strAbort = "abort";
  50127. // Install callbacks on deferreds
  50128. completeDeferred.add( s.complete );
  50129. jqXHR.done( s.success );
  50130. jqXHR.fail( s.error );
  50131. // Get transport
  50132. transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR );
  50133. // If no transport, we auto-abort
  50134. if ( !transport ) {
  50135. done( -1, "No Transport" );
  50136. } else {
  50137. jqXHR.readyState = 1;
  50138. // Send global event
  50139. if ( fireGlobals ) {
  50140. globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] );
  50141. }
  50142. // If request was aborted inside ajaxSend, stop there
  50143. if ( completed ) {
  50144. return jqXHR;
  50145. }
  50146. // Timeout
  50147. if ( s.async && s.timeout > 0 ) {
  50148. timeoutTimer = window.setTimeout( function() {
  50149. jqXHR.abort( "timeout" );
  50150. }, s.timeout );
  50151. }
  50152. try {
  50153. completed = false;
  50154. transport.send( requestHeaders, done );
  50155. } catch ( e ) {
  50156. // Rethrow post-completion exceptions
  50157. if ( completed ) {
  50158. throw e;
  50159. }
  50160. // Propagate others as results
  50161. done( -1, e );
  50162. }
  50163. }
  50164. // Callback for when everything is done
  50165. function done( status, nativeStatusText, responses, headers ) {
  50166. var isSuccess, success, error, response, modified,
  50167. statusText = nativeStatusText;
  50168. // Ignore repeat invocations
  50169. if ( completed ) {
  50170. return;
  50171. }
  50172. completed = true;
  50173. // Clear timeout if it exists
  50174. if ( timeoutTimer ) {
  50175. window.clearTimeout( timeoutTimer );
  50176. }
  50177. // Dereference transport for early garbage collection
  50178. // (no matter how long the jqXHR object will be used)
  50179. transport = undefined;
  50180. // Cache response headers
  50181. responseHeadersString = headers || "";
  50182. // Set readyState
  50183. jqXHR.readyState = status > 0 ? 4 : 0;
  50184. // Determine if successful
  50185. isSuccess = status >= 200 && status < 300 || status === 304;
  50186. // Get response data
  50187. if ( responses ) {
  50188. response = ajaxHandleResponses( s, jqXHR, responses );
  50189. }
  50190. // Convert no matter what (that way responseXXX fields are always set)
  50191. response = ajaxConvert( s, response, jqXHR, isSuccess );
  50192. // If successful, handle type chaining
  50193. if ( isSuccess ) {
  50194. // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode.
  50195. if ( s.ifModified ) {
  50196. modified = jqXHR.getResponseHeader( "Last-Modified" );
  50197. if ( modified ) {
  50198. jQuery.lastModified[ cacheURL ] = modified;
  50199. }
  50200. modified = jqXHR.getResponseHeader( "etag" );
  50201. if ( modified ) {
  50202. jQuery.etag[ cacheURL ] = modified;
  50203. }
  50204. }
  50205. // if no content
  50206. if ( status === 204 || s.type === "HEAD" ) {
  50207. statusText = "nocontent";
  50208. // if not modified
  50209. } else if ( status === 304 ) {
  50210. statusText = "notmodified";
  50211. // If we have data, let's convert it
  50212. } else {
  50213. statusText = response.state;
  50214. success = response.data;
  50215. error = response.error;
  50216. isSuccess = !error;
  50217. }
  50218. } else {
  50219. // Extract error from statusText and normalize for non-aborts
  50220. error = statusText;
  50221. if ( status || !statusText ) {
  50222. statusText = "error";
  50223. if ( status < 0 ) {
  50224. status = 0;
  50225. }
  50226. }
  50227. }
  50228. // Set data for the fake xhr object
  50229. jqXHR.status = status;
  50230. jqXHR.statusText = ( nativeStatusText || statusText ) + "";
  50231. // Success/Error
  50232. if ( isSuccess ) {
  50233. deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] );
  50234. } else {
  50235. deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] );
  50236. }
  50237. // Status-dependent callbacks
  50238. jqXHR.statusCode( statusCode );
  50239. statusCode = undefined;
  50240. if ( fireGlobals ) {
  50241. globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError",
  50242. [ jqXHR, s, isSuccess ? success : error ] );
  50243. }
  50244. // Complete
  50245. completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] );
  50246. if ( fireGlobals ) {
  50247. globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] );
  50248. // Handle the global AJAX counter
  50249. if ( !( --jQuery.active ) ) {
  50250. jQuery.event.trigger( "ajaxStop" );
  50251. }
  50252. }
  50253. }
  50254. return jqXHR;
  50255. },
  50256. getJSON: function( url, data, callback ) {
  50257. return jQuery.get( url, data, callback, "json" );
  50258. },
  50259. getScript: function( url, callback ) {
  50260. return jQuery.get( url, undefined, callback, "script" );
  50261. }
  50262. } );
  50263. jQuery.each( [ "get", "post" ], function( i, method ) {
  50264. jQuery[ method ] = function( url, data, callback, type ) {
  50265. // Shift arguments if data argument was omitted
  50266. if ( isFunction( data ) ) {
  50267. type = type || callback;
  50268. callback = data;
  50269. data = undefined;
  50270. }
  50271. // The url can be an options object (which then must have .url)
  50272. return jQuery.ajax( jQuery.extend( {
  50273. url: url,
  50274. type: method,
  50275. dataType: type,
  50276. data: data,
  50277. success: callback
  50278. }, jQuery.isPlainObject( url ) && url ) );
  50279. };
  50280. } );
  50281. jQuery._evalUrl = function( url ) {
  50282. return jQuery.ajax( {
  50283. url: url,
  50284. // Make this explicit, since user can override this through ajaxSetup (#11264)
  50285. type: "GET",
  50286. dataType: "script",
  50287. cache: true,
  50288. async: false,
  50289. global: false,
  50290. "throws": true
  50291. } );
  50292. };
  50293. jQuery.fn.extend( {
  50294. wrapAll: function( html ) {
  50295. var wrap;
  50296. if ( this[ 0 ] ) {
  50297. if ( isFunction( html ) ) {
  50298. html = html.call( this[ 0 ] );
  50299. }
  50300. // The elements to wrap the target around
  50301. wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true );
  50302. if ( this[ 0 ].parentNode ) {
  50303. wrap.insertBefore( this[ 0 ] );
  50304. }
  50305. wrap.map( function() {
  50306. var elem = this;
  50307. while ( elem.firstElementChild ) {
  50308. elem = elem.firstElementChild;
  50309. }
  50310. return elem;
  50311. } ).append( this );
  50312. }
  50313. return this;
  50314. },
  50315. wrapInner: function( html ) {
  50316. if ( isFunction( html ) ) {
  50317. return this.each( function( i ) {
  50318. jQuery( this ).wrapInner( html.call( this, i ) );
  50319. } );
  50320. }
  50321. return this.each( function() {
  50322. var self = jQuery( this ),
  50323. contents = self.contents();
  50324. if ( contents.length ) {
  50325. contents.wrapAll( html );
  50326. } else {
  50327. self.append( html );
  50328. }
  50329. } );
  50330. },
  50331. wrap: function( html ) {
  50332. var htmlIsFunction = isFunction( html );
  50333. return this.each( function( i ) {
  50334. jQuery( this ).wrapAll( htmlIsFunction ? html.call( this, i ) : html );
  50335. } );
  50336. },
  50337. unwrap: function( selector ) {
  50338. this.parent( selector ).not( "body" ).each( function() {
  50339. jQuery( this ).replaceWith( this.childNodes );
  50340. } );
  50341. return this;
  50342. }
  50343. } );
  50344. jQuery.expr.pseudos.hidden = function( elem ) {
  50345. return !jQuery.expr.pseudos.visible( elem );
  50346. };
  50347. jQuery.expr.pseudos.visible = function( elem ) {
  50348. return !!( elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length );
  50349. };
  50350. jQuery.ajaxSettings.xhr = function() {
  50351. try {
  50352. return new window.XMLHttpRequest();
  50353. } catch ( e ) {}
  50354. };
  50355. var xhrSuccessStatus = {
  50356. // File protocol always yields status code 0, assume 200
  50357. 0: 200,
  50358. // Support: IE <=9 only
  50359. // #1450: sometimes IE returns 1223 when it should be 204
  50360. 1223: 204
  50361. },
  50362. xhrSupported = jQuery.ajaxSettings.xhr();
  50363. support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported );
  50364. support.ajax = xhrSupported = !!xhrSupported;
  50365. jQuery.ajaxTransport( function( options ) {
  50366. var callback, errorCallback;
  50367. // Cross domain only allowed if supported through XMLHttpRequest
  50368. if ( support.cors || xhrSupported && !options.crossDomain ) {
  50369. return {
  50370. send: function( headers, complete ) {
  50371. var i,
  50372. xhr = options.xhr();
  50373. xhr.open(
  50374. options.type,
  50375. options.url,
  50376. options.async,
  50377. options.username,
  50378. options.password
  50379. );
  50380. // Apply custom fields if provided
  50381. if ( options.xhrFields ) {
  50382. for ( i in options.xhrFields ) {
  50383. xhr[ i ] = options.xhrFields[ i ];
  50384. }
  50385. }
  50386. // Override mime type if needed
  50387. if ( options.mimeType && xhr.overrideMimeType ) {
  50388. xhr.overrideMimeType( options.mimeType );
  50389. }
  50390. // X-Requested-With header
  50391. // For cross-domain requests, seeing as conditions for a preflight are
  50392. // akin to a jigsaw puzzle, we simply never set it to be sure.
  50393. // (it can always be set on a per-request basis or even using ajaxSetup)
  50394. // For same-domain requests, won't change header if already provided.
  50395. if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) {
  50396. headers[ "X-Requested-With" ] = "XMLHttpRequest";
  50397. }
  50398. // Set headers
  50399. for ( i in headers ) {
  50400. xhr.setRequestHeader( i, headers[ i ] );
  50401. }
  50402. // Callback
  50403. callback = function( type ) {
  50404. return function() {
  50405. if ( callback ) {
  50406. callback = errorCallback = xhr.onload =
  50407. xhr.onerror = xhr.onabort = xhr.ontimeout =
  50408. xhr.onreadystatechange = null;
  50409. if ( type === "abort" ) {
  50410. xhr.abort();
  50411. } else if ( type === "error" ) {
  50412. // Support: IE <=9 only
  50413. // On a manual native abort, IE9 throws
  50414. // errors on any property access that is not readyState
  50415. if ( typeof xhr.status !== "number" ) {
  50416. complete( 0, "error" );
  50417. } else {
  50418. complete(
  50419. // File: protocol always yields status 0; see #8605, #14207
  50420. xhr.status,
  50421. xhr.statusText
  50422. );
  50423. }
  50424. } else {
  50425. complete(
  50426. xhrSuccessStatus[ xhr.status ] || xhr.status,
  50427. xhr.statusText,
  50428. // Support: IE <=9 only
  50429. // IE9 has no XHR2 but throws on binary (trac-11426)
  50430. // For XHR2 non-text, let the caller handle it (gh-2498)
  50431. ( xhr.responseType || "text" ) !== "text" ||
  50432. typeof xhr.responseText !== "string" ?
  50433. { binary: xhr.response } :
  50434. { text: xhr.responseText },
  50435. xhr.getAllResponseHeaders()
  50436. );
  50437. }
  50438. }
  50439. };
  50440. };
  50441. // Listen to events
  50442. xhr.onload = callback();
  50443. errorCallback = xhr.onerror = xhr.ontimeout = callback( "error" );
  50444. // Support: IE 9 only
  50445. // Use onreadystatechange to replace onabort
  50446. // to handle uncaught aborts
  50447. if ( xhr.onabort !== undefined ) {
  50448. xhr.onabort = errorCallback;
  50449. } else {
  50450. xhr.onreadystatechange = function() {
  50451. // Check readyState before timeout as it changes
  50452. if ( xhr.readyState === 4 ) {
  50453. // Allow onerror to be called first,
  50454. // but that will not handle a native abort
  50455. // Also, save errorCallback to a variable
  50456. // as xhr.onerror cannot be accessed
  50457. window.setTimeout( function() {
  50458. if ( callback ) {
  50459. errorCallback();
  50460. }
  50461. } );
  50462. }
  50463. };
  50464. }
  50465. // Create the abort callback
  50466. callback = callback( "abort" );
  50467. try {
  50468. // Do send the request (this may raise an exception)
  50469. xhr.send( options.hasContent && options.data || null );
  50470. } catch ( e ) {
  50471. // #14683: Only rethrow if this hasn't been notified as an error yet
  50472. if ( callback ) {
  50473. throw e;
  50474. }
  50475. }
  50476. },
  50477. abort: function() {
  50478. if ( callback ) {
  50479. callback();
  50480. }
  50481. }
  50482. };
  50483. }
  50484. } );
  50485. // Prevent auto-execution of scripts when no explicit dataType was provided (See gh-2432)
  50486. jQuery.ajaxPrefilter( function( s ) {
  50487. if ( s.crossDomain ) {
  50488. s.contents.script = false;
  50489. }
  50490. } );
  50491. // Install script dataType
  50492. jQuery.ajaxSetup( {
  50493. accepts: {
  50494. script: "text/javascript, application/javascript, " +
  50495. "application/ecmascript, application/x-ecmascript"
  50496. },
  50497. contents: {
  50498. script: /\b(?:java|ecma)script\b/
  50499. },
  50500. converters: {
  50501. "text script": function( text ) {
  50502. jQuery.globalEval( text );
  50503. return text;
  50504. }
  50505. }
  50506. } );
  50507. // Handle cache's special case and crossDomain
  50508. jQuery.ajaxPrefilter( "script", function( s ) {
  50509. if ( s.cache === undefined ) {
  50510. s.cache = false;
  50511. }
  50512. if ( s.crossDomain ) {
  50513. s.type = "GET";
  50514. }
  50515. } );
  50516. // Bind script tag hack transport
  50517. jQuery.ajaxTransport( "script", function( s ) {
  50518. // This transport only deals with cross domain requests
  50519. if ( s.crossDomain ) {
  50520. var script, callback;
  50521. return {
  50522. send: function( _, complete ) {
  50523. script = jQuery( "<script>" ).prop( {
  50524. charset: s.scriptCharset,
  50525. src: s.url
  50526. } ).on(
  50527. "load error",
  50528. callback = function( evt ) {
  50529. script.remove();
  50530. callback = null;
  50531. if ( evt ) {
  50532. complete( evt.type === "error" ? 404 : 200, evt.type );
  50533. }
  50534. }
  50535. );
  50536. // Use native DOM manipulation to avoid our domManip AJAX trickery
  50537. document.head.appendChild( script[ 0 ] );
  50538. },
  50539. abort: function() {
  50540. if ( callback ) {
  50541. callback();
  50542. }
  50543. }
  50544. };
  50545. }
  50546. } );
  50547. var oldCallbacks = [],
  50548. rjsonp = /(=)\?(?=&|$)|\?\?/;
  50549. // Default jsonp settings
  50550. jQuery.ajaxSetup( {
  50551. jsonp: "callback",
  50552. jsonpCallback: function() {
  50553. var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) );
  50554. this[ callback ] = true;
  50555. return callback;
  50556. }
  50557. } );
  50558. // Detect, normalize options and install callbacks for jsonp requests
  50559. jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) {
  50560. var callbackName, overwritten, responseContainer,
  50561. jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ?
  50562. "url" :
  50563. typeof s.data === "string" &&
  50564. ( s.contentType || "" )
  50565. .indexOf( "application/x-www-form-urlencoded" ) === 0 &&
  50566. rjsonp.test( s.data ) && "data"
  50567. );
  50568. // Handle iff the expected data type is "jsonp" or we have a parameter to set
  50569. if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) {
  50570. // Get callback name, remembering preexisting value associated with it
  50571. callbackName = s.jsonpCallback = isFunction( s.jsonpCallback ) ?
  50572. s.jsonpCallback() :
  50573. s.jsonpCallback;
  50574. // Insert callback into url or form data
  50575. if ( jsonProp ) {
  50576. s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName );
  50577. } else if ( s.jsonp !== false ) {
  50578. s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName;
  50579. }
  50580. // Use data converter to retrieve json after script execution
  50581. s.converters[ "script json" ] = function() {
  50582. if ( !responseContainer ) {
  50583. jQuery.error( callbackName + " was not called" );
  50584. }
  50585. return responseContainer[ 0 ];
  50586. };
  50587. // Force json dataType
  50588. s.dataTypes[ 0 ] = "json";
  50589. // Install callback
  50590. overwritten = window[ callbackName ];
  50591. window[ callbackName ] = function() {
  50592. responseContainer = arguments;
  50593. };
  50594. // Clean-up function (fires after converters)
  50595. jqXHR.always( function() {
  50596. // If previous value didn't exist - remove it
  50597. if ( overwritten === undefined ) {
  50598. jQuery( window ).removeProp( callbackName );
  50599. // Otherwise restore preexisting value
  50600. } else {
  50601. window[ callbackName ] = overwritten;
  50602. }
  50603. // Save back as free
  50604. if ( s[ callbackName ] ) {
  50605. // Make sure that re-using the options doesn't screw things around
  50606. s.jsonpCallback = originalSettings.jsonpCallback;
  50607. // Save the callback name for future use
  50608. oldCallbacks.push( callbackName );
  50609. }
  50610. // Call if it was a function and we have a response
  50611. if ( responseContainer && isFunction( overwritten ) ) {
  50612. overwritten( responseContainer[ 0 ] );
  50613. }
  50614. responseContainer = overwritten = undefined;
  50615. } );
  50616. // Delegate to script
  50617. return "script";
  50618. }
  50619. } );
  50620. // Support: Safari 8 only
  50621. // In Safari 8 documents created via document.implementation.createHTMLDocument
  50622. // collapse sibling forms: the second one becomes a child of the first one.
  50623. // Because of that, this security measure has to be disabled in Safari 8.
  50624. // https://bugs.webkit.org/show_bug.cgi?id=137337
  50625. support.createHTMLDocument = ( function() {
  50626. var body = document.implementation.createHTMLDocument( "" ).body;
  50627. body.innerHTML = "<form></form><form></form>";
  50628. return body.childNodes.length === 2;
  50629. } )();
  50630. // Argument "data" should be string of html
  50631. // context (optional): If specified, the fragment will be created in this context,
  50632. // defaults to document
  50633. // keepScripts (optional): If true, will include scripts passed in the html string
  50634. jQuery.parseHTML = function( data, context, keepScripts ) {
  50635. if ( typeof data !== "string" ) {
  50636. return [];
  50637. }
  50638. if ( typeof context === "boolean" ) {
  50639. keepScripts = context;
  50640. context = false;
  50641. }
  50642. var base, parsed, scripts;
  50643. if ( !context ) {
  50644. // Stop scripts or inline event handlers from being executed immediately
  50645. // by using document.implementation
  50646. if ( support.createHTMLDocument ) {
  50647. context = document.implementation.createHTMLDocument( "" );
  50648. // Set the base href for the created document
  50649. // so any parsed elements with URLs
  50650. // are based on the document's URL (gh-2965)
  50651. base = context.createElement( "base" );
  50652. base.href = document.location.href;
  50653. context.head.appendChild( base );
  50654. } else {
  50655. context = document;
  50656. }
  50657. }
  50658. parsed = rsingleTag.exec( data );
  50659. scripts = !keepScripts && [];
  50660. // Single tag
  50661. if ( parsed ) {
  50662. return [ context.createElement( parsed[ 1 ] ) ];
  50663. }
  50664. parsed = buildFragment( [ data ], context, scripts );
  50665. if ( scripts && scripts.length ) {
  50666. jQuery( scripts ).remove();
  50667. }
  50668. return jQuery.merge( [], parsed.childNodes );
  50669. };
  50670. /**
  50671. * Load a url into a page
  50672. */
  50673. jQuery.fn.load = function( url, params, callback ) {
  50674. var selector, type, response,
  50675. self = this,
  50676. off = url.indexOf( " " );
  50677. if ( off > -1 ) {
  50678. selector = stripAndCollapse( url.slice( off ) );
  50679. url = url.slice( 0, off );
  50680. }
  50681. // If it's a function
  50682. if ( isFunction( params ) ) {
  50683. // We assume that it's the callback
  50684. callback = params;
  50685. params = undefined;
  50686. // Otherwise, build a param string
  50687. } else if ( params && typeof params === "object" ) {
  50688. type = "POST";
  50689. }
  50690. // If we have elements to modify, make the request
  50691. if ( self.length > 0 ) {
  50692. jQuery.ajax( {
  50693. url: url,
  50694. // If "type" variable is undefined, then "GET" method will be used.
  50695. // Make value of this field explicit since
  50696. // user can override it through ajaxSetup method
  50697. type: type || "GET",
  50698. dataType: "html",
  50699. data: params
  50700. } ).done( function( responseText ) {
  50701. // Save response for use in complete callback
  50702. response = arguments;
  50703. self.html( selector ?
  50704. // If a selector was specified, locate the right elements in a dummy div
  50705. // Exclude scripts to avoid IE 'Permission Denied' errors
  50706. jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) :
  50707. // Otherwise use the full result
  50708. responseText );
  50709. // If the request succeeds, this function gets "data", "status", "jqXHR"
  50710. // but they are ignored because response was set above.
  50711. // If it fails, this function gets "jqXHR", "status", "error"
  50712. } ).always( callback && function( jqXHR, status ) {
  50713. self.each( function() {
  50714. callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] );
  50715. } );
  50716. } );
  50717. }
  50718. return this;
  50719. };
  50720. // Attach a bunch of functions for handling common AJAX events
  50721. jQuery.each( [
  50722. "ajaxStart",
  50723. "ajaxStop",
  50724. "ajaxComplete",
  50725. "ajaxError",
  50726. "ajaxSuccess",
  50727. "ajaxSend"
  50728. ], function( i, type ) {
  50729. jQuery.fn[ type ] = function( fn ) {
  50730. return this.on( type, fn );
  50731. };
  50732. } );
  50733. jQuery.expr.pseudos.animated = function( elem ) {
  50734. return jQuery.grep( jQuery.timers, function( fn ) {
  50735. return elem === fn.elem;
  50736. } ).length;
  50737. };
  50738. jQuery.offset = {
  50739. setOffset: function( elem, options, i ) {
  50740. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
  50741. position = jQuery.css( elem, "position" ),
  50742. curElem = jQuery( elem ),
  50743. props = {};
  50744. // Set position first, in-case top/left are set even on static elem
  50745. if ( position === "static" ) {
  50746. elem.style.position = "relative";
  50747. }
  50748. curOffset = curElem.offset();
  50749. curCSSTop = jQuery.css( elem, "top" );
  50750. curCSSLeft = jQuery.css( elem, "left" );
  50751. calculatePosition = ( position === "absolute" || position === "fixed" ) &&
  50752. ( curCSSTop + curCSSLeft ).indexOf( "auto" ) > -1;
  50753. // Need to be able to calculate position if either
  50754. // top or left is auto and position is either absolute or fixed
  50755. if ( calculatePosition ) {
  50756. curPosition = curElem.position();
  50757. curTop = curPosition.top;
  50758. curLeft = curPosition.left;
  50759. } else {
  50760. curTop = parseFloat( curCSSTop ) || 0;
  50761. curLeft = parseFloat( curCSSLeft ) || 0;
  50762. }
  50763. if ( isFunction( options ) ) {
  50764. // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
  50765. options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
  50766. }
  50767. if ( options.top != null ) {
  50768. props.top = ( options.top - curOffset.top ) + curTop;
  50769. }
  50770. if ( options.left != null ) {
  50771. props.left = ( options.left - curOffset.left ) + curLeft;
  50772. }
  50773. if ( "using" in options ) {
  50774. options.using.call( elem, props );
  50775. } else {
  50776. curElem.css( props );
  50777. }
  50778. }
  50779. };
  50780. jQuery.fn.extend( {
  50781. // offset() relates an element's border box to the document origin
  50782. offset: function( options ) {
  50783. // Preserve chaining for setter
  50784. if ( arguments.length ) {
  50785. return options === undefined ?
  50786. this :
  50787. this.each( function( i ) {
  50788. jQuery.offset.setOffset( this, options, i );
  50789. } );
  50790. }
  50791. var rect, win,
  50792. elem = this[ 0 ];
  50793. if ( !elem ) {
  50794. return;
  50795. }
  50796. // Return zeros for disconnected and hidden (display: none) elements (gh-2310)
  50797. // Support: IE <=11 only
  50798. // Running getBoundingClientRect on a
  50799. // disconnected node in IE throws an error
  50800. if ( !elem.getClientRects().length ) {
  50801. return { top: 0, left: 0 };
  50802. }
  50803. // Get document-relative position by adding viewport scroll to viewport-relative gBCR
  50804. rect = elem.getBoundingClientRect();
  50805. win = elem.ownerDocument.defaultView;
  50806. return {
  50807. top: rect.top + win.pageYOffset,
  50808. left: rect.left + win.pageXOffset
  50809. };
  50810. },
  50811. // position() relates an element's margin box to its offset parent's padding box
  50812. // This corresponds to the behavior of CSS absolute positioning
  50813. position: function() {
  50814. if ( !this[ 0 ] ) {
  50815. return;
  50816. }
  50817. var offsetParent, offset, doc,
  50818. elem = this[ 0 ],
  50819. parentOffset = { top: 0, left: 0 };
  50820. // position:fixed elements are offset from the viewport, which itself always has zero offset
  50821. if ( jQuery.css( elem, "position" ) === "fixed" ) {
  50822. // Assume position:fixed implies availability of getBoundingClientRect
  50823. offset = elem.getBoundingClientRect();
  50824. } else {
  50825. offset = this.offset();
  50826. // Account for the *real* offset parent, which can be the document or its root element
  50827. // when a statically positioned element is identified
  50828. doc = elem.ownerDocument;
  50829. offsetParent = elem.offsetParent || doc.documentElement;
  50830. while ( offsetParent &&
  50831. ( offsetParent === doc.body || offsetParent === doc.documentElement ) &&
  50832. jQuery.css( offsetParent, "position" ) === "static" ) {
  50833. offsetParent = offsetParent.parentNode;
  50834. }
  50835. if ( offsetParent && offsetParent !== elem && offsetParent.nodeType === 1 ) {
  50836. // Incorporate borders into its offset, since they are outside its content origin
  50837. parentOffset = jQuery( offsetParent ).offset();
  50838. parentOffset.top += jQuery.css( offsetParent, "borderTopWidth", true );
  50839. parentOffset.left += jQuery.css( offsetParent, "borderLeftWidth", true );
  50840. }
  50841. }
  50842. // Subtract parent offsets and element margins
  50843. return {
  50844. top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
  50845. left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
  50846. };
  50847. },
  50848. // This method will return documentElement in the following cases:
  50849. // 1) For the element inside the iframe without offsetParent, this method will return
  50850. // documentElement of the parent window
  50851. // 2) For the hidden or detached element
  50852. // 3) For body or html element, i.e. in case of the html node - it will return itself
  50853. //
  50854. // but those exceptions were never presented as a real life use-cases
  50855. // and might be considered as more preferable results.
  50856. //
  50857. // This logic, however, is not guaranteed and can change at any point in the future
  50858. offsetParent: function() {
  50859. return this.map( function() {
  50860. var offsetParent = this.offsetParent;
  50861. while ( offsetParent && jQuery.css( offsetParent, "position" ) === "static" ) {
  50862. offsetParent = offsetParent.offsetParent;
  50863. }
  50864. return offsetParent || documentElement;
  50865. } );
  50866. }
  50867. } );
  50868. // Create scrollLeft and scrollTop methods
  50869. jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
  50870. var top = "pageYOffset" === prop;
  50871. jQuery.fn[ method ] = function( val ) {
  50872. return access( this, function( elem, method, val ) {
  50873. // Coalesce documents and windows
  50874. var win;
  50875. if ( isWindow( elem ) ) {
  50876. win = elem;
  50877. } else if ( elem.nodeType === 9 ) {
  50878. win = elem.defaultView;
  50879. }
  50880. if ( val === undefined ) {
  50881. return win ? win[ prop ] : elem[ method ];
  50882. }
  50883. if ( win ) {
  50884. win.scrollTo(
  50885. !top ? val : win.pageXOffset,
  50886. top ? val : win.pageYOffset
  50887. );
  50888. } else {
  50889. elem[ method ] = val;
  50890. }
  50891. }, method, val, arguments.length );
  50892. };
  50893. } );
  50894. // Support: Safari <=7 - 9.1, Chrome <=37 - 49
  50895. // Add the top/left cssHooks using jQuery.fn.position
  50896. // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
  50897. // Blink bug: https://bugs.chromium.org/p/chromium/issues/detail?id=589347
  50898. // getComputedStyle returns percent when specified for top/left/bottom/right;
  50899. // rather than make the css module depend on the offset module, just check for it here
  50900. jQuery.each( [ "top", "left" ], function( i, prop ) {
  50901. jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
  50902. function( elem, computed ) {
  50903. if ( computed ) {
  50904. computed = curCSS( elem, prop );
  50905. // If curCSS returns percentage, fallback to offset
  50906. return rnumnonpx.test( computed ) ?
  50907. jQuery( elem ).position()[ prop ] + "px" :
  50908. computed;
  50909. }
  50910. }
  50911. );
  50912. } );
  50913. // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods
  50914. jQuery.each( { Height: "height", Width: "width" }, function( name, type ) {
  50915. jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name },
  50916. function( defaultExtra, funcName ) {
  50917. // Margin is only for outerHeight, outerWidth
  50918. jQuery.fn[ funcName ] = function( margin, value ) {
  50919. var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ),
  50920. extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" );
  50921. return access( this, function( elem, type, value ) {
  50922. var doc;
  50923. if ( isWindow( elem ) ) {
  50924. // $( window ).outerWidth/Height return w/h including scrollbars (gh-1729)
  50925. return funcName.indexOf( "outer" ) === 0 ?
  50926. elem[ "inner" + name ] :
  50927. elem.document.documentElement[ "client" + name ];
  50928. }
  50929. // Get document width or height
  50930. if ( elem.nodeType === 9 ) {
  50931. doc = elem.documentElement;
  50932. // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height],
  50933. // whichever is greatest
  50934. return Math.max(
  50935. elem.body[ "scroll" + name ], doc[ "scroll" + name ],
  50936. elem.body[ "offset" + name ], doc[ "offset" + name ],
  50937. doc[ "client" + name ]
  50938. );
  50939. }
  50940. return value === undefined ?
  50941. // Get width or height on the element, requesting but not forcing parseFloat
  50942. jQuery.css( elem, type, extra ) :
  50943. // Set width or height on the element
  50944. jQuery.style( elem, type, value, extra );
  50945. }, type, chainable ? margin : undefined, chainable );
  50946. };
  50947. } );
  50948. } );
  50949. jQuery.each( ( "blur focus focusin focusout resize scroll click dblclick " +
  50950. "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " +
  50951. "change select submit keydown keypress keyup contextmenu" ).split( " " ),
  50952. function( i, name ) {
  50953. // Handle event binding
  50954. jQuery.fn[ name ] = function( data, fn ) {
  50955. return arguments.length > 0 ?
  50956. this.on( name, null, data, fn ) :
  50957. this.trigger( name );
  50958. };
  50959. } );
  50960. jQuery.fn.extend( {
  50961. hover: function( fnOver, fnOut ) {
  50962. return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver );
  50963. }
  50964. } );
  50965. jQuery.fn.extend( {
  50966. bind: function( types, data, fn ) {
  50967. return this.on( types, null, data, fn );
  50968. },
  50969. unbind: function( types, fn ) {
  50970. return this.off( types, null, fn );
  50971. },
  50972. delegate: function( selector, types, data, fn ) {
  50973. return this.on( types, selector, data, fn );
  50974. },
  50975. undelegate: function( selector, types, fn ) {
  50976. // ( namespace ) or ( selector, types [, fn] )
  50977. return arguments.length === 1 ?
  50978. this.off( selector, "**" ) :
  50979. this.off( types, selector || "**", fn );
  50980. }
  50981. } );
  50982. // Bind a function to a context, optionally partially applying any
  50983. // arguments.
  50984. // jQuery.proxy is deprecated to promote standards (specifically Function#bind)
  50985. // However, it is not slated for removal any time soon
  50986. jQuery.proxy = function( fn, context ) {
  50987. var tmp, args, proxy;
  50988. if ( typeof context === "string" ) {
  50989. tmp = fn[ context ];
  50990. context = fn;
  50991. fn = tmp;
  50992. }
  50993. // Quick check to determine if target is callable, in the spec
  50994. // this throws a TypeError, but we will just return undefined.
  50995. if ( !isFunction( fn ) ) {
  50996. return undefined;
  50997. }
  50998. // Simulated bind
  50999. args = slice.call( arguments, 2 );
  51000. proxy = function() {
  51001. return fn.apply( context || this, args.concat( slice.call( arguments ) ) );
  51002. };
  51003. // Set the guid of unique handler to the same of original handler, so it can be removed
  51004. proxy.guid = fn.guid = fn.guid || jQuery.guid++;
  51005. return proxy;
  51006. };
  51007. jQuery.holdReady = function( hold ) {
  51008. if ( hold ) {
  51009. jQuery.readyWait++;
  51010. } else {
  51011. jQuery.ready( true );
  51012. }
  51013. };
  51014. jQuery.isArray = Array.isArray;
  51015. jQuery.parseJSON = JSON.parse;
  51016. jQuery.nodeName = nodeName;
  51017. jQuery.isFunction = isFunction;
  51018. jQuery.isWindow = isWindow;
  51019. jQuery.camelCase = camelCase;
  51020. jQuery.type = toType;
  51021. jQuery.now = Date.now;
  51022. jQuery.isNumeric = function( obj ) {
  51023. // As of jQuery 3.0, isNumeric is limited to
  51024. // strings and numbers (primitives or objects)
  51025. // that can be coerced to finite numbers (gh-2662)
  51026. var type = jQuery.type( obj );
  51027. return ( type === "number" || type === "string" ) &&
  51028. // parseFloat NaNs numeric-cast false positives ("")
  51029. // ...but misinterprets leading-number strings, particularly hex literals ("0x...")
  51030. // subtraction forces infinities to NaN
  51031. !isNaN( obj - parseFloat( obj ) );
  51032. };
  51033. // Register as a named AMD module, since jQuery can be concatenated with other
  51034. // files that may use define, but not via a proper concatenation script that
  51035. // understands anonymous AMD modules. A named AMD is safest and most robust
  51036. // way to register. Lowercase jquery is used because AMD module names are
  51037. // derived from file names, and jQuery is normally delivered in a lowercase
  51038. // file name. Do this after creating the global so that if an AMD module wants
  51039. // to call noConflict to hide this version of jQuery, it will work.
  51040. // Note that for maximum portability, libraries that are not jQuery should
  51041. // declare themselves as anonymous modules, and avoid setting a global if an
  51042. // AMD loader is present. jQuery is a special case. For more information, see
  51043. // https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon
  51044. if ( true ) {
  51045. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function() {
  51046. return jQuery;
  51047. }).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
  51048. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  51049. }
  51050. var
  51051. // Map over jQuery in case of overwrite
  51052. _jQuery = window.jQuery,
  51053. // Map over the $ in case of overwrite
  51054. _$ = window.$;
  51055. jQuery.noConflict = function( deep ) {
  51056. if ( window.$ === jQuery ) {
  51057. window.$ = _$;
  51058. }
  51059. if ( deep && window.jQuery === jQuery ) {
  51060. window.jQuery = _jQuery;
  51061. }
  51062. return jQuery;
  51063. };
  51064. // Expose jQuery and $ identifiers, even in AMD
  51065. // (#7102#comment:10, https://github.com/jquery/jquery/pull/557)
  51066. // and CommonJS for browser emulators (#13566)
  51067. if ( !noGlobal ) {
  51068. window.jQuery = window.$ = jQuery;
  51069. }
  51070. return jQuery;
  51071. } );
  51072. /***/ }),
  51073. /***/ "./node_modules/line-i18n/dist/LanguageService.js":
  51074. /*!********************************************************!*\
  51075. !*** ./node_modules/line-i18n/dist/LanguageService.js ***!
  51076. \********************************************************/
  51077. /*! exports provided: LanguageService */
  51078. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51079. "use strict";
  51080. __webpack_require__.r(__webpack_exports__);
  51081. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageService", function() { return LanguageService; });
  51082. var LanguageService = /** @class */ (function () {
  51083. function LanguageService(lsKey, defaultLang) {
  51084. if (defaultLang === void 0) { defaultLang = 'pt'; }
  51085. this.lsKey = lsKey;
  51086. this.defaultLang = defaultLang;
  51087. this.listeners = [];
  51088. this.document = document;
  51089. this.setupListener();
  51090. }
  51091. LanguageService.prototype.setupListener = function () {
  51092. var _this = this;
  51093. if (this.document !== null) {
  51094. this.document.addEventListener("storage", (function (event) {
  51095. var e = event;
  51096. if (e.key === _this.lsKey) {
  51097. _this.listeners.forEach(function (l) { return l(); });
  51098. }
  51099. }));
  51100. }
  51101. };
  51102. LanguageService.prototype.getLang = function () {
  51103. var lang = localStorage.getItem(this.lsKey);
  51104. if (lang === null || lang === undefined) {
  51105. console.warn("Internal Error: User language information has not been set. Returning default...");
  51106. return this.getDefaultLang();
  51107. }
  51108. return lang;
  51109. };
  51110. LanguageService.prototype.getDefaultLang = function () {
  51111. return this.defaultLang;
  51112. };
  51113. LanguageService.prototype.registerLanguageChangeListener = function (listener) {
  51114. this.listeners.push(listener);
  51115. };
  51116. return LanguageService;
  51117. }());
  51118. /***/ }),
  51119. /***/ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js":
  51120. /*!************************************************************!*\
  51121. !*** ./node_modules/line-i18n/dist/LanguageServiceNoLS.js ***!
  51122. \************************************************************/
  51123. /*! exports provided: LanguageServiceNoLS */
  51124. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51125. "use strict";
  51126. __webpack_require__.r(__webpack_exports__);
  51127. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LanguageServiceNoLS", function() { return LanguageServiceNoLS; });
  51128. var LanguageServiceNoLS = /** @class */ (function () {
  51129. function LanguageServiceNoLS(lang) {
  51130. this.lang = lang;
  51131. this.listeners = [];
  51132. }
  51133. LanguageServiceNoLS.prototype.setupListener = function () { };
  51134. LanguageServiceNoLS.prototype.notifyChange = function () {
  51135. this.listeners.forEach(function (l) { return l(); });
  51136. };
  51137. LanguageServiceNoLS.prototype.setLang = function (lang) {
  51138. this.lang = lang;
  51139. this.notifyChange();
  51140. };
  51141. LanguageServiceNoLS.prototype.getLang = function () {
  51142. return this.lang;
  51143. };
  51144. LanguageServiceNoLS.prototype.getDefaultLang = function () {
  51145. return this.lang;
  51146. };
  51147. LanguageServiceNoLS.prototype.registerLanguageChangeListener = function (listener) {
  51148. this.listeners.push(listener);
  51149. };
  51150. return LanguageServiceNoLS;
  51151. }());
  51152. /***/ }),
  51153. /***/ "./node_modules/line-i18n/dist/LocalizedStrings.js":
  51154. /*!*********************************************************!*\
  51155. !*** ./node_modules/line-i18n/dist/LocalizedStrings.js ***!
  51156. \*********************************************************/
  51157. /*! exports provided: LocalizedStrings */
  51158. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51159. "use strict";
  51160. __webpack_require__.r(__webpack_exports__);
  51161. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocalizedStrings", function() { return LocalizedStrings; });
  51162. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  51163. var LocalizedStrings = /** @class */ (function () {
  51164. function LocalizedStrings(service, i18nData, listenToChange) {
  51165. if (listenToChange === void 0) { listenToChange = false; }
  51166. var _this = this;
  51167. this.service = service;
  51168. this.i18nData = i18nData;
  51169. this.listenToChange = listenToChange;
  51170. this.document = document;
  51171. if (this.listenToChange) {
  51172. service.registerLanguageChangeListener(function () {
  51173. _this.updateTagText();
  51174. });
  51175. }
  51176. }
  51177. LocalizedStrings.prototype.getString = function (id, type) {
  51178. var i18nObj = this.i18nData[this.service.getLang()];
  51179. if (!!!i18nObj) {
  51180. console.warn("Internal Error. The language set at ivprog.lang is not valid: " + this.service.getLang());
  51181. i18nObj = this.i18nData[this.service.getDefaultLang()];
  51182. }
  51183. if (!!!i18nObj[type]) {
  51184. return "{MISSING_I18N_TYPE_IDENTIFIER}";
  51185. }
  51186. else if (!!!i18nObj[type][id]) {
  51187. return "{MISSING_I18N_IDENTIFIER}";
  51188. }
  51189. else {
  51190. return i18nObj[type][id];
  51191. }
  51192. };
  51193. LocalizedStrings.prototype.getOR = function () {
  51194. return this.getUI('join_or');
  51195. };
  51196. LocalizedStrings.prototype.getError = function (id, context) {
  51197. if (context === void 0) { context = []; }
  51198. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR);
  51199. return this.processString(text, context);
  51200. };
  51201. LocalizedStrings.prototype.getMessage = function (id, context) {
  51202. if (context === void 0) { context = []; }
  51203. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE);
  51204. return this.processString(text, context);
  51205. };
  51206. LocalizedStrings.prototype.getUI = function (id, context) {
  51207. if (context === void 0) { context = []; }
  51208. var text = this.getString(id, _StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI);
  51209. return this.processString(text, context);
  51210. };
  51211. LocalizedStrings.prototype.processString = function (text, context) {
  51212. for (var i = 0; i < context.length; i++) {
  51213. var v = context[i];
  51214. text = text.replace('\$' + i, v);
  51215. }
  51216. return text;
  51217. };
  51218. LocalizedStrings.prototype.updateTagText = function (func) {
  51219. var _this = this;
  51220. if (func === void 0) { func = null; }
  51221. if (this.document !== null) {
  51222. var list = this.document.querySelectorAll("data.i18n");
  51223. list.forEach(function (node) {
  51224. if (func === null) {
  51225. node.innerHTML = _this.processTagTex(node.getAttribute("value"));
  51226. }
  51227. else {
  51228. node.innerHTML = func(node.getAttribute("value"));
  51229. }
  51230. });
  51231. }
  51232. };
  51233. LocalizedStrings.prototype.processTagTex = function (text) {
  51234. if (text === null) {
  51235. return "<Invalid i18n identifier>";
  51236. }
  51237. var opts = text.split(':');
  51238. var type = opts[0].toLowerCase();
  51239. var id = opts[1];
  51240. if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].ERROR === type) {
  51241. return this.getError(id);
  51242. }
  51243. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].MESSAGE === type) {
  51244. return this.getMessage(id);
  51245. }
  51246. else if (_StringTypes__WEBPACK_IMPORTED_MODULE_0__["StringTypes"].UI === type) {
  51247. return this.getUI(id);
  51248. }
  51249. else {
  51250. console.warn(" A string has been passed to the i18n helper function that was not in the form type:id -> " + text);
  51251. return this.getString(id, type);
  51252. }
  51253. };
  51254. return LocalizedStrings;
  51255. }());
  51256. /***/ }),
  51257. /***/ "./node_modules/line-i18n/dist/StringTypes.js":
  51258. /*!****************************************************!*\
  51259. !*** ./node_modules/line-i18n/dist/StringTypes.js ***!
  51260. \****************************************************/
  51261. /*! exports provided: StringTypes */
  51262. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51263. "use strict";
  51264. __webpack_require__.r(__webpack_exports__);
  51265. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringTypes", function() { return StringTypes; });
  51266. var StringTypes;
  51267. (function (StringTypes) {
  51268. StringTypes["ERROR"] = "error";
  51269. StringTypes["MESSAGE"] = "message";
  51270. StringTypes["UI"] = "ui";
  51271. })(StringTypes || (StringTypes = {}));
  51272. /***/ }),
  51273. /***/ "./node_modules/line-i18n/dist/index.js":
  51274. /*!**********************************************!*\
  51275. !*** ./node_modules/line-i18n/dist/index.js ***!
  51276. \**********************************************/
  51277. /*! exports provided: default */
  51278. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51279. "use strict";
  51280. __webpack_require__.r(__webpack_exports__);
  51281. /* harmony import */ var _LanguageService__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./LanguageService */ "./node_modules/line-i18n/dist/LanguageService.js");
  51282. /* harmony import */ var _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./LocalizedStrings */ "./node_modules/line-i18n/dist/LocalizedStrings.js");
  51283. /* harmony import */ var _StringTypes__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./StringTypes */ "./node_modules/line-i18n/dist/StringTypes.js");
  51284. /* harmony import */ var _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./LanguageServiceNoLS */ "./node_modules/line-i18n/dist/LanguageServiceNoLS.js");
  51285. /* harmony default export */ __webpack_exports__["default"] = ({
  51286. LanguageService: _LanguageService__WEBPACK_IMPORTED_MODULE_0__["LanguageService"],
  51287. LanguageServiceNoLS: _LanguageServiceNoLS__WEBPACK_IMPORTED_MODULE_3__["LanguageServiceNoLS"],
  51288. LocalizedStrings: _LocalizedStrings__WEBPACK_IMPORTED_MODULE_1__["LocalizedStrings"],
  51289. StringTypes: _StringTypes__WEBPACK_IMPORTED_MODULE_2__["StringTypes"]
  51290. });
  51291. /***/ }),
  51292. /***/ "./node_modules/melanke-watchjs/src/watch.js":
  51293. /*!***************************************************!*\
  51294. !*** ./node_modules/melanke-watchjs/src/watch.js ***!
  51295. \***************************************************/
  51296. /*! no static exports found */
  51297. /***/ (function(module, exports, __webpack_require__) {
  51298. "use strict";
  51299. /**
  51300. * DEVELOPED BY
  51301. * GIL LOPES BUENO
  51302. * gilbueno.mail@gmail.com
  51303. *
  51304. * WORKS WITH:
  51305. * IE8*, IE 9+, FF 4+, SF 5+, WebKit, CH 7+, OP 12+, BESEN, Rhino 1.7+
  51306. * For IE8 (and other legacy browsers) WatchJS will use dirty checking
  51307. *
  51308. * FORK:
  51309. * https://github.com/melanke/Watch.JS
  51310. *
  51311. * LICENSE: MIT
  51312. */
  51313. (function (factory) {
  51314. if (true) {
  51315. // Node. Does not work with strict CommonJS, but
  51316. // only CommonJS-like enviroments that support module.exports,
  51317. // like Node.
  51318. module.exports = factory();
  51319. } else {}
  51320. }(function () {
  51321. var WatchJS = {
  51322. noMore: false, // use WatchJS.suspend(obj) instead
  51323. useDirtyCheck: false, // use only dirty checking to track changes.
  51324. preserveExistingSetters: false
  51325. },
  51326. lengthsubjects = [];
  51327. var dirtyChecklist = [];
  51328. var pendingChanges = []; // used coalesce changes from defineProperty and __defineSetter__
  51329. var supportDefineProperty = false;
  51330. try {
  51331. supportDefineProperty = Object.defineProperty && Object.defineProperty({},'x', {});
  51332. } catch(ex) { /* not supported */ }
  51333. var isFunction = function (functionToCheck) {
  51334. var getType = {};
  51335. return functionToCheck && getType.toString.call(functionToCheck) == '[object Function]';
  51336. };
  51337. var isInt = function (x) {
  51338. return x % 1 === 0;
  51339. };
  51340. var isArray = function(obj) {
  51341. return Object.prototype.toString.call(obj) === '[object Array]';
  51342. };
  51343. var isObject = function(obj) {
  51344. return {}.toString.apply(obj) === '[object Object]';
  51345. };
  51346. var getObjDiff = function(a, b){
  51347. var aplus = [],
  51348. bplus = [];
  51349. if(!(typeof a == "string") && !(typeof b == "string")){
  51350. if (isArray(a) && b) {
  51351. for (var i=0; i<a.length; i++) {
  51352. if (b[i] === undefined) aplus.push(i);
  51353. }
  51354. } else {
  51355. for(var i in a){
  51356. if (a.hasOwnProperty(i)) {
  51357. if(b && !b.hasOwnProperty(i)) {
  51358. aplus.push(i);
  51359. }
  51360. }
  51361. }
  51362. }
  51363. if (isArray(b) && a) {
  51364. for (var j=0; j<b.length; j++) {
  51365. if (a[j] === undefined) bplus.push(j);
  51366. }
  51367. } else {
  51368. for(var j in b){
  51369. if (b.hasOwnProperty(j)) {
  51370. if(a && !a.hasOwnProperty(j)) {
  51371. bplus.push(j);
  51372. }
  51373. }
  51374. }
  51375. }
  51376. }
  51377. return {
  51378. added: aplus,
  51379. removed: bplus
  51380. }
  51381. };
  51382. var clone = function(obj){
  51383. if (null == obj || "object" != typeof obj) {
  51384. return obj;
  51385. }
  51386. var copy = obj.constructor();
  51387. for (var attr in obj) {
  51388. copy[attr] = obj[attr];
  51389. }
  51390. return copy;
  51391. }
  51392. var getExistingSetter = function (obj, propName) {
  51393. if (WatchJS.preserveExistingSetters) {
  51394. var existing = Object.getOwnPropertyDescriptor(obj, propName);
  51395. return existing.set;
  51396. }
  51397. return undefined;
  51398. }
  51399. var defineGetAndSet = function (obj, propName, getter, setter) {
  51400. try {
  51401. var existingSetter = getExistingSetter(obj, propName);
  51402. Object.defineProperty(obj, propName, {
  51403. get: getter,
  51404. set: function(value) {
  51405. setter.call(this, value, true); // coalesce changes
  51406. if (existingSetter) {
  51407. existingSetter(value);
  51408. }
  51409. },
  51410. enumerable: true,
  51411. configurable: true
  51412. });
  51413. }
  51414. catch(e1) {
  51415. try{
  51416. Object.prototype.__defineGetter__.call(obj, propName, getter);
  51417. Object.prototype.__defineSetter__.call(obj, propName, function(value) {
  51418. setter.call(this,value,true); // coalesce changes
  51419. });
  51420. }
  51421. catch(e2) {
  51422. observeDirtyChanges(obj,propName,setter);
  51423. //throw new Error("watchJS error: browser not supported :/")
  51424. }
  51425. }
  51426. };
  51427. var defineProp = function (obj, propName, value) {
  51428. try {
  51429. Object.defineProperty(obj, propName, {
  51430. enumerable: false,
  51431. configurable: true,
  51432. writable: false,
  51433. value: value
  51434. });
  51435. } catch(error) {
  51436. obj[propName] = value;
  51437. }
  51438. };
  51439. var observeDirtyChanges = function(obj,propName,setter) {
  51440. dirtyChecklist[dirtyChecklist.length] = {
  51441. prop: propName,
  51442. object: obj,
  51443. orig: clone(obj[propName]),
  51444. callback: setter
  51445. }
  51446. }
  51447. var watch = function () {
  51448. if (isFunction(arguments[1])) {
  51449. watchAll.apply(this, arguments);
  51450. } else if (isArray(arguments[1])) {
  51451. watchMany.apply(this, arguments);
  51452. } else {
  51453. watchOne.apply(this, arguments);
  51454. }
  51455. };
  51456. var watchAll = function (obj, watcher, level, addNRemove) {
  51457. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51458. return;
  51459. }
  51460. if(isArray(obj)) {
  51461. defineWatcher(obj, "__watchall__", watcher, level); // watch all changes on the array
  51462. if (level===undefined||level > 0) {
  51463. for (var prop = 0; prop < obj.length; prop++) { // watch objects in array
  51464. watchAll(obj[prop],watcher,level, addNRemove);
  51465. }
  51466. }
  51467. }
  51468. else {
  51469. var prop,props = [];
  51470. for (prop in obj) { //for each attribute if obj is an object
  51471. if (prop == "$val" || (!supportDefineProperty && prop === 'watchers')) {
  51472. continue;
  51473. }
  51474. if (Object.prototype.hasOwnProperty.call(obj, prop)) {
  51475. props.push(prop); //put in the props
  51476. }
  51477. }
  51478. watchMany(obj, props, watcher, level, addNRemove); //watch all items of the props
  51479. }
  51480. if (addNRemove) {
  51481. pushToLengthSubjects(obj, "$$watchlengthsubjectroot", watcher, level);
  51482. }
  51483. };
  51484. var watchMany = function (obj, props, watcher, level, addNRemove) {
  51485. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51486. return;
  51487. }
  51488. for (var i=0; i<props.length; i++) { //watch each property
  51489. var prop = props[i];
  51490. watchOne(obj, prop, watcher, level, addNRemove);
  51491. }
  51492. };
  51493. var watchOne = function (obj, prop, watcher, level, addNRemove) {
  51494. if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51495. return;
  51496. }
  51497. if(isFunction(obj[prop])) { //dont watch if it is a function
  51498. return;
  51499. }
  51500. if(obj[prop] != null && (level === undefined || level > 0)){
  51501. watchAll(obj[prop], watcher, level!==undefined? level-1 : level); //recursively watch all attributes of this
  51502. }
  51503. defineWatcher(obj, prop, watcher, level);
  51504. if(addNRemove && (level === undefined || level > 0)){
  51505. pushToLengthSubjects(obj, prop, watcher, level);
  51506. }
  51507. };
  51508. var unwatch = function () {
  51509. if (isFunction(arguments[1])) {
  51510. unwatchAll.apply(this, arguments);
  51511. } else if (isArray(arguments[1])) {
  51512. unwatchMany.apply(this, arguments);
  51513. } else {
  51514. unwatchOne.apply(this, arguments);
  51515. }
  51516. };
  51517. var unwatchAll = function (obj, watcher) {
  51518. if (obj instanceof String || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
  51519. return;
  51520. }
  51521. if (isArray(obj)) {
  51522. var props = ['__watchall__'];
  51523. for (var prop = 0; prop < obj.length; prop++) { //for each item if obj is an array
  51524. props.push(prop); //put in the props
  51525. }
  51526. unwatchMany(obj, props, watcher); //watch all itens of the props
  51527. } else {
  51528. var unwatchPropsInObject = function (obj2) {
  51529. var props = [];
  51530. for (var prop2 in obj2) { //for each attribute if obj is an object
  51531. if (obj2.hasOwnProperty(prop2)) {
  51532. if (obj2[prop2] instanceof Object) {
  51533. unwatchPropsInObject(obj2[prop2]); //recurs into object props
  51534. } else {
  51535. props.push(prop2); //put in the props
  51536. }
  51537. }
  51538. }
  51539. unwatchMany(obj2, props, watcher); //unwatch all of the props
  51540. };
  51541. unwatchPropsInObject(obj);
  51542. }
  51543. };
  51544. var unwatchMany = function (obj, props, watcher) {
  51545. for (var prop2 in props) { //watch each attribute of "props" if is an object
  51546. if (props.hasOwnProperty(prop2)) {
  51547. unwatchOne(obj, props[prop2], watcher);
  51548. }
  51549. }
  51550. };
  51551. var timeouts = [],
  51552. timerID = null;
  51553. function clearTimerID() {
  51554. timerID = null;
  51555. for(var i=0; i< timeouts.length; i++) {
  51556. timeouts[i]();
  51557. }
  51558. timeouts.length = 0;
  51559. }
  51560. var getTimerID= function () {
  51561. if (!timerID) {
  51562. timerID = setTimeout(clearTimerID);
  51563. }
  51564. return timerID;
  51565. }
  51566. var registerTimeout = function(fn) { // register function to be called on timeout
  51567. if (timerID==null) getTimerID();
  51568. timeouts[timeouts.length] = fn;
  51569. }
  51570. // Track changes made to an array, object or an object's property
  51571. // and invoke callback with a single change object containing type, value, oldvalue and array splices
  51572. // Syntax:
  51573. // trackChange(obj, callback, recursive, addNRemove)
  51574. // trackChange(obj, prop, callback, recursive, addNRemove)
  51575. var trackChange = function() {
  51576. var fn = (isFunction(arguments[2])) ? trackProperty : trackObject ;
  51577. fn.apply(this,arguments);
  51578. }
  51579. // track changes made to an object and invoke callback with a single change object containing type, value and array splices
  51580. var trackObject= function(obj, callback, recursive, addNRemove) {
  51581. var change = null,lastTimerID = -1;
  51582. var isArr = isArray(obj);
  51583. var level,fn = function(prop, action, newValue, oldValue) {
  51584. var timerID = getTimerID();
  51585. if (lastTimerID!==timerID) { // check if timer has changed since last update
  51586. lastTimerID = timerID;
  51587. change = {
  51588. type: 'update'
  51589. }
  51590. change['value'] = obj;
  51591. change['splices'] = null;
  51592. registerTimeout(function() {
  51593. callback.call(this,change);
  51594. change = null;
  51595. });
  51596. }
  51597. // create splices for array changes
  51598. if (isArr && obj === this && change !== null) {
  51599. if (action==='pop'||action==='shift') {
  51600. newValue = [];
  51601. oldValue = [oldValue];
  51602. }
  51603. else if (action==='push'||action==='unshift') {
  51604. newValue = [newValue];
  51605. oldValue = [];
  51606. }
  51607. else if (action!=='splice') {
  51608. return; // return here - for reverse and sort operations we don't need to return splices. a simple update will do
  51609. }
  51610. if (!change.splices) change.splices = [];
  51611. change.splices[change.splices.length] = {
  51612. index: prop,
  51613. deleteCount: oldValue ? oldValue.length : 0,
  51614. addedCount: newValue ? newValue.length : 0,
  51615. added: newValue,
  51616. deleted: oldValue
  51617. };
  51618. }
  51619. }
  51620. level = (recursive==true) ? undefined : 0;
  51621. watchAll(obj,fn, level, addNRemove);
  51622. }
  51623. // track changes made to the property of an object and invoke callback with a single change object containing type, value, oldvalue and splices
  51624. var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
  51625. if (obj && prop) {
  51626. watchOne(obj,prop,function(prop, action, newvalue, oldvalue) {
  51627. var change = {
  51628. type: 'update'
  51629. }
  51630. change['value'] = newvalue;
  51631. change['oldvalue'] = oldvalue;
  51632. if (recursive && isObject(newvalue)||isArray(newvalue)) {
  51633. trackObject(newvalue,callback,recursive, addNRemove);
  51634. }
  51635. callback.call(this,change);
  51636. },0)
  51637. if (recursive && isObject(obj[prop])||isArray(obj[prop])) {
  51638. trackObject(obj[prop],callback,recursive, addNRemove);
  51639. }
  51640. }
  51641. }
  51642. var defineWatcher = function (obj, prop, watcher, level) {
  51643. var newWatcher = false;
  51644. var isArr = isArray(obj);
  51645. if (!obj.watchers) {
  51646. defineProp(obj, "watchers", {});
  51647. if (isArr) {
  51648. // watch array functions
  51649. watchFunctions(obj, function(index,action,newValue, oldValue) {
  51650. addPendingChange(obj, index, action,newValue, oldValue);
  51651. if (level !== 0 && newValue && (isObject(newValue) || isArray(newValue))) {
  51652. var i,n, ln, wAll, watchList = obj.watchers[prop];
  51653. if ((wAll = obj.watchers['__watchall__'])) {
  51654. watchList = watchList ? watchList.concat(wAll) : wAll;
  51655. }
  51656. ln = watchList ? watchList.length : 0;
  51657. for (i = 0; i<ln; i++) {
  51658. if (action!=='splice') {
  51659. watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
  51660. }
  51661. else {
  51662. // watch spliced values
  51663. for(n=0; n < newValue.length; n++) {
  51664. watchAll(newValue[n], watchList[i], (level===undefined)?level:level-1);
  51665. }
  51666. }
  51667. }
  51668. }
  51669. });
  51670. }
  51671. }
  51672. if (!obj.watchers[prop]) {
  51673. obj.watchers[prop] = [];
  51674. if (!isArr) newWatcher = true;
  51675. }
  51676. for (var i=0; i<obj.watchers[prop].length; i++) {
  51677. if(obj.watchers[prop][i] === watcher){
  51678. return;
  51679. }
  51680. }
  51681. obj.watchers[prop].push(watcher); //add the new watcher to the watchers array
  51682. if (newWatcher) {
  51683. var val = obj[prop];
  51684. var getter = function () {
  51685. return val;
  51686. };
  51687. var setter = function (newval, delayWatcher) {
  51688. var oldval = val;
  51689. val = newval;
  51690. if (level !== 0
  51691. && obj[prop] && (isObject(obj[prop]) || isArray(obj[prop]))
  51692. && !obj[prop].watchers) {
  51693. // watch sub properties
  51694. var i,ln = obj.watchers[prop].length;
  51695. for(i=0; i<ln; i++) {
  51696. watchAll(obj[prop], obj.watchers[prop][i], (level===undefined)?level:level-1);
  51697. }
  51698. }
  51699. //watchFunctions(obj, prop);
  51700. if (isSuspended(obj, prop)) {
  51701. resume(obj, prop);
  51702. return;
  51703. }
  51704. if (!WatchJS.noMore){ // this does not work with Object.observe
  51705. //if (JSON.stringify(oldval) !== JSON.stringify(newval)) {
  51706. if (oldval !== newval) {
  51707. if (!delayWatcher) {
  51708. callWatchers(obj, prop, "set", newval, oldval);
  51709. }
  51710. else {
  51711. addPendingChange(obj, prop, "set", newval, oldval);
  51712. }
  51713. WatchJS.noMore = false;
  51714. }
  51715. }
  51716. };
  51717. if (WatchJS.useDirtyCheck) {
  51718. observeDirtyChanges(obj,prop,setter);
  51719. }
  51720. else {
  51721. defineGetAndSet(obj, prop, getter, setter);
  51722. }
  51723. }
  51724. };
  51725. var callWatchers = function (obj, prop, action, newval, oldval) {
  51726. if (prop !== undefined) {
  51727. var ln, wl, watchList = obj.watchers[prop];
  51728. if ((wl = obj.watchers['__watchall__'])) {
  51729. watchList = watchList ? watchList.concat(wl) : wl;
  51730. }
  51731. ln = watchList ? watchList.length : 0;
  51732. for (var wr=0; wr< ln; wr++) {
  51733. watchList[wr].call(obj, prop, action, newval, oldval);
  51734. }
  51735. } else {
  51736. for (var prop in obj) {//call all
  51737. if (obj.hasOwnProperty(prop)) {
  51738. callWatchers(obj, prop, action, newval, oldval);
  51739. }
  51740. }
  51741. }
  51742. };
  51743. var methodNames = ['pop', 'push', 'reverse', 'shift', 'sort', 'slice', 'unshift', 'splice'];
  51744. var defineArrayMethodWatcher = function (obj, original, methodName, callback) {
  51745. defineProp(obj, methodName, function () {
  51746. var index = 0;
  51747. var i,newValue, oldValue, response;
  51748. // get values before splicing array
  51749. if (methodName === 'splice') {
  51750. var start = arguments[0];
  51751. var end = start + arguments[1];
  51752. oldValue = obj.slice(start,end);
  51753. newValue = [];
  51754. for(i=2;i<arguments.length;i++) {
  51755. newValue[i-2] = arguments[i];
  51756. }
  51757. index = start;
  51758. }
  51759. else {
  51760. newValue = arguments.length > 0 ? arguments[0] : undefined;
  51761. }
  51762. response = original.apply(obj, arguments);
  51763. if (methodName !== 'slice') {
  51764. if (methodName === 'pop') {
  51765. oldValue = response;
  51766. index = obj.length;
  51767. }
  51768. else if (methodName === 'push') {
  51769. index = obj.length-1;
  51770. }
  51771. else if (methodName === 'shift') {
  51772. oldValue = response;
  51773. }
  51774. else if (methodName !== 'unshift' && newValue===undefined) {
  51775. newValue = response;
  51776. }
  51777. callback.call(obj, index, methodName,newValue, oldValue)
  51778. }
  51779. return response;
  51780. });
  51781. };
  51782. var watchFunctions = function(obj, callback) {
  51783. if (!isFunction(callback) || !obj || (obj instanceof String) || (!isArray(obj))) {
  51784. return;
  51785. }
  51786. for (var i = methodNames.length, methodName; i--;) {
  51787. methodName = methodNames[i];
  51788. defineArrayMethodWatcher(obj, obj[methodName], methodName, callback);
  51789. }
  51790. };
  51791. var unwatchOne = function (obj, prop, watcher) {
  51792. if (prop) {
  51793. if (obj.watchers && obj.watchers[prop]) {
  51794. if (watcher === undefined) {
  51795. delete obj.watchers[prop]; // remove all property watchers
  51796. }
  51797. else {
  51798. for (var i = 0; i < obj.watchers[prop].length; i++) {
  51799. var w = obj.watchers[prop][i];
  51800. if (w == watcher) {
  51801. obj.watchers[prop].splice(i, 1);
  51802. }
  51803. }
  51804. }
  51805. }
  51806. } else {
  51807. delete obj.watchers;
  51808. }
  51809. removeFromLengthSubjects(obj, prop, watcher);
  51810. removeFromDirtyChecklist(obj, prop);
  51811. };
  51812. // suspend watchers until next update cycle
  51813. var suspend = function(obj, prop) {
  51814. if (obj.watchers) {
  51815. var name = '__wjs_suspend__'+(prop!==undefined ? prop : '');
  51816. obj.watchers[name] = true;
  51817. }
  51818. }
  51819. var isSuspended = function(obj, prop) {
  51820. return obj.watchers
  51821. && (obj.watchers['__wjs_suspend__'] ||
  51822. obj.watchers['__wjs_suspend__'+prop]);
  51823. }
  51824. // resumes preivously suspended watchers
  51825. var resume = function(obj, prop) {
  51826. registerTimeout(function() {
  51827. delete obj.watchers['__wjs_suspend__'];
  51828. delete obj.watchers['__wjs_suspend__'+prop];
  51829. })
  51830. }
  51831. var pendingTimerID = null;
  51832. var addPendingChange = function(obj,prop, mode, newval, oldval) {
  51833. pendingChanges[pendingChanges.length] = {
  51834. obj:obj,
  51835. prop: prop,
  51836. mode: mode,
  51837. newval: newval,
  51838. oldval: oldval
  51839. };
  51840. if (pendingTimerID===null) {
  51841. pendingTimerID = setTimeout(applyPendingChanges);
  51842. }
  51843. };
  51844. var applyPendingChanges = function() {
  51845. // apply pending changes
  51846. var change = null;
  51847. pendingTimerID = null;
  51848. for(var i=0;i < pendingChanges.length;i++) {
  51849. change = pendingChanges[i];
  51850. callWatchers(change.obj, change.prop, change.mode, change.newval, change.oldval);
  51851. }
  51852. if (change) {
  51853. pendingChanges = [];
  51854. change = null;
  51855. }
  51856. }
  51857. var loop = function(){
  51858. // check for new or deleted props
  51859. for(var i=0; i<lengthsubjects.length; i++) {
  51860. var subj = lengthsubjects[i];
  51861. if (subj.prop === "$$watchlengthsubjectroot") {
  51862. var difference = getObjDiff(subj.obj, subj.actual);
  51863. if(difference.added.length || difference.removed.length){
  51864. if(difference.added.length){
  51865. watchMany(subj.obj, difference.added, subj.watcher, subj.level - 1, true);
  51866. }
  51867. subj.watcher.call(subj.obj, "root", "differentattr", difference, subj.actual);
  51868. }
  51869. subj.actual = clone(subj.obj);
  51870. } else {
  51871. var difference = getObjDiff(subj.obj[subj.prop], subj.actual);
  51872. if(difference.added.length || difference.removed.length){
  51873. if(difference.added.length){
  51874. for (var j=0; j<subj.obj.watchers[subj.prop].length; j++) {
  51875. watchMany(subj.obj[subj.prop], difference.added, subj.obj.watchers[subj.prop][j], subj.level - 1, true);
  51876. }
  51877. }
  51878. callWatchers(subj.obj, subj.prop, "differentattr", difference, subj.actual);
  51879. }
  51880. subj.actual = clone(subj.obj[subj.prop]);
  51881. }
  51882. }
  51883. // start dirty check
  51884. var n, value;
  51885. if (dirtyChecklist.length > 0) {
  51886. for (var i = 0; i < dirtyChecklist.length; i++) {
  51887. n = dirtyChecklist[i];
  51888. value = n.object[n.prop];
  51889. if (!compareValues(n.orig, value)) {
  51890. n.orig = clone(value);
  51891. n.callback(value);
  51892. }
  51893. }
  51894. }
  51895. };
  51896. var compareValues = function(a,b) {
  51897. var i, state = true;
  51898. if (a!==b) {
  51899. if (isObject(a)) {
  51900. for(i in a) {
  51901. if (!supportDefineProperty && i==='watchers') continue;
  51902. if (a[i]!==b[i]) {
  51903. state = false;
  51904. break;
  51905. };
  51906. }
  51907. }
  51908. else {
  51909. state = false;
  51910. }
  51911. }
  51912. return state;
  51913. }
  51914. var pushToLengthSubjects = function(obj, prop, watcher, level){
  51915. var actual;
  51916. if (prop === "$$watchlengthsubjectroot") {
  51917. actual = clone(obj);
  51918. } else {
  51919. actual = clone(obj[prop]);
  51920. }
  51921. lengthsubjects.push({
  51922. obj: obj,
  51923. prop: prop,
  51924. actual: actual,
  51925. watcher: watcher,
  51926. level: level
  51927. });
  51928. };
  51929. var removeFromLengthSubjects = function(obj, prop, watcher){
  51930. for (var i=0; i<lengthsubjects.length; i++) {
  51931. var subj = lengthsubjects[i];
  51932. if (subj.obj == obj) {
  51933. if (!prop || subj.prop == prop) {
  51934. if (!watcher || subj.watcher == watcher) {
  51935. // if we splice off one item at position i
  51936. // we need to decrement i as the array is one item shorter
  51937. // so when we increment i in the loop statement we
  51938. // will land at the correct index.
  51939. // if it's not decremented, you won't delete all length subjects
  51940. lengthsubjects.splice(i--, 1);
  51941. }
  51942. }
  51943. }
  51944. }
  51945. };
  51946. var removeFromDirtyChecklist = function(obj, prop){
  51947. var notInUse;
  51948. for (var i=0; i<dirtyChecklist.length; i++) {
  51949. var n = dirtyChecklist[i];
  51950. var watchers = n.object.watchers;
  51951. notInUse = (
  51952. n.object == obj
  51953. && (!prop || n.prop == prop)
  51954. && watchers
  51955. && (!prop || !watchers[prop] || watchers[prop].length == 0 )
  51956. );
  51957. if (notInUse) {
  51958. // we use the same syntax as in removeFromLengthSubjects
  51959. dirtyChecklist.splice(i--, 1);
  51960. }
  51961. }
  51962. };
  51963. setInterval(loop, 50);
  51964. WatchJS.watch = watch;
  51965. WatchJS.unwatch = unwatch;
  51966. WatchJS.callWatchers = callWatchers;
  51967. WatchJS.suspend = suspend; // suspend watchers
  51968. WatchJS.onChange = trackChange; // track changes made to object or it's property and return a single change object
  51969. return WatchJS;
  51970. }));
  51971. /***/ }),
  51972. /***/ "./node_modules/node-libs-browser/mock/empty.js":
  51973. /*!******************************************************!*\
  51974. !*** ./node_modules/node-libs-browser/mock/empty.js ***!
  51975. \******************************************************/
  51976. /*! no static exports found */
  51977. /***/ (function(module, exports) {
  51978. /***/ })
  51979. /******/ });
  51980. });
  51981. //# sourceMappingURL=ivprog.bundle.js.map